Subversion Repositories eFlore/Applications.del

Rev

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

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