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