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);
}
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);
}
}
Aggregations