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