Package org.dlese.dpc.util
Class MetadataUtils
java.lang.Object
org.dlese.dpc.util.MetadataUtils
This class holds handy static methods for working with DLESE metadata.
- Author:
- John Weatherley
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final DateConverts a String of the union.dateType or ISO8601 UTC datastamp form to a Date.static final DateparseISO8601DateStamp(String datestamp) Converts an ISO8601 UTC datastamp of the form yyyy-MM-ddTHH:mm:ssZ or the short form yyyy-MM-dd to a Java Date.static final DateparseUnionDateType(String dateString) Converts a String in a DLESE union.dateType format into a Java Date object.
-
Constructor Details
-
MetadataUtils
public MetadataUtils()
-
-
Method Details
-
parseUnionDateType
Converts a String in a DLESE union.dateType format into a Java Date object. The possible formats are YYYY-mm-dd, YYYY-mm or YYYY. Uses MST time to interpret the dates.- Parameters:
dateString- A String that in one of the following four formats: YYYY-mm-dd, YYYY-mm, YYYY.- Returns:
- The Date object.
- Throws:
ParseException- If unable to interpret the date String using the given format.
-
parseISO8601DateStamp
Converts an ISO8601 UTC datastamp of the form yyyy-MM-ddTHH:mm:ssZ or the short form yyyy-MM-dd to a Java Date. See ISO8601 and OAI date info for more info. If the short form yyyy-MM-dd is given, this method adds the String t01:00:00z to it to produce an ISO8601 compliant date time.- Parameters:
datestamp- A datestamp in UTC format.- Returns:
- A Java Date that corresponds to the date String.
- Throws:
ParseException- If unable to interpret the datestamp.
-
parseDate
Converts a String of the union.dateType or ISO8601 UTC datastamp form to a Date. The possible forms include YYYY-mm-dd, YYYY-mm, YYYY or the ISO8601 form yyyy-MM-ddTHH:mm:ssZ.- Parameters:
dateString- A date String- Returns:
- A Date Object
- Throws:
ParseException- If unable to parse the date
-