Subversion Repositories eFlore/Applications.del

Rev

Rev 2050 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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