root / trunk / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / querys / Z3950Query.java @ 2047
History | View | Annotate | Download (3.25 KB)
1 |
/*
|
---|---|
2 |
* Created on 27-abr-2005
|
3 |
*
|
4 |
* TODO To change the template for this generated file go to
|
5 |
* Window - Preferences - Java - Code Style - Code Templates
|
6 |
*/
|
7 |
package es.gva.cit.catalogClient.querys; |
8 |
|
9 |
import es.gva.cit.catalogClient.languages.BasicEncodingRules; |
10 |
|
11 |
/**
|
12 |
* @author Administrador
|
13 |
*
|
14 |
* TODO To change the template for this generated type comment go to
|
15 |
* Window - Preferences - Java - Code Style - Code Templates
|
16 |
*/
|
17 |
|
18 |
public class Z3950Query extends Query implements IQuery { |
19 |
public Z3950Query(Query query){ |
20 |
super(query.getTitle(),
|
21 |
query.getTitleFilter(), |
22 |
query.getAbstract(), |
23 |
query.getThemeKey(), |
24 |
query.getTopic(), |
25 |
query.getScale(), |
26 |
query.getProvider(), |
27 |
query.getDateFrom(), |
28 |
query.getDateTo(), |
29 |
query.getCoordenates(), |
30 |
query.getCoordenatesFilter()); |
31 |
} |
32 |
|
33 |
public String getQuery(){ |
34 |
|
35 |
// Create a RemoteBooleanQuery
|
36 |
BasicEncodingRules query = new BasicEncodingRules();
|
37 |
|
38 |
//Title (title, 4), Word List (6)
|
39 |
if (this.getTitle() != null) |
40 |
query.addClauses("4", "6", "3", this.getTitle(),this.getTitleFilter()); |
41 |
|
42 |
//Abstract (abstract, 62), Word List (6)
|
43 |
if (this.getAbstract() != null) |
44 |
query.addClauses("62", "6", "3", this.getAbstract(),"E"); |
45 |
|
46 |
//Theme Keyword (themekey, 2002), Word List (6)
|
47 |
if (this.getThemeKey() != null) |
48 |
query.addClauses("2002", "6", "3", this.getThemeKey(),"Y"); |
49 |
|
50 |
//Any (any, 1016), Word List (6), Equal(3)
|
51 |
//if (this.getTopic() != null)
|
52 |
//query.addClauses("1016", "6", "3", this.getTopic(),"E");
|
53 |
|
54 |
//Source Scale Denominator (srcscale, 1024), Numeric String (109)
|
55 |
//if (this.getScale() != null)
|
56 |
//query.addClauses("1024", "109", "1", this.getScale(),"E");
|
57 |
|
58 |
//Originator (originator, 1005), Word List (6)
|
59 |
//if (this.getProvider() != null)
|
60 |
//query.addClauses("1005", "6", "3",this.getProvider(),"E");
|
61 |
|
62 |
//Beginning Date (begdate, 2072), Date(210)
|
63 |
//if (this.getDateFrom() != null)
|
64 |
//query.addClauses("2072", "210", "4",formatDate(this.getDateFrom()),"E");
|
65 |
|
66 |
//Ending Date (enddate, 2073), Date(210)
|
67 |
//if (this.getDateTo() != null)
|
68 |
//query.addClauses("2073", "210", "2", formatDate(this.getDateTo()),"E");
|
69 |
|
70 |
if (this.getCoordenates() != null) { |
71 |
String sNorth = this.getCoordenates().getUly(); |
72 |
String sWest = this.getCoordenates().getUlx(); |
73 |
String sSouth = this.getCoordenates().getBry(); |
74 |
String sEast = this.getCoordenates().getBrx(); |
75 |
String sBounding = sNorth + " " + sWest + " " + sSouth + " " + sEast; |
76 |
String sRelation = getRelation(this.getCoordenatesFilter()); |
77 |
|
78 |
// Bounding Coordinates (bounding, 2041), Coordinate String (201)
|
79 |
query.addClauses("2060", "201", sRelation, sBounding, "E"); |
80 |
|
81 |
} |
82 |
|
83 |
//return query
|
84 |
return query.toString();
|
85 |
} |
86 |
|
87 |
/**
|
88 |
* Return a value for the option of the 'Coordenates Filter'
|
89 |
*
|
90 |
* @param relation
|
91 |
* String in the combo. Possible values:
|
92 |
* encloses
|
93 |
* overlaps
|
94 |
* fullyOutsideOf
|
95 |
* equals
|
96 |
* @return String
|
97 |
* Possible values:
|
98 |
* 9 -> encloses
|
99 |
* 7 -> overlaps
|
100 |
* 10 -> fullyOutsideOf
|
101 |
* 3 -> equals
|
102 |
*/
|
103 |
static private String getRelation(String relacion){ |
104 |
if (relacion.equals("igual")) |
105 |
return "3"; |
106 |
|
107 |
if (relacion.equals("contiene")) |
108 |
return "10"; |
109 |
|
110 |
if (relacion.equals("incluye")) |
111 |
return "9"; |
112 |
else
|
113 |
return "7"; |
114 |
|
115 |
|
116 |
} |
117 |
|
118 |
|
119 |
} |