
org.geotoolkit.metadata.iso.acquisition.DefaultRequirement Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of geotk-metadata Show documentation
Show all versions of geotk-metadata Show documentation
Implementations of metadata derived from ISO 19115. This module provides both an implementation
of the metadata interfaces defined in GeoAPI, and a framework for handling those metadata through
Java reflection.
The newest version!
/*
* Geotoolkit.org - An Open Source Java GIS Toolkit
* http://www.geotoolkit.org
*
* (C) 2009-2012, Open Source Geospatial Foundation (OSGeo)
* (C) 2009-2012, Geomatys
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* This package contains documentation from OpenGIS specifications.
* OpenGIS consortium's work is fully acknowledged here.
*/
package org.geotoolkit.metadata.iso.acquisition;
import java.util.Collection;
import java.util.Date;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import net.jcip.annotations.ThreadSafe;
import org.opengis.metadata.Identifier;
import org.opengis.metadata.acquisition.Plan;
import org.opengis.metadata.acquisition.Priority;
import org.opengis.metadata.acquisition.RequestedDate;
import org.opengis.metadata.acquisition.Requirement;
import org.opengis.metadata.citation.Citation;
import org.opengis.metadata.citation.ResponsibleParty;
import org.geotoolkit.metadata.iso.MetadataEntity;
import org.geotoolkit.internal.jaxb.NonMarshalledAuthority;
/**
* Requirement to be satisfied by the planned data acquisition.
*
* @author Cédric Briançon (Geomatys)
* @author Martin Desruisseaux (Geomatys)
* @version 3.19
*
* @since 3.03
* @module
*/
@ThreadSafe
@XmlType(name = "MI_Requirement_Type", propOrder={
"citation",
"identifier",
"requestors",
"recipients",
"priority",
"requestedDate",
"expiryDate",
"satisfiedPlans"
})
@XmlRootElement(name = "MI_Requirement")
public class DefaultRequirement extends MetadataEntity implements Requirement {
/**
* Serial number for inter-operability with different versions.
*/
private static final long serialVersionUID = 7305276418007196948L;
/**
* Identification of reference or guidance material for the requirement.
*/
private Citation citation;
/**
* Origin of requirement.
*/
private Collection requestors;
/**
* Person(s), or body(ies), to receive results of requirement.
*/
private Collection recipients;
/**
* Relative ordered importance, or urgency, of the requirement.
*/
private Priority priority;
/**
* Required or preferred acquisition date and time.
*/
private RequestedDate requestedDate;
/**
* Date and time after which collection is no longer valid,
* or {@link Long#MIN_VALUE} if none.
*/
private long expiryDate;
/**
* Plan that identifies solution to satisfy the requirement.
*/
private Collection satisfiedPlans;
/**
* Constructs an initially empty requirement.
*/
public DefaultRequirement() {
expiryDate = Long.MIN_VALUE;
}
/**
* Constructs a metadata entity initialized with the values from the specified metadata.
*
* @param source The metadata to copy, or {@code null} if none.
*/
public DefaultRequirement(final Requirement source) {
super(source);
if (source != null) {
// Be careful to not overwrite date value (GEOTK-170).
if (expiryDate == 0 && source.getExpiryDate() == null) {
expiryDate = Long.MIN_VALUE;
}
}
}
/**
* Returns a Geotk metadata implementation with the same values than the given arbitrary
* implementation. If the given object is {@code null}, then this method returns {@code null}.
* Otherwise if the given object is already a Geotk implementation, then the given object is
* returned unchanged. Otherwise a new Geotk implementation is created and initialized to the
* attribute values of the given object, using a shallow copy operation
* (i.e. attributes are not cloned).
*
* @param object The object to get as a Geotk implementation, or {@code null} if none.
* @return A Geotk implementation containing the values of the given object (may be the
* given object itself), or {@code null} if the argument was null.
*
* @since 3.18
*/
public static DefaultRequirement castOrCopy(final Requirement object) {
return (object == null) || (object instanceof DefaultRequirement)
? (DefaultRequirement) object : new DefaultRequirement(object);
}
/**
* Returns the identification of reference or guidance material for the requirement.
* {@code null} if unspecified.
*/
@Override
@XmlElement(name = "citation")
public synchronized Citation getCitation() {
return citation;
}
/**
* Sets the identification of reference or guidance material for the requirement.
*
* @param newValue The new citation value.
*/
public synchronized void setCitation(final Citation newValue) {
checkWritePermission();
citation = newValue;
}
/**
* Returns the unique name, or code, for the requirement.
*/
@Override
@XmlElement(name = "identifier", required = true)
public Identifier getIdentifier() {
return super.getIdentifier();
}
/**
* Sets the unique name, or code, for the requirement.
*
* @param newValue The new identifier value.
*/
public synchronized void setIdentifier(final Identifier newValue) {
checkWritePermission();
NonMarshalledAuthority.setMarshallable(super.getIdentifiers(), newValue);
}
/**
* Returns the origin of requirement.
*/
@Override
@XmlElement(name = "requestor", required = true)
public synchronized Collection getRequestors() {
return requestors = nonNullCollection(requestors, ResponsibleParty.class);
}
/**
* Sets the origin of requirement.
*
* @param newValues The new requestors values.
*/
public synchronized void setRequestors(final Collection extends ResponsibleParty> newValues) {
requestors = copyCollection(newValues, requestors, ResponsibleParty.class);
}
/**
* Returns the person(s), or body(ies), to receive results of requirement.
*/
@Override
@XmlElement(name = "recipient", required = true)
public synchronized Collection getRecipients() {
return recipients = nonNullCollection(recipients, ResponsibleParty.class);
}
/**
* Sets the Person(s), or body(ies), to receive results of requirement.
*
* @param newValues The new recipients values.
*/
public synchronized void setRecipients(final Collection extends ResponsibleParty> newValues) {
recipients = copyCollection(newValues, recipients, ResponsibleParty.class);
}
/**
* Returns the relative ordered importance, or urgency, of the requirement.
*/
@Override
@XmlElement(name = "priority", required = true)
public synchronized Priority getPriority() {
return priority;
}
/**
* Sets the relative ordered importance, or urgency, of the requirement.
*
* @param newValue The new priority value.
*/
public synchronized void setPriority(final Priority newValue) {
checkWritePermission();
priority = newValue;
}
/**
* Returns the required or preferred acquisition date and time.
*/
@Override
@XmlElement(name = "requestedDate", required = true)
public synchronized RequestedDate getRequestedDate() {
return requestedDate;
}
/**
* Sets the required or preferred acquisition date and time.
*
* @param newValue The new requested date value.
*/
public synchronized void setRequestedDate(final RequestedDate newValue) {
checkWritePermission();
requestedDate = newValue;
}
/**
* Returns the date and time after which collection is no longer valid.
*/
@Override
@XmlElement(name = "expiryDate", required = true)
public synchronized Date getExpiryDate() {
final long date = this.expiryDate;
return (date != Long.MIN_VALUE) ? new Date(date) : null;
}
/**
* Sets the date and time after which collection is no longer valid.
*
* @param newValue The new expiry date.
*/
public synchronized void setExpiryDate(final Date newValue) {
checkWritePermission();
expiryDate = (newValue != null) ? newValue.getTime() : Long.MIN_VALUE;
}
/**
* Returns the plan that identifies solution to satisfy the requirement.
*/
@Override
@XmlElement(name = "satisfiedPlan")
public synchronized Collection getSatisfiedPlans() {
return satisfiedPlans = nonNullCollection(satisfiedPlans, Plan.class);
}
/**
* @param newValues The new satisfied plans values.
*/
public synchronized void setSatisfiedPlans(final Collection extends Plan> newValues) {
satisfiedPlans = copyCollection(newValues, satisfiedPlans, Plan.class);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy