Subversion Repositories eFlore/Applications.del

Rev

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

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