Rev 1892 | Blame | Compare with Previous | Last modification | View Log | RSS feed
package org.tela_botanica.del.client.modeles;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import com.google.gwt.user.client.Window;
public class PropositionDetermination extends InterventionForum implements Serializable {
private static final long serialVersionUID = 840032625524143547L;
private String id, espece, commentaire, numNomenclatural, referentiel, valideePar, dateValidation;
private int nbCommentaires = 0;
/** Doit valoir 1 s'il y a un commentaire initial, sinon 0 */
private int commentaireInitial = 0;
private boolean estPropositionInitiale = false;
public boolean estPropositionInitiale() {
return estPropositionInitiale;
}
public void setEstPropositionInitiale(boolean estPropositionInitiale) {
this.estPropositionInitiale = estPropositionInitiale;
}
private Map<String, VoteDetermination> votesDeterminations = new HashMap<String, VoteDetermination>();
private Observation observation;
public PropositionDetermination(String id, Contributeur contributeur, String texte) {
setId(id);
setContributeur(contributeur);
setCommentaire(texte);
}
public PropositionDetermination(Observation observation) {
this.observation = observation;
}
protected void additionnerCommentaireInitial() {
if (this.commentaire != null && !this.commentaire.equals("")) {
commentaireInitial = 1;
} else {
commentaireInitial = 0;
}
}
public boolean estPropositionRetenue() {
return (this.espece.equals(this.observation.getNomRetenu()));
}
public void ajouterVoteDetermination(VoteDetermination vd) {
votesDeterminations.put(vd.getContributeur(), vd);
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getEspece() {
return espece;
}
public void setEspece(String espece) {
this.espece = espece;
}
public Map<String, VoteDetermination> getVotesDeterminations() {
return votesDeterminations;
}
public void setVotesDeterminations(Map<String, VoteDetermination> votesDeterminations) {
this.votesDeterminations = votesDeterminations;
}
public boolean utilisateurAVotePourDetermination(String idContributeur) {
return votesDeterminations.containsKey(idContributeur);
}
public Observation getObservation() {
return observation;
}
public void setObservation(Observation observation) {
this.observation = observation;
}
public void setCommentaire(String commentaire) {
this.commentaire = commentaire;
additionnerCommentaireInitial();
}
public String getCommentaire() {
return commentaire;
}
public void setNbCommentaires(int nbCommentaires) {
this.nbCommentaires = nbCommentaires;
}
public int getTotalCommentaires() {
if (nbCommentaires == 0 && this.listeCommentaires.size() != 0) {
// wtf ?
nbCommentaires = super.getTotalCommentaires();
}
return nbCommentaires + commentaireInitial;
}
public String getNumNomenclatural() {
return numNomenclatural;
}
public void setNumNomenclatural(String numNomenclatural) {
this.numNomenclatural = numNomenclatural;
}
public String getReferentiel() {
return referentiel;
}
public void setReferentiel(String referentiel) {
this.referentiel = referentiel;
}
public String getValideePar() {
return valideePar;
}
public void setValideePar(String idUtilisateur) {
valideePar = idUtilisateur;
}
public void setDateValidation(String dateValidation) {
this.dateValidation = dateValidation;
}
public String getDateValidation() {
return dateValidation;
}
}