Subversion Repositories eFlore/Applications.del

Rev

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

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