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: // OpenGIS direct dependencies
023: import org.opengis.metadata.Identifier;
024: import org.opengis.metadata.citation.Citation;
025:
026: /**
027: * Value uniquely identifying an object within a namespace.
028: *
029: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/metadata/src/main/java/org/geotools/metadata/iso/IdentifierImpl.java $
030: * @version $Id: IdentifierImpl.java 25189 2007-04-17 13:23:47Z desruisseaux $
031: * @author Martin Desruisseaux
032: * @author Touraïvane
033: *
034: * @since 2.1
035: */
036: public class IdentifierImpl extends MetadataEntity implements
037: Identifier {
038: /**
039: * Serial number for interoperability with different versions.
040: */
041: private static final long serialVersionUID = 7459062382170865919L;
042:
043: /**
044: * Alphanumeric value identifying an instance in the namespace.
045: */
046: private String code;
047:
048: /**
049: * Identifier of the version of the associated code space or code, as specified
050: * by the code space or code authority. This version is included only when the
051: * {@linkplain #getCode code} uses versions.
052: * When appropriate, the edition is identified by the effective date, coded using
053: * ISO 8601 date format.
054: */
055: private String version;
056:
057: /**
058: * Organization or party responsible for definition and maintenance of the
059: * {@linkplain #getCode code}.
060: */
061: private Citation authority;
062:
063: /**
064: * Construct an initially empty identifier.
065: */
066: public IdentifierImpl() {
067: }
068:
069: /**
070: * Constructs a metadata entity initialized with the values from the specified metadata.
071: *
072: * @since 2.4
073: */
074: public IdentifierImpl(final Identifier source) {
075: super (source);
076: }
077:
078: /**
079: * Creates an identifier initialized to the given code.
080: */
081: public IdentifierImpl(final String code) {
082: setCode(code);
083: }
084:
085: /**
086: * Creates an identifier initialized to the given authority and code.
087: *
088: * @since 2.2
089: */
090: public IdentifierImpl(final Citation authority, final String code) {
091: setAuthority(authority);
092: setCode(code);
093: }
094:
095: /**
096: * Alphanumeric value identifying an instance in the namespace.
097: *
098: * @return The code.
099: */
100: public String getCode() {
101: return code;
102: }
103:
104: /**
105: * Set the alphanumeric value identifying an instance in the namespace.
106: */
107: public synchronized void setCode(final String newValue) {
108: checkWritePermission();
109: code = newValue;
110: }
111:
112: /**
113: * Identifier of the version of the associated code, as specified
114: * by the code space or code authority. This version is included only when the
115: * {@linkplain #getCode code} uses versions.
116: * When appropriate, the edition is identified by the effective date, coded using
117: * ISO 8601 date format.
118: *
119: * @return The version, or {@code null} if not available.
120: */
121: public String getVersion() {
122: return version;
123: }
124:
125: /**
126: * Set an identifier of the version of the associated code.
127: */
128: public synchronized void setVersion(final String newValue) {
129: checkWritePermission();
130: version = newValue;
131: }
132:
133: /**
134: * Organization or party responsible for definition and maintenance of the
135: * {@linkplain #getCode code}.
136: *
137: * @return The authority, or {@code null} if not available.
138: */
139: public Citation getAuthority() {
140: return authority;
141: }
142:
143: /**
144: * Set the organization or party responsible for definition and maintenance of the
145: * {@linkplain #getCode code}.
146: */
147: public synchronized void setAuthority(final Citation newValue) {
148: checkWritePermission();
149: authority = newValue;
150: }
151: }
|