Revision 112 org.gvsig.wfs.app/trunk/org.gvsig.wfs.app/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/wfs/WFSStoreParameters.java
WFSStoreParameters.java | ||
---|---|---|
2 | 2 |
* |
3 | 3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
4 | 4 |
* of the Valencian Government (CIT) |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
8 | 8 |
* as published by the Free Software Foundation; either version 2 |
9 | 9 |
* of the License, or (at your option) any later version. |
10 |
*
|
|
10 |
* |
|
11 | 11 |
* This program is distributed in the hope that it will be useful, |
12 | 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | 14 |
* GNU General Public License for more details. |
15 |
*
|
|
15 |
* |
|
16 | 16 |
* You should have received a copy of the GNU General Public License |
17 | 17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 | 19 |
* MA 02110-1301, USA. |
20 |
*
|
|
20 |
* |
|
21 | 21 |
*/ |
22 | 22 |
|
23 | 23 |
/* |
24 | 24 |
* AUTHORS (In addition to CIT): |
25 | 25 |
* 2009 {Iver T.I.} {Task} |
26 | 26 |
*/ |
27 |
|
|
27 |
|
|
28 | 28 |
package org.gvsig.fmap.dal.store.wfs; |
29 | 29 |
|
30 | 30 |
import org.apache.commons.lang3.BooleanUtils; |
... | ... | |
35 | 35 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
36 | 36 |
import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
37 | 37 |
import org.gvsig.fmap.geom.Geometry; |
38 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
38 | 39 |
import org.gvsig.tools.ToolsLocator; |
39 | 40 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
40 | 41 |
import org.gvsig.tools.dynobject.DynClass; |
... | ... | |
48 | 49 |
DataStoreParameters{ |
49 | 50 |
protected static DynClass DYNCLASS = null; |
50 | 51 |
public static final String DYNCLASS_NAME = "WFSStoreParameters"; |
51 |
|
|
52 |
|
|
52 | 53 |
public static final String DYNFIELDNAME_URL = "url"; |
53 | 54 |
public static final String DYNFIELDNAME_VERSION = "version"; |
54 | 55 |
public static final String DYNFIELDNAME_TYPENAME = "typeName"; |
... | ... | |
61 | 62 |
public static final String DYNFIELDNAME_USER = "user"; |
62 | 63 |
public static final String DYNFIELDNAME_PASSWORD = "password"; |
63 | 64 |
public static final String DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY = "filterByAreaGeometry"; |
65 |
public static final String DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE = "filterByAreaEnvelope"; |
|
64 | 66 |
public static final String DYNFIELDNAME_FILTER_BY_AREA_OPERATION = "filterByAreaOperation"; |
65 | 67 |
public static final String DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE = "filterByAreaAttribute"; |
66 | 68 |
public static final String DYNFIELDNAME_FILTER_BY_AREA_CRS = "filterByAreaCrs"; |
67 | 69 |
|
68 | 70 |
private DelegatedDynObject delegatedDynObject; |
69 |
|
|
71 |
|
|
70 | 72 |
public WFSStoreParameters() { |
71 | 73 |
super(); |
72 | 74 |
this.delegatedDynObject = (DelegatedDynObject) ToolsLocator |
73 | 75 |
.getDynObjectManager().createDynObject( |
74 | 76 |
WFSStoreParameters.DYNCLASS); |
75 |
}
|
|
76 |
|
|
77 |
} |
|
78 |
|
|
77 | 79 |
@Override |
78 | 80 |
protected DelegatedDynObject getDelegatedDynObject() { |
79 | 81 |
return delegatedDynObject; |
80 | 82 |
} |
81 | 83 |
|
82 | 84 |
public WFSStoreParameters(DataParameters dataParameters) throws InitializeException, ProviderNotRegisteredException{ |
83 |
this();
|
|
85 |
this(); |
|
84 | 86 |
setUrl((String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_URL)); |
85 | 87 |
String namespace = null; |
86 | 88 |
String namespacePrefix = null; |
... | ... | |
108 | 110 |
setFilterByAreaCrs((String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_CRS)); |
109 | 111 |
setFilterByAreaOperation((Integer)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_OPERATION)); |
110 | 112 |
} |
113 |
if (dataParameters.hasDynValue(WFSStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE)){ |
|
114 |
setFilterByAreaEnvelope((Envelope)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE)); |
|
115 |
setFilterByAreaAttribute((String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE)); |
|
116 |
setFilterByAreaCrs((String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_CRS)); |
|
117 |
setFilterByAreaOperation((Integer)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_OPERATION)); |
|
118 |
} |
|
111 | 119 |
if (dataParameters.hasDynValue(WFSStoreParameters.DYNFIELDNAME_VERSION)){ |
112 | 120 |
setVersion((String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_VERSION)); |
113 | 121 |
} |
... | ... | |
121 | 129 |
setPassword((String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_PASSWORD)); |
122 | 130 |
} |
123 | 131 |
} |
124 |
|
|
132 |
|
|
125 | 133 |
protected static void registerDynClass() { |
126 | 134 |
if (DYNCLASS == null) { |
127 | 135 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
... | ... | |
129 | 137 |
WFSStoreParameters.class, |
130 | 138 |
DYNCLASS_NAME, |
131 | 139 |
"WFSStoreParameters Persistence definition", |
132 |
null,
|
|
140 |
null, |
|
133 | 141 |
null |
134 | 142 |
); |
135 | 143 |
definition.addDynFieldString(DYNFIELDNAME_URL) |
136 | 144 |
.setDescription("URL of the WFS server") |
137 | 145 |
.setMandatory(true); |
138 |
|
|
146 |
|
|
139 | 147 |
definition.addDynFieldString(DYNFIELDNAME_VERSION) |
140 | 148 |
.setDescription("Version of the WFS server") |
141 | 149 |
.setMandatory(false); |
142 |
|
|
150 |
|
|
143 | 151 |
definition.addDynFieldString(DYNFIELDNAME_TYPENAME) |
144 | 152 |
.setDescription("Feature type to retrieve") |
145 | 153 |
.setMandatory(true); |
146 |
|
|
154 |
|
|
147 | 155 |
definition.addDynFieldString(DYNFIELDNAME_NAMESPACE) |
148 | 156 |
.setDescription("Namespace of the feature type to retrieve") |
149 | 157 |
.setMandatory(false); |
150 |
|
|
158 |
|
|
151 | 159 |
definition.addDynFieldString(DYNFIELDNAME_NAMESPACEPREFIX) |
152 | 160 |
.setDescription("Prefix of the namespace of the feature type to retrieve") |
153 | 161 |
.setMandatory(false); |
154 |
|
|
162 |
|
|
155 | 163 |
definition.addDynFieldString(DYNFIELDNAME_FIELDS) |
156 | 164 |
.setDescription("Fields to retrieve separated by ','") |
157 | 165 |
.setMandatory(false); |
158 |
|
|
166 |
|
|
159 | 167 |
definition.addDynFieldString(DYNFIELDNAME_FILTER_ENCODING_BY_ATTRIBUTE) |
160 | 168 |
.setDescription("Filter encoding request") |
161 | 169 |
.setMandatory(false); |
162 |
|
|
170 |
|
|
163 | 171 |
definition.addDynFieldInt(DYNFIELDNAME_MAXFEATURES) |
164 | 172 |
.setDescription("Number of features to retrieve") |
165 | 173 |
.setMandatory(false); |
166 |
|
|
174 |
|
|
167 | 175 |
definition.addDynFieldInt(DYNFIELDNAME_TIMEOUT) |
168 | 176 |
.setDescription("Timeout") |
169 | 177 |
.setMandatory(false); |
170 |
|
|
178 |
|
|
171 | 179 |
definition.addDynFieldString(DYNFIELDNAME_USER) |
172 | 180 |
.setDescription("User name (not used at this moment)") |
173 | 181 |
.setMandatory(false); |
174 |
|
|
182 |
|
|
175 | 183 |
definition.addDynFieldString(DYNFIELDNAME_PASSWORD) |
176 |
.setDescription("Passwrod (not used at this moment")
|
|
177 |
.setMandatory(false);
|
|
178 |
|
|
184 |
.setDescription("Password (not used at this moment")
|
|
185 |
.setMandatory(false); |
|
186 |
|
|
179 | 187 |
definition.addDynFieldObject(DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY) |
180 | 188 |
.setType(DataTypes.GEOMETRY) |
181 | 189 |
.setDescription("Geometry used to do the filter") |
182 | 190 |
.setMandatory(false); |
183 |
|
|
191 |
|
|
192 |
definition.addDynFieldObject(DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE) |
|
193 |
.setType(DataTypes.ENVELOPE) |
|
194 |
.setDescription("Envelope used to do the filter") |
|
195 |
.setMandatory(false); |
|
196 |
|
|
184 | 197 |
definition.addDynFieldInt(DYNFIELDNAME_FILTER_BY_AREA_OPERATION) |
185 | 198 |
.setDescription("Geometry operation used to do the filter") |
186 | 199 |
.setMandatory(false); |
187 |
|
|
200 |
|
|
188 | 201 |
definition.addDynFieldString(DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE) |
189 | 202 |
.setDescription("Attribute that contains the geometry") |
190 | 203 |
.setMandatory(false); |
191 |
|
|
204 |
|
|
192 | 205 |
definition.addDynFieldString(DYNFIELDNAME_FILTER_BY_AREA_CRS) |
193 | 206 |
.setDescription("CRS to do the query") |
194 | 207 |
.setMandatory(false); |
195 |
|
|
196 |
definition.addDynFieldBoolean("useAxisOrderYX")
|
|
208 |
|
|
209 |
definition.addDynFieldBoolean("useAxisOrderYX") |
|
197 | 210 |
.setDefaultFieldValue("false") |
198 | 211 |
.setMandatory(false); |
199 |
|
|
200 |
definition.addDynFieldBoolean("ignoreCache")
|
|
212 |
|
|
213 |
definition.addDynFieldBoolean("ignoreCache") |
|
201 | 214 |
.setDefaultFieldValue("false") |
202 | 215 |
.setMandatory(false); |
203 |
|
|
216 |
|
|
204 | 217 |
DYNCLASS = (DynClass) definition; |
205 | 218 |
} |
206 |
}
|
|
219 |
} |
|
207 | 220 |
|
208 | 221 |
/* (non-Javadoc) |
209 | 222 |
* @see org.gvsig.fmap.dal.DataStoreParameters#getDataStoreName() |
... | ... | |
217 | 230 |
*/ |
218 | 231 |
public String getDescription() { |
219 | 232 |
return WFSStoreProvider.DESCRIPTION; |
220 |
}
|
|
233 |
} |
|
221 | 234 |
|
222 | 235 |
/* (non-Javadoc) |
223 | 236 |
* @see org.gvsig.fmap.dal.DataStoreParameters#isValid() |
... | ... | |
226 | 239 |
// TODO Auto-generated method stub |
227 | 240 |
return false; |
228 | 241 |
} |
229 |
|
|
242 |
|
|
230 | 243 |
public String getUrl(){ |
231 | 244 |
return (String) this.getDynValue(DYNFIELDNAME_URL); |
232 | 245 |
} |
233 |
|
|
246 |
|
|
234 | 247 |
public void setUrl(String url){ |
235 | 248 |
this.setDynValue(DYNFIELDNAME_URL, url); |
236 | 249 |
} |
237 |
|
|
250 |
|
|
238 | 251 |
public String getVersion(){ |
239 | 252 |
return (String) this.getDynValue(DYNFIELDNAME_VERSION); |
240 | 253 |
} |
241 |
|
|
254 |
|
|
242 | 255 |
public void setVersion(String version){ |
243 | 256 |
this.setDynValue(DYNFIELDNAME_VERSION, version); |
244 | 257 |
} |
245 |
|
|
258 |
|
|
246 | 259 |
public String getFeatureType(){ |
247 | 260 |
return (String) this.getDynValue(DYNFIELDNAME_TYPENAME); |
248 | 261 |
} |
249 |
|
|
262 |
|
|
250 | 263 |
public void setFeatureType(String featureType){ |
251 | 264 |
this.setDynValue(DYNFIELDNAME_TYPENAME, featureType); |
252 | 265 |
} |
253 |
|
|
266 |
|
|
254 | 267 |
public void setFeatureType(String namespace, String featureType){ |
255 | 268 |
this.setDynValue(DYNFIELDNAME_NAMESPACE, namespace); |
256 | 269 |
this.setDynValue(DYNFIELDNAME_TYPENAME, featureType); |
257 | 270 |
} |
258 |
|
|
271 |
|
|
259 | 272 |
public void setFeatureType(String prefix, String namespace, String featureType){ |
260 | 273 |
this.setDynValue(DYNFIELDNAME_NAMESPACEPREFIX, prefix); |
261 | 274 |
this.setDynValue(DYNFIELDNAME_NAMESPACE, namespace); |
262 | 275 |
this.setDynValue(DYNFIELDNAME_TYPENAME, featureType); |
263 | 276 |
} |
264 |
|
|
277 |
|
|
265 | 278 |
public String getFeatureNamespace(){ |
266 | 279 |
return (String) this.getDynValue(DYNFIELDNAME_NAMESPACE); |
267 | 280 |
} |
268 |
|
|
281 |
|
|
269 | 282 |
public String getFeaturePrefix(){ |
270 | 283 |
return (String) this.getDynValue(DYNFIELDNAME_NAMESPACEPREFIX); |
271 | 284 |
} |
272 |
|
|
285 |
|
|
273 | 286 |
public String getFields(){ |
274 | 287 |
return (String) this.getDynValue(DYNFIELDNAME_FIELDS); |
275 | 288 |
} |
276 |
|
|
289 |
|
|
277 | 290 |
public void setFields(String fields){ |
278 | 291 |
this.setDynValue(DYNFIELDNAME_FIELDS, fields); |
279 | 292 |
} |
280 |
|
|
293 |
|
|
281 | 294 |
public String getFilterEncodingByAttribute(){ |
282 | 295 |
return (String) this.getDynValue(DYNFIELDNAME_FILTER_ENCODING_BY_ATTRIBUTE); |
283 | 296 |
} |
284 |
|
|
297 |
|
|
285 | 298 |
public void setFilterEncodingByAttribute(String filter){ |
286 | 299 |
this.setDynValue(DYNFIELDNAME_FILTER_ENCODING_BY_ATTRIBUTE, filter); |
287 | 300 |
} |
288 |
|
|
301 |
|
|
289 | 302 |
public Integer getMaxFeatures(){ |
290 | 303 |
return (Integer) this.getDynValue(DYNFIELDNAME_MAXFEATURES); |
291 | 304 |
} |
292 |
|
|
305 |
|
|
293 | 306 |
public void setMaxFeatures(Integer maxFeatures){ |
294 | 307 |
this.setDynValue(DYNFIELDNAME_MAXFEATURES, maxFeatures); |
295 | 308 |
} |
296 |
|
|
309 |
|
|
297 | 310 |
public Integer getTimeOut(){ |
298 | 311 |
return (Integer) this.getDynValue(DYNFIELDNAME_TIMEOUT); |
299 | 312 |
} |
300 |
|
|
313 |
|
|
301 | 314 |
public void setTimeOut(Integer timeOut){ |
302 | 315 |
this.setDynValue(DYNFIELDNAME_TIMEOUT, timeOut); |
303 |
}
|
|
304 |
|
|
316 |
} |
|
317 |
|
|
305 | 318 |
public String getUser(){ |
306 | 319 |
return (String) this.getDynValue(DYNFIELDNAME_USER); |
307 | 320 |
} |
308 |
|
|
321 |
|
|
309 | 322 |
public void setUser(String user){ |
310 | 323 |
this.setDynValue(DYNFIELDNAME_USER, user); |
311 | 324 |
} |
312 |
|
|
325 |
|
|
313 | 326 |
public String getPassword(){ |
314 | 327 |
return (String) this.getDynValue(DYNFIELDNAME_PASSWORD); |
315 | 328 |
} |
316 |
|
|
329 |
|
|
317 | 330 |
public void setPassword(String password){ |
318 | 331 |
this.setDynValue(DYNFIELDNAME_PASSWORD, password); |
319 | 332 |
} |
320 |
|
|
333 |
|
|
321 | 334 |
public Geometry getFilterByAreaGeometry(){ |
322 | 335 |
return (Geometry) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY); |
323 | 336 |
} |
324 |
|
|
337 |
|
|
325 | 338 |
public void setFilterByAreaGeometry(Geometry area){ |
326 | 339 |
this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY, area); |
327 | 340 |
} |
328 |
|
|
341 |
|
|
342 |
public Envelope getFilterByAreaEnvelope(){ |
|
343 |
return (Envelope) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE); |
|
344 |
} |
|
345 |
|
|
346 |
public void setFilterByAreaEnvelope(Envelope area){ |
|
347 |
this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE, area); |
|
348 |
} |
|
349 |
|
|
329 | 350 |
public Integer getFilterByAreaOperation(){ |
330 | 351 |
return (Integer) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_OPERATION); |
331 | 352 |
} |
332 |
|
|
353 |
|
|
333 | 354 |
public void setFilterByAreaOperation(Integer operation){ |
334 | 355 |
this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_OPERATION, operation); |
335 | 356 |
} |
336 |
|
|
357 |
|
|
337 | 358 |
public String getFilterByAreaCrs(){ |
338 | 359 |
return (String) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_CRS); |
339 | 360 |
} |
340 |
|
|
361 |
|
|
341 | 362 |
public void setFilterByAreaCrs(String crs){ |
342 | 363 |
this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_CRS, crs); |
343 | 364 |
} |
344 |
|
|
365 |
|
|
345 | 366 |
public String getFilterByAreaAttribute(){ |
346 | 367 |
return (String) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE); |
347 | 368 |
} |
348 |
|
|
369 |
|
|
349 | 370 |
public void setFilterByAreaAttribute(String attribute){ |
350 | 371 |
this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE, attribute); |
351 | 372 |
} |
... | ... | |
354 | 375 |
Boolean x = (Boolean) this.getDynValue("useAxisOrderYX"); |
355 | 376 |
return BooleanUtils.isTrue(x); |
356 | 377 |
} |
357 |
|
|
378 |
|
|
358 | 379 |
public void setUseAxisOrderYX(boolean useAxisOrderYX){ |
359 | 380 |
this.setDynValue("useAxisOrderYX", new Boolean(useAxisOrderYX)); |
360 | 381 |
} |
... | ... | |
363 | 384 |
Boolean x = (Boolean) this.getDynValue("ignoreCache"); |
364 | 385 |
return BooleanUtils.isTrue(x); |
365 | 386 |
} |
366 |
|
|
387 |
|
|
367 | 388 |
public void setIgnoreCache(boolean ignoreCache){ |
368 | 389 |
this.setDynValue("ignoreCache", new Boolean(ignoreCache)); |
369 | 390 |
} |
Also available in: Unified diff