Subversion Repositories eFlore/Applications.del

Rev

Rev 2139 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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