Subversion Repositories eFlore/Applications.del

Rev

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

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