Subversion Repositories eFlore/Applications.del

Rev

Rev 1128 | Rev 1393 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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