Subversion Repositories eFlore/Applications.del

Rev

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

Rev Author Line No. Line
658 benjamin 1
package org.tela_botanica.del.client.modeles;
2
 
663 benjamin 3
import java.util.ArrayList;
658 benjamin 4
import java.util.Date;
918 aurelien 5
import java.util.Iterator;
663 benjamin 6
import java.util.List;
881 aurelien 7
public class InterventionForum {
690 gduche 8
 
9
	private Contributeur contributeur;
658 benjamin 10
	private Date date;
890 gduche 11
	private String id, idParent;
881 aurelien 12
	private InterventionForum parent;
13
	private Observation observation;
663 benjamin 14
	public List<Commentaire> listeCommentaires = new ArrayList<Commentaire>();
683 gduche 15
 
881 aurelien 16
	public void setId(String id) {
17
		this.id = id;
18
	}
19
 
20
	public String getId() {
21
		return id;
22
	}
23
 
890 gduche 24
	public String getIdParent() {
25
		return idParent;
26
	}
27
 
28
	public void setIdParent(String idParent) {
29
		this.idParent = idParent;
30
	}
31
 
881 aurelien 32
	public void setParent(InterventionForum parent) {
33
		this.parent = parent;
34
	}
35
 
893 gduche 36
	public boolean estFils() {
37
		return (this.parent != null);
38
	}
39
 
881 aurelien 40
	public InterventionForum getParent() {
41
		return parent;
42
	}
43
 
44
	public void setObservation(Observation observation) {
45
		this.observation = observation;
46
	}
47
 
48
	public Observation getObservation() {
49
		return observation;
50
	}
51
 
658 benjamin 52
	public String getAuteur() {
690 gduche 53
		return contributeur.getNomComplet();
658 benjamin 54
	}
683 gduche 55
 
690 gduche 56
	public void setContributeur(Contributeur contributeur) {
57
		this.contributeur = contributeur;
658 benjamin 58
	}
690 gduche 59
 
60
	public Contributeur getContributeur() {
61
		return contributeur;
683 gduche 62
	}
63
 
658 benjamin 64
	public Date getDate() {
65
		return date;
66
	}
683 gduche 67
 
658 benjamin 68
	public void setDate(Date date) {
69
		this.date = date;
70
	}
683 gduche 71
 
663 benjamin 72
	public List<Commentaire> getListeCommentaires() {
73
		return listeCommentaires;
74
	}
658 benjamin 75
 
663 benjamin 76
	public void setListeCommentaires(List<Commentaire> listeCommentaires) {
77
		this.listeCommentaires = listeCommentaires;
78
	}
79
 
80
	public void ajouterCommentaire(Commentaire commentaire) {
81
		listeCommentaires.add(commentaire);
82
	}
887 aurelien 83
 
84
	public PropositionDetermination getPropositionParenteOuNulle() {
85
		InterventionForum parent = getParent();
86
		PropositionDetermination proposition = null;
87
		while(parent != null && !(parent instanceof PropositionDetermination)) {
88
			parent = parent.getParent();
89
		}
90
		if(parent != null) {
91
			proposition = (PropositionDetermination)parent;
92
		}
93
		return proposition;
94
	}
918 aurelien 95
 
96
	public int getTotalCommentaires() {
97
		int nbCommentaires = 0;
98
		for (Iterator<Commentaire> iterator = listeCommentaires.iterator(); iterator.hasNext();) {
99
			nbCommentaires++;
100
			Commentaire commentaire = (Commentaire) iterator.next();
101
			nbCommentaires += commentaire.getTotalCommentaires();
102
		}
103
 
104
		return nbCommentaires;
105
	}
658 benjamin 106
}