• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DateUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.tools.ant.util.DateUtils的典型用法代码示例。如果您正苦于以下问题:Java DateUtils类的具体用法?Java DateUtils怎么用?Java DateUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DateUtils类属于org.apache.tools.ant.util包,在下文中一共展示了DateUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getSeriesData

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
/**
 * prepares data for the chart
 *
 * @return data series
 * @throws Exception
 */
private List<Coordinate<String, Number>> getSeriesData() throws Exception {

	final List<Coordinate<String, Number>> seriesData = new ArrayList<Coordinate<String, Number>>();

	for (final EapEvent event : EapEvent.findByEventType(this.eventType)) {
		final Serializable value = event.getValues().get(this.attributeName);
		if (value == null) {
			throw new Exception("AttributeName " + this.attributeName + " contains null-Values for " + this.eventType);
		}
		// values should be integer
		int intValue = 0;
		try {
			intValue = Integer.parseInt((String) value);
		} catch (final Exception e) {
			intValue = (Integer) value;
		}
		;
		seriesData.add(new Coordinate<String, Number>(DateUtils.format(event.getTimestamp(), "'Date.UTC('yyyy, M, d, h, m, s')'"), intValue));
	}

	return seriesData;
}
 
开发者ID:bptlab,项目名称:Unicorn,代码行数:29,代码来源:SplatterChartOptions.java


示例2: write

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
/**
 * @param output The destination, unbuffered
 */
public void write(TestClassResult result, OutputStream output) {
    String className = result.getClassName();
    long classId = result.getId();

    try {
        SimpleXmlWriter writer = new SimpleXmlWriter(output, "  ");
        writer.startElement("testsuite")
                .attribute("name", className)
                .attribute("tests", String.valueOf(result.getTestsCount()))
                .attribute("skipped", String.valueOf(result.getSkippedCount()))
                .attribute("failures", String.valueOf(result.getFailuresCount()))
                .attribute("errors", "0")
                .attribute("timestamp", DateUtils.format(result.getStartTime(), DateUtils.ISO8601_DATETIME_PATTERN))
                .attribute("hostname", hostName)
                .attribute("time", String.valueOf(result.getDuration() / 1000.0));

        writer.startElement("properties");
        writer.endElement();

        writeTests(writer, result.getResults(), className, classId);

        writer.startElement("system-out");
        writeOutputs(writer, classId, outputAssociation.equals(TestOutputAssociation.WITH_SUITE), TestOutputEvent.Destination.StdOut);
        writer.endElement();
        writer.startElement("system-err");
        writeOutputs(writer, classId, outputAssociation.equals(TestOutputAssociation.WITH_SUITE), TestOutputEvent.Destination.StdErr);
        writer.endElement();

        writer.endElement();
    } catch (IOException e) {
        throw UncheckedException.throwAsUncheckedException(e);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:37,代码来源:JUnitXmlResultWriter.java


示例3: run

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
public void run() {

        Calendar startDate = new GregorianCalendar();
        Calendar endDate = new GregorianCalendar();
        endDate.add(Calendar.DAY_OF_MONTH, futureDaysCount);

        ObecData obecData = new ObecData();
        String sDate = DateUtils.format(startDate.getTime(), "yyyy-MM-dd");
        String eDate = DateUtils.format(endDate.getTime(), "yyyy-MM-dd");
        String fileName = obecData.generateOBEC(sDate, eDate, properties);

        // send generated file to EDT service
        UploadData uploadData = toUpload(fileName);
        sendUploadData(uploadData);
    }
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:16,代码来源:OBECRunner.java


示例4: write

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
public void write(TestClassResult result, OutputStream output) {
    String className = result.getClassName();
    long classId = result.getId();

    try {
        SimpleXmlWriter writer = new SimpleXmlWriter(output, "  ");
        writer.startElement("testsuite")
                .attribute("name", className)
                .attribute("tests", String.valueOf(result.getTestsCount()))
                .attribute("skipped", String.valueOf(result.getSkippedCount()))
                .attribute("failures", String.valueOf(result.getFailuresCount()))
                .attribute("errors", "0")
                .attribute("timestamp", DateUtils.format(result.getStartTime(), DateUtils.ISO8601_DATETIME_PATTERN))
                .attribute("hostname", hostName)
                .attribute("time", String.valueOf(result.getDuration() / 1000.0));

        writer.startElement("properties");
        writer.endElement();

        writeTests(writer, result.getResults(), className, classId);

        writer.startElement("system-out");
        writeOutputs(writer, classId, outputAssociation.equals(TestOutputAssociation.WITH_SUITE), TestOutputEvent.Destination.StdOut);
        writer.endElement();
        writer.startElement("system-err");
        writeOutputs(writer, classId, outputAssociation.equals(TestOutputAssociation.WITH_SUITE), TestOutputEvent.Destination.StdErr);
        writer.endElement();

        writer.endElement();
    } catch (IOException e) {
        throw UncheckedException.throwAsUncheckedException(e);
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:34,代码来源:JUnitXmlResultWriter.java


示例5: startTestSuite

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
/**
     * The whole testsuite started.
     * @param suite the testsuite.
     */
    public void startTestSuite(final JUnitTest suite) {
        doc = getDocumentBuilder().newDocument();
        rootElement = doc.createElement(TESTSUITE);
        String n = suite.getName();
//        if (n != null && !tag.isEmpty())
//            n = n + "-" + tag;
        rootElement.setAttribute(ATTR_NAME, n == null ? UNKNOWN : n);

        //add the timestamp
        final String timestamp = DateUtils.format(new Date(),
                DateUtils.ISO8601_DATETIME_PATTERN);
        rootElement.setAttribute(TIMESTAMP, timestamp);
        //and the hostname.
        rootElement.setAttribute(HOSTNAME, getHostname());

        // Output properties
        final Element propsElement = doc.createElement(PROPERTIES);
        rootElement.appendChild(propsElement);
        final Properties props = suite.getProperties();
        if (props != null) {
            final Enumeration e = props.propertyNames();
            while (e.hasMoreElements()) {
                final String name = (String) e.nextElement();
                final Element propElement = doc.createElement(PROPERTY);
                propElement.setAttribute(ATTR_NAME, name);
                propElement.setAttribute(ATTR_VALUE, props.getProperty(name));
                propsElement.appendChild(propElement);
            }
        }
    }
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:35,代码来源:CassandraXMLJUnitResultFormatter.java


示例6: checkAttributesAndElements

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
/** Check the attributes and elements */
private void checkAttributesAndElements() {
    if (baseDir == null && resources.isEmpty() && groupfilesets.isEmpty()
        && "zip".equals(archiveType)) {
        throw new BuildException(
            "basedir attribute must be set, or at least one resource collection must be given!");
    }

    if (zipFile == null) {
        throw new BuildException("You must specify the %s file to create!",
            archiveType);
    }

    if (fixedModTime != null) {
        try {
            modTimeMillis = DateUtils.parseLenientDateTime(fixedModTime).getTime();
        } catch (ParseException pe) {
            throw new BuildException("Failed to parse date string %s.", fixedModTime);
        }
        if (roundUp) {
            modTimeMillis += ROUNDUP_MILLIS;
        }
    }

    if (zipFile.exists() && !zipFile.isFile()) {
        throw new BuildException("%s is not a file.", zipFile);
    }

    if (zipFile.exists() && !zipFile.canWrite()) {
        throw new BuildException("%s is read-only.", zipFile);
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:33,代码来源:Zip.java


示例7: startTestSuite

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
/**
 * The whole testsuite started.
 * @param suite the testsuite.
 */
@Override
public void startTestSuite(final JUnitTest suite) {
    doc = getDocumentBuilder().newDocument();
    rootElement = doc.createElement(TESTSUITE);
    final String n = suite.getName();
    rootElement.setAttribute(ATTR_NAME, n == null ? UNKNOWN : n);

    //add the timestamp
    final String timestamp = DateUtils.format(new Date(),
            DateUtils.ISO8601_DATETIME_PATTERN);
    rootElement.setAttribute(TIMESTAMP, timestamp);
    //and the hostname.
    rootElement.setAttribute(HOSTNAME, getHostname());

    // Output properties
    final Element propsElement = doc.createElement(PROPERTIES);
    rootElement.appendChild(propsElement);
    final Properties props = suite.getProperties();
    if (props != null) {
        for (String name : props.stringPropertyNames()) {
            final Element propElement = doc.createElement(PROPERTY);
            propElement.setAttribute(ATTR_NAME, name);
            propElement.setAttribute(ATTR_VALUE, props.getProperty(name));
            propsElement.appendChild(propElement);
        }
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:32,代码来源:XMLJUnitResultFormatter.java


示例8: targetFinished

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
/**
 * Fired when a target finishes building, this adds the time taken
 * and any error stacktrace to the appropriate target element in the log.
 *
 * @param event An event with any relevant extra information.
 *              Will not be <code>null</code>.
 */
public void targetFinished(BuildEvent event) {
    Target target = event.getTarget();
    TimedElement targetElement = (TimedElement) targets.get(target);
    if (targetElement != null) {
        long totalTime
                = System.currentTimeMillis() - targetElement.startTime;
        targetElement.element.setAttribute(TIME_ATTR,
                DateUtils.formatElapsedTime(totalTime));

        TimedElement parentElement = null;
        Stack<TimedElement> threadStack = getStack();
        if (!threadStack.empty()) {
            TimedElement poppedStack = (TimedElement) threadStack.pop();
            if (poppedStack != targetElement) {
                throw new RuntimeException("Mismatch - popped element = "
                        + poppedStack.element + " finished target element = "
                        + targetElement.element);
            }
            if (!threadStack.empty()) {
                parentElement = (TimedElement) threadStack.peek();
            }
        }
        if (parentElement == null) {
            buildElement.element.appendChild(targetElement.element);
        } else {
            parentElement.element.appendChild(targetElement.element);
        }
    }

}
 
开发者ID:ModelN,项目名称:build-management,代码行数:38,代码来源:FrequentXmlLogger.java


示例9: taskFinished

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
/**
 * Fired when a task finishes building, this adds the time taken
 * and any error stacktrace to the appropriate task element in the log.
 *
 * @param event An event with any relevant extra information.
 *              Will not be <code>null</code>.
 */
public void taskFinished(BuildEvent event) {
    Task task = event.getTask();
    TimedElement taskElement = (TimedElement) tasks.get(task);
    if (taskElement != null) {
        long totalTime = System.currentTimeMillis() - taskElement.startTime;
        taskElement.element.setAttribute(TIME_ATTR,
                DateUtils.formatElapsedTime(totalTime));
        Target target = task.getOwningTarget();
        TimedElement targetElement = null;
        if (target != null) {
            targetElement = (TimedElement) targets.get(target);
        }
        if (targetElement == null) {
            buildElement.element.appendChild(taskElement.element);
        } else {
            targetElement.element.appendChild(taskElement.element);
        }
        Stack<TimedElement> threadStack = getStack();
        if (!threadStack.empty()) {
            TimedElement poppedStack = (TimedElement) threadStack.pop();
            if (poppedStack != taskElement) {
                throw new RuntimeException("Mismatch - popped element = "
                        + poppedStack.element + " finished task element = "
                        + taskElement.element);
            }
        }
    }
}
 
开发者ID:ModelN,项目名称:build-management,代码行数:36,代码来源:FrequentXmlLogger.java


示例10: setNotePermissions

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
public ActionForward setNotePermissions(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
	CaseManagementNoteDAO noteDao = (CaseManagementNoteDAO) SpringUtils.getBean("caseManagementNoteDAO");
	ProgramDao programDao = (ProgramDao) SpringUtils.getBean("programDao");
	SecroleDao secroleDao = (SecroleDao) SpringUtils.getBean("secroleDao");

	String noteId = request.getParameter("noteId");
	String newProgramNo = request.getParameter("program");
	String newRoleId = request.getParameter("role");

	HashMap<String, Object> hashMap = new HashMap<String, Object>();

	hashMap.put("noteId", noteId);

	LoggedInInfo loggedInInfo=LoggedInInfo.getLoggedInInfoFromSession(request);
	String providerNo=loggedInInfo.getLoggedInProviderNo();
	Provider provider = loggedInInfo.getLoggedInProvider();

	if (canNoteBeModified(providerNo, noteId)) {
		CaseManagementNote note = noteDao.getNote(Long.parseLong(noteId));


		// Are this note's permissions being changed after all?
		if (note.getReporter_caisi_role() != null && note.getReporter_caisi_role().equalsIgnoreCase(newRoleId)
				&& note.getProgram_no() != null && note.getProgram_no().equalsIgnoreCase(newProgramNo)) {
			hashMap.put("success", "NO_CHANGE");
		} else if (providerHasAccess(providerNo, newProgramNo, newRoleId, note.getDemographic_no())) {
			// Check if this provider has access to the requested program & role pair
			Program p = programDao.getProgram(Integer.parseInt(newProgramNo));
			Secrole r = secroleDao.getRole(Integer.parseInt(newRoleId));

			note.setProgram_no(newProgramNo);
			note.setReporter_caisi_role(newRoleId);
			Date newDate = new Date();
			note.setUpdate_date(newDate);

			String newNote = note.getNote();
			newNote += "\n[" + DateUtils.format(newDate, "yyyy-MM-dd") + " Program/role changed to: " + p.getName() + " (" + r.getName() + ") by " + provider.getLastName() + ", " + provider.getFirstName() + "]";
			note.setNote(newNote);

			Object id = noteDao.saveAndReturn(note);

			hashMap.put("success", "SAVED");
			hashMap.put("newProgramNo", newProgramNo);
			hashMap.put("newRoleId", newRoleId);
			hashMap.put("newProgramName", p.getName());
			hashMap.put("newRoleName", r.getName());
			hashMap.put("noteContent", newNote);
			hashMap.put("newNoteId", id);
		} else {
			// The provider making this modification won't be able to see the note if this change is made
			hashMap.put("error", "MAKES_INVISIBLE");
		}
	} else {
		// The provider doesn't have permission to see this note, so they can't modify it
		hashMap.put("error", "PERMISSION_DENIED");
	}

	JSONObject json = JSONObject.fromObject(hashMap);
	response.getOutputStream().write(json.toString().getBytes());

	return null;
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:63,代码来源:NotePermissionsAction.java


示例11: getPatientList

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
@GET
@Path("/patientList")
@Produces("application/json")
public AbstractSearchResponse<AdmissionTo1> getPatientList(@QueryParam("programNo")String programNo, @QueryParam("day") String day, @QueryParam("startIndex") Integer startIndex,  @QueryParam("numToReturn") Integer numToReturn) throws Exception {
	
	AbstractSearchResponse<AdmissionTo1> response = new  AbstractSearchResponse<AdmissionTo1>();
	
	if(day == null) {
		day = DateFormatUtils.format(Calendar.getInstance(), DateUtils.ISO8601_DATE_PATTERN);
	}
	
	
	Date d = new SimpleDateFormat(DateUtils.ISO8601_DATE_PATTERN).parse(day);	
	
	if(programNo == null) {
		//get default
		ProgramProvider current = null;
		ProgramProvider pp = programManager.getCurrentProgramInDomain(getLoggedInInfo(),getLoggedInInfo().getLoggedInProviderNo());
		if(pp != null) {
			current = pp;
		} else {
			List<ProgramProvider> ppList = programManager.getProgramDomain(getLoggedInInfo(),getLoggedInInfo().getLoggedInProviderNo());
			if(ppList.size()>0) {
				current = ppList.get(0);
			}
		}
		if(current != null) {
			programNo = String.valueOf(current.getProgramId());
		}
	}
	
	if(programNo == null) {
		throw new Exception("Can't get a program for this provider to use as default");
	}
	
	
	List<AdmissionTo1> transfers = new AdmissionConverter().includeDemographic(true).getAllAsTransferObjects(getLoggedInInfo(),admissionManager.findAdmissionsByProgramAndDate(getLoggedInInfo(), Integer.parseInt(programNo),d,startIndex,numToReturn));
	
	response.setContent(transfers);
	response.setTotal(admissionManager.findAdmissionsByProgramAndDateAsCount(getLoggedInInfo(), Integer.parseInt(programNo),d));
	
	return response;
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:44,代码来源:ProgramService.java


示例12: getAppointmentsForDay

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
@GET
@Path("/{providerNo}/day/{date}")
@Produces("application/json")
/**
 * Will substitute "me" to your logged in provider no, and "today" to doday's date.
 * eg /schedule/me/day/today
 * 
 * @param providerNo
 * @param date
 * @return
 */
public PatientListApptBean getAppointmentsForDay(@PathParam("providerNo") String providerNo, @PathParam("date") String date) {
	SimpleDateFormat timeFormatter = new SimpleDateFormat("hh:mm aa");
	LoggedInInfo loggedInInfo = getLoggedInInfo();
	PatientListApptBean response = new PatientListApptBean();

	try {
		Date dateObj = null;
		if ("today".equals(date)) {
			dateObj = new Date();
		} else {
			dateObj = DateUtils.parseIso8601Date(date);
		}

		if ("".equals(providerNo)) {
			providerNo = loggedInInfo.getLoggedInProviderNo();
		}

		List<Appointment> appts = scheduleManager.getDayAppointments(loggedInInfo, providerNo, dateObj);
		for (Appointment appt : appts) {
			PatientListApptItemBean item = new PatientListApptItemBean();
			item.setDemographicNo(appt.getDemographicNo());
			if(appt.getDemographicNo() == 0){
				item.setName(appt.getName());
			}else{
				item.setName(demographicManager.getDemographicFormattedName(loggedInInfo, appt.getDemographicNo()));
			}
			item.setStartTime(timeFormatter.format(appt.getStartTime()));
			item.setReason(appt.getReason());
			item.setStatus(appt.getStatus());
			item.setAppointmentNo(appt.getId());
			item.setDate(appt.getStartTimeAsFullDate());
			response.getPatients().add(item);
		}
	} catch (ParseException e) {
		throw new RuntimeException("Invalid Date sent, use yyyy-MM-dd format");
	}
	return response;
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:50,代码来源:ScheduleService.java


示例13: getCoordinate

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
private Coordinate<String, Number> getCoordinate(final EapEvent event, final EapEventType eventType) {
	return new Coordinate<String, Number>(DateUtils.format(event.getTimestamp(), "'Date.UTC('yyyy, M, d, h, m, s')'"), this.mappingTypeToInt.get(eventType));
}
 
开发者ID:bptlab,项目名称:Unicorn,代码行数:4,代码来源:EventViewOptions.java


示例14: getPrimaryFormat

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
@Override
public DateFormat getPrimaryFormat() {
    return DateUtils.EN_US_DATE_FORMAT_MIN.get();
}
 
开发者ID:apache,项目名称:ant,代码行数:5,代码来源:Touch.java


示例15: getFallbackFormat

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
@Override
public DateFormat getFallbackFormat() {
    return DateUtils.EN_US_DATE_FORMAT_SEC.get();
}
 
开发者ID:apache,项目名称:ant,代码行数:5,代码来源:Touch.java


示例16: ExecutionResult

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
public ExecutionResult(String unitName, long elapsedTime, ExecutionStatus buildStatus) {
    this.unitName = unitName;
    this.elapsedTime = elapsedTime;
    this.formattedElapsedTime = DateUtils.formatElapsedTime(elapsedTime);
    this.buildStatus = buildStatus;
}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:7,代码来源:ExecutionResult.java


示例17: setNotePermissions

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
public ActionForward setNotePermissions(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
	CaseManagementNoteDAO noteDao = (CaseManagementNoteDAO) SpringUtils.getBean("caseManagementNoteDAO");
	ProgramDao programDao = (ProgramDao) SpringUtils.getBean("programDao");
	SecroleDao secroleDao = (SecroleDao) SpringUtils.getBean("secroleDao");

	String noteId = request.getParameter("noteId");
	String newProgramNo = request.getParameter("program");
	String newRoleId = request.getParameter("role");

	HashMap<String, Object> hashMap = new HashMap<String, Object>();

	hashMap.put("noteId", noteId);

	Provider provider = LoggedInInfo.loggedInInfo.get().loggedInProvider;
	String providerNo = provider.getProviderNo();
	if (canNoteBeModified(providerNo, noteId)) {
		CaseManagementNote note = noteDao.getNote(Long.parseLong(noteId));


		// Are this note's permissions being changed after all?
		if (note.getReporter_caisi_role() != null && note.getReporter_caisi_role().equalsIgnoreCase(newRoleId)
				&& note.getProgram_no() != null && note.getProgram_no().equalsIgnoreCase(newProgramNo)) {
			hashMap.put("success", "NO_CHANGE");
		} else if (providerHasAccess(providerNo, newProgramNo, newRoleId, note.getDemographic_no())) {
			// Check if this provider has access to the requested program & role pair
			Program p = programDao.getProgram(Integer.parseInt(newProgramNo));
			Secrole r = secroleDao.getRole(Integer.parseInt(newRoleId));

			note.setProgram_no(newProgramNo);
			note.setReporter_caisi_role(newRoleId);
			Date newDate = new Date();
			note.setUpdate_date(newDate);

			String newNote = note.getNote();
			newNote += "\n[" + DateUtils.format(newDate, "yyyy-MM-dd") + " Program/role changed to: " + p.getName() + " (" + r.getName() + ") by " + provider.getLastName() + ", " + provider.getFirstName() + "]";
			note.setNote(newNote);

			Object id = noteDao.saveAndReturn(note);

			hashMap.put("success", "SAVED");
			hashMap.put("newProgramNo", newProgramNo);
			hashMap.put("newRoleId", newRoleId);
			hashMap.put("newProgramName", p.getName());
			hashMap.put("newRoleName", r.getName());
			hashMap.put("noteContent", newNote);
			hashMap.put("newNoteId", id);
		} else {
			// The provider making this modification won't be able to see the note if this change is made
			hashMap.put("error", "MAKES_INVISIBLE");
		}
	} else {
		// The provider doesn't have permission to see this note, so they can't modify it
		hashMap.put("error", "PERMISSION_DENIED");
	}

	JSONObject json = JSONObject.fromObject(hashMap);
	response.getOutputStream().write(json.toString().getBytes());

	return null;
}
 
开发者ID:oscarservice,项目名称:oscar-old,代码行数:61,代码来源:NotePermissionsAction.java


示例18: writeLog

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
/**
 * Write the log file to disk.
 *
 * @param   event       Build event
 */
private void writeLog(BuildEvent event) {
    long totalTime = System.currentTimeMillis() - buildElement.startTime;
    buildElement.element.setAttribute(TIME_ATTR,
            DateUtils.formatElapsedTime(totalTime));

    if (event.getException() != null) {
        buildElement.element.setAttribute(ERROR_ATTR,
                event.getException().toString());
        // print the stacktrace in the build file it is always useful...
        // better have too much info than not enough.
        Throwable t = event.getException();
        Text errText = doc.createCDATASection(StringUtils.getStackTrace(t));
        Element stacktrace = doc.createElement(STACKTRACE_TAG);
        stacktrace.appendChild(errText);
        buildElement.element.appendChild(stacktrace);
    }

    String outFilename = event.getProject().getProperty("XmlLogger.file");
    if (outFilename == null) {
        outFilename = "log.xml";
    }
    String xslUri
            = event.getProject().getProperty("ant.XmlLogger.stylesheet.uri");
    if (xslUri == null) {
        xslUri = "log.xsl";
    }
    Writer out = null;
    try {
        // specify output in UTF8 otherwise accented characters will blow
        // up everything
        OutputStream stream = outStream;
        if (stream == null) {
            stream = new FileOutputStream(outFilename);
        }
        out = new OutputStreamWriter(stream, "UTF8");
        out.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
        if (xslUri.length() > 0) {
            out.write("<?xml-stylesheet type=\"text/xsl\" href=\""
                    + xslUri + "\"?>\n\n");
        }

        (new DOMElementWriter()).write(buildElement.element, out, 0, "\t");
        out.flush();
    } catch (IOException exc) {
        throw new BuildException("Unable to write log file", exc);
    } finally {
        if (out != null) {
            try {
                out.close();
            } catch (IOException e) {
                throw new BuildException("Unable to close log file", e);
            }
        }
    }
}
 
开发者ID:ModelN,项目名称:build-management,代码行数:61,代码来源:FrequentXmlLogger.java


示例19: formatTime

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
/**
 * Convenience method to format a specified length of time.
 *
 * @param millis Length of time to format, in milliseconds.
 *
 * @return the time as a formatted string.
 *
 * @see DateUtils#formatElapsedTime(long)
 */
protected static String formatTime(final long millis) {
    return DateUtils.formatElapsedTime(millis);
}
 
开发者ID:apache,项目名称:ant,代码行数:13,代码来源:DefaultLogger.java


示例20: getDate

import org.apache.tools.ant.util.DateUtils; //导入依赖的package包/类
/**
 * Return the current Date in a format suitable for a SMTP date
 * header.
 *
 * @return the current date in SMTP suitable format.
 * @since Ant 1.5
 */
protected final String getDate() {
    return DateUtils.getDateForHeader();
}
 
开发者ID:apache,项目名称:ant,代码行数:11,代码来源:Mailer.java



注:本文中的org.apache.tools.ant.util.DateUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java I18nResolver类代码示例发布时间:2022-05-22
下一篇:
Java TemplateTransferDropTargetListener类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap