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