Statistics
| Revision:

root / trunk / applications / appCatalogAndGazetteerClient / src / es / gva / cit / catalog / srw / filters / SRWFilter.java @ 15558

History | View | Annotate | Download (3.11 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.catalog.srw.filters;
43
import es.gva.cit.catalog.filters.AbstractFilter;
44
import es.gva.cit.catalog.languages.CommonQueryLanguage;
45

    
46
/**
47
 * This class create que query in the language suported by the SRW protocol
48
 * 
49
 * 
50
 * @author Jorge Piera Llodra (piera_jor@gva.es)
51
 */
52
public class SRWFilter extends AbstractFilter {
53

    
54
/**
55
 * 
56
 * 
57
 */
58
    public  SRWFilter() {        
59
        super();
60
    } 
61

    
62
/**
63
 * Devuelve un query en el lenguaje que soporte el protocolo SRW
64
 * 
65
 * 
66
 * @param query 
67
 * @return String : query en el lenguaje soportado
68
 * @param profile 
69
 */
70
    public String getQuery(es.gva.cit.catalog.querys.CatalogQuery query) {        
71
        String pregunta = null;
72
        // Construimos una RemoteBooleanQuery
73
        CommonQueryLanguage filter = new CommonQueryLanguage();
74
        
75
        if (query.getTitle() != null) {
76
            filter.addClauses("dc.title", query.getTitle(), query.getTitleFilter(),"And");
77
        }
78
        
79
        if (query.isMinimized()){
80
                if (query.getAbstract() != null) {
81
                        filter.addClauses("dc.subject", query.getAbstract(), "E", "Or");
82
                }
83
        }else{
84
                if (query.getAbstract() != null) {
85
                        filter.addClauses("dc.subject", query.getAbstract(), "E", "And");
86
                }
87
                
88
                if (query.getProvider() != null) {
89
                filter.addClauses("dc.creator", query.getProvider(), "E","And");
90
            }
91
        }                
92
                
93
        //if (this.getThemeKey() != null) 
94
        //query.addClauses("", this.getThemeKey(),"Y");
95
        //if (this.getScale() != null) 
96
        //query.addClauses("map_scale", this.getScale(),"E");
97
        
98
        //if (this.getDateFrom() != null) 
99
        //query.addClauses("2072", "210", "4",this.getDateFrom(),"E");
100
        //if (this.getDateTo() != null) 
101
        //query.addClauses("2073", "210", "2",this.getDateTo(),"E");
102
        pregunta = filter.toString();
103
        System.out.println(pregunta);
104
        return pregunta;
105
    } 
106
 }