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