本文整理汇总了Java中org.apache.tools.ant.util.DateUtils.format方法的典型用法代码示例。如果您正苦于以下问题:Java DateUtils.format方法的具体用法?Java DateUtils.format怎么用?Java DateUtils.format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tools.ant.util.DateUtils
的用法示例。
在下文中一共展示了DateUtils.format方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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);
}
}
}
示例3: 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);
}
}
}
示例4: 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;
}
示例5: 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));
}
示例6: 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;
}