001    //$HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/base/branches/2.5_testing/src/org/deegree/security/owsproxy/OperationParameter.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    package org.deegree.security.owsproxy;
037    
038    import java.util.List;
039    
040    import org.w3c.dom.Element;
041    
042    /**
043     * Bean like class for encapsulating parameters of a owsProxy policy pre/post condition
044     *
045     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth </a>
046     * @author last edited by: $Author: mschneider $
047     *
048     * @version $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18 Jun 2009) $
049     */
050    public class OperationParameter {
051    
052        private boolean userCoupled = false;
053    
054        private String name = null;
055    
056        private List<String> values;
057    
058        private List<Element> complexValues;
059    
060        private boolean any = false;
061    
062        /**
063         * @param name
064         * @param values
065         * @param complexValues
066         * @param userCoupled
067         */
068        public OperationParameter( String name, List<String> values, List<Element> complexValues, boolean userCoupled ) {
069            this.name = name;
070            this.values = values;
071            this.complexValues = complexValues;
072            this.userCoupled = userCoupled;
073        }
074    
075        /**
076         * @param name
077         * @param any
078         */
079        public OperationParameter( String name, boolean any ) {
080            this.any = any;
081            this.name = name;
082        }
083    
084        /**
085         * @return Returns the name of a parameter
086         */
087        public String getName() {
088            return name;
089        }
090    
091        /**
092         * @param name
093         *            The name to set.
094         */
095        public void setName( String name ) {
096            this.name = name;
097        }
098    
099        /**
100         *
101         * @return all values
102         */
103        public List<String> getValues() {
104            return values;
105        }
106    
107        /**
108         *
109         * @return all values
110         */
111        public List<Element> getComplexValues() {
112            return complexValues;
113        }
114    
115        /**
116         * returns the first value of the list as integer. This is useful for operation parameter that
117         * only allow one single string expression (e.g. BBOX)
118         *
119         * @return first value of a list as String
120         */
121        public String getFirstAsString() {
122            return values.get( 0 );
123        }
124    
125        /**
126         * returns the first value of the list as integer. This is useful for operation parameter that
127         * only allow one single integer expression (e.g. maxHeight)
128         *
129         * @return first value of a list as integer
130         */
131        public int getFirstAsInt() {
132            return Integer.parseInt( values.get( 0 ) );
133        }
134    
135        /**
136         * returns the first value of the list as double. This is useful for operation parameter that
137         * only allow one single double expression (e.g. resolution)
138         *
139         * @return first value of a list as double
140         */
141        public double getFirstAsDouble() {
142            return Double.parseDouble( values.get( 0 ) );
143        }
144    
145        /**
146         *
147         * @param values
148         */
149        public void setValues( List<String> values ) {
150            this.values.clear();
151            this.values = values;
152        }
153    
154        /**
155         *
156         * @param complexValues
157         */
158        public void setComplexValues( List<Element> complexValues ) {
159            this.complexValues.clear();
160            this.complexValues = complexValues;
161        }
162    
163        /**
164         *
165         * @param value
166         */
167        public void addValue( String value ) {
168            values.add( value );
169        }
170    
171        /**
172         *
173         * @param complexValue
174         */
175        public void addComplexValue( Element complexValue ) {
176            complexValues.add( complexValue );
177        }
178    
179        /**
180         *
181         * @param value
182         */
183        public void removeValue( String value ) {
184            values.remove( value );
185        }
186    
187        /**
188         * @return Returns the userCoupled.
189         */
190        public boolean isUserCoupled() {
191            return userCoupled;
192        }
193    
194        /**
195         * @param userCoupled
196         *            The userCoupled to set.
197         */
198        public void setUserCoupled( boolean userCoupled ) {
199            this.userCoupled = userCoupled;
200        }
201    
202        /**
203         * @return Returns the all.
204         */
205        public boolean isAny() {
206            return any;
207        }
208    
209        /**
210         * @param any
211         */
212        public void setAny( boolean any ) {
213            this.any = any;
214        }
215    
216    }