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