Subversion Repositories eFlore/Applications.del

Rev

Details | Last modification | View Log | RSS feed

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