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());
|
|
|
47 |
set("indication_nvt", getPublication().getIndicationNvt());
|
|
|
48 |
set("fascicule", getPublication().getFascicule());
|
|
|
49 |
set("truk_pages", getPublication().getPages());
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
// ID
|
|
|
53 |
/** Génère un identifiant de CollectionAPersonne.
|
|
|
54 |
*
|
|
|
55 |
* C'est une concaténation des clés primaires de la table coel_collection_a_personne séparées par un tiret "-".
|
|
|
56 |
*
|
|
|
57 |
* @return identifiant unique d'une relation "collection à personne".
|
|
|
58 |
*/
|
|
|
59 |
public String getId() {
|
|
|
60 |
String idCollection = getIdCollection();
|
|
|
61 |
String idPublication = getIdPublication();
|
|
|
62 |
if (idCollection.equals("") && idPublication.equals("")) {
|
|
|
63 |
return null;
|
|
|
64 |
} else {
|
|
|
65 |
return (idCollection+"-"+idPublication);
|
|
|
66 |
}
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
//+---------------------------------------------------------------------------------------------------------------+
|
|
|
70 |
// CHAMPS PROVENANT de la TABLE COEL_COLLECTION_A_PERSONNE
|
|
|
71 |
|
|
|
72 |
// ID COLLECTION
|
|
|
73 |
public String getIdCollection() {
|
|
|
74 |
return renvoyerValeurCorrecte("id_collection");
|
|
|
75 |
}
|
|
|
76 |
public void setIdCollection(String idCollection) {
|
|
|
77 |
set("id_collection", idCollection);
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
// ID PUBLICATION
|
|
|
81 |
public String getIdPublication() {
|
|
|
82 |
return renvoyerValeurCorrecte("id_publication");
|
|
|
83 |
}
|
|
|
84 |
public void setIdPublication(String ip) {
|
|
|
85 |
set("id_publication", ip);
|
|
|
86 |
}
|
|
|
87 |
|
|
|
88 |
}
|