883 |
jpm |
1 |
package org.tela_botanica.client.modeles;
|
|
|
2 |
|
|
|
3 |
import com.google.gwt.json.client.JSONObject;
|
|
|
4 |
|
|
|
5 |
public class CollectionAPublication extends aDonnee {
|
|
|
6 |
|
|
|
7 |
private static final long serialVersionUID = 1L;
|
|
|
8 |
|
|
|
9 |
public static final String PREFIXE = "ccapu";
|
|
|
10 |
private Publication publicationLiee = null;
|
|
|
11 |
|
|
|
12 |
public CollectionAPublication() {
|
|
|
13 |
initialiser(new JSONObject());
|
|
|
14 |
}
|
|
|
15 |
|
|
|
16 |
public CollectionAPublication(JSONObject collectionAPublicationListe) {
|
|
|
17 |
initialiser(collectionAPublicationListe);
|
|
|
18 |
}
|
|
|
19 |
|
|
|
20 |
@Override
|
|
|
21 |
protected String getPrefixe() {
|
|
|
22 |
return PREFIXE;
|
|
|
23 |
}
|
|
|
24 |
|
|
|
25 |
private void initialiser(JSONObject collectionAPublicationListe) {
|
|
|
26 |
setPublication(new Publication(collectionAPublicationListe));
|
|
|
27 |
initialiserChampsPourGrille();
|
|
|
28 |
initialiserModele(collectionAPublicationListe);
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
// PUBLICATION
|
|
|
32 |
public Publication getPublication() {
|
|
|
33 |
return publicationLiee;
|
|
|
34 |
}
|
|
|
35 |
public void setPublication(Publication publication) {
|
|
|
36 |
publicationLiee = publication;
|
|
|
37 |
initialiserChampsPourGrille();
|
907 |
jpm |
38 |
if (publication != null) {
|
|
|
39 |
setIdPublication(publication.getId());
|
|
|
40 |
}
|
883 |
jpm |
41 |
}
|
|
|
42 |
|
|
|
43 |
private void initialiserChampsPourGrille() {
|
|
|
44 |
set("fmt_auteur", getPublication().getAuteur());
|
|
|
45 |
set("titre", getPublication().getTitre());
|
|
|
46 |
set("collection", getPublication().getCollection());
|
910 |
jpm |
47 |
set("_editeur_", "");
|
|
|
48 |
set("_annee_", "");
|
883 |
jpm |
49 |
set("indication_nvt", getPublication().getIndicationNvt());
|
|
|
50 |
set("fascicule", getPublication().getFascicule());
|
|
|
51 |
set("truk_pages", getPublication().getPages());
|
910 |
jpm |
52 |
set("_etat_", "");
|
883 |
jpm |
53 |
}
|
|
|
54 |
|
|
|
55 |
// ID
|
|
|
56 |
/** Génère un identifiant de CollectionAPersonne.
|
|
|
57 |
*
|
|
|
58 |
* C'est une concaténation des clés primaires de la table coel_collection_a_personne séparées par un tiret "-".
|
|
|
59 |
*
|
|
|
60 |
* @return identifiant unique d'une relation "collection à personne".
|
|
|
61 |
*/
|
|
|
62 |
public String getId() {
|
|
|
63 |
String idCollection = getIdCollection();
|
|
|
64 |
String idPublication = getIdPublication();
|
|
|
65 |
if (idCollection.equals("") && idPublication.equals("")) {
|
|
|
66 |
return null;
|
|
|
67 |
} else {
|
|
|
68 |
return (idCollection+"-"+idPublication);
|
|
|
69 |
}
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
//+---------------------------------------------------------------------------------------------------------------+
|
|
|
73 |
// CHAMPS PROVENANT de la TABLE COEL_COLLECTION_A_PERSONNE
|
|
|
74 |
|
|
|
75 |
// ID COLLECTION
|
|
|
76 |
public String getIdCollection() {
|
|
|
77 |
return renvoyerValeurCorrecte("id_collection");
|
|
|
78 |
}
|
|
|
79 |
public void setIdCollection(String idCollection) {
|
|
|
80 |
set("id_collection", idCollection);
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
// ID PUBLICATION
|
|
|
84 |
public String getIdPublication() {
|
|
|
85 |
return renvoyerValeurCorrecte("id_publication");
|
|
|
86 |
}
|
|
|
87 |
public void setIdPublication(String ip) {
|
|
|
88 |
set("id_publication", ip);
|
|
|
89 |
}
|
|
|
90 |
|
|
|
91 |
}
|