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;
021:
022: // J2SE direct dependencies
023: import java.util.Collection;
024:
025: // OpenGIS dependencies
026: import org.opengis.metadata.Datatype;
027: import org.opengis.metadata.Obligation;
028: import org.opengis.metadata.citation.ResponsibleParty;
029: import org.opengis.metadata.ExtendedElementInformation;
030: import org.opengis.util.InternationalString;
031:
032: /**
033: * New metadata element, not found in ISO 19115, which is required to describe geographic data.
034: *
035: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/metadata/src/main/java/org/geotools/metadata/iso/ExtendedElementInformationImpl.java $
036: * @version $Id: ExtendedElementInformationImpl.java 25189 2007-04-17 13:23:47Z desruisseaux $
037: * @author Martin Desruisseaux
038: * @author Touraïvane
039: *
040: * @since 2.1
041: */
042: public class ExtendedElementInformationImpl extends MetadataEntity
043: implements ExtendedElementInformation {
044: /**
045: * Serial number for interoperability with different versions.
046: */
047: private static final long serialVersionUID = -935396252908733907L;
048:
049: /**
050: * Name of the extended metadata element.
051: */
052: private String name;
053:
054: /**
055: * Short form suitable for use in an implementation method such as XML or SGML.
056: */
057: private String shortName;
058:
059: /**
060: * Three digit code assigned to the extended element.
061: * Non-null only if the {@linkplain #getDataType data type}
062: * is {@linkplain Datatype#CODE_LIST_ELEMENT code list element}.
063: */
064: private Integer domainCode;
065:
066: /**
067: * Definition of the extended element.
068: */
069: private InternationalString definition;
070:
071: /**
072: * Obligation of the extended element.
073: */
074: private Obligation obligation;
075:
076: /**
077: * Condition under which the extended element is mandatory.
078: * Non-null value only if the {@linkplain #getObligation obligation}
079: * is {@linkplain Obligation#CONDITIONAL conditional}.
080: */
081: private InternationalString condition;
082:
083: /**
084: * Code which identifies the kind of value provided in the extended element.
085: */
086: private Datatype dataType;
087:
088: /**
089: * Maximum occurrence of the extended element.
090: * Returns {@code null} if it doesn't apply, for example if the
091: * {@linkplain #getDataType data type} is {@linkplain Datatype#ENUMERATION enumeration},
092: * {@linkplain Datatype#CODE_LIST code list} or {@linkplain Datatype#CODE_LIST_ELEMENT
093: * code list element}.
094: */
095: private Integer maximumOccurrence;
096:
097: /**
098: * Valid values that can be assigned to the extended element.
099: * Returns {@code null} if it doesn't apply, for example if the
100: * {@linkplain #getDataType data type} is {@linkplain Datatype#ENUMERATION enumeration},
101: * {@linkplain Datatype#CODE_LIST code list} or {@linkplain Datatype#CODE_LIST_ELEMENT
102: * code list element}.
103: */
104: private InternationalString domainValue;
105:
106: /**
107: * Name of the metadata entity(s) under which this extended metadata element may appear.
108: * The name(s) may be standard metadata element(s) or other extended metadata element(s).
109: */
110: private Collection parentEntity;
111:
112: /**
113: * Specifies how the extended element relates to other existing elements and entities.
114: */
115: private InternationalString rule;
116:
117: /**
118: * Reason for creating the extended element.
119: */
120: private Collection rationales;
121:
122: /**
123: * Name of the person or organization creating the extended element.
124: */
125: private Collection sources;
126:
127: /**
128: * Construct an initially empty extended element information.
129: */
130: public ExtendedElementInformationImpl() {
131: }
132:
133: /**
134: * Constructs a metadata entity initialized with the values from the specified metadata.
135: *
136: * @since 2.4
137: */
138: public ExtendedElementInformationImpl(
139: final ExtendedElementInformation source) {
140: super (source);
141: }
142:
143: /**
144: * Create an extended element information initialized to the given values.
145: */
146: public ExtendedElementInformationImpl(final String name,
147: final InternationalString definition,
148: final InternationalString condition,
149: final Datatype datatype, final Collection parentEntity,
150: final InternationalString rule, final Collection sources) {
151: setName(name);
152: setDefinition(definition);
153: setCondition(condition);
154: setDataType(dataType);
155: setParentEntity(parentEntity);
156: setRule(rule);
157: setSources(sources);
158: }
159:
160: /**
161: * Name of the extended metadata element.
162: */
163: public String getName() {
164: return name;
165: }
166:
167: /**
168: * Set the name of the extended metadata element.
169: */
170: public synchronized void setName(final String newValue) {
171: checkWritePermission();
172: name = newValue;
173: }
174:
175: /**
176: * Short form suitable for use in an implementation method such as XML or SGML.
177: * NOTE: other methods may be used.
178: * Returns {@code null} if the {@linkplain #getDataType data type}
179: * is {@linkplain Datatype#CODE_LIST_ELEMENT code list element}.
180: */
181: public String getShortName() {
182: return shortName;
183: }
184:
185: /**
186: * Set a short form suitable for use in an implementation method such as XML or SGML.
187: */
188: public synchronized void setShortName(final String newValue) {
189: checkWritePermission();
190: shortName = newValue;
191: }
192:
193: /**
194: * Three digit code assigned to the extended element.
195: * Returns a non-null value only if the {@linkplain #getDataType data type}
196: * is {@linkplain Datatype#CODE_LIST_ELEMENT code list element}.
197: */
198: public Integer getDomainCode() {
199: return domainCode;
200: }
201:
202: /**
203: * Set a three digit code assigned to the extended element.
204: */
205: public synchronized void setDomainCode(final Integer newValue) {
206: checkWritePermission();
207: domainCode = newValue;
208: }
209:
210: /**
211: * Definition of the extended element.
212: */
213: public InternationalString getDefinition() {
214: return definition;
215: }
216:
217: /**
218: * Set the definition of the extended element.
219: */
220: public synchronized void setDefinition(
221: final InternationalString newValue) {
222: checkWritePermission();
223: definition = newValue;
224: }
225:
226: /**
227: * Obligation of the extended element.
228: */
229: public Obligation getObligation() {
230: return obligation;
231: }
232:
233: /**
234: * Set the obligation of the extended element.
235: */
236: public synchronized void setObligation(final Obligation newValue) {
237: checkWritePermission();
238: obligation = newValue;
239: }
240:
241: /**
242: * Condition under which the extended element is mandatory.
243: * Returns a non-null value only if the {@linkplain #getObligation obligation}
244: * is {@linkplain Obligation#CONDITIONAL conditional}.
245: */
246: public InternationalString getCondition() {
247: return condition;
248: }
249:
250: /**
251: * Set the condition under which the extended element is mandatory.
252: */
253: public synchronized void setCondition(
254: final InternationalString newValue) {
255: checkWritePermission();
256: condition = newValue;
257: }
258:
259: /**
260: * Code which identifies the kind of value provided in the extended element.
261: */
262: public Datatype getDataType() {
263: return dataType;
264: }
265:
266: /**
267: * Set the code which identifies the kind of value provided in the extended element.
268: */
269: public synchronized void setDataType(final Datatype newValue) {
270: checkWritePermission();
271: dataType = newValue;
272: }
273:
274: /**
275: * Maximum occurrence of the extended element.
276: * Returns {@code null} if it doesn't apply, for example if the
277: * {@linkplain #getDataType data type} is {@linkplain Datatype#ENUMERATION enumeration},
278: * {@linkplain Datatype#CODE_LIST code list} or {@linkplain Datatype#CODE_LIST_ELEMENT
279: * code list element}.
280: */
281: public Integer getMaximumOccurrence() {
282: return maximumOccurrence;
283: }
284:
285: /**
286: * Set the maximum occurrence of the extended element.
287: */
288: public synchronized void setMaximumOccurrence(final Integer newValue) {
289: checkWritePermission();
290: maximumOccurrence = newValue;
291: }
292:
293: /**
294: * Valid values that can be assigned to the extended element.
295: * Returns {@code null} if it doesn't apply, for example if the
296: * {@linkplain #getDataType data type} is {@linkplain Datatype#ENUMERATION enumeration},
297: * {@linkplain Datatype#CODE_LIST code list} or {@linkplain Datatype#CODE_LIST_ELEMENT
298: * code list element}.
299: */
300: public InternationalString getDomainValue() {
301: return domainValue;
302: }
303:
304: /**
305: * Set the valid values that can be assigned to the extended element.
306: */
307: public synchronized void setDomainValue(
308: final InternationalString newValue) {
309: checkWritePermission();
310: domainValue = newValue;
311: }
312:
313: /**
314: * Name of the metadata entity(s) under which this extended metadata element may appear.
315: * The name(s) may be standard metadata element(s) or other extended metadata element(s).
316: */
317: public synchronized Collection getParentEntity() {
318: return parentEntity = nonNullCollection(parentEntity,
319: String.class);
320: }
321:
322: /**
323: * Set the name of the metadata entity(s) under which this extended metadata element may appear.
324: */
325: public synchronized void setParentEntity(final Collection newValues) {
326: parentEntity = copyCollection(newValues, parentEntity,
327: String.class);
328: }
329:
330: /**
331: * Specifies how the extended element relates to other existing elements and entities.
332: */
333: public InternationalString getRule() {
334: return rule;
335: }
336:
337: /**
338: * Set how the extended element relates to other existing elements and entities.
339: */
340: public synchronized void setRule(final InternationalString newValue) {
341: checkWritePermission();
342: rule = newValue;
343: }
344:
345: /**
346: * Reason for creating the extended element.
347: */
348: public synchronized Collection getRationales() {
349: return rationales = nonNullCollection(rationales,
350: InternationalString.class);
351: }
352:
353: /**
354: * Set the reason for creating the extended element.
355: */
356: public synchronized void setRationales(final Collection newValues) {
357: rationales = copyCollection(newValues, rationales,
358: InternationalString.class);
359: }
360:
361: /**
362: * Name of the person or organization creating the extended element.
363: */
364: public synchronized Collection getSources() {
365: return sources = nonNullCollection(sources,
366: ResponsibleParty.class);
367: }
368:
369: /**
370: * Set the name of the person or organization creating the extended element.
371: */
372: public synchronized void setSources(final Collection newValues) {
373: sources = copyCollection(newValues, sources,
374: ResponsibleParty.class);
375: }
376: }
|