Class MetadataUtils

java.lang.Object
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 Details

    • MetadataUtils

      public MetadataUtils()
  • Method Details

    • 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