/** * Converts an instance of java.util.Date into a String using the date * format: yyyy-MM-ddTHH:mm:ss.SSSZ. * * @param date * Instance of java.util.Date. * @return ISO 8601 String representation (yyyy-MM-ddTHH:mm:ss.SSSZ) of the * Date argument or null if the Date argument is null. */ public static String convertDateToString(Date date) { return convertDateToString(date, true); }
/** * Converts an instance of java.util.Date into a String using the date * format: yyyy-MM-ddTHH:mm:ss.SSSZ. * * @param date * Instance of java.util.Date. * @return ISO 8601 String representation (yyyy-MM-ddTHH:mm:ss.SSSZ) of the * Date argument or null if the Date argument is null. */ public static String convertDateToString(Date date) { return convertDateToString(date, true); }
public static final String dateAsString(Date date) throws Exception { return DateUtility.convertDateToString(date, false); }
public static final String dateAsString(Date date) throws Exception { return DateUtility.convertDateToString(date, false); }
private static String getItemDissURL(String reposBaseURL, String applicationContext, String PID, String datastreamID, Date versDateTime) { String itemDissURL = null; if (versDateTime == null) { itemDissURL = reposBaseURL + "/" + applicationContext + "/get/" + PID + "/" + datastreamID; } else { itemDissURL = reposBaseURL + "/" + applicationContext + "/get/" + PID + "/" + datastreamID + "/" + DateUtility.convertDateToString(versDateTime); } return itemDissURL; } }
private List<String> toStringList(Date[] dates) throws Exception { List<String> out = new ArrayList<String>(dates.length); for (Date date : dates) { out.add(DateUtility.convertDateToString(date)); } return out; }
private List<String> toStringList(Date[] dates) throws Exception { List<String> out = new ArrayList<String>(dates.length); for (Date date : dates) { out.add(DateUtility.convertDateToString(date)); } return out; }
private List<String> toStringList(Date[] dates) throws Exception { List<String> out = new ArrayList<String>(dates.length); for (Date date : dates) { out.add(DateUtility.convertDateToString(date)); } return out; }
private List<String> toStringList(Date[] dates) throws Exception { List<String> out = new ArrayList<String>(dates.length); for (Date date : dates) { out.add(DateUtility.convertDateToString(date)); } return out; }
private static void appendXML( String name, Date dt, Writer out) throws IOException { if (dt != null) { appendXML(name, DateUtility.convertDateToString(dt), out); } }
private static void appendProperty(String uri, Date value, PrintWriter writer) { if (value != null) { appendProperty(uri, DateUtility.convertDateToString(value), writer, false); } }
private static void appendXML( String name, Date dt, Writer out) throws IOException { if (dt != null) { appendXML(name, DateUtility.convertDateToString(dt), out); } }
private static void appendProperty(String uri, Date value, PrintWriter writer) { if (value != null) { appendProperty(uri, DateUtility.convertDateToString(value), writer, false); } }
/** * {@inheritDoc} */ @Override public String[] getObjectHistory(String PID) { String[] dsIDs = ListDatastreamIDs(null); TreeSet<String> modDates = new TreeSet<String>(); for (String element : dsIDs) { Date[] dsDates = getDatastreamVersions(element); for (Date element2 : dsDates) { modDates.add(DateUtility.convertDateToString(element2)); } } return modDates.toArray(EMPTY_STRING_ARRAY); }
/** * {@inheritDoc} */ @Override public String[] getObjectHistory(String PID) { String[] dsIDs = ListDatastreamIDs(null); TreeSet<String> modDates = new TreeSet<String>(); for (String element : dsIDs) { Date[] dsDates = getDatastreamVersions(element); for (Date element2 : dsDates) { modDates.add(DateUtility.convertDateToString(element2)); } } return modDates.toArray(EMPTY_STRING_ARRAY); }
@Override public String purgeObject(String pid, String logMessage, boolean force) { LOG.debug("start: purgeObject, {}", pid); assertInitialized(); try { MessageContext ctx = context.getMessageContext(); return DateUtility.convertDateToString(m_management .purgeObject(ReadOnlyContext.getSoapContext(ctx), pid, logMessage)); } catch (Throwable th) { LOG.error("Error purging object", th); throw CXFUtility.getFault(th); } finally { LOG.debug("end: purgeObject, {}", pid); } }
@Test public void testConvertDateToString() { assertEquals(EPOCH_DT, DateUtility.convertDateToString(EPOCH)); assertEquals(EPOCH_DT, DateUtility.convertDateToString(EPOCH, true)); assertEquals(EPOCH_DT2, DateUtility.convertDateToString(EPOCH, false)); assertEquals(ONE_CE_DT, DateUtility.convertDateToString(ONE_CE)); assertEquals(ONE_BCE_DT, DateUtility.convertDateToString(ONE_BCE)); assertEquals(TWO_BCE_DT, DateUtility.convertDateToString(TWO_BCE)); }
private static final MultiValueMap<URI> beginEnvironmentMap(String messageProtocol) { MultiValueMap<URI> environmentMap = new MultiValueMap<URI>(); try { environmentMap.set(Constants.HTTP_REQUEST.MESSAGE_PROTOCOL.attributeId, messageProtocol); Date now = new Date(); environmentMap.set(Constants.ENVIRONMENT.CURRENT_DATE_TIME.attributeId, DateUtility.convertDateToString(now)); environmentMap.set(Constants.ENVIRONMENT.CURRENT_DATE.attributeId, DateUtility .convertDateToDateString(now)); environmentMap.set(Constants.ENVIRONMENT.CURRENT_TIME.attributeId, DateUtility .convertDateToTimeString(now)); } catch (Exception e) { logger.warn("Datastream could not set envAttributes for checksum context"); } return environmentMap; }
private static final MultiValueMap<URI> beginEnvironmentMap(String messageProtocol) throws Exception { MultiValueMap<URI> environmentMap = new MultiValueMap<URI>(); environmentMap.set(Constants.HTTP_REQUEST.MESSAGE_PROTOCOL.attributeId, messageProtocol); Date now = new Date(); environmentMap.set(Constants.ENVIRONMENT.CURRENT_DATE_TIME.attributeId, DateUtility.convertDateToString(now)); environmentMap.set(Constants.ENVIRONMENT.CURRENT_DATE.attributeId, DateUtility .convertDateToDateString(now)); environmentMap.set(Constants.ENVIRONMENT.CURRENT_TIME.attributeId, DateUtility .convertDateToTimeString(now)); return environmentMap; }
private static final MultiValueMap<URI> beginEnvironmentMap(String messageProtocol) throws Exception { MultiValueMap<URI> environmentMap = new MultiValueMap<URI>(); environmentMap.set(Constants.HTTP_REQUEST.MESSAGE_PROTOCOL.attributeId, messageProtocol); Date now = new Date(); environmentMap.set(Constants.ENVIRONMENT.CURRENT_DATE_TIME.attributeId, DateUtility.convertDateToString(now)); environmentMap.set(Constants.ENVIRONMENT.CURRENT_DATE.attributeId, DateUtility .convertDateToDateString(now)); environmentMap.set(Constants.ENVIRONMENT.CURRENT_TIME.attributeId, DateUtility .convertDateToTimeString(now)); return environmentMap; }