Subversion Repositories eFlore/Applications.del

Rev

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

Rev 1409 Rev 1426
1
package org.tela_botanica.del.client.modeles;
1
package org.tela_botanica.del.client.modeles;
2
 
2
 
3
import com.google.gwt.http.client.URL;
3
import com.google.gwt.http.client.URL;
4
 
4
 
5
public class InformationsRecherche {
5
public class InformationsRecherche {
6
 
6
 
7
	private String rechercheLibre;
7
	private String rechercheLibre;
8
 
8
 
9
	private String departement;
9
	private String departement;
10
	
10
	
11
	private String referentiel;
11
	private String referentiel;
12
 
12
 
13
	private String taxon;
13
	private String taxon;
14
 
14
 
15
	private String genre;
15
	private String genre;
-
 
16
 
16
 
17
	// gardé pour ancienne comptabilité
-
 
18
	private String motClef;
-
 
19
	
-
 
20
	// mots clés publics de del
-
 
21
	private String motClefDel;
-
 
22
	
-
 
23
	// mots clés privés du cel
17
	private String motClef;
24
	private String motClefCel;
18
 
25
 
19
	private String date;
26
	private String date;
20
 
27
 
21
	private String commune;
28
	private String commune;
22
 
29
 
23
	private String famille;
30
	private String famille;
24
 
31
 
25
	private String tag;
32
	private String tag;
26
 
33
 
27
	private String auteur;
34
	private String auteur;
28
 
35
 
29
	private String idProtocoleSelectionne = null;
36
	private String idProtocoleSelectionne = null;
30
 
37
 
31
	private ModeTri triParNbVotes = ModeTri.PAS_DE_TRI;
38
	private ModeTri triParNbVotes = ModeTri.PAS_DE_TRI;
32
 
39
 
33
	private ModeTri triParDate = ModeTri.PAS_DE_TRI;
40
	private ModeTri triParDate = ModeTri.PAS_DE_TRI;
34
	
41
	
35
	private ModeTri triParNbTag = ModeTri.PAS_DE_TRI;
42
	private ModeTri triParNbTag = ModeTri.PAS_DE_TRI;
36
 
43
 
37
	public String getRechercheLibre() {
44
	public String getRechercheLibre() {
38
		return rechercheLibre;
45
		return rechercheLibre;
39
	}
46
	}
40
 
47
 
41
	public void setRechercheLibre(String rechercheLibre) {
48
	public void setRechercheLibre(String rechercheLibre) {
42
		if (rechercheLibre != null) {
49
		if (rechercheLibre != null) {
43
			this.rechercheLibre = rechercheLibre;
50
			this.rechercheLibre = rechercheLibre;
44
		}
51
		}
45
	}
52
	}
46
 
53
 
47
	public String getDepartement() {
54
	public String getDepartement() {
48
		return departement;
55
		return departement;
49
	}
56
	}
50
 
57
 
51
	public void setDepartement(String departement) {
58
	public void setDepartement(String departement) {
52
		if (departement != null) {
59
		if (departement != null) {
53
			this.departement = departement;
60
			this.departement = departement;
54
		}
61
		}
55
	}
62
	}
56
	
63
	
57
	public String getReferentiel() {
64
	public String getReferentiel() {
58
		return referentiel;
65
		return referentiel;
59
	}
66
	}
60
 
67
 
61
	public void setReferentiel(String referentiel) {
68
	public void setReferentiel(String referentiel) {
62
		this.referentiel = referentiel;
69
		this.referentiel = referentiel;
63
	}
70
	}
64
 
71
 
65
	public String getTaxon() {
72
	public String getTaxon() {
66
		return taxon;
73
		return taxon;
67
	}
74
	}
68
 
75
 
69
	public void setTaxon(String taxon) {
76
	public void setTaxon(String taxon) {
70
		if (taxon != null) {
77
		if (taxon != null) {
71
			 this.taxon = taxon;
78
			 this.taxon = taxon;
72
		}
79
		}
73
	}
80
	}
74
 
81
 
75
	public String getGenre() {
82
	public String getGenre() {
76
		return genre;
83
		return genre;
77
	}
84
	}
78
 
85
 
79
	public void setGenre(String genre) {
86
	public void setGenre(String genre) {
80
		if (genre != null) {
87
		if (genre != null) {
81
			this.genre = genre;
88
			this.genre = genre;
82
		}
89
		}
83
	}
90
	}
84
 
91
 
85
	public String getMotClef() {
92
	public String getMotClef() {
86
		return motClef;
93
		return motClef;
87
	}
94
	}
88
 
95
 
89
	public void setMotClef(String motClef) {
96
	public void setMotClef(String motClef) {
90
		if (motClef != null) {
97
		if (motClef != null) {
91
			this.motClef = motClef;
98
			this.motClef = motClef;
92
		}
99
		}
93
	}
100
	}
94
 
101
 
95
	public String getDate() {
102
	public String getDate() {
96
		return date;
103
		return date;
97
	}
104
	}
98
 
105
 
99
	public void setDate(String date) {
106
	public void setDate(String date) {
100
		if (date != null) {
107
		if (date != null) {
101
			this.date = date;
108
			this.date = date;
102
		}
109
		}
103
	}
110
	}
104
 
111
 
105
	public String getCommune() {
112
	public String getCommune() {
106
		return commune;
113
		return commune;
107
	}
114
	}
108
 
115
 
109
	public void setCommune(String commune) {
116
	public void setCommune(String commune) {
110
		if (commune != null) {
117
		if (commune != null) {
111
			String[] tableauCommuneDpt = commune.split(" ");
118
			String[] tableauCommuneDpt = commune.split(" ");
112
			if (tableauCommuneDpt.length == 2) {
119
			if (tableauCommuneDpt.length == 2) {
113
				String dpt = tableauCommuneDpt[1].replaceAll("\\(", "").replaceAll("\\)", "");
120
				String dpt = tableauCommuneDpt[1].replaceAll("\\(", "").replaceAll("\\)", "");
114
				setDepartement(dpt);
121
				setDepartement(dpt);
115
				this.commune = tableauCommuneDpt[0];
122
				this.commune = tableauCommuneDpt[0];
116
			} else {
123
			} else {
117
				this.commune = commune;
124
				this.commune = commune;
118
			}
125
			}
119
		}
126
		}
120
	}
127
	}
121
 
128
 
122
	public String getFamille() {
129
	public String getFamille() {
123
		return famille;
130
		return famille;
124
	}
131
	}
125
 
132
 
126
	public void setFamille(String famille) {
133
	public void setFamille(String famille) {
127
		if (famille != null) {
134
		if (famille != null) {
128
			this.famille = famille;
135
			this.famille = famille;
129
		}
136
		}
130
	}
137
	}
131
 
138
 
132
	public String getTag() {
139
	public String getTag() {
133
		return tag;
140
		return tag;
134
	}
141
	}
135
 
142
 
136
	public void setTag(String tag) {
143
	public void setTag(String tag) {
137
		if (tag != null) {
144
		if (tag != null) {
138
			this.tag = tag;
145
			this.tag = tag;
139
		}
146
		}
140
	}
147
	}
141
 
148
 
142
	public String getAuteur() {
149
	public String getAuteur() {
143
		return auteur;
150
		return auteur;
144
	}
151
	}
145
 
152
 
146
	public void setAuteur(String auteur) {
153
	public void setAuteur(String auteur) {
147
		if (auteur != null) {
154
		if (auteur != null) {
148
			this.auteur = auteur;
155
			this.auteur = auteur;
149
		}
156
		}
150
	}
157
	}
151
 
158
 
152
	public ModeTri getTriParNbVotes() {
159
	public ModeTri getTriParNbVotes() {
153
		return triParNbVotes;
160
		return triParNbVotes;
154
	}
161
	}
155
 
162
 
156
	public void setTriParNbVotes(ModeTri triParNbVotes) {
163
	public void setTriParNbVotes(ModeTri triParNbVotes) {
157
		this.triParNbVotes = triParNbVotes;
164
		this.triParNbVotes = triParNbVotes;
158
	}
165
	}
159
 
166
 
160
	public void setIdProtocoleSelectionne(String idProtocoleSelectionne) {
167
	public void setIdProtocoleSelectionne(String idProtocoleSelectionne) {
161
		this.idProtocoleSelectionne = idProtocoleSelectionne;
168
		this.idProtocoleSelectionne = idProtocoleSelectionne;
162
	}
169
	}
163
 
170
 
164
	public String getIdProtocoleSelectionne() {
171
	public String getIdProtocoleSelectionne() {
165
		return idProtocoleSelectionne;
172
		return idProtocoleSelectionne;
166
	}
173
	}
167
 
174
 
168
	public ModeTri getTriParDate() {
175
	public ModeTri getTriParDate() {
169
		return triParDate;
176
		return triParDate;
170
	}
177
	}
171
 
178
 
172
	public void setTriParDate(ModeTri triParDate) {
179
	public void setTriParDate(ModeTri triParDate) {
173
		this.triParDate = triParDate;
180
		this.triParDate = triParDate;
174
	}
181
	}
175
 
182
 
176
	public void setTriParNbTags(ModeTri triParTag) {
183
	public void setTriParNbTags(ModeTri triParTag) {
177
		this.triParNbTag = triParTag;
184
		this.triParNbTag = triParTag;
178
	}
185
	}
179
 
186
 
180
	public String versChaineRequete() {
187
	public String versChaineRequete() {
181
		String chaine = "";
188
		String chaine = "";
182
		chaine += estNonNull(rechercheLibre) ? "&masque=" + URL.encodeQueryString(rechercheLibre) : "";
189
		chaine += estNonNull(rechercheLibre) ? "&masque=" + URL.encodeQueryString(rechercheLibre) : "";
183
		chaine += estNonNull(departement) ? "&masque.departement=" + URL.encodeQueryString(departement) : "";
190
		chaine += estNonNull(departement) ? "&masque.departement=" + URL.encodeQueryString(departement) : "";
184
		chaine += estNonNull(referentiel) && !referentiel.equals("tous") ? "&masque.referentiel=" + URL.encodeQueryString(referentiel) : "";
191
		chaine += estNonNull(referentiel) && !referentiel.equals("tous") ? "&masque.referentiel=" + URL.encodeQueryString(referentiel) : "";
185
		chaine += estNonNull(taxon) ? "&masque.ns=" + URL.encodeQueryString(taxon) : "";
192
		chaine += estNonNull(taxon) ? "&masque.ns=" + URL.encodeQueryString(taxon) : "";
186
		chaine += estNonNull(genre) ? "&masque.genre=" + URL.encodeQueryString(genre) : "";
193
		chaine += estNonNull(genre) ? "&masque.genre=" + URL.encodeQueryString(genre) : "";
187
		chaine += estNonNull(motClef) ? "&masque.tag=" + URL.encodeQueryString(motClef) : "";
194
		chaine += estNonNull(motClef) ? "&masque.tag=" + URL.encodeQueryString(motClef) : "";
-
 
195
		chaine += estNonNull(motClefCel) ? "&masque.tag_cel=" + URL.encodeQueryString(motClefCel) : "";
-
 
196
		chaine += estNonNull(motClefDel) ? "&masque.tag_pictoflora=" + URL.encodeQueryString(motClefDel) : "";
188
		chaine += estNonNull(date) ? "&masque.date=" + URL.encodeQueryString(date) : "";
197
		chaine += estNonNull(date) ? "&masque.date=" + URL.encodeQueryString(date) : "";
189
		chaine += estNonNull(commune) ? "&masque.commune=" + URL.encodeQueryString(commune) : "";
198
		chaine += estNonNull(commune) ? "&masque.commune=" + URL.encodeQueryString(commune) : "";
190
		chaine += estNonNull(famille) ? "&masque.famille=" + URL.encodeQueryString(famille) : "";
199
		chaine += estNonNull(famille) ? "&masque.famille=" + URL.encodeQueryString(famille) : "";
191
		chaine += estNonNull(auteur) ? "&masque.auteur=" + URL.encodeQueryString(auteur) : "";
200
		chaine += estNonNull(auteur) ? "&masque.auteur=" + URL.encodeQueryString(auteur) : "";
192
		
201
		
193
		//TODO: réadapter les web services pour que ceux-ci prennent en compte un tri
202
		//TODO: réadapter les web services pour que ceux-ci prennent en compte un tri
194
		chaine += triParDate != ModeTri.PAS_DE_TRI ? "&tri=date_observation" : "";
203
		chaine += triParDate != ModeTri.PAS_DE_TRI ? "&tri=date_observation" : "";
195
		chaine += triParNbVotes != ModeTri.PAS_DE_TRI ? "&tri=votes" : "";
204
		chaine += triParNbVotes != ModeTri.PAS_DE_TRI ? "&tri=votes" : "";
196
		chaine += triParDate != ModeTri.PAS_DE_TRI ? "&ordre=" + triParDate : "";
205
		chaine += triParDate != ModeTri.PAS_DE_TRI ? "&ordre=" + triParDate : "";
197
		chaine += triParNbVotes != ModeTri.PAS_DE_TRI ? "&ordre=" + triParNbVotes : "";
206
		chaine += triParNbVotes != ModeTri.PAS_DE_TRI ? "&ordre=" + triParNbVotes : "";
198
		chaine += triParNbTag != ModeTri.PAS_DE_TRI ? "&tri=tags" : "";
207
		chaine += triParNbTag != ModeTri.PAS_DE_TRI ? "&tri=tags" : "";
199
		chaine += triParNbTag != ModeTri.PAS_DE_TRI ? "&ordre=" + triParNbTag : "";
208
		chaine += triParNbTag != ModeTri.PAS_DE_TRI ? "&ordre=" + triParNbTag : "";
200
		chaine += estNonNull(idProtocoleSelectionne) ? "&protocole=" + idProtocoleSelectionne : "";
209
		chaine += estNonNull(idProtocoleSelectionne) ? "&protocole=" + idProtocoleSelectionne : "";
201
 
210
 
202
		return chaine;
211
		return chaine;
203
	}
212
	}
204
 
213
 
205
	private boolean estNonNull(String critere) {
214
	private boolean estNonNull(String critere) {
206
		return critere != null && !critere.trim().isEmpty();
215
		return critere != null && !critere.trim().isEmpty();
207
	}
216
	}
-
 
217
 
-
 
218
	public String getMotClefDel() {
-
 
219
		return motClefDel;
-
 
220
	}
-
 
221
 
-
 
222
	public void setMotClefDel(String motClefDel) {
-
 
223
		this.motClefDel = motClefDel;
-
 
224
	}
-
 
225
 
-
 
226
	public String getMotClefCel() {
-
 
227
		return motClefCel;
-
 
228
	}
-
 
229
 
-
 
230
	public void setMotClefCel(String motClefCel) {
-
 
231
		this.motClefCel = motClefCel;
-
 
232
	}
208
}
233
}