Statistics
| Revision:

gvsig-catalog / org.gvsig.catalog / branches / org.gvsig.catalog-CSW2.0.2 / org.gvsig.catalog / org.gvsig.catalog.lib / src / main / java / org / gvsig / catalog / querys / CatalogQuery.java @ 55

History | View | Annotate | Download (8.58 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 org.gvsig.catalog.querys;
43

    
44
import org.gvsig.catalog.utils.CatalogConstants;
45

    
46
/**
47
 * This class implements a general query. It contains an attribute
48
 * for each parameter that can be showed in the search form.
49
 * 
50
 * 
51
 * @author Jorge Piera Llodra (piera_jor@gva.es)
52
 */
53
public class CatalogQuery extends DiscoveryServiceQuery{
54
        private Search service = null;
55
        private String title;
56
        private String titleFilter;
57
        private String abstract_;
58
        private String themeKey;
59
        private String topic;
60
        private String scale;
61
        private String provider;
62
        private String DateFrom;
63
        private String DateTo;
64
        private Coordinates coordinates;
65
        private String coordinatesFilter;
66
        private boolean isMinimized;
67
        private boolean isCoordinatesClicked;
68

    
69
        public  CatalogQuery() {        
70
                super();
71
        } 
72

    
73
        /**
74
         * @param title 
75
         * @param titleFilter 
76
         * @param abstract_ 
77
         * @param themeKey 
78
         * @param topic 
79
         * @param scale 
80
         * @param provider 
81
         * @param dateFrom 
82
         * @param dateTo 
83
         * @param coordinates 
84
         * @param coordinatesFilter 
85
         * @param translator 
86
         */
87
        public  CatalogQuery(String title, String titleFilter, String abstract_, String themeKey, String topic, String scale, String provider, String dateFrom, String dateTo, Coordinates coordinates, String coordinatesFilter) {        
88
                super();
89
                this.title = title;
90
                this.titleFilter = titleFilter;
91
                this.abstract_ = abstract_;
92
                this.themeKey = themeKey;
93
                this.topic = topic;
94
                this.scale = scale;
95
                this.provider = provider;
96
                //Date
97
                this.DateFrom = dateFrom;
98
                this.DateTo = dateTo;
99
                //Coordinates
100
                this.coordinates = coordinates;
101
                if (this.coordinates != null) {
102
                        if (this.coordinates.getUlx().equals("") ||
103
                                        this.coordinates.getUlx().equals("") ||
104
                                        this.coordinates.getBrx().equals("") ||
105
                                        this.coordinates.getBry().equals("")) {
106
                                this.coordinates = null;
107
                        } else {
108
                                try {
109
                                        Double.parseDouble(this.coordinates.getUlx());
110
                                        Double.parseDouble(this.coordinates.getUlx());
111
                                        Double.parseDouble(this.coordinates.getBrx());
112
                                        Double.parseDouble(this.coordinates.getBry());
113
                                        this.coordinates = coordinates;
114
                                } catch (Exception e) {
115
                                        this.coordinates = null;
116

    
117
                                }
118
                        }
119
                }
120
                this.coordinatesFilter = coordinatesFilter;
121

    
122
                setMinimized(false);
123
        } 
124

    
125
        /**
126
         * Return logic operators
127
         * 
128
         * @param titleKeys E,A o Y --> Exact, All, anY
129
         * 
130
         * @return String
131
         * @param concordancia 
132
         */
133
        public String getOperator(String concordancia) {        
134
                if (concordancia.equals(CatalogConstants.ANY_WORD)) {
135
                        return CatalogConstants.OR;
136
                } else {
137
                        return CatalogConstants.OR;
138
                }
139
        } 
140

    
141
        /**
142
         * 
143
         * 
144
         * 
145
         * @return Returns the abstract_.
146
         */
147
        public String getAbstract() {        
148
                return abstract_;
149
        } 
150

    
151
        /**
152
         * 
153
         * 
154
         * 
155
         * @param abstract_ The abstract_ to set.
156
         */
157
        public void setAbstract(String abstract_) {        
158
                this.abstract_ = abstract_;
159
        } 
160

    
161
        /**
162
         * 
163
         * 
164
         * 
165
         * @return Returns the coordinates.
166
         */
167
        public Coordinates getCoordenates() {        
168
                return coordinates;
169
        } 
170

    
171
        /**
172
         * 
173
         * 
174
         * 
175
         * @param coordenates The coordinates to set.
176
         */
177
        public void setCoordenates(Coordinates coordenates) {        
178
                this.coordinates = coordenates;
179
        } 
180

    
181
        /**
182
         * 
183
         * 
184
         * 
185
         * @return Returns the coordinatesFilter.
186
         */
187
        public String getCoordenatesFilter() {        
188
                return coordinatesFilter;
189
        } 
190

    
191
        /**
192
         * 
193
         * 
194
         * 
195
         * @param coordenatesFilter The coordenatesFilter to set.
196
         */
197
        public void setCoordenatesFilter(String coordenatesFilter) {        
198
                this.coordinatesFilter = coordenatesFilter;
199
        } 
200

    
201
        /**
202
         * 
203
         * 
204
         * 
205
         * @return Returns the dateFrom.
206
         */
207
        public String getDateFrom() {        
208
                return DateFrom;
209
        } 
210

    
211
        /**
212
         * 
213
         * 
214
         * 
215
         * @param dateFrom The dateFrom to set.
216
         */
217
        public void setDateFrom(String dateFrom) {        
218
                DateFrom = dateFrom;
219
        } 
220

    
221
        /**
222
         * 
223
         * 
224
         * 
225
         * @return Returns the dateTo.
226
         */
227
        public String getDateTo() {        
228
                return DateTo;
229
        } 
230

    
231
        /**
232
         * 
233
         * 
234
         * 
235
         * @param dateTo The dateTo to set.
236
         */
237
        public void setDateTo(String dateTo) {        
238
                DateTo = dateTo;
239
        } 
240

    
241
        /**
242
         * 
243
         * 
244
         * 
245
         * @return Returns the provider.
246
         */
247
        public String getProvider() {        
248
                return provider;
249
        } 
250

    
251
        /**
252
         * 
253
         * 
254
         * 
255
         * @param provider The provider to set.
256
         */
257
        public void setProvider(String provider) {        
258
                this.provider = provider;
259
        } 
260

    
261
        /**
262
         * 
263
         * 
264
         * 
265
         * @return Returns the scale.
266
         */
267
        public String getScale() {        
268
                return scale;
269
        } 
270

    
271
        /**
272
         * 
273
         * 
274
         * 
275
         * @param scale The scale to set.
276
         */
277
        public void setScale(String scale) {        
278
                this.scale = scale;
279
        } 
280

    
281
        /**
282
         * 
283
         * 
284
         * 
285
         * @return Returns the themeKey.
286
         */
287
        public String getThemeKey() {        
288
                return themeKey;
289
        } 
290

    
291
        /**
292
         * 
293
         * 
294
         * 
295
         * @param themeKey The themeKey to set.
296
         */
297
        public void setThemeKey(String themeKey) {        
298
                this.themeKey = themeKey;
299
        } 
300

    
301
        /**
302
         * 
303
         * 
304
         * 
305
         * @return Returns the title.
306
         */
307
        public String getTitle() {        
308
                return title;
309
        } 
310

    
311
        /**
312
         * 
313
         * 
314
         * 
315
         * @param title The title to set.
316
         */
317
        public void setTitle(String title) {        
318
                this.title = title;
319
        } 
320

    
321
        /**
322
         * 
323
         * 
324
         * 
325
         * @return Returns the titleFilter.
326
         */
327
        public String getTitleFilter() {        
328
                return titleFilter;
329
        } 
330

    
331
        /**
332
         * 
333
         * 
334
         * 
335
         * @param titleFilter The titleFilter to set.
336
         */
337
        public void setTitleFilter(String titleFilter) {        
338
                this.titleFilter = titleFilter;
339
        } 
340

    
341
        /**
342
         * 
343
         * 
344
         * 
345
         * @return Returns the topic.
346
         */
347
        public String getTopic() {        
348
                return topic;
349
        } 
350

    
351
        /**
352
         * 
353
         * 
354
         * 
355
         * @param topic The topic to set.
356
         */
357
        public void setTopic(String topic) {        
358
                this.topic = topic;
359
        } 
360

    
361
        /**
362
         * 
363
         * 
364
         * 
365
         * @return Returns the isMinimized.
366
         */
367
        public boolean isMinimized() {        
368
                return isMinimized;
369
        } 
370

    
371
        /**
372
         * 
373
         * 
374
         * 
375
         * @param isMinimized The isMinimized to set.
376
         */
377
        public void setMinimized(boolean isMinimized) {        
378
                this.isMinimized = isMinimized;
379
                if (isMinimized){
380
                        this.setAbstract(getTitle());
381
                }
382
        } 
383

    
384
        /**
385
         * 
386
         * 
387
         * 
388
         * @return Returns the isCoordinatesClicked.
389
         */
390
        public boolean isCoordinatesClicked() {        
391
                return isCoordinatesClicked;
392
        } 
393

    
394
        /**
395
         * 
396
         * 
397
         * 
398
         * @param isCoordinatesClicked The isCoordinatesClicked to set.
399
         */
400
        public void setCoordinatesClicked(boolean isCoordinatesClicked) {        
401
                this.isCoordinatesClicked = isCoordinatesClicked;
402
        } 
403

    
404

    
405
        /**
406
         * It returns the lower scale
407
         * 
408
         * 
409
         * @return String or Null if ther is not a low value (0)
410
         */
411
        public String getMinScale() {        
412
                if (scale.equals(">1.000.000")){
413
                        return "1000000";
414
                }
415

    
416
                if (scale.equals("1.000.000 - 250.000")){
417
                        return "250000";
418
                }
419

    
420
                if (scale.equals("250.000 - 50.000")){
421
                        return "50000";
422
                }
423

    
424
                if (scale.equals("50.000 - 10.000")){
425
                        return "10000";
426
                }
427

    
428
                if (scale.equals("10.000 - 5000")){
429
                        return "5000";
430
                }
431

    
432
                return null;        
433
        } 
434

    
435
        /**
436
         * It returns the upper scale
437
         * 
438
         * 
439
         * @return String or Null if ther is not a value (infinity)
440
         */
441
        public String getMaxScale() {        
442
                if (scale.equals("1.000.000 - 250.000")){
443
                        return "1000000";
444
                }
445

    
446
                if (scale.equals("250.000 - 50.000")){
447
                        return "250000";
448
                }        
449

    
450
                if (scale.equals("50.000 - 10.000")){
451
                        return "50000";
452
                }
453

    
454
                if (scale.equals("10.000 - 5000")){
455
                        return "10000";
456
                }
457

    
458
                if (scale.equals("<5.000")){
459
                        return "5000";
460
                }   
461
                return null;        
462
        }
463

    
464
        /**
465
         * @return the service
466
         */
467
        public Search getService() {
468
                return service;
469
        }
470

    
471
        /**
472
         * @param service the service to set
473
         */
474
        public void setService(Search service) {
475
                this.service = service;
476
        } 
477
        
478
}