Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 984 → Rev 985

/trunk/src/org/tela_botanica/client/modeles/commentaire/Commentaire.java
New file
0,0 → 1,133
package org.tela_botanica.client.modeles.commentaire;
 
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.modeles.aDonnee;
import org.tela_botanica.client.modeles.collection.Collection;
import org.tela_botanica.client.modeles.collection.CollectionACommentaire;
 
import com.google.gwt.json.client.JSONObject;
 
public class Commentaire extends aDonnee {
 
private static final long serialVersionUID = 7216356814682582569L;
private static final String PREFIXE = "ccm";
private Collection collection = null;
private CollectionACommentaire collectionACommentaire = null;
public Commentaire() {
}
public Commentaire(JSONObject commentaire) {
initialiserCommentaire(commentaire, false);
}
 
public Commentaire(JSONObject commentaire, boolean chargerCollectionACommentaire) {
initialiserCommentaire(commentaire, chargerCollectionACommentaire);
}
public void initialiserCommentaire(JSONObject commentaire, boolean chargerCollectionACommentaire) {
initialiserModele(commentaire);
collection = new Collection(commentaire);
if (chargerCollectionACommentaire) {
collectionACommentaire = new CollectionACommentaire(commentaire);
} else {
collectionACommentaire = new CollectionACommentaire();
}
initialiserChampsPourGrille();
}
@Override
protected String getPrefixe() {
return PREFIXE;
}
private void initialiserChampsPourGrille() {
set("_collection_nom_", getCollection().getNom());
set("_type_", getCollectionACommentaire().getType());
set("_titre_", getTitre());
set("_texte_", getTexteResume());
set("_ponderation_", getPonderation());
set("_public_", getPublic());
set("_etat_", "");
}
public Collection getCollection() {
if (collection == null) {
collection = new Collection();
}
return collection;
}
public void setCollection(Collection collectionAStocker) {
collection = collectionAStocker;
}
public CollectionACommentaire getCollectionACommentaire() {
if (collectionACommentaire == null) {
collectionACommentaire = new CollectionACommentaire();
}
return collectionACommentaire;
}
public void setCollectionACommentaire(CollectionACommentaire collectionACommentaireAStocker) {
collectionACommentaire = collectionACommentaireAStocker;
}
public String getId() {
return renvoyerValeurCorrecte("id_commentaire");
}
public void setId(String idCommentaire) {
this.set("id_commentaire", idCommentaire);
}
public String getIdProjet() {
return renvoyerValeurCorrecte("ce_projet");
}
public void setIdProjet(String idProjet) {
this.set("ce_projet", idProjet);
}
public String getCommentairePereId() {
return renvoyerValeurCorrecte("ce_pere");
}
public void setCommentairePereId(String idPere) {
this.set("ce_pere", idPere);
}
public String getTitre() {
return renvoyerValeurCorrecte("titre");
}
public void setTitre(String titre) {
this.set("titre", titre);
}
public String getTexteResume() {
String resume = getTexte();
if (getTexte().length() > 100) {
resume = getTexte().substring(0, 100);
}
return resume;
}
public String getTexte() {
return renvoyerValeurCorrecte("texte");
}
public void setTexte(String texte) {
this.set("texte", texte);
}
public String getPonderation() {
return renvoyerValeurCorrecte("ponderation");
}
public void setPonderation(String ponderation) {
this.set("ponderation", ponderation);
}
public boolean etrePublic() {
return (getPublic().equals("1") ? true : false);
}
public String getPublic() {
return renvoyerValeurCorrecte("public");
}
public void setPublic(String publique) {
this.set("public", publique);
}
}