Subversion Repositories eFlore/Applications.del

Rev

Rev 1104 | Rev 1221 | 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;
227 aurelien 4
import java.util.HashMap;
5
import java.util.Map;
9 benjamin 6
 
1209 gduche 7
import com.google.gwt.core.shared.GWT;
1003 benjamin 8
import com.google.gwt.user.client.Window;
9
 
663 benjamin 10
public class PropositionDetermination extends InterventionForum implements Serializable {
9 benjamin 11
 
12
	private static final long serialVersionUID = 840032625524143547L;
1104 gduche 13
	private String id, espece, commentaire, numNomenclatural;
919 aurelien 14
	private int nbCommentaires = 0;
1209 gduche 15
	private boolean estPropositionInitiale = false;
890 gduche 16
 
1209 gduche 17
	public boolean estPropositionInitiale() {
18
 
19
		return estPropositionInitiale;
20
	}
21
 
22
	public void setEstPropositionInitiale(boolean estPropositionInitiale) {
23
 
24
		this.estPropositionInitiale = estPropositionInitiale;
25
	}
26
 
232 gduche 27
	private Map<String, VoteDetermination> votesDeterminations = new HashMap<String, VoteDetermination>();
835 aurelien 28
	private Observation observation;
922 benjamin 29
 
890 gduche 30
	public PropositionDetermination(String id, Contributeur contributeur, String texte) {
31
		setId(id);
32
		setContributeur(contributeur);
911 aurelien 33
		setCommentaire(texte);
890 gduche 34
	}
922 benjamin 35
 
835 aurelien 36
	public PropositionDetermination(Observation observation) {
37
		this.observation = observation;
38
	}
9 benjamin 39
 
1209 gduche 40
	public boolean estPropositionRetenue() {
1051 gduche 41
		return (this.espece.equals(this.observation.getNomRetenu()) && this.getContributeur().getNomComplet().equals(this.observation.getAuteur()));
42
	}
43
 
141 aurelien 44
	public void ajouterVoteDetermination(VoteDetermination vd) {
227 aurelien 45
		votesDeterminations.put(vd.getContributeur(), vd);
9 benjamin 46
	}
47
 
896 aurelien 48
	public String getId() {
49
		return id;
50
	}
51
 
52
	public void setId(String id) {
53
		this.id = id;
54
	}
55
 
90 aurelien 56
	public String getEspece() {
57
		return espece;
58
	}
59
 
60
	public void setEspece(String espece) {
61
		this.espece = espece;
62
	}
147 benjamin 63
 
227 aurelien 64
	public Map<String, VoteDetermination> getVotesDeterminations() {
147 benjamin 65
		return votesDeterminations;
66
	}
67
 
227 aurelien 68
	public void setVotesDeterminations(Map<String, VoteDetermination> votesDeterminations) {
147 benjamin 69
		this.votesDeterminations = votesDeterminations;
70
	}
922 benjamin 71
 
835 aurelien 72
	public boolean utilisateurAVotePourDetermination(String idContributeur) {
73
		return votesDeterminations.containsKey(idContributeur);
74
	}
658 benjamin 75
 
835 aurelien 76
	public Observation getObservation() {
77
		return observation;
78
	}
79
 
80
	public void setObservation(Observation observation) {
81
		this.observation = observation;
82
	}
922 benjamin 83
 
896 aurelien 84
	public void setCommentaire(String commentaire) {
85
		this.commentaire = commentaire;
86
	}
835 aurelien 87
 
907 aurelien 88
	public String getCommentaire() {
896 aurelien 89
		return commentaire;
90
	}
922 benjamin 91
 
919 aurelien 92
	public void setNbCommentaires(int nbCommentaires) {
93
		this.nbCommentaires = nbCommentaires;
94
	}
922 benjamin 95
 
919 aurelien 96
	public int getTotalCommentaires() {
933 aurelien 97
		// le nombre de commentaire peut avoir été renvoyé par le web service
98
		// sans que l'on possède la liste des commentaires elle même, auquel cas, il sera différent de 0
99
		// et ne doit pas être recalculé
100
		if (nbCommentaires == 0 && this.listeCommentaires.size() != 0) {
922 benjamin 101
			nbCommentaires = super.getTotalCommentaires();
102
			if (this.getCommentaire() != null&&this.getCommentaire()!="") {
103
				nbCommentaires += 1;
104
			}
919 aurelien 105
		}
1066 gduche 106
		if (this.commentaire != null && !this.commentaire.equals("")) {
107
			nbCommentaires ++;
108
		}
922 benjamin 109
 
919 aurelien 110
		return nbCommentaires;
111
	}
1104 gduche 112
 
113
	public String getNumNomenclatural() {
114
		return numNomenclatural;
115
	}
116
 
117
	public void setNumNomenclatural(String numNomenclatural) {
118
		this.numNomenclatural = numNomenclatural;
119
	}
9 benjamin 120
}