Subversion Repositories eFlore/Applications.coel

Rev

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

Rev Author Line No. Line
985 jpm 1
package org.tela_botanica.client.modeles.commentaire;
2
 
3
import org.tela_botanica.client.Mediateur;
4
import org.tela_botanica.client.modeles.aDonnee;
5
import org.tela_botanica.client.modeles.collection.Collection;
6
import org.tela_botanica.client.modeles.collection.CollectionACommentaire;
7
 
8
import com.google.gwt.json.client.JSONObject;
9
 
10
public class Commentaire extends aDonnee {
11
 
12
	private static final long serialVersionUID = 7216356814682582569L;
13
	private static final String PREFIXE = "ccm";
14
	private Collection collection = null;
15
	private CollectionACommentaire collectionACommentaire = null;
16
 
17
	public Commentaire() {
18
	}
19
 
20
	public Commentaire(JSONObject commentaire) {
21
		initialiserCommentaire(commentaire, false);
22
	}
23
 
24
	public Commentaire(JSONObject commentaire, boolean chargerCollectionACommentaire) {
25
		initialiserCommentaire(commentaire, chargerCollectionACommentaire);
26
	}
27
 
28
	public void initialiserCommentaire(JSONObject commentaire, boolean chargerCollectionACommentaire) {
29
		initialiserModele(commentaire);
30
		collection = new Collection(commentaire);
31
		if (chargerCollectionACommentaire) {
32
			collectionACommentaire = new CollectionACommentaire(commentaire);
33
		} else {
34
			collectionACommentaire = new CollectionACommentaire();
35
		}
36
		initialiserChampsPourGrille();
37
	}
38
 
39
	@Override
40
	protected String getPrefixe() {
41
		return PREFIXE;
42
	}
43
 
44
	private void initialiserChampsPourGrille() {
45
		set("_collection_nom_", getCollection().getNom());
46
		set("_type_", getCollectionACommentaire().getType());
47
		set("_titre_", getTitre());
48
		set("_texte_", getTexteResume());
49
		set("_ponderation_", getPonderation());
50
		set("_public_", getPublic());
51
		set("_etat_", "");
52
	}
53
 
54
	public Collection getCollection() {
55
		if (collection == null) {
56
			collection = new Collection();
57
		}
58
		return collection;
59
	}
60
	public void setCollection(Collection collectionAStocker) {
61
		collection = collectionAStocker;
62
	}
63
 
64
	public CollectionACommentaire getCollectionACommentaire() {
65
		if (collectionACommentaire == null) {
66
			collectionACommentaire = new CollectionACommentaire();
67
		}
68
		return collectionACommentaire;
69
	}
70
	public void setCollectionACommentaire(CollectionACommentaire collectionACommentaireAStocker) {
71
		collectionACommentaire = collectionACommentaireAStocker;
72
	}
73
 
74
	public String getId() {
75
		return renvoyerValeurCorrecte("id_commentaire");
76
	}
77
	public void setId(String idCommentaire) {
78
		this.set("id_commentaire", idCommentaire);
79
	}
80
 
81
	public String getIdProjet() {
82
		return renvoyerValeurCorrecte("ce_projet");
83
	}
84
	public void setIdProjet(String idProjet) {
85
		this.set("ce_projet", idProjet);
86
	}
87
 
88
	public String getCommentairePereId() {
89
		return renvoyerValeurCorrecte("ce_pere");
90
	}
91
	public void setCommentairePereId(String idPere) {
92
		this.set("ce_pere", idPere);
93
	}
94
 
95
	public String getTitre() {
96
		return renvoyerValeurCorrecte("titre");
97
	}
98
	public void setTitre(String titre) {
99
		this.set("titre", titre);
100
	}
101
 
102
	public String getTexteResume() {
103
		String resume = getTexte();
104
		if (getTexte().length() > 100) {
105
			resume = getTexte().substring(0, 100);
106
		}
107
		return resume;
108
	}
109
	public String getTexte() {
110
		return renvoyerValeurCorrecte("texte");
111
	}
112
	public void setTexte(String texte) {
113
		this.set("texte", texte);
114
	}
115
 
116
	public String getPonderation() {
117
		return renvoyerValeurCorrecte("ponderation");
118
	}
119
	public void setPonderation(String ponderation) {
120
		this.set("ponderation", ponderation);
121
	}
122
 
123
	public boolean etrePublic() {
124
		return (getPublic().equals("1") ? true : false);
125
	}
126
	public String getPublic() {
989 jpm 127
		return renvoyerValeurCorrecte("mark_public");
985 jpm 128
	}
129
	public void setPublic(String publique) {
989 jpm 130
		this.set("mark_public", publique);
985 jpm 131
	}
132
 
133
}