Statistics
| Revision:

svn-gvsig-desktop / tags / v1_0_2_Build_910 / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / querys / Query.java @ 11275

History | View | Annotate | Download (9.57 KB)

1 3566 jorpiell
2 2820 jorpiell
/* 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 2047 luisw
package es.gva.cit.catalogClient.querys;
43
44
/**
45 2820 jorpiell
 * This class implements a general query. It contains an attribute
46
 * for each parameter that can be showed in the search form.
47
 *
48 3566 jorpiell
 *
49 2820 jorpiell
 * @author Jorge Piera Llodra (piera_jor@gva.es)
50 2047 luisw
 */
51
public class Query {
52 8604 jorpiell
        public static int SEARCH_SERVICE = 0;
53
        public static int SEARCH_DATA = 1;
54 3566 jorpiell
55 8604 jorpiell
        private int searchType = SEARCH_DATA;
56 3566 jorpiell
/**
57
 *
58
 *
59
 */
60 2047 luisw
    private String title;
61 3566 jorpiell
62
/**
63
 *
64
 *
65
 */
66 2047 luisw
    private String titleFilter;
67 3566 jorpiell
68
/**
69
 *
70
 *
71
 */
72 2724 jorpiell
    private String abstract_;
73 3566 jorpiell
74
/**
75
 *
76
 *
77
 */
78 2047 luisw
    private String themeKey;
79 3566 jorpiell
80
/**
81
 *
82
 *
83
 */
84 2047 luisw
    private String topic;
85 3566 jorpiell
86
/**
87
 *
88
 *
89
 */
90 2047 luisw
    private String scale;
91 3566 jorpiell
92
/**
93
 *
94
 *
95
 */
96 2047 luisw
    private String provider;
97 3566 jorpiell
98
/**
99
 *
100
 *
101
 */
102 2047 luisw
    private String DateFrom;
103 3566 jorpiell
104
/**
105
 *
106
 *
107
 */
108 2047 luisw
    private String DateTo;
109 3566 jorpiell
/**
110
 *
111
 *
112
 */
113 2047 luisw
    private Coordinates coordinates;
114 3566 jorpiell
115
/**
116
 *
117
 *
118
 */
119 2047 luisw
    private String coordinatesFilter;
120 3566 jorpiell
121
/**
122
 *
123
 *
124
 */
125 2985 jorpiell
    private boolean isMinimized;
126 3566 jorpiell
127
/**
128
 *
129
 *
130
 */
131 3161 jorpiell
    private boolean isCoordinatesClicked;
132 2724 jorpiell
133 3566 jorpiell
/**
134
 *
135
 *
136
 */
137
    public  Query() {
138
        super();
139
    }
140 2985 jorpiell
141 3566 jorpiell
/**
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 4713 cesar
    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 2724 jorpiell
        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 3202 jorpiell
188 2724 jorpiell
                }
189
            }
190
        }
191
        this.coordinatesFilter = coordinatesFilter;
192 2985 jorpiell
193
        setMinimized(false);
194 3566 jorpiell
    }
195 2724 jorpiell
196 3566 jorpiell
/**
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 2724 jorpiell
        if (concordancia.equals("Y")) {
206
            return "Or";
207
        } else {
208
            return "And";
209
        }
210 3566 jorpiell
    }
211 2724 jorpiell
212 3566 jorpiell
/**
213
 *
214
 *
215
 *
216
 * @return Returns the abstract_.
217
 */
218
    public String getAbstract() {
219 2724 jorpiell
        return abstract_;
220 3566 jorpiell
    }
221 2724 jorpiell
222 3566 jorpiell
/**
223
 *
224
 *
225
 *
226
 * @param abstract_ The abstract_ to set.
227
 */
228
    public void setAbstract(String abstract_) {
229 2724 jorpiell
        this.abstract_ = abstract_;
230 3566 jorpiell
    }
231 2724 jorpiell
232 3566 jorpiell
/**
233
 *
234
 *
235
 *
236
 * @return Returns the coordinates.
237
 */
238
    public Coordinates getCoordenates() {
239 2724 jorpiell
        return coordinates;
240 3566 jorpiell
    }
241 2724 jorpiell
242 3566 jorpiell
/**
243
 *
244
 *
245
 *
246
 * @param coordenates The coordinates to set.
247
 */
248
    public void setCoordenates(Coordinates coordenates) {
249 2724 jorpiell
        this.coordinates = coordenates;
250 3566 jorpiell
    }
251 2724 jorpiell
252 3566 jorpiell
/**
253
 *
254
 *
255
 *
256
 * @return Returns the coordinatesFilter.
257
 */
258
    public String getCoordenatesFilter() {
259 2724 jorpiell
        return coordinatesFilter;
260 3566 jorpiell
    }
261 2724 jorpiell
262 3566 jorpiell
/**
263
 *
264
 *
265
 *
266
 * @param coordenatesFilter The coordenatesFilter to set.
267
 */
268
    public void setCoordenatesFilter(String coordenatesFilter) {
269 2724 jorpiell
        this.coordinatesFilter = coordenatesFilter;
270 3566 jorpiell
    }
271 2724 jorpiell
272 3566 jorpiell
/**
273
 *
274
 *
275
 *
276
 * @return Returns the dateFrom.
277
 */
278
    public String getDateFrom() {
279 2724 jorpiell
        return DateFrom;
280 3566 jorpiell
    }
281 2724 jorpiell
282 3566 jorpiell
/**
283
 *
284
 *
285
 *
286
 * @param dateFrom The dateFrom to set.
287
 */
288
    public void setDateFrom(String dateFrom) {
289 2724 jorpiell
        DateFrom = dateFrom;
290 3566 jorpiell
    }
291 2724 jorpiell
292 3566 jorpiell
/**
293
 *
294
 *
295
 *
296
 * @return Returns the dateTo.
297
 */
298
    public String getDateTo() {
299 2724 jorpiell
        return DateTo;
300 3566 jorpiell
    }
301 2724 jorpiell
302 3566 jorpiell
/**
303
 *
304
 *
305
 *
306
 * @param dateTo The dateTo to set.
307
 */
308
    public void setDateTo(String dateTo) {
309 2724 jorpiell
        DateTo = dateTo;
310 3566 jorpiell
    }
311 2724 jorpiell
312 3566 jorpiell
/**
313
 *
314
 *
315
 *
316
 * @return Returns the provider.
317
 */
318
    public String getProvider() {
319 2724 jorpiell
        return provider;
320 3566 jorpiell
    }
321 2724 jorpiell
322 3566 jorpiell
/**
323
 *
324
 *
325
 *
326
 * @param provider The provider to set.
327
 */
328
    public void setProvider(String provider) {
329 2724 jorpiell
        this.provider = provider;
330 3566 jorpiell
    }
331 2724 jorpiell
332 3566 jorpiell
/**
333
 *
334
 *
335
 *
336
 * @return Returns the scale.
337
 */
338
    public String getScale() {
339 2724 jorpiell
        return scale;
340 3566 jorpiell
    }
341 2724 jorpiell
342 3566 jorpiell
/**
343
 *
344
 *
345
 *
346
 * @param scale The scale to set.
347
 */
348
    public void setScale(String scale) {
349 2724 jorpiell
        this.scale = scale;
350 3566 jorpiell
    }
351 2724 jorpiell
352 3566 jorpiell
/**
353
 *
354
 *
355
 *
356
 * @return Returns the themeKey.
357
 */
358
    public String getThemeKey() {
359 2724 jorpiell
        return themeKey;
360 3566 jorpiell
    }
361 2724 jorpiell
362 3566 jorpiell
/**
363
 *
364
 *
365
 *
366
 * @param themeKey The themeKey to set.
367
 */
368
    public void setThemeKey(String themeKey) {
369 2724 jorpiell
        this.themeKey = themeKey;
370 3566 jorpiell
    }
371 2724 jorpiell
372 3566 jorpiell
/**
373
 *
374
 *
375
 *
376
 * @return Returns the title.
377
 */
378
    public String getTitle() {
379 2724 jorpiell
        return title;
380 3566 jorpiell
    }
381 2724 jorpiell
382 3566 jorpiell
/**
383
 *
384
 *
385
 *
386
 * @param title The title to set.
387
 */
388
    public void setTitle(String title) {
389 2724 jorpiell
        this.title = title;
390 3566 jorpiell
    }
391 2724 jorpiell
392 3566 jorpiell
/**
393
 *
394
 *
395
 *
396
 * @return Returns the titleFilter.
397
 */
398
    public String getTitleFilter() {
399 2724 jorpiell
        return titleFilter;
400 3566 jorpiell
    }
401 2724 jorpiell
402 3566 jorpiell
/**
403
 *
404
 *
405
 *
406
 * @param titleFilter The titleFilter to set.
407
 */
408
    public void setTitleFilter(String titleFilter) {
409 2724 jorpiell
        this.titleFilter = titleFilter;
410 3566 jorpiell
    }
411 2724 jorpiell
412 3566 jorpiell
/**
413
 *
414
 *
415
 *
416
 * @return Returns the topic.
417
 */
418
    public String getTopic() {
419 2724 jorpiell
        return topic;
420 3566 jorpiell
    }
421 2724 jorpiell
422 3566 jorpiell
/**
423
 *
424
 *
425
 *
426
 * @param topic The topic to set.
427
 */
428
    public void setTopic(String topic) {
429 2724 jorpiell
        this.topic = topic;
430 3566 jorpiell
    }
431
432
/**
433
 *
434
 *
435
 *
436
 * @return Returns the isMinimized.
437
 */
438
    public boolean isMinimized() {
439 2985 jorpiell
        return isMinimized;
440 3566 jorpiell
    }
441
442
/**
443
 *
444
 *
445
 *
446
 * @param isMinimized The isMinimized to set.
447
 */
448
    public void setMinimized(boolean isMinimized) {
449 2985 jorpiell
        this.isMinimized = isMinimized;
450 3033 jorpiell
        if (isMinimized){
451
            this.setAbstract(getTitle());
452
        }
453 3566 jorpiell
    }
454
455
/**
456
 *
457
 *
458
 *
459
 * @return Returns the isCoordinatesClicked.
460
 */
461
    public boolean isCoordinatesClicked() {
462 3161 jorpiell
        return isCoordinatesClicked;
463 3566 jorpiell
    }
464
465
/**
466
 *
467
 *
468
 *
469
 * @param isCoordinatesClicked The isCoordinatesClicked to set.
470
 */
471
    public void setCoordinatesClicked(boolean isCoordinatesClicked) {
472 3161 jorpiell
        this.isCoordinatesClicked = isCoordinatesClicked;
473 3566 jorpiell
    }
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 3454 jorpiell
        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 3566 jorpiell
    }
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 3454 jorpiell
        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 8765 jjdelcerro
    }
535
536
    public int getSearchType() {
537
            return searchType;
538 8604 jorpiell
    }
539
540 8765 jjdelcerro
    public void setSearchType(int searchType) {
541
            this.searchType = searchType;
542
    }
543 3566 jorpiell
 }