/** * 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); }
/** * 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 (DateType.CREATION.equals(date.getDateType())) { if (newValue == null) { it.remove();
/** * 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; }
while (it.hasNext()) { final CitationDate date = it.next(); if (NEXT_UPDATE.equals(date.getDateType())) { if (newValue == null) { it.remove();
while (it.hasNext()) { final CitationDate date = it.next(); if (NEXT_UPDATE.equals(date.getDateType())) { if (newValue == null) { it.remove();
while (it.hasNext()) { final CitationDate date = it.next(); if (DateType.CREATION.equals(date.getDateType())) { if (newValue == null) { it.remove();
/** * Returns the scheduled revision date for resource. * This method fetches the value from the {@linkplain #getMaintenanceDates() maintenance dates}. * * @return scheduled revision date, or {@code null}. * * @deprecated As of ISO 19115:2014, replaced by {@link #getMaintenanceDates()} in order to enable inclusion * of a {@link DateType} to describe the type of the date. The associated date type is * {@code DateType.valueOf("NEXT_UPDATE")}. */ @Override @Deprecated @XmlElement(name = "dateOfNextUpdate") @Dependencies("getMaintenanceDates") public Date getDateOfNextUpdate() { final Collection<CitationDate> dates = getMaintenanceDates(); if (dates != null) { // May be null on XML marshalling. for (final CitationDate date : dates) { if (NEXT_UPDATE.equals(date.getDateType())) { return date.getDate(); } } } return null; }
/** * 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 @Dependencies("getDateInfo") @XmlElement(name = "dateStamp", namespace = LegacyNamespaces.GMD) public Date getDateStamp() { if (FilterByVersion.LEGACY_METADATA.accept()) { 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 scheduled revision date for resource. * This method fetches the value from the {@linkplain #getMaintenanceDates() maintenance dates}. * * @return scheduled revision date, or {@code null}. * * @deprecated As of ISO 19115:2014, replaced by {@link #getMaintenanceDates()} in order to enable inclusion * of a {@link DateType} to describe the type of the date. The associated date type is * {@code DateType.valueOf("NEXT_UPDATE")}. */ @Override @Deprecated @Dependencies("getMaintenanceDates") @XmlElement(name = "dateOfNextUpdate", namespace = LegacyNamespaces.GMD) public Date getDateOfNextUpdate() { if (FilterByVersion.LEGACY_METADATA.accept()) { final Collection<CitationDate> dates = getMaintenanceDates(); if (dates != null) { // May be null on XML marshalling. for (final CitationDate date : dates) { if (NEXT_UPDATE.equals(date.getDateType())) { return date.getDate(); } } } } return null; }