Subversion Repositories eFlore/Applications.coel

Rev

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

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