001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2004-2006, GeoTools Project Managment Committee (PMC)
005: * (C) 2004, Institut de Recherche pour le Développement
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation;
010: * version 2.1 of the License.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * This package contains documentation from OpenGIS specifications.
018: * OpenGIS consortium's work is fully acknowledged here.
019: */
020: package org.geotools.metadata.iso.constraint;
021:
022: // J2SE direct dependencies
023: import java.util.Collection;
024: import java.util.Collections;
025:
026: // OpenGIS dependencies
027: import org.opengis.metadata.constraint.Restriction;
028: import org.opengis.metadata.constraint.LegalConstraints;
029: import org.opengis.util.InternationalString;
030:
031: /**
032: * Restrictions and legal prerequisites for accessing and using the resource.
033: *
034: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/metadata/src/main/java/org/geotools/metadata/iso/constraint/LegalConstraintsImpl.java $
035: * @version $Id: LegalConstraintsImpl.java 25189 2007-04-17 13:23:47Z desruisseaux $
036: * @author Martin Desruisseaux
037: * @author Touraïvane
038: *
039: * @since 2.1
040: */
041: public class LegalConstraintsImpl extends ConstraintsImpl implements
042: LegalConstraints {
043: /**
044: * Serial number for interoperability with different versions.
045: */
046: private static final long serialVersionUID = -2891061818279024901L;
047:
048: /**
049: * Access constraints applied to assure the protection of privacy or intellectual property,
050: * and any special restrictions or limitations on obtaining the resource.
051: */
052: private Collection accessConstraints;
053:
054: /**
055: * Constraints applied to assure the protection of privacy or intellectual property, and any
056: * special restrictions or limitations or warnings on using the resource.
057: */
058: private Collection useConstraints;
059:
060: /**
061: * Other restrictions and legal prerequisites for accessing and using the resource.
062: * This method should returns a non-empty value only if {@linkplain #getAccessConstraints
063: * access constraints} or {@linkplain #getUseConstraints use constraints} declares
064: * {@linkplain Restriction#OTHER_RESTRICTIONS other restrictions}.
065: */
066: private Collection/*<InternationalString>*/otherConstraints;
067:
068: /**
069: * Constructs an initially empty constraints.
070: */
071: public LegalConstraintsImpl() {
072: }
073:
074: /**
075: * Constructs a metadata entity initialized with the values from the specified metadata.
076: *
077: * @since 2.4
078: */
079: public LegalConstraintsImpl(final LegalConstraints source) {
080: super (source);
081: }
082:
083: /**
084: * Returns the access constraints applied to assure the protection of privacy or intellectual property,
085: * and any special restrictions or limitations on obtaining the resource.
086: */
087: public synchronized Collection getAccessConstraints() {
088: return accessConstraints = nonNullCollection(accessConstraints,
089: Restriction.class);
090: }
091:
092: /**
093: * Set the access constraints applied to assure the protection of privacy or intellectual property,
094: * and any special restrictions or limitations on obtaining the resource.
095: */
096: public synchronized void setAccessConstraints(
097: final Collection newValues) {
098: accessConstraints = copyCollection(newValues,
099: accessConstraints, Restriction.class);
100: }
101:
102: /**
103: * Returns the constraints applied to assure the protection of privacy or intellectual property, and any
104: * special restrictions or limitations or warnings on using the resource.
105: */
106: public synchronized Collection getUseConstraints() {
107: return useConstraints = nonNullCollection(useConstraints,
108: Restriction.class);
109: }
110:
111: /**
112: * Set the constraints applied to assure the protection of privacy or intellectual property, and any
113: * special restrictions or limitations or warnings on using the resource.
114: */
115: public synchronized void setUseConstraints(
116: final Collection newValues) {
117: useConstraints = copyCollection(newValues, useConstraints,
118: Restriction.class);
119: }
120:
121: /**
122: * Returns the other restrictions and legal prerequisites for accessing and using the resource.
123: * This method should returns a non-empty value only if {@linkplain #getAccessConstraints
124: * access constraints} or {@linkplain #getUseConstraints use constraints} declares
125: * {@linkplain Restriction#OTHER_RESTRICTIONS other restrictions}.
126: */
127: public synchronized Collection getOtherConstraints() {
128: return otherConstraints = nonNullCollection(otherConstraints,
129: InternationalString.class);
130: }
131:
132: /**
133: * Set the other restrictions and legal prerequisites for accessing and using the resource.
134: */
135: public synchronized void setOtherConstraints(
136: final Collection/*<InternationalString>*/newValues) {
137: otherConstraints = copyCollection(newValues, otherConstraints,
138: InternationalString.class);
139: }
140: }
|