1934 |
aurelien |
1 |
package org.tela_botanica.del.client.modeles;
|
|
|
2 |
|
|
|
3 |
import org.tela_botanica.del.client.config.Config;
|
|
|
4 |
|
|
|
5 |
import com.google.gwt.http.client.URL;
|
|
|
6 |
import com.google.gwt.user.client.Window;
|
|
|
7 |
|
|
|
8 |
public class InformationsRecherche {
|
|
|
9 |
|
|
|
10 |
private String rechercheLibre;
|
|
|
11 |
|
|
|
12 |
private String departement;
|
|
|
13 |
|
|
|
14 |
private String referentiel;
|
|
|
15 |
|
|
|
16 |
private String taxon;
|
|
|
17 |
|
|
|
18 |
private String genre;
|
|
|
19 |
|
|
|
20 |
// gardé pour ancienne comptabilité
|
|
|
21 |
private String motClef;
|
|
|
22 |
|
|
|
23 |
// mots clés publics de del
|
|
|
24 |
private String motClefDel;
|
|
|
25 |
|
|
|
26 |
// mots clés privés du cel
|
|
|
27 |
private String motClefCel;
|
|
|
28 |
|
|
|
29 |
private String date;
|
1986 |
aurelien |
30 |
|
|
|
31 |
private String pays;
|
1934 |
aurelien |
32 |
|
|
|
33 |
private String commune;
|
|
|
34 |
|
|
|
35 |
private String famille;
|
|
|
36 |
|
|
|
37 |
private String tag;
|
|
|
38 |
|
|
|
39 |
private String auteur;
|
|
|
40 |
|
|
|
41 |
private String idProtocoleSelectionne = null;
|
|
|
42 |
|
|
|
43 |
private ModeTri triParMoyenneArithmetique = ModeTri.PAS_DE_TRI;
|
|
|
44 |
|
|
|
45 |
private ModeTri triParDatePublication = ModeTri.PAS_DE_TRI;
|
|
|
46 |
|
|
|
47 |
private ModeTri triParDateObservation = ModeTri.PAS_DE_TRI;
|
|
|
48 |
|
|
|
49 |
private ModeTri triParNbCommentaires = ModeTri.PAS_DE_TRI;
|
|
|
50 |
|
|
|
51 |
private ModeTri triParNbTag = ModeTri.PAS_DE_TRI;
|
|
|
52 |
|
|
|
53 |
private ModeTri triParNbPoints = ModeTri.PAS_DE_TRI;
|
|
|
54 |
|
|
|
55 |
public String getRechercheLibre() {
|
|
|
56 |
return rechercheLibre;
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
public void setRechercheLibre(String rechercheLibre) {
|
|
|
60 |
if (rechercheLibre != null) {
|
|
|
61 |
this.rechercheLibre = rechercheLibre;
|
|
|
62 |
}
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
public String getDepartement() {
|
|
|
66 |
return departement;
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
public void setDepartement(String departement) {
|
|
|
70 |
if (departement != null) {
|
|
|
71 |
this.departement = departement;
|
|
|
72 |
}
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
public String getReferentiel() {
|
|
|
76 |
return referentiel;
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
public void setReferentiel(String referentiel) {
|
|
|
80 |
this.referentiel = referentiel;
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
public String getTaxon() {
|
|
|
84 |
return taxon;
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
public void setTaxon(String taxon) {
|
|
|
88 |
if (taxon != null) {
|
|
|
89 |
this.taxon = taxon;
|
|
|
90 |
}
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
public String getGenre() {
|
|
|
94 |
return genre;
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
public void setGenre(String genre) {
|
|
|
98 |
if (genre != null) {
|
|
|
99 |
this.genre = genre;
|
|
|
100 |
}
|
|
|
101 |
}
|
|
|
102 |
|
|
|
103 |
public String getMotClef() {
|
|
|
104 |
return motClef;
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
public void setMotClef(String motClef) {
|
|
|
108 |
if (motClef != null) {
|
|
|
109 |
this.motClef = motClef;
|
|
|
110 |
}
|
|
|
111 |
}
|
|
|
112 |
|
|
|
113 |
public String getDate() {
|
|
|
114 |
return date;
|
|
|
115 |
}
|
|
|
116 |
|
|
|
117 |
public void setDate(String date) {
|
|
|
118 |
if (date != null) {
|
|
|
119 |
this.date = date;
|
|
|
120 |
}
|
|
|
121 |
}
|
1986 |
aurelien |
122 |
|
|
|
123 |
public String setPays(String pays) {
|
|
|
124 |
return this.pays = pays;
|
|
|
125 |
}
|
1934 |
aurelien |
126 |
|
1986 |
aurelien |
127 |
public String getPays() {
|
|
|
128 |
return pays;
|
|
|
129 |
}
|
|
|
130 |
|
1934 |
aurelien |
131 |
public String getCommune() {
|
|
|
132 |
return commune;
|
|
|
133 |
}
|
|
|
134 |
|
|
|
135 |
public void setCommune(String commune) {
|
|
|
136 |
if (commune != null) {
|
|
|
137 |
String[] tableauCommuneDpt = commune.split(" ");
|
|
|
138 |
if (tableauCommuneDpt.length == 2) {
|
|
|
139 |
String dpt = tableauCommuneDpt[1].replaceAll("\\(", "").replaceAll("\\)", "");
|
|
|
140 |
setDepartement(dpt);
|
|
|
141 |
this.commune = tableauCommuneDpt[0];
|
|
|
142 |
} else {
|
|
|
143 |
this.commune = commune;
|
|
|
144 |
}
|
|
|
145 |
}
|
|
|
146 |
}
|
|
|
147 |
|
|
|
148 |
public String getFamille() {
|
|
|
149 |
return famille;
|
|
|
150 |
}
|
|
|
151 |
|
|
|
152 |
public void setFamille(String famille) {
|
|
|
153 |
if (famille != null) {
|
|
|
154 |
this.famille = famille;
|
|
|
155 |
}
|
|
|
156 |
}
|
|
|
157 |
|
|
|
158 |
public String getTag() {
|
|
|
159 |
return tag;
|
|
|
160 |
}
|
|
|
161 |
|
|
|
162 |
public void setTag(String tag) {
|
|
|
163 |
if (tag != null) {
|
|
|
164 |
this.tag = tag;
|
|
|
165 |
}
|
|
|
166 |
}
|
|
|
167 |
|
|
|
168 |
public String getAuteur() {
|
|
|
169 |
return auteur;
|
|
|
170 |
}
|
|
|
171 |
|
|
|
172 |
public void setAuteur(String auteur) {
|
|
|
173 |
if (auteur != null) {
|
|
|
174 |
this.auteur = auteur;
|
|
|
175 |
}
|
|
|
176 |
}
|
|
|
177 |
|
|
|
178 |
public ModeTri getTriParMoyenneArithmetique() {
|
|
|
179 |
return triParMoyenneArithmetique;
|
|
|
180 |
}
|
|
|
181 |
|
|
|
182 |
public void setTriParMoyenneArithmetique(ModeTri triParMoyenneArithmetique) {
|
|
|
183 |
this.triParMoyenneArithmetique = triParMoyenneArithmetique;
|
|
|
184 |
}
|
|
|
185 |
|
|
|
186 |
public void setIdProtocoleSelectionne(String idProtocoleSelectionne) {
|
|
|
187 |
this.idProtocoleSelectionne = idProtocoleSelectionne;
|
|
|
188 |
}
|
|
|
189 |
|
|
|
190 |
public String getIdProtocoleSelectionne() {
|
|
|
191 |
return idProtocoleSelectionne;
|
|
|
192 |
}
|
|
|
193 |
|
|
|
194 |
public ModeTri getTriParDatePublication() {
|
|
|
195 |
return triParDatePublication;
|
|
|
196 |
}
|
|
|
197 |
|
|
|
198 |
public void setTriParDatePublication(ModeTri triParDatePublication) {
|
|
|
199 |
this.triParDatePublication = triParDatePublication;
|
|
|
200 |
}
|
|
|
201 |
|
|
|
202 |
public ModeTri getTriParDateObservation() {
|
|
|
203 |
return triParDateObservation;
|
|
|
204 |
}
|
|
|
205 |
|
|
|
206 |
public void setTriParDateObservation(ModeTri triParDateObservation) {
|
|
|
207 |
this.triParDateObservation = triParDateObservation;
|
|
|
208 |
}
|
|
|
209 |
|
|
|
210 |
public void setTriParNbTags(ModeTri triParTag) {
|
|
|
211 |
this.triParNbTag = triParTag;
|
|
|
212 |
}
|
|
|
213 |
|
|
|
214 |
public ModeTri getTriParNbPoints() {
|
|
|
215 |
return this.triParNbPoints;
|
|
|
216 |
}
|
|
|
217 |
|
|
|
218 |
public void setTriParNbPoints(ModeTri triParPoints) {
|
|
|
219 |
this.triParNbPoints = triParPoints;
|
|
|
220 |
}
|
|
|
221 |
|
|
|
222 |
public ModeTri getTriParNbTags() {
|
|
|
223 |
return this.triParNbTag;
|
|
|
224 |
}
|
|
|
225 |
|
|
|
226 |
public void setTriParNbCommentaires(ModeTri triParNbCommentaires) {
|
|
|
227 |
this.triParNbCommentaires = triParNbCommentaires;
|
|
|
228 |
}
|
|
|
229 |
|
|
|
230 |
public ModeTri getTriParNbCommentaires() {
|
|
|
231 |
return triParNbCommentaires;
|
|
|
232 |
}
|
|
|
233 |
|
|
|
234 |
public String versChaineRequete() {
|
|
|
235 |
String chaine = "";
|
|
|
236 |
chaine += estNonNull(rechercheLibre) ? "&masque=" + URL.encodeQueryString(rechercheLibre) : "";
|
|
|
237 |
chaine += estNonNull(departement) ? "&masque.departement=" + URL.encodeQueryString(departement) : "";
|
|
|
238 |
chaine += estNonNull(referentiel) && !referentiel.equals("tous") ? "&masque.referentiel=" + URL.encodeQueryString(referentiel) : "";
|
|
|
239 |
chaine += estNonNull(taxon) ? "&masque.ns=" + URL.encodeQueryString(taxon) : "";
|
|
|
240 |
chaine += estNonNull(genre) ? "&masque.genre=" + URL.encodeQueryString(genre) : "";
|
|
|
241 |
chaine += estNonNull(motClef) ? "&masque.tag=" + URL.encodeQueryString(motClef) : "";
|
|
|
242 |
chaine += estNonNull(motClefCel) ? "&masque.tag_cel=" + URL.encodeQueryString(motClefCel) : "";
|
|
|
243 |
chaine += estNonNull(motClefDel) ? "&masque.tag_pictoflora=" + URL.encodeQueryString(motClefDel) : "";
|
|
|
244 |
chaine += estNonNull(date) ? "&masque.date=" + URL.encodeQueryString(date) : "";
|
|
|
245 |
chaine += estNonNull(commune) ? "&masque.commune=" + URL.encodeQueryString(commune) : "";
|
|
|
246 |
chaine += estNonNull(famille) ? "&masque.famille=" + URL.encodeQueryString(famille) : "";
|
|
|
247 |
chaine += estNonNull(auteur) ? "&masque.auteur=" + URL.encodeQueryString(auteur) : "";
|
1986 |
aurelien |
248 |
chaine += estNonNull(pays) ? "&masque.pays=" + URL.encodeQueryString(pays) : "";
|
1934 |
aurelien |
249 |
|
|
|
250 |
String urlCourante = Window.Location.getHref();
|
|
|
251 |
Config config = new Config();
|
|
|
252 |
String urlAppliImg = config.getUrl("pictoflora");
|
|
|
253 |
if (urlCourante.contains(urlAppliImg)) {
|
|
|
254 |
chaine += triParMoyenneArithmetique != ModeTri.PAS_DE_TRI ? "&tri=moyenne-arithmetique" : "";
|
|
|
255 |
chaine += triParMoyenneArithmetique != ModeTri.PAS_DE_TRI ? "&ordre=" + triParMoyenneArithmetique : "";
|
|
|
256 |
chaine += triParNbTag != ModeTri.PAS_DE_TRI ? "&tri=tags" : "";
|
|
|
257 |
chaine += triParNbTag != ModeTri.PAS_DE_TRI ? "&ordre=" + triParNbTag : "";
|
|
|
258 |
chaine += triParNbPoints != ModeTri.PAS_DE_TRI ? "&tri=points" : "";
|
|
|
259 |
chaine += triParNbPoints != ModeTri.PAS_DE_TRI ? "&ordre=" + triParNbPoints : "";
|
|
|
260 |
chaine += estNonNull(idProtocoleSelectionne) ? "&protocole=" + idProtocoleSelectionne : "";
|
|
|
261 |
} else {
|
|
|
262 |
chaine += triParNbCommentaires != ModeTri.PAS_DE_TRI ? "&tri=nb_commentaires" : "";
|
|
|
263 |
chaine += triParNbCommentaires != ModeTri.PAS_DE_TRI ? "&ordre=" + triParNbCommentaires : "";
|
|
|
264 |
}
|
|
|
265 |
|
|
|
266 |
chaine += triParDateObservation != ModeTri.PAS_DE_TRI ? "&tri=date_observation" : "";
|
|
|
267 |
chaine += triParDateObservation != ModeTri.PAS_DE_TRI ? "&ordre=" + triParDateObservation : "";
|
|
|
268 |
chaine += triParDatePublication != ModeTri.PAS_DE_TRI ? "&tri=date_transmission" : "";
|
|
|
269 |
chaine += triParDatePublication != ModeTri.PAS_DE_TRI ? "&ordre=" + triParDatePublication : "";
|
|
|
270 |
|
|
|
271 |
return chaine;
|
|
|
272 |
}
|
|
|
273 |
|
|
|
274 |
private boolean estNonNull(String critere) {
|
|
|
275 |
return critere != null && !critere.trim().isEmpty();
|
|
|
276 |
}
|
|
|
277 |
|
|
|
278 |
public String getMotClefDel() {
|
|
|
279 |
return motClefDel;
|
|
|
280 |
}
|
|
|
281 |
|
|
|
282 |
public void setMotClefDel(String motClefDel) {
|
|
|
283 |
this.motClefDel = motClefDel;
|
|
|
284 |
}
|
|
|
285 |
|
|
|
286 |
public String getMotClefCel() {
|
|
|
287 |
return motClefCel;
|
|
|
288 |
}
|
|
|
289 |
|
|
|
290 |
public void setMotClefCel(String motClefCel) {
|
|
|
291 |
this.motClefCel = motClefCel;
|
|
|
292 |
}
|
|
|
293 |
}
|