001    //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/branches/2.3_testing/src/org/deegree/owscommon_1_1_0/DomainType.java $
002    /*----------------------------------------------------------------------------
003     This file is part of deegree, http://deegree.org/
004     Copyright (C) 2001-2009 by:
005       Department of Geography, University of Bonn
006     and
007       lat/lon GmbH
008    
009     This library is free software; you can redistribute it and/or modify it under
010     the terms of the GNU Lesser General Public License as published by the Free
011     Software Foundation; either version 2.1 of the License, or (at your option)
012     any later version.
013     This library is distributed in the hope that it will be useful, but WITHOUT
014     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
015     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
016     details.
017     You should have received a copy of the GNU Lesser General Public License
018     along with this library; if not, write to the Free Software Foundation, Inc.,
019     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020    
021     Contact information:
022    
023     lat/lon GmbH
024     Aennchenstr. 19, 53177 Bonn
025     Germany
026     http://lat-lon.de/
027    
028     Department of Geography, University of Bonn
029     Prof. Dr. Klaus Greve
030     Postfach 1147, 53001 Bonn
031     Germany
032     http://www.geographie.uni-bonn.de/deegree/
033    
034     e-mail: info@deegree.org
035    ----------------------------------------------------------------------------*/
036    
037    package org.deegree.owscommon_1_1_0;
038    
039    import java.util.ArrayList;
040    import java.util.List;
041    
042    import org.deegree.framework.util.Pair;
043    
044    /**
045     * <code>DomainType</code> encapsulation of the domaintype parameters, used in a operationmetadata of ows 1.1.0
046     *
047     * @author <a href="mailto:bezema@lat-lon.de">Rutger Bezema</a>
048     *
049     * @author last edited by: $Author: mschneider $
050     *
051     * @version $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
052     *
053     */
054    
055    public class DomainType {
056    
057        private final List<String> values;
058    
059        private final List<Range> ranges;
060    
061        private final String defaultValue;
062    
063        private final Pair<String, String> meaning;
064    
065        private final Pair<String, String> dataType;
066    
067        private final Pair<String, String> uom;
068    
069        private final Pair<String, String> referenceSystem;
070    
071        private final List<Metadata> metadataAttribs;
072    
073        private final String name;
074    
075        private final boolean anyValue;
076    
077        private final boolean noValues;
078    
079        private final Pair<String, String> valuesReference;
080    
081        /**
082         * @param values
083         *            <code>null</code> if allowedvalues was not set
084         * @param ranges
085         *            <code>null</code> if allowedvalues was not set
086         * @param valuesReference
087         *            <code>null</code> if not set
088         * @param noValues
089         *            true if the noValues element was set.
090         * @param anyValue
091         *            true if the anyvalues element was set.
092         * @param defaultValue
093         * @param meaning
094         *            a pair containing &lt;text(), reference-attribute&gt; values
095         * @param dataType
096         *            a pair containing &lt;text(), reference-attribute&gt; values
097         * @param uom
098         *            a pair containing &lt;text(), reference-attribute&gt; values
099         * @param referenceSystem
100         *            a pair containing &lt;text(), reference-attribute&gt; values
101         * @param metadataAttribs
102         *            list containing metadatas
103         * @param name
104         *            attribute.
105         */
106        public DomainType( List<String> values, List<Range> ranges, boolean anyValue, boolean noValues,
107                           Pair<String, String> valuesReference, String defaultValue, Pair<String, String> meaning,
108                           Pair<String, String> dataType, Pair<String, String> uom, Pair<String, String> referenceSystem,
109                           List<Metadata> metadataAttribs, String name ) {
110            this.values = values;
111            this.ranges = ranges;
112            this.anyValue = anyValue;
113            this.noValues = noValues;
114            this.valuesReference = valuesReference;
115    
116            this.defaultValue = defaultValue;
117            this.meaning = meaning;
118            this.dataType = dataType;
119            this.uom = uom;
120            this.referenceSystem = referenceSystem;
121            if ( metadataAttribs == null ) {
122                this.metadataAttribs = new ArrayList<Metadata>();
123            } else {
124                this.metadataAttribs = metadataAttribs;
125            }
126            this.name = name;
127        }
128    
129        /**
130         * @return true if the allowedValues was defined.
131         */
132        public boolean hasAllowedValues() {
133            return ( values != null || ranges != null );
134        }
135    
136        /**
137         * @return the values <code>null</code> if none present
138         */
139        public final List<String> getValues() {
140            return values;
141        }
142    
143        /**
144         * @return the ranges <code>null</code> if none present
145         */
146        public final List<Range> getRanges() {
147            return ranges;
148        }
149    
150        /**
151         * @return the defaultValues <code>null</code> if none present
152         */
153        public final String getDefaultValue() {
154            return defaultValue;
155        }
156    
157        /**
158         * @return the meaning &lt;text(), reference-attribute&gt; or <code>null</code> if none present
159         */
160        public final Pair<String, String> getMeaning() {
161            return meaning;
162        }
163    
164        /**
165         * @return the dataType &lt;text(), reference-attribute&gt; or <code>null</code> if none present
166         */
167        public final Pair<String, String> getDataType() {
168            return dataType;
169        }
170    
171        /**
172         * @return true if the DomaintType valuesUnit was set (uom || referencesystem != null ).
173         */
174        public final boolean hasValuesUnit() {
175            return ( uom != null || referenceSystem != null );
176        }
177    
178        /**
179         * @return the uom, &lt;text(), reference-attribute&gt; or <code>null</code> if none present
180         */
181        public final Pair<String, String> getUom() {
182            return uom;
183        }
184    
185        /**
186         * @return the referenceSystem &lt;text(), reference-attribute&gt; or <code>null</code> if none present
187         */
188        public final Pair<String, String> getReferenceSystem() {
189            return referenceSystem;
190        }
191    
192        /**
193         * @return the metadataAttribs may be empty but will never be <code>null</code>.
194         */
195        public final List<Metadata> getMetadataAttribs() {
196            return metadataAttribs;
197        }
198    
199        /**
200         * @return the name, mandatory not <code>null</code>
201         */
202        public final String getName() {
203            return name;
204        }
205    
206        /**
207         * @return true if the anyValue element was set.
208         */
209        public final boolean hasAnyValue() {
210            return anyValue;
211        }
212    
213        /**
214         * @return true if the noValues element was set.
215         */
216        public final boolean hasNoValues() {
217            return noValues;
218        }
219    
220        /**
221         * @return the valuesReference &lt;text(), reference-attribute&gt; or <code>null</code> if none present
222         */
223        public final Pair<String, String> getValuesReference() {
224            return valuesReference;
225        }
226    
227    }