svn-gvsig-desktop / tags / v1_0_2_Build_906 / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / querys / Query.java @ 10972
History | View | Annotate | Download (9.57 KB)
1 |
|
---|---|
2 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
3 |
*
|
4 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
19 |
*
|
20 |
* For more information, contact:
|
21 |
*
|
22 |
* Generalitat Valenciana
|
23 |
* Conselleria d'Infraestructures i Transport
|
24 |
* Av. Blasco Ib??ez, 50
|
25 |
* 46010 VALENCIA
|
26 |
* SPAIN
|
27 |
*
|
28 |
* +34 963862235
|
29 |
* gvsig@gva.es
|
30 |
* www.gvsig.gva.es
|
31 |
*
|
32 |
* or
|
33 |
*
|
34 |
* IVER T.I. S.A
|
35 |
* Salamanca 50
|
36 |
* 46005 Valencia
|
37 |
* Spain
|
38 |
*
|
39 |
* +34 963163400
|
40 |
* dac@iver.es
|
41 |
*/
|
42 |
package es.gva.cit.catalogClient.querys; |
43 |
|
44 |
/**
|
45 |
* This class implements a general query. It contains an attribute
|
46 |
* for each parameter that can be showed in the search form.
|
47 |
*
|
48 |
*
|
49 |
* @author Jorge Piera Llodra (piera_jor@gva.es)
|
50 |
*/
|
51 |
public class Query { |
52 |
public static int SEARCH_SERVICE = 0; |
53 |
public static int SEARCH_DATA = 1; |
54 |
|
55 |
private int searchType = SEARCH_DATA; |
56 |
/**
|
57 |
*
|
58 |
*
|
59 |
*/
|
60 |
private String title; |
61 |
|
62 |
/**
|
63 |
*
|
64 |
*
|
65 |
*/
|
66 |
private String titleFilter; |
67 |
|
68 |
/**
|
69 |
*
|
70 |
*
|
71 |
*/
|
72 |
private String abstract_; |
73 |
|
74 |
/**
|
75 |
*
|
76 |
*
|
77 |
*/
|
78 |
private String themeKey; |
79 |
|
80 |
/**
|
81 |
*
|
82 |
*
|
83 |
*/
|
84 |
private String topic; |
85 |
|
86 |
/**
|
87 |
*
|
88 |
*
|
89 |
*/
|
90 |
private String scale; |
91 |
|
92 |
/**
|
93 |
*
|
94 |
*
|
95 |
*/
|
96 |
private String provider; |
97 |
|
98 |
/**
|
99 |
*
|
100 |
*
|
101 |
*/
|
102 |
private String DateFrom; |
103 |
|
104 |
/**
|
105 |
*
|
106 |
*
|
107 |
*/
|
108 |
private String DateTo; |
109 |
/**
|
110 |
*
|
111 |
*
|
112 |
*/
|
113 |
private Coordinates coordinates;
|
114 |
|
115 |
/**
|
116 |
*
|
117 |
*
|
118 |
*/
|
119 |
private String coordinatesFilter; |
120 |
|
121 |
/**
|
122 |
*
|
123 |
*
|
124 |
*/
|
125 |
private boolean isMinimized; |
126 |
|
127 |
/**
|
128 |
*
|
129 |
*
|
130 |
*/
|
131 |
private boolean isCoordinatesClicked; |
132 |
|
133 |
/**
|
134 |
*
|
135 |
*
|
136 |
*/
|
137 |
public Query() { |
138 |
super();
|
139 |
} |
140 |
|
141 |
/**
|
142 |
*
|
143 |
*
|
144 |
*
|
145 |
* @param title
|
146 |
* @param titleFilter
|
147 |
* @param abstract_
|
148 |
* @param themeKey
|
149 |
* @param topic
|
150 |
* @param scale
|
151 |
* @param provider
|
152 |
* @param dateFrom
|
153 |
* @param dateTo
|
154 |
* @param coordinates
|
155 |
* @param coordinatesFilter
|
156 |
* @param translator
|
157 |
*/
|
158 |
public Query(String title, String titleFilter, String abstract_, String themeKey, String topic, String scale, String provider, String dateFrom, String dateTo, Coordinates coordinates, String coordinatesFilter) { |
159 |
super();
|
160 |
this.title = title;
|
161 |
this.titleFilter = titleFilter;
|
162 |
this.abstract_ = abstract_;
|
163 |
this.themeKey = themeKey;
|
164 |
this.topic = topic;
|
165 |
this.scale = scale;
|
166 |
this.provider = provider;
|
167 |
//Date
|
168 |
this.DateFrom = dateFrom;
|
169 |
this.DateTo = dateTo;
|
170 |
//Coordinates
|
171 |
this.coordinates = coordinates;
|
172 |
if (this.coordinates != null) { |
173 |
if (this.coordinates.getUlx().equals("") || |
174 |
this.coordinates.getUlx().equals("") || |
175 |
this.coordinates.getBrx().equals("") || |
176 |
this.coordinates.getBry().equals("")) { |
177 |
this.coordinates = null; |
178 |
} else {
|
179 |
try {
|
180 |
Double.parseDouble(this.coordinates.getUlx()); |
181 |
Double.parseDouble(this.coordinates.getUlx()); |
182 |
Double.parseDouble(this.coordinates.getBrx()); |
183 |
Double.parseDouble(this.coordinates.getBry()); |
184 |
this.coordinates = coordinates;
|
185 |
} catch (Exception e) { |
186 |
this.coordinates = null; |
187 |
|
188 |
} |
189 |
} |
190 |
} |
191 |
this.coordinatesFilter = coordinatesFilter;
|
192 |
|
193 |
setMinimized(false);
|
194 |
} |
195 |
|
196 |
/**
|
197 |
* Return logic operators
|
198 |
*
|
199 |
* @param titleKeys E,A o Y --> Exact, All, anY
|
200 |
*
|
201 |
* @return String
|
202 |
* @param concordancia
|
203 |
*/
|
204 |
public String getOperator(String concordancia) { |
205 |
if (concordancia.equals("Y")) { |
206 |
return "Or"; |
207 |
} else {
|
208 |
return "And"; |
209 |
} |
210 |
} |
211 |
|
212 |
/**
|
213 |
*
|
214 |
*
|
215 |
*
|
216 |
* @return Returns the abstract_.
|
217 |
*/
|
218 |
public String getAbstract() { |
219 |
return abstract_;
|
220 |
} |
221 |
|
222 |
/**
|
223 |
*
|
224 |
*
|
225 |
*
|
226 |
* @param abstract_ The abstract_ to set.
|
227 |
*/
|
228 |
public void setAbstract(String abstract_) { |
229 |
this.abstract_ = abstract_;
|
230 |
} |
231 |
|
232 |
/**
|
233 |
*
|
234 |
*
|
235 |
*
|
236 |
* @return Returns the coordinates.
|
237 |
*/
|
238 |
public Coordinates getCoordenates() {
|
239 |
return coordinates;
|
240 |
} |
241 |
|
242 |
/**
|
243 |
*
|
244 |
*
|
245 |
*
|
246 |
* @param coordenates The coordinates to set.
|
247 |
*/
|
248 |
public void setCoordenates(Coordinates coordenates) { |
249 |
this.coordinates = coordenates;
|
250 |
} |
251 |
|
252 |
/**
|
253 |
*
|
254 |
*
|
255 |
*
|
256 |
* @return Returns the coordinatesFilter.
|
257 |
*/
|
258 |
public String getCoordenatesFilter() { |
259 |
return coordinatesFilter;
|
260 |
} |
261 |
|
262 |
/**
|
263 |
*
|
264 |
*
|
265 |
*
|
266 |
* @param coordenatesFilter The coordenatesFilter to set.
|
267 |
*/
|
268 |
public void setCoordenatesFilter(String coordenatesFilter) { |
269 |
this.coordinatesFilter = coordenatesFilter;
|
270 |
} |
271 |
|
272 |
/**
|
273 |
*
|
274 |
*
|
275 |
*
|
276 |
* @return Returns the dateFrom.
|
277 |
*/
|
278 |
public String getDateFrom() { |
279 |
return DateFrom;
|
280 |
} |
281 |
|
282 |
/**
|
283 |
*
|
284 |
*
|
285 |
*
|
286 |
* @param dateFrom The dateFrom to set.
|
287 |
*/
|
288 |
public void setDateFrom(String dateFrom) { |
289 |
DateFrom = dateFrom; |
290 |
} |
291 |
|
292 |
/**
|
293 |
*
|
294 |
*
|
295 |
*
|
296 |
* @return Returns the dateTo.
|
297 |
*/
|
298 |
public String getDateTo() { |
299 |
return DateTo;
|
300 |
} |
301 |
|
302 |
/**
|
303 |
*
|
304 |
*
|
305 |
*
|
306 |
* @param dateTo The dateTo to set.
|
307 |
*/
|
308 |
public void setDateTo(String dateTo) { |
309 |
DateTo = dateTo; |
310 |
} |
311 |
|
312 |
/**
|
313 |
*
|
314 |
*
|
315 |
*
|
316 |
* @return Returns the provider.
|
317 |
*/
|
318 |
public String getProvider() { |
319 |
return provider;
|
320 |
} |
321 |
|
322 |
/**
|
323 |
*
|
324 |
*
|
325 |
*
|
326 |
* @param provider The provider to set.
|
327 |
*/
|
328 |
public void setProvider(String provider) { |
329 |
this.provider = provider;
|
330 |
} |
331 |
|
332 |
/**
|
333 |
*
|
334 |
*
|
335 |
*
|
336 |
* @return Returns the scale.
|
337 |
*/
|
338 |
public String getScale() { |
339 |
return scale;
|
340 |
} |
341 |
|
342 |
/**
|
343 |
*
|
344 |
*
|
345 |
*
|
346 |
* @param scale The scale to set.
|
347 |
*/
|
348 |
public void setScale(String scale) { |
349 |
this.scale = scale;
|
350 |
} |
351 |
|
352 |
/**
|
353 |
*
|
354 |
*
|
355 |
*
|
356 |
* @return Returns the themeKey.
|
357 |
*/
|
358 |
public String getThemeKey() { |
359 |
return themeKey;
|
360 |
} |
361 |
|
362 |
/**
|
363 |
*
|
364 |
*
|
365 |
*
|
366 |
* @param themeKey The themeKey to set.
|
367 |
*/
|
368 |
public void setThemeKey(String themeKey) { |
369 |
this.themeKey = themeKey;
|
370 |
} |
371 |
|
372 |
/**
|
373 |
*
|
374 |
*
|
375 |
*
|
376 |
* @return Returns the title.
|
377 |
*/
|
378 |
public String getTitle() { |
379 |
return title;
|
380 |
} |
381 |
|
382 |
/**
|
383 |
*
|
384 |
*
|
385 |
*
|
386 |
* @param title The title to set.
|
387 |
*/
|
388 |
public void setTitle(String title) { |
389 |
this.title = title;
|
390 |
} |
391 |
|
392 |
/**
|
393 |
*
|
394 |
*
|
395 |
*
|
396 |
* @return Returns the titleFilter.
|
397 |
*/
|
398 |
public String getTitleFilter() { |
399 |
return titleFilter;
|
400 |
} |
401 |
|
402 |
/**
|
403 |
*
|
404 |
*
|
405 |
*
|
406 |
* @param titleFilter The titleFilter to set.
|
407 |
*/
|
408 |
public void setTitleFilter(String titleFilter) { |
409 |
this.titleFilter = titleFilter;
|
410 |
} |
411 |
|
412 |
/**
|
413 |
*
|
414 |
*
|
415 |
*
|
416 |
* @return Returns the topic.
|
417 |
*/
|
418 |
public String getTopic() { |
419 |
return topic;
|
420 |
} |
421 |
|
422 |
/**
|
423 |
*
|
424 |
*
|
425 |
*
|
426 |
* @param topic The topic to set.
|
427 |
*/
|
428 |
public void setTopic(String topic) { |
429 |
this.topic = topic;
|
430 |
} |
431 |
|
432 |
/**
|
433 |
*
|
434 |
*
|
435 |
*
|
436 |
* @return Returns the isMinimized.
|
437 |
*/
|
438 |
public boolean isMinimized() { |
439 |
return isMinimized;
|
440 |
} |
441 |
|
442 |
/**
|
443 |
*
|
444 |
*
|
445 |
*
|
446 |
* @param isMinimized The isMinimized to set.
|
447 |
*/
|
448 |
public void setMinimized(boolean isMinimized) { |
449 |
this.isMinimized = isMinimized;
|
450 |
if (isMinimized){
|
451 |
this.setAbstract(getTitle());
|
452 |
} |
453 |
} |
454 |
|
455 |
/**
|
456 |
*
|
457 |
*
|
458 |
*
|
459 |
* @return Returns the isCoordinatesClicked.
|
460 |
*/
|
461 |
public boolean isCoordinatesClicked() { |
462 |
return isCoordinatesClicked;
|
463 |
} |
464 |
|
465 |
/**
|
466 |
*
|
467 |
*
|
468 |
*
|
469 |
* @param isCoordinatesClicked The isCoordinatesClicked to set.
|
470 |
*/
|
471 |
public void setCoordinatesClicked(boolean isCoordinatesClicked) { |
472 |
this.isCoordinatesClicked = isCoordinatesClicked;
|
473 |
} |
474 |
|
475 |
|
476 |
/**
|
477 |
* It returns the lower scale
|
478 |
*
|
479 |
*
|
480 |
* @return String or Null if ther is not a low value (0)
|
481 |
*/
|
482 |
public String getMinScale() { |
483 |
if (scale.equals(">1.000.000")){ |
484 |
return "1000000"; |
485 |
} |
486 |
|
487 |
if (scale.equals("1.000.000 - 250.000")){ |
488 |
return "250000"; |
489 |
} |
490 |
|
491 |
if (scale.equals("250.000 - 50.000")){ |
492 |
return "50000"; |
493 |
} |
494 |
|
495 |
if (scale.equals("50.000 - 10.000")){ |
496 |
return "10000"; |
497 |
} |
498 |
|
499 |
if (scale.equals("10.000 - 5000")){ |
500 |
return "5000"; |
501 |
} |
502 |
|
503 |
return null; |
504 |
} |
505 |
|
506 |
/**
|
507 |
* It returns the upper scale
|
508 |
*
|
509 |
*
|
510 |
* @return String or Null if ther is not a value (infinity)
|
511 |
*/
|
512 |
public String getMaxScale() { |
513 |
if (scale.equals("1.000.000 - 250.000")){ |
514 |
return "1000000"; |
515 |
} |
516 |
|
517 |
if (scale.equals("250.000 - 50.000")){ |
518 |
return "250000"; |
519 |
} |
520 |
|
521 |
if (scale.equals("50.000 - 10.000")){ |
522 |
return "50000"; |
523 |
} |
524 |
|
525 |
if (scale.equals("10.000 - 5000")){ |
526 |
return "10000"; |
527 |
} |
528 |
|
529 |
if (scale.equals("<5.000")){ |
530 |
return "5000"; |
531 |
} |
532 |
|
533 |
return null; |
534 |
} |
535 |
|
536 |
public int getSearchType() { |
537 |
return searchType;
|
538 |
} |
539 |
|
540 |
public void setSearchType(int searchType) { |
541 |
this.searchType = searchType;
|
542 |
} |
543 |
} |