Subversion Repositories eFlore/Applications.del

Rev

Rev 1986 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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