001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/tags/2.1/src/org/deegree/security/owsproxy/OperationParameter.java $
002    /*----------------    FILE HEADER  ------------------------------------------
003    
004     This file is part of deegree.
005     Copyright (C) 2001-2006 by:
006     EXSE, Department of Geography, University of Bonn
007     http://www.giub.uni-bonn.de/deegree/
008     lat/lon GmbH
009     http://www.lat-lon.de
010    
011     This library is free software; you can redistribute it and/or
012     modify it under the terms of the GNU Lesser General Public
013     License as published by the Free Software Foundation; either
014     version 2.1 of the License, or (at your option) any later version.
015    
016     This library is distributed in the hope that it will be useful,
017     but WITHOUT ANY WARRANTY; without even the implied warranty of
018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
019     Lesser General Public License for more details.
020    
021     You should have received a copy of the GNU Lesser General Public
022     License along with this library; if not, write to the Free Software
023     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
024    
025     Contact:
026    
027     Andreas Poth
028     lat/lon GmbH
029     Aennchenstr. 19
030     53115 Bonn
031     Germany
032     E-Mail: poth@lat-lon.de
033    
034     Prof. Dr. Klaus Greve
035     Department of Geography
036     University of Bonn
037     Meckenheimer Allee 166
038     53115 Bonn
039     Germany
040     E-Mail: greve@giub.uni-bonn.de
041    
042     ---------------------------------------------------------------------------*/
043    package org.deegree.security.owsproxy;
044    
045    import java.util.List;
046    
047    import org.w3c.dom.Element;
048    
049    /**
050     * Bean like class for encapsulating parameters of a owsProxy policy pre/post condition
051     * 
052     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth </a>
053     * @author last edited by: $Author: wanhoff $
054     * 
055     * @version $Revision: 6367 $, $Date: 2007-03-26 13:44:46 +0200 (Mo, 26 Mär 2007) $
056     */
057    public class OperationParameter {
058    
059        private boolean userCoupled = false;
060    
061        private String name = null;
062    
063        private List<String> values;
064    
065        private List<Element> complexValues;
066    
067        private boolean any = false;
068    
069        /**
070         * @param name
071         * @param values
072         * @param complexValues
073         * @param userCoupled
074         */
075        public OperationParameter( String name, List<String> values, List<Element> complexValues,
076                                   boolean userCoupled ) {
077            this.name = name;
078            this.values = values;
079            this.complexValues = complexValues;
080            this.userCoupled = userCoupled;
081        }
082    
083        /**
084         * @param name
085         * @param any
086         */
087        public OperationParameter( String name, boolean any ) {
088            this.any = any;
089            this.name = name;
090        }
091    
092        /**
093         * @return Returns the name of a parameter
094         */
095        public String getName() {
096            return name;
097        }
098    
099        /**
100         * @param name
101         *            The name to set.
102         */
103        public void setName( String name ) {
104            this.name = name;
105        }
106    
107        /**
108         * 
109         * @return all values
110         */
111        public List<String> getValues() {
112            return values;
113        }
114    
115        /**
116         * 
117         * @return all values
118         */
119        public List<Element> getComplexValues() {
120            return complexValues;
121        }
122    
123        /**
124         * returns the first value of the list as integer. This is useful for operation parameter that
125         * only allow one single string expression (e.g. BBOX)
126         * 
127         * @return first value of a list as String
128         */
129        public String getFirstAsString() {
130            return values.get( 0 );
131        }
132    
133        /**
134         * returns the first value of the list as integer. This is useful for operation parameter that
135         * only allow one single integer expression (e.g. maxHeight)
136         * 
137         * @return first value of a list as integer
138         */
139        public int getFirstAsInt() {
140            return Integer.parseInt( values.get( 0 ) );
141        }
142    
143        /**
144         * returns the first value of the list as double. This is useful for operation parameter that
145         * only allow one single double expression (e.g. resolution)
146         * 
147         * @return first value of a list as double
148         */
149        public double getFirstAsDouble() {
150            return Double.parseDouble( values.get( 0 ) );
151        }
152    
153        /**
154         * 
155         * @param values
156         */
157        public void setValues( List<String> values ) {
158            this.values.clear();
159            this.values = values;
160        }
161    
162        /**
163         * 
164         * @param complexValues
165         */
166        public void setComplexValues( List<Element> complexValues ) {
167            this.complexValues.clear();
168            this.complexValues = complexValues;
169        }
170    
171        /**
172         * 
173         * @param value
174         */
175        public void addValue( String value ) {
176            values.add( value );
177        }
178    
179        /**
180         * 
181         * @param complexValue
182         */
183        public void addComplexValue( Element complexValue ) {
184            complexValues.add( complexValue );
185        }
186    
187        /**
188         * 
189         * @param value
190         */
191        public void removeValue( String value ) {
192            values.remove( value );
193        }
194    
195        /**
196         * @return Returns the userCoupled.
197         */
198        public boolean isUserCoupled() {
199            return userCoupled;
200        }
201    
202        /**
203         * @param userCoupled
204         *            The userCoupled to set.
205         */
206        public void setUserCoupled( boolean userCoupled ) {
207            this.userCoupled = userCoupled;
208        }
209    
210        /**
211         * @return Returns the all.
212         */
213        public boolean isAny() {
214            return any;
215        }
216    
217        /**
218         * @param any
219         * @param all
220         *            The all to set.
221         */
222        public void setAny( boolean any ) {
223            this.any = any;
224        }
225    
226    }