New file |
0,0 → 1,110 |
package org.tela_botanica.client.modeles.collection; |
|
import org.tela_botanica.client.modeles.aDonnee; |
import org.tela_botanica.client.modeles.commentaire.Commentaire; |
|
import com.google.gwt.json.client.JSONObject; |
|
public class CollectionACommentaire extends aDonnee { |
|
private static final long serialVersionUID = 8751553802444398035L; |
public static final String PREFIXE = "ccac"; |
private Commentaire commentaireLiee = null; |
public static String[] champsObligatoires = {"cc_id_collection", "ccac_id_commentaire"}; |
|
public CollectionACommentaire() { |
initialiser(new JSONObject(), false); |
} |
|
public CollectionACommentaire(JSONObject collectionACommentaireListe) { |
initialiser(collectionACommentaireListe, true); |
} |
|
public CollectionACommentaire(JSONObject collectionACommentaireListe, boolean chargerCommentaire) { |
initialiser(collectionACommentaireListe, chargerCommentaire); |
} |
|
@Override |
protected String getPrefixe() { |
return PREFIXE; |
} |
|
protected String[] getChampsObligatoires() { |
return champsObligatoires; |
} |
|
private void initialiser(JSONObject collectionACommentaireListe, boolean chargerCommentaire) { |
if (chargerCommentaire) { |
setCommentaire(new Commentaire(collectionACommentaireListe, false)); |
} else { |
setCommentaire(new Commentaire()); |
} |
initialiserModele(collectionACommentaireListe); |
initialiserChampsPourGrille(); |
} |
|
// COMMENTAIRE |
public Commentaire getCommentaire() { |
return commentaireLiee; |
} |
public void setCommentaire(Commentaire commentaire) { |
commentaireLiee = commentaire; |
initialiserChampsPourGrille(); |
if (commentaire != null) { |
setIdCommentaire(commentaire.getId()); |
} |
} |
|
private void initialiserChampsPourGrille() { |
set("_type_", getType()); |
set("_titre_", getCommentaire().getTitre()); |
set("_texte_", getCommentaire().getTexte()); |
set("_ponderation_", getCommentaire().getPonderation()); |
set("_public_", getCommentaire().getPublic()); |
set("_etat_", ""); |
} |
|
// ID |
/** Génère un identifiant de CollectionACommentaire. |
* |
* C'est une concaténation des clés primaires de la table coel_collection_a_commentaire séparées par un tiret "-". |
* |
* @return identifiant unique d'une relation "collection à commentaire". |
*/ |
public String getId() { |
String idCollection = getIdCollection(); |
String idCommentaire = getIdCommentaire(); |
if (idCollection.equals("") && idCommentaire.equals("")) { |
return null; |
} else { |
return (idCollection+"-"+idCommentaire); |
} |
} |
|
//+---------------------------------------------------------------------------------------------------------------+ |
// CHAMPS PROVENANT de la TABLE COEL_COLLECTION_A_COMMENTAIRE |
|
// ID COLLECTION |
public String getIdCollection() { |
return renvoyerValeurCorrecte("id_collection"); |
} |
public void setIdCollection(String idCollection) { |
set("id_collection", idCollection); |
} |
|
// ID COMENTAIRE |
public String getIdCommentaire() { |
return renvoyerValeurCorrecte("id_commentaire"); |
} |
public void setIdCommentaire(String ic) { |
set("id_commentaire", ic); |
} |
|
// TRUCK TYPE |
public String getType() { |
return renvoyerValeurCorrecte("truk_type"); |
} |
public void setType(String type) { |
set("truk_type", type); |
} |
} |
Property changes: |
Added: svn:mergeinfo |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/CollectionACommentaire.java:r1136-1368 |