Subversion Repositories eFlore/Applications.coel

Rev

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

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