Search in sources :

Example 6 with CitationDate

use of org.opengis.metadata.citation.CitationDate in project sis by apache.

the class DefaultMetadata method setDateStamp.

/**
 * Sets the date that the metadata was created.
 *
 * @param  newValue  the new date stamp.
 *
 * @deprecated As of ISO 19115:2014, replaced by {@link #setDateInfo(Collection)}.
 */
@Deprecated
public void setDateStamp(final Date newValue) {
    checkWritePermission();
    // See "Note about deprecated methods implementation"
    Collection<CitationDate> newValues = dateInfo;
    if (newValues == null) {
        if (newValue == null) {
            return;
        }
        newValues = new ArrayList<>(1);
    } else {
        final Iterator<CitationDate> it = newValues.iterator();
        while (it.hasNext()) {
            final CitationDate date = it.next();
            if (DateType.CREATION.equals(date.getDateType())) {
                if (newValue == null) {
                    it.remove();
                    return;
                }
                if (date instanceof DefaultCitationDate) {
                    ((DefaultCitationDate) date).setDate(newValue);
                    return;
                }
                it.remove();
                break;
            }
        }
    }
    newValues.add(new DefaultCitationDate(newValue, DateType.CREATION));
    setDateInfo(newValues);
}
Also used : CitationDate(org.opengis.metadata.citation.CitationDate) DefaultCitationDate(org.apache.sis.metadata.iso.citation.DefaultCitationDate) DefaultCitationDate(org.apache.sis.metadata.iso.citation.DefaultCitationDate)

Example 7 with CitationDate

use of org.opengis.metadata.citation.CitationDate in project sis by apache.

the class DefaultMaintenanceInformation method setDateOfNextUpdate.

/**
 * Sets the scheduled revision date for resource.
 * This method stores the value in the {@linkplain #getMaintenanceDates() maintenance dates}.
 *
 * @param  newValue  the new date of next update.
 */
@Deprecated
public void setDateOfNextUpdate(final Date newValue) {
    checkWritePermission();
    Collection<CitationDate> dates = maintenanceDates;
    if (dates != null) {
        final Iterator<CitationDate> it = dates.iterator();
        while (it.hasNext()) {
            final CitationDate date = it.next();
            if (NEXT_UPDATE.equals(date.getDateType())) {
                if (newValue == null) {
                    it.remove();
                    return;
                } else if (date instanceof DefaultCitationDate) {
                    ((DefaultCitationDate) date).setDate(newValue);
                    return;
                }
            }
        }
    }
    if (newValue != null) {
        final CitationDate date = new DefaultCitationDate(newValue, NEXT_UPDATE);
        if (dates != null) {
            dates.add(date);
        } else {
            dates = Collections.singleton(date);
        }
        setMaintenanceDates(dates);
    }
}
Also used : CitationDate(org.opengis.metadata.citation.CitationDate) DefaultCitationDate(org.apache.sis.metadata.iso.citation.DefaultCitationDate) DefaultCitationDate(org.apache.sis.metadata.iso.citation.DefaultCitationDate)

Aggregations

CitationDate (org.opengis.metadata.citation.CitationDate)7 DefaultCitationDate (org.apache.sis.metadata.iso.citation.DefaultCitationDate)3 Date (java.util.Date)2 ResponsibleParty (org.opengis.metadata.citation.ResponsibleParty)2 LocalDate (java.time.LocalDate)1 ArrayList (java.util.ArrayList)1 Locale (java.util.Locale)1 Marshaller (javax.xml.bind.Marshaller)1 CheckedArrayList (org.apache.sis.internal.util.CheckedArrayList)1 CheckedHashSet (org.apache.sis.internal.util.CheckedHashSet)1 DefaultLegalConstraints (org.apache.sis.metadata.iso.constraint.DefaultLegalConstraints)1 DefaultGeographicDescription (org.apache.sis.metadata.iso.extent.DefaultGeographicDescription)1 DefaultDataIdentification (org.apache.sis.metadata.iso.identification.DefaultDataIdentification)1 CodeListSet (org.apache.sis.util.collection.CodeListSet)1 MarshallerPool (org.apache.sis.xml.MarshallerPool)1 Test (org.junit.Test)1 Contact (org.opengis.metadata.citation.Contact)1 OnlineResource (org.opengis.metadata.citation.OnlineResource)1 Restriction (org.opengis.metadata.constraint.Restriction)1 Format (org.opengis.metadata.distribution.Format)1