Subversion Repositories eFlore/Applications.del

Rev

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

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