Subversion Repositories eFlore/Applications.del

Rev

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

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