Subversion Repositories eFlore/Applications.del

Rev

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

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