DLESE Tools
v1.6.0

org.dlese.dpc.util
Class MetadataUtils

java.lang.Object
  extended by org.dlese.dpc.util.MetadataUtils

public class MetadataUtils
extends Object

This class holds handy static methods for working with DLESE metadata.

Author:
John Weatherley

Constructor Summary
MetadataUtils()
           
 
Method Summary
static Date parseDate(String dateString)
          Converts a String of the union.dateType or ISO8601 UTC datastamp form to a Date.
static Date parseISO8601DateStamp(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 Date parseUnionDateType(String dateString)
          Converts a String in a DLESE union.dateType format into a Java Date object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetadataUtils

public MetadataUtils()
Method Detail

parseUnionDateType

public static final Date parseUnionDateType(String dateString)
                                     throws ParseException
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

public static final Date parseISO8601DateStamp(String datestamp)
                                        throws ParseException
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

public static final Date parseDate(String dateString)
                            throws ParseException
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

DLESE Tools
v1.6.0