Subversion Repositories eFlore/Applications.del

Rev

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

Rev 1995 Rev 2050
1
package org.tela_botanica.del.client.modeles;
1
package org.tela_botanica.del.client.modeles;
2
 
2
 
3
import java.io.Serializable;
3
import java.io.Serializable;
4
import java.util.ArrayList;
4
import java.util.ArrayList;
5
import java.util.Iterator;
5
import java.util.Iterator;
6
import java.util.List;
6
import java.util.List;
-
 
7
import java.util.Map;
7
 
8
 
8
public class Observation implements Serializable {
9
public class Observation implements Serializable {
9
 
10
 
10
	private static final long serialVersionUID = 840032625524143547L;
11
	private static final long serialVersionUID = 840032625524143547L;
11
	private String id, auteur, idAuteur, nomAuteur, prenomAuteur, courrielAuteur, nomRetenu, famille, localite, idLocalite, 
12
	private String id, auteur, idAuteur, nomAuteur, prenomAuteur, courrielAuteur, nomRetenu, famille, localite, idLocalite, 
12
					dateTransmission, numNomenclatural, nomCommun, lieuDit, 
13
					dateTransmission, numNomenclatural, nomCommun, lieuDit, 
13
					milieu, commentaire, dateReleve, station, referentiel, pays;
14
					milieu, commentaire, dateReleve, station, referentiel, pays;
14
 
15
 
15
	private List<String> motsClefs = new ArrayList<String>();
16
	private List<String> motsClefs = new ArrayList<String>();
-
 
17
	private List<String> evenements = new ArrayList<String>();
16
 
18
 
17
	// les propositions sont une liste ordonnée qui contient soit des
19
	// les propositions sont une liste ordonnée qui contient soit des
18
	// proposition de determinations, soit des commentaires
20
	// proposition de determinations, soit des commentaires
19
	private List<InterventionForum> propositions = new ArrayList<InterventionForum>();
21
	private List<InterventionForum> propositions = new ArrayList<InterventionForum>();
20
	private List<Image> images = new ArrayList<Image>();
22
	private List<Image> images = new ArrayList<Image>();
21
	private String nbCommentaires;
23
	private String nbCommentaires;
22
 
24
 
23
	public String getAuteur() {
25
	public String getAuteur() {
24
		return auteur;
26
		return auteur;
25
	}
27
	}
26
 
28
 
27
	public void setAuteur(String auteur) {
29
	public void setAuteur(String auteur) {
28
		this.auteur = auteur;
30
		this.auteur = auteur;
29
	}
31
	}
30
 
32
 
31
	public String getNomRetenu() {
33
	public String getNomRetenu() {
32
		return nomRetenu;
34
		return nomRetenu;
33
	}
35
	}
34
 
36
 
35
	public void setNomRetenu(String commonName) {
37
	public void setNomRetenu(String commonName) {
36
		this.nomRetenu = commonName;
38
		this.nomRetenu = commonName;
37
	}
39
	}
38
 
40
 
39
	public String getNomCommun() {
41
	public String getNomCommun() {
40
		return nomCommun;
42
		return nomCommun;
41
	}
43
	}
42
 
44
 
43
	public void setNomCommun(String nomCommun) {
45
	public void setNomCommun(String nomCommun) {
44
		this.nomCommun = nomCommun;
46
		this.nomCommun = nomCommun;
45
	}
47
	}
46
 
48
 
47
	public String getStation() {
49
	public String getStation() {
48
		return this.station;
50
		return this.station;
49
	}
51
	}
50
	
52
	
51
	public void setStation(String station) {
53
	public void setStation(String station) {
52
		this.station = station;
54
		this.station = station;
53
	}
55
	}
54
	
56
	
55
	public String getLieuDit() {
57
	public String getLieuDit() {
56
		return this.lieuDit;
58
		return this.lieuDit;
57
	}
59
	}
58
 
60
 
59
	public void setLieuDit(String lieuDit) {
61
	public void setLieuDit(String lieuDit) {
60
		this.lieuDit = lieuDit;
62
		this.lieuDit = lieuDit;
61
	}
63
	}
62
 
64
 
63
	public String getMilieu() {
65
	public String getMilieu() {
64
		return milieu;
66
		return milieu;
65
	}
67
	}
66
 
68
 
67
	public void setMilieu(String milieu) {
69
	public void setMilieu(String milieu) {
68
		this.milieu = milieu;
70
		this.milieu = milieu;
69
	}
71
	}
70
 
72
 
71
	public String getCommentaire() {
73
	public String getCommentaire() {
72
		return commentaire;
74
		return commentaire;
73
	}
75
	}
74
 
76
 
75
	public void setCommentaire(String commentaire) {
77
	public void setCommentaire(String commentaire) {
76
		this.commentaire = commentaire;
78
		this.commentaire = commentaire;
77
	}
79
	}
78
 
80
 
79
	public String getFamille() {
81
	public String getFamille() {
80
		return famille;
82
		return famille;
81
	}
83
	}
82
 
84
 
83
	public void setFamille(String famille) {
85
	public void setFamille(String famille) {
84
		this.famille = famille;
86
		this.famille = famille;
85
	}
87
	}
86
 
88
 
87
	public String getIdLocalite() {
89
	public String getIdLocalite() {
88
		return idLocalite;
90
		return idLocalite;
89
	}
91
	}
90
 
92
 
91
	public void setIdLocalite(String idlocalite) {
93
	public void setIdLocalite(String idlocalite) {
92
		this.idLocalite = idlocalite;
94
		this.idLocalite = idlocalite;
93
	}
95
	}
94
 
96
 
95
	public String getLocalite() {
97
	public String getLocalite() {
96
		return localite;
98
		return localite;
97
	}
99
	}
98
 
100
 
99
	public String getLocaliteAvecIdFormatee() {
101
	public String getLocaliteAvecIdFormatee() {
100
		String localiteFormatee = this.localite;
102
		String localiteFormatee = this.localite;
101
		if (idLocalite != null && idLocalite.length() >= 5 && idLocalite.substring(0, 5).equals("INSEE")) {
103
		if (idLocalite != null && idLocalite.length() >= 5 && idLocalite.substring(0, 5).equals("INSEE")) {
102
			String[] tableaulocalite = idLocalite.split(":");
104
			String[] tableaulocalite = idLocalite.split(":");
103
			String idLocaliteFormatee = (tableaulocalite.length == 2) ? tableaulocalite[1] : localiteFormatee;
105
			String idLocaliteFormatee = (tableaulocalite.length == 2) ? tableaulocalite[1] : localiteFormatee;
104
			localiteFormatee += " (" + idLocaliteFormatee + ")";
106
			localiteFormatee += " (" + idLocaliteFormatee + ")";
105
		} else if (idLocalite != null && idLocalite.length() >= 2) {
107
		} else if (idLocalite != null && idLocalite.length() >= 2) {
106
			localiteFormatee += " (" + idLocalite.substring(0, 2) + ")";
108
			localiteFormatee += " (" + idLocalite.substring(0, 2) + ")";
107
		}
109
		}
108
 
110
 
109
		return localiteFormatee;
111
		return localiteFormatee;
110
	}
112
	}
111
 
113
 
112
	public void setLocalite(String localite) {
114
	public void setLocalite(String localite) {
113
		this.localite = localite;
115
		this.localite = localite;
114
	}
116
	}
115
 
117
 
116
	public String getDateTransmission() {
118
	public String getDateTransmission() {
117
		return dateTransmission;
119
		return dateTransmission;
118
	}
120
	}
119
 
121
 
120
	public void setDateTransmission(String date) {
122
	public void setDateTransmission(String date) {
121
		this.dateTransmission = date;
123
		this.dateTransmission = date;
122
	}
124
	}
123
 
125
 
124
	public String getDateReleve() {
126
	public String getDateReleve() {
125
		return dateReleve;
127
		return dateReleve;
126
	}
128
	}
127
 
129
 
128
	public void setDateReleve(String dateReleve) {
130
	public void setDateReleve(String dateReleve) {
129
		this.dateReleve = dateReleve;
131
		this.dateReleve = dateReleve;
130
	}
132
	}
131
 
133
 
132
	public String getNumNomenclatural() {
134
	public String getNumNomenclatural() {
133
		return numNomenclatural;
135
		return numNomenclatural;
134
	}
136
	}
135
 
137
 
136
	public void setNumNomenclatural(String numNomenclatural) {
138
	public void setNumNomenclatural(String numNomenclatural) {
137
		this.numNomenclatural = numNomenclatural;
139
		this.numNomenclatural = numNomenclatural;
138
	}
140
	}
139
 
141
 
140
	public List<InterventionForum> getInterventionsForum() {
142
	public List<InterventionForum> getInterventionsForum() {
141
		return propositions;
143
		return propositions;
142
	}
144
	}
143
 
145
 
144
	public void setInterventionsForum(List<InterventionForum> propositions) {
146
	public void setInterventionsForum(List<InterventionForum> propositions) {
145
		this.propositions = propositions;
147
		this.propositions = propositions;
146
	}
148
	}
147
 
149
 
148
	public List<String> getMotsClefs() {
150
	public List<String> getMotsClefs() {
149
		return motsClefs;
151
		return motsClefs;
150
	}
152
	}
151
 
153
 
152
	public void setMotsClefs(List<String> motsClefs) {
154
	public void setMotsClefs(List<String> motsClefs) {
153
		this.motsClefs = motsClefs;
155
		this.motsClefs = motsClefs;
154
	}
156
	}
155
 
157
 
156
	public void ajouterMotsClef(String motsClefs) {
158
	public void ajouterMotsClef(String motsClefs) {
157
		if (this.motsClefs == null) {
159
		if (this.motsClefs == null) {
158
			this.motsClefs = new ArrayList<String>();
160
			this.motsClefs = new ArrayList<String>();
159
		}
161
		}
160
		this.motsClefs.add(motsClefs);
162
		this.motsClefs.add(motsClefs);
161
	}
163
	}
162
 
164
 
163
	public void ajouterPropositionDetermination(PropositionDetermination observationValidation) {
165
	public void ajouterPropositionDetermination(PropositionDetermination observationValidation) {
164
		propositions.add(observationValidation);
166
		propositions.add(observationValidation);
165
	}
167
	}
166
 
168
 
167
	public ArrayList<String> getPropositionsTaxonsData() {
169
	public ArrayList<String> getPropositionsTaxonsData() {
168
 
170
 
169
		ArrayList<String> propositionsTaxonDatas = new ArrayList<String>();
171
		ArrayList<String> propositionsTaxonDatas = new ArrayList<String>();
170
		for (InterventionForum proposition : propositions) {
172
		for (InterventionForum proposition : propositions) {
171
			if (proposition instanceof PropositionDetermination) {
173
			if (proposition instanceof PropositionDetermination) {
172
				String espece = ((PropositionDetermination) proposition).getEspece();
174
				String espece = ((PropositionDetermination) proposition).getEspece();
173
				if (espece != "" && !propositionsTaxonDatas.contains(espece)) {
175
				if (espece != "" && !propositionsTaxonDatas.contains(espece)) {
174
					propositionsTaxonDatas.add(espece);
176
					propositionsTaxonDatas.add(espece);
175
				}
177
				}
176
			}
178
			}
177
		}
179
		}
178
 
180
 
179
		return propositionsTaxonDatas;
181
		return propositionsTaxonDatas;
180
	}
182
	}
181
 
183
 
182
	public List<PropositionDetermination> getPropositionDeterminations() {
184
	public List<PropositionDetermination> getPropositionDeterminations() {
183
		List<PropositionDetermination> determinations = new ArrayList<PropositionDetermination>();
185
		List<PropositionDetermination> determinations = new ArrayList<PropositionDetermination>();
184
		for (InterventionForum proposition : getInterventionsForum()) {
186
		for (InterventionForum proposition : getInterventionsForum()) {
185
			if (proposition instanceof PropositionDetermination) {
187
			if (proposition instanceof PropositionDetermination) {
186
				determinations.add((PropositionDetermination) proposition);
188
				determinations.add((PropositionDetermination) proposition);
187
			}
189
			}
188
		}
190
		}
189
		return determinations;
191
		return determinations;
190
	}
192
	}
191
	
193
	
192
	public List<Commentaire> getCommentairesForum() {
194
	public List<Commentaire> getCommentairesForum() {
193
		List<Commentaire> commentaires = new ArrayList<Commentaire>();
195
		List<Commentaire> commentaires = new ArrayList<Commentaire>();
194
		for (InterventionForum proposition : getInterventionsForum()) {
196
		for (InterventionForum proposition : getInterventionsForum()) {
195
			if (proposition instanceof Commentaire) {
197
			if (proposition instanceof Commentaire) {
196
				commentaires.add((Commentaire) proposition);
198
				commentaires.add((Commentaire) proposition);
197
			}
199
			}
198
		}
200
		}
199
		return commentaires;
201
		return commentaires;
200
	}
202
	}
201
		
203
		
202
	public void supprimerIntervention(InterventionForum intervention) {
204
	public void supprimerIntervention(InterventionForum intervention) {
203
		if(propositions.contains(intervention)) {
205
		if(propositions.contains(intervention)) {
204
			propositions.remove(intervention);
206
			propositions.remove(intervention);
205
		} else {
207
		} else {
206
			for (Iterator<InterventionForum> iterator = propositions.iterator(); iterator.hasNext();) {
208
			for (Iterator<InterventionForum> iterator = propositions.iterator(); iterator.hasNext();) {
207
				iterator.next().supprimerIntervention(intervention);
209
				iterator.next().supprimerIntervention(intervention);
208
			}
210
			}
209
		}
211
		}
210
	}
212
	}
211
 
213
 
212
	public List<Image> getImages() {
214
	public List<Image> getImages() {
213
		return images;
215
		return images;
214
	}
216
	}
215
 
217
 
216
	public void setImages(List<Image> images) {
218
	public void setImages(List<Image> images) {
217
		this.images = images;
219
		this.images = images;
218
	}
220
	}
219
 
221
 
220
	public String getId() {
222
	public String getId() {
221
		return id;
223
		return id;
222
	}
224
	}
223
 
225
 
224
	public void setId(String id) {
226
	public void setId(String id) {
225
		this.id = id;
227
		this.id = id;
226
	}
228
	}
227
	
229
	
228
	public void setIdAuteur(String idAuteur) {
230
	public void setIdAuteur(String idAuteur) {
229
		this.idAuteur = idAuteur;
231
		this.idAuteur = idAuteur;
230
	}
232
	}
231
 
233
 
232
	public String getIdAuteur() {
234
	public String getIdAuteur() {
233
		return idAuteur;
235
		return idAuteur;
234
	}
236
	}
235
	
237
	
236
	public String getNomAuteur() {
238
	public String getNomAuteur() {
237
		return nomAuteur;
239
		return nomAuteur;
238
	}
240
	}
239
 
241
 
240
	public void setNomAuteur(String nomAuteur) {
242
	public void setNomAuteur(String nomAuteur) {
241
		this.nomAuteur = nomAuteur;
243
		this.nomAuteur = nomAuteur;
242
	}
244
	}
243
 
245
 
244
	public String getPrenomAuteur() {
246
	public String getPrenomAuteur() {
245
		return prenomAuteur;
247
		return prenomAuteur;
246
	}
248
	}
247
 
249
 
248
	public void setPrenomAuteur(String prenomAuteur) {
250
	public void setPrenomAuteur(String prenomAuteur) {
249
		this.prenomAuteur = prenomAuteur;
251
		this.prenomAuteur = prenomAuteur;
250
	}
252
	}
251
 
253
 
252
	public String getCourrielAuteur() {
254
	public String getCourrielAuteur() {
253
		return courrielAuteur;
255
		return courrielAuteur;
254
	}
256
	}
255
 
257
 
256
	public void setCourrielAuteur(String courrielAuteur) {
258
	public void setCourrielAuteur(String courrielAuteur) {
257
		this.courrielAuteur = courrielAuteur;
259
		this.courrielAuteur = courrielAuteur;
258
	}
260
	}
259
	
261
	
260
	public boolean estADeterminer() {
262
	public boolean estADeterminer() {
261
		return nomRetenu == null || nomRetenu.isEmpty() || nomRetenu.equals("0") || motsClefs.contains("aDeterminer");
263
		return nomRetenu == null || nomRetenu.isEmpty() || nomRetenu.equals("0") || motsClefs.contains("aDeterminer");
262
	}
264
	}
263
	
265
	
264
	public String getReferentiel() {
266
	public String getReferentiel() {
265
		String refFmt = "";
267
		String refFmt = "";
266
		// on ne renvoie que le code du référentiel, sans version, et seulement également si l'on possède
268
		// on ne renvoie que le code du référentiel, sans version, et seulement également si l'on possède
267
		// un numéro nomenclatural associé (ce qui nous assure une certaine cohérence)
269
		// un numéro nomenclatural associé (ce qui nous assure une certaine cohérence)
268
		if(referentiel.length() >= 3  && numNomenclatural != null && !numNomenclatural.equals("0")) {
270
		if(referentiel.length() >= 3  && numNomenclatural != null && !numNomenclatural.equals("0")) {
269
			int positionDeuxPoints = referentiel.indexOf(':');
271
			int positionDeuxPoints = referentiel.indexOf(':');
270
			if (positionDeuxPoints == -1) {
272
			if (positionDeuxPoints == -1) {
271
				refFmt = referentiel;
273
				refFmt = referentiel;
272
			} else {
274
			} else {
273
				refFmt = referentiel.substring(0, positionDeuxPoints);
275
				refFmt = referentiel.substring(0, positionDeuxPoints);
274
			}
276
			}
275
		}
277
		}
276
		return refFmt;
278
		return refFmt;
277
	}
279
	}
278
	
280
	
279
	public void setReferentiel(String referentiel) {
281
	public void setReferentiel(String referentiel) {
280
		this.referentiel = referentiel;
282
		this.referentiel = referentiel;
281
	}
283
	}
282
	
284
	
283
	public String getNomRetenuFormateReferentiel() {
285
	public String getNomRetenuFormateReferentiel() {
284
		String nomRetenuFmt = "";
286
		String nomRetenuFmt = "";
285
		if(nomRetenu != null && !nomRetenu.equals("")) {
287
		if(nomRetenu != null && !nomRetenu.equals("")) {
286
			nomRetenuFmt += nomRetenu;
288
			nomRetenuFmt += nomRetenu;
287
		}
289
		}
288
		String referentiel = getReferentiel();
290
		String referentiel = getReferentiel();
289
		if(!nomRetenuFmt.equals("") && !referentiel.equals("")) {
291
		if(!nomRetenuFmt.equals("") && !referentiel.equals("")) {
290
			nomRetenuFmt += " ("+referentiel+")";
292
			nomRetenuFmt += " ("+referentiel+")";
291
		}
293
		}
292
		return nomRetenuFmt;
294
		return nomRetenuFmt;
293
	}
295
	}
294
	
296
	
295
	public String getNbCommentaires() {
297
	public String getNbCommentaires() {
296
		return nbCommentaires;
298
		return nbCommentaires;
297
	}
299
	}
298
 
300
 
299
	public void setNbCommentaires(String nbCommentaires) {
301
	public void setNbCommentaires(String nbCommentaires) {
300
		this.nbCommentaires = nbCommentaires;
302
		this.nbCommentaires = nbCommentaires;
301
	}
303
	}
302
	
304
	
303
	public String getPays() {
305
	public String getPays() {
304
		return pays;
306
		return pays;
305
	}
307
	}
306
 
308
 
307
	public void setPays(String pays) {
309
	public void setPays(String pays) {
308
		this.pays = pays;
310
		this.pays = pays;
309
	}
311
	}
-
 
312
	
-
 
313
	public List<String> setEvenementsAssocies(List<String> evenements) {
-
 
314
		return this.evenements = evenements;
-
 
315
	}
-
 
316
	
-
 
317
	public List<String> getEvenementsAssocies() {
-
 
318
		return evenements;
-
 
319
	}
310
}
320
}