| 935 |
jpm |
1 |
package org.tela_botanica.client.modeles.structure;
|
| 194 |
jp_milcent |
2 |
|
|
|
3 |
import java.util.Iterator;
|
|
|
4 |
import java.util.Set;
|
|
|
5 |
|
| 935 |
jpm |
6 |
import org.tela_botanica.client.modeles.aDonnee;
|
|
|
7 |
|
| 194 |
jp_milcent |
8 |
import com.google.gwt.json.client.JSONObject;
|
|
|
9 |
|
|
|
10 |
public class StructureValorisation extends aDonnee {
|
|
|
11 |
|
| 1733 |
raphael |
12 |
private static final long serialVersionUID = 8906713360999774621L;
|
| 748 |
jpm |
13 |
|
| 1733 |
raphael |
14 |
public static final String PREFIXE = "csv";
|
|
|
15 |
public static String[] champsObligatoires = {"csv_id_structure"};
|
| 194 |
jp_milcent |
16 |
|
| 1733 |
raphael |
17 |
public StructureValorisation() {
|
|
|
18 |
}
|
| 194 |
jp_milcent |
19 |
|
| 1733 |
raphael |
20 |
public StructureValorisation(JSONObject valorisation) {
|
|
|
21 |
// L'objet JSON est une table de hachage
|
|
|
22 |
Set<String> im = valorisation.keySet();
|
| 194 |
jp_milcent |
23 |
|
| 1733 |
raphael |
24 |
// Parcourt pour chaque clé
|
|
|
25 |
for (Iterator<String> it = im.iterator(); it.hasNext();) {
|
|
|
26 |
// Si elle est associée à une valeur, nous l'ajoutons
|
|
|
27 |
String cle = it.next();
|
|
|
28 |
if (cle.startsWith(PREFIXE+"_")) {
|
|
|
29 |
// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
|
|
|
30 |
String cleObjet = cle.replaceFirst("^"+PREFIXE+"_", "");
|
|
|
31 |
// Sinon, nous ajoutons la clé avec une valeur vide
|
|
|
32 |
String valeur = "";
|
|
|
33 |
if (valorisation.get(cle).isString() != null) {
|
|
|
34 |
valeur = valorisation.get(cle).isString().stringValue();
|
| 194 |
jp_milcent |
35 |
}
|
| 1733 |
raphael |
36 |
this.set(cleObjet, valeur);
|
|
|
37 |
}
|
| 194 |
jp_milcent |
38 |
}
|
| 1733 |
raphael |
39 |
}
|
| 194 |
jp_milcent |
40 |
|
| 1733 |
raphael |
41 |
@Override
|
|
|
42 |
protected String getPrefixe() {
|
|
|
43 |
return PREFIXE;
|
|
|
44 |
}
|
| 748 |
jpm |
45 |
|
| 1733 |
raphael |
46 |
protected String[] getChampsObligatoires() {
|
|
|
47 |
return champsObligatoires;
|
|
|
48 |
}
|
| 1173 |
jpm |
49 |
|
| 1733 |
raphael |
50 |
// ACTION
|
|
|
51 |
public Integer getAction() {
|
|
|
52 |
if (renvoyerValeurCorrecte("mark_action").equals("")) {
|
|
|
53 |
return null;
|
| 194 |
jp_milcent |
54 |
}
|
| 1733 |
raphael |
55 |
return Integer.parseInt(renvoyerValeurCorrecte("mark_action"));
|
|
|
56 |
}
|
|
|
57 |
public void setAction(String a) {
|
|
|
58 |
this.set("mark_action", a != null ? Integer.parseInt(a) : null);
|
|
|
59 |
}
|
| 194 |
jp_milcent |
60 |
|
| 1733 |
raphael |
61 |
// ACTION INFO
|
|
|
62 |
public String getActionInfo() {
|
|
|
63 |
return renvoyerValeurCorrecte("truk_action");
|
|
|
64 |
}
|
|
|
65 |
public void setActionInfo(String a) {
|
|
|
66 |
this.set("truk_action", a);
|
|
|
67 |
}
|
|
|
68 |
public void setActionInfo(String type, Object valeur) {
|
|
|
69 |
remplacerTypeDansChaineDenormalise("truk_action", type, valeur);
|
|
|
70 |
}
|
| 194 |
jp_milcent |
71 |
|
| 1733 |
raphael |
72 |
// PUBLICATION
|
|
|
73 |
public String getPublication() {
|
|
|
74 |
return renvoyerValeurCorrecte("publication");
|
|
|
75 |
}
|
|
|
76 |
public void setPublication(String p) {
|
|
|
77 |
this.set("publication", p);
|
|
|
78 |
}
|
| 194 |
jp_milcent |
79 |
|
| 1733 |
raphael |
80 |
// COLLECTION AUTRE
|
|
|
81 |
public String getCollectionAutre() {
|
|
|
82 |
return renvoyerValeurCorrecte("collection_autre");
|
|
|
83 |
}
|
|
|
84 |
public void setCollectionAutre(String ca) {
|
|
|
85 |
this.set("collection_autre", ca);
|
|
|
86 |
}
|
|
|
87 |
public void setCollectionAutre(String type, Object valeur) {
|
|
|
88 |
remplacerTypeDansChaineDenormalise("collection_autre", type, valeur);
|
|
|
89 |
}
|
| 194 |
jp_milcent |
90 |
|
| 1733 |
raphael |
91 |
// ACTION FUTURE
|
|
|
92 |
public Integer getActionFuture() {
|
|
|
93 |
if (renvoyerValeurCorrecte("mark_action_future").equals("")) {
|
|
|
94 |
return null;
|
| 194 |
jp_milcent |
95 |
}
|
| 1733 |
raphael |
96 |
return Integer.parseInt(renvoyerValeurCorrecte("mark_action_future"));
|
|
|
97 |
}
|
|
|
98 |
public void setActionFuture(String af) {
|
|
|
99 |
this.set("mark_action_future", af != null ? Integer.parseInt(af) : null);
|
|
|
100 |
}
|
| 194 |
jp_milcent |
101 |
|
| 1733 |
raphael |
102 |
// ACTION FUTURE INFO
|
|
|
103 |
public String getActionFutureInfo() {
|
|
|
104 |
return renvoyerValeurCorrecte("action_future");
|
|
|
105 |
}
|
|
|
106 |
public void setActionFutureInfo(String af) {
|
|
|
107 |
this.set("action_future", af);
|
|
|
108 |
}
|
| 205 |
jp_milcent |
109 |
|
| 194 |
jp_milcent |
110 |
|
| 1733 |
raphael |
111 |
// RECHERCHE
|
|
|
112 |
public Integer getRecherche() {
|
|
|
113 |
if (renvoyerValeurCorrecte("mark_recherche").equals("")) {
|
|
|
114 |
return null;
|
| 205 |
jp_milcent |
115 |
}
|
| 1733 |
raphael |
116 |
return Integer.parseInt(renvoyerValeurCorrecte("mark_recherche"));
|
|
|
117 |
|
|
|
118 |
}
|
|
|
119 |
public void setRecherche(String r) {
|
|
|
120 |
this.set("mark_recherche", r != null ? Integer.parseInt(r) : null);
|
|
|
121 |
}
|
| 205 |
jp_milcent |
122 |
|
| 1733 |
raphael |
123 |
// RECHERCHE PROVENANCE
|
|
|
124 |
public String getRechercheProvenance() {
|
|
|
125 |
return renvoyerValeurCorrecte("truk_recherche_provenance");
|
|
|
126 |
}
|
|
|
127 |
public void setRechercheProvenance(String rp) {
|
|
|
128 |
this.set("truk_recherche_provenance", rp);
|
|
|
129 |
}
|
|
|
130 |
public void setRechercheProvenance(String type, Object valeur) {
|
|
|
131 |
remplacerTypeDansChaineDenormalise("truk_recherche_provenance", type, valeur);
|
|
|
132 |
}
|
| 205 |
jp_milcent |
133 |
|
| 1733 |
raphael |
134 |
// RECHERCHE TYPE
|
|
|
135 |
public String getRechercheType() {
|
|
|
136 |
return renvoyerValeurCorrecte("truk_recherche_type");
|
|
|
137 |
}
|
|
|
138 |
public void setRechercheType(String rt) {
|
|
|
139 |
this.set("truk_recherche_type", rt);
|
|
|
140 |
}
|
|
|
141 |
public void setRechercheType(String type, Object valeur) {
|
|
|
142 |
remplacerTypeDansChaineDenormalise("truk_recherche_type", type, valeur);
|
|
|
143 |
}
|
| 205 |
jp_milcent |
144 |
|
| 1733 |
raphael |
145 |
// ACCES SANS MOTIF
|
|
|
146 |
public Integer getAccesSansMotif() {
|
|
|
147 |
if (renvoyerValeurCorrecte("mark_acces_ss_motif").equals("")) {
|
|
|
148 |
return null;
|
| 205 |
jp_milcent |
149 |
}
|
| 1733 |
raphael |
150 |
return Integer.parseInt(renvoyerValeurCorrecte("mark_acces_ss_motif"));
|
|
|
151 |
|
|
|
152 |
}
|
|
|
153 |
public void setAccesSansMotif(String asm) {
|
|
|
154 |
this.set("mark_acces_ss_motif", asm != null ? Integer.parseInt(asm) : null);
|
|
|
155 |
}
|
| 205 |
jp_milcent |
156 |
|
| 1733 |
raphael |
157 |
// ACCES SANS MOTIF INFO
|
|
|
158 |
public String getAccesSansMotifInfo() {
|
|
|
159 |
return renvoyerValeurCorrecte("acces_ss_motif");
|
|
|
160 |
}
|
|
|
161 |
public void setAccesSansMotifInfo(String asm) {
|
|
|
162 |
this.set("acces_ss_motif", asm);
|
|
|
163 |
}
|
| 205 |
jp_milcent |
164 |
|
| 1733 |
raphael |
165 |
// VISITE AVEC MOTIF
|
|
|
166 |
public Integer getVisiteAvecMotif() {
|
|
|
167 |
if (renvoyerValeurCorrecte("mark_visite_avec_motif").equals("")) {
|
|
|
168 |
return null;
|
| 205 |
jp_milcent |
169 |
}
|
| 1733 |
raphael |
170 |
return Integer.parseInt(renvoyerValeurCorrecte("mark_visite_avec_motif"));
|
|
|
171 |
|
|
|
172 |
}
|
|
|
173 |
public void setVisiteAvecMotif(String vam) {
|
|
|
174 |
this.set("mark_visite_avec_motif", vam != null ? Integer.parseInt(vam) : null);
|
|
|
175 |
}
|
| 205 |
jp_milcent |
176 |
|
| 1733 |
raphael |
177 |
// VISITE AVEC MOTIF INFO
|
|
|
178 |
public String getVisiteAvecMotifInfo() {
|
|
|
179 |
return renvoyerValeurCorrecte("visite_avec_motif");
|
|
|
180 |
}
|
|
|
181 |
public void setVisiteAvecMotifInfo(String vam) {
|
|
|
182 |
this.set("visite_avec_motif", vam);
|
|
|
183 |
}
|
| 205 |
jp_milcent |
184 |
|
| 194 |
jp_milcent |
185 |
}
|