/** * Returns the date type that matches the given string, or returns a new one if none match it. * * @param code The name of the code to fetch or to create. * @return A code matching the given name. */ public static DateType valueOf(String code) { return valueOf(DateType.class, code); } }
private void getMetaDataDateInfo(Metadata metadata, DefaultMetadata defaultMetaData){ ArrayList<CitationDate> citationDateList= (ArrayList<CitationDate>) defaultMetaData.getDateInfo(); for(CitationDate c:citationDateList){ if(c.getDateType()!=null) { String date = DateUtils.formatDate(c.getDate()); metadata.add("DateInfo ",c.getDateType().name()+" "+date); } } }
/** Returns the list of enumerations of the same kind than this enum. */ public DateType[] family() { return values(); }
/** * Adds a date in the given collection, making sure that there is no two dates of the same type. * If two dates are of the same type, retains the latest one if the type name starts with {@code "LATE_"} * or retains the earliest date otherwise. */ private static void addEarliest(final Collection<CitationDate> dates, final CitationDate cd, final DateType type) { for (final Iterator<CitationDate> it = dates.iterator(); it.hasNext();) { final CitationDate co = it.next(); if (type.equals(co.getDateType())) { final Date oldDate = co.getDate(); final Date newDate = cd.getDate(); if (type.name().startsWith("LATE_") ? oldDate.before(newDate) : oldDate.after(newDate)) { it.remove(); break; } return; } } dates.add(cd); }
/** * Returns the DateType that matches the given string, or returns a * new one if none match it. */ public static DateType valueOf(String code) { if (code == null) { return null; } synchronized (VALUES) { Iterator iter = VALUES.iterator(); while (iter.hasNext()) { DateType type = (DateType) iter.next(); if (code.equalsIgnoreCase(type.name())) { return type; } } return new DateType(code); } } }
while (it.hasNext()) { final CitationDate date = it.next(); if (DateType.CREATION.equals(date.getDateType())) { if (newValue == null) { it.remove();
/** * Asserts that the date {@code d2} is equals or after {@code d1}. */ private static void assertOrdered(final DateType t1, final Date d1, final DateType t2, final Date d2) { if (d1 != null && d2.before(d1)) { fail("The ‘" + t2.identifier() + "’ date (" + d2 + ") shall be equal or after " + "the ‘" + t1.identifier() + "’ date (" + d1 + ")."); } }
/** * Adds a date in the given collection, making sure that there is no two dates of the same type. * If two dates are of the same type, retains the latest one if the type name starts with {@code "LATE_"} * or retains the earliest date otherwise. */ private static void addEarliest(final Collection<CitationDate> dates, final CitationDate cd, final DateType type) { for (final Iterator<CitationDate> it = dates.iterator(); it.hasNext();) { final CitationDate co = it.next(); if (type.equals(co.getDateType())) { final Date oldDate = co.getDate(); final Date newDate = cd.getDate(); if (type.name().startsWith("LATE_") ? oldDate.before(newDate) : oldDate.after(newDate)) { it.remove(); break; } return; } } dates.add(cd); }
while (it.hasNext()) { final CitationDate date = it.next(); if (NEXT_UPDATE.equals(date.getDateType())) { if (newValue == null) { it.remove();
/** * ISO 19115 metadata property fixed to {@code DateType.IN_FORCE}. * This is part of the properties returned by {@link #getDates()}. * * @return event used for reference date. */ @Override public DateType getDateType() { return DateType.valueOf("IN_FORCE"); }
if (d.getDateType()!=null) { String date = DateUtils.formatDate(d.getDate()); metadata.add("CitationDate ",d.getDateType().name()+"-->"+date); if (cd.getDateType()!=null) { String date = DateUtils.formatDate(cd.getDate()); metadata.add("ThesaurusNameDate ",cd.getDateType().name() +"-->" + date); if (cd.getDateType()!=null && cd.getDate()!=null) { String date = DateUtils.formatDate(cd.getDate()); metadata.add("GeographicIdentifierAuthorityDate ",cd.getDateType().name()+" "+date);
/** * Returns the list of codes of the same kind than this code list element. * Invoking this method is equivalent to invoking {@link #values()}, except that * this method can be invoked on an instance of the parent {@code CodeList} class. * * @return all code {@linkplain #values() values} for this code list. */ @Override public DateType[] family() { return values(); }
/** * Returns the date that the metadata was created. * * @return date that the metadata was created, or {@code null}. * * @deprecated As of ISO 19115:2014, replaced by {@link #getDateInfo()}. */ @Override @Deprecated @XmlElement(name = "dateStamp", required = true) @Dependencies("getDateInfo") public Date getDateStamp() { final Collection<CitationDate> dates = getDateInfo(); if (dates != null) { for (final CitationDate date : dates) { if (DateType.CREATION.equals(date.getDateType())) { return date.getDate(); } } } return null; }
/** * Returns the date type that matches the given string, or returns a * new one if none match it. More specifically, this methods returns the first instance for * which <code>{@linkplain #name() name()}.{@linkplain String#equals equals}(code)</code> * returns {@code true}. If no existing instance is found, then a new one is created for * the given name. * * @param code the name of the code to fetch or to create. * @return a code matching the given name. */ public static DateType valueOf(String code) { return valueOf(DateType.class, code); } }
private void getMetaDataDateInfo(Metadata metadata, DefaultMetadata defaultMetaData){ ArrayList<CitationDate> citationDateList= (ArrayList<CitationDate>) defaultMetaData.getDateInfo(); for(CitationDate c:citationDateList){ if(c.getDateType()!=null) metadata.add("DateInfo ",c.getDateType().name()+" "+c.getDate()); } }
/** * Returns the list of enumerations of the same kind than this enum. */ public /*{DateType}*/ CodeList[] family() { return values(); }
while (it.hasNext()) { final CitationDate date = it.next(); if (NEXT_UPDATE.equals(date.getDateType())) { if (newValue == null) { it.remove();
/** * Returns the date type that matches the given string, or returns a * new one if none match it. More specifically, this methods returns the first instance for * which <code>{@linkplain #name() name()}.{@linkplain String#equals equals}(code)</code> * returns {@code true}. If no existing instance is found, then a new one is created for * the given name. * * @param code the name of the code to fetch or to create. * @return a code matching the given name. */ public static DateType valueOf(String code) { return valueOf(DateType.class, code); } }
private void getMetaDataDateInfo(Metadata metadata, DefaultMetadata defaultMetaData){ ArrayList<CitationDate> citationDateList= (ArrayList<CitationDate>) defaultMetaData.getDateInfo(); for(CitationDate c:citationDateList){ if(c.getDateType()!=null) metadata.add("DateInfo ",c.getDateType().name()+" "+c.getDate()); } }
/** * Returns the list of codes of the same kind than this code list element. * Invoking this method is equivalent to invoking {@link #values()}, except that * this method can be invoked on an instance of the parent {@code CodeList} class. * * @return all code {@linkplain #values() values} for this code list. */ @Override public DateType[] family() { return values(); }