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