| 60 |
jpm |
1 |
package org.tela_botanica.client.modeles;
|
|
|
2 |
|
|
|
3 |
import java.util.Iterator;
|
|
|
4 |
import java.util.Set;
|
|
|
5 |
|
|
|
6 |
import com.google.gwt.json.client.JSONObject;
|
|
|
7 |
|
| 69 |
jpm |
8 |
public class Structure extends aDonnee {
|
| 60 |
jpm |
9 |
|
|
|
10 |
/**
|
|
|
11 |
* Constructeur vide
|
|
|
12 |
*
|
|
|
13 |
*/
|
|
|
14 |
public Structure() {
|
|
|
15 |
|
|
|
16 |
}
|
|
|
17 |
|
|
|
18 |
/**
|
|
|
19 |
* Constructeur avec un objet JSON
|
|
|
20 |
*
|
|
|
21 |
* @param image
|
|
|
22 |
*/
|
|
|
23 |
public Structure(JSONObject institution) {
|
|
|
24 |
// l'objet JSON est une table de hachage
|
|
|
25 |
Set<String> im = institution.keySet();
|
|
|
26 |
|
|
|
27 |
// Parcourt pour chaque clé
|
|
|
28 |
for (Iterator<String> it = im.iterator(); it.hasNext();) {
|
|
|
29 |
// Si elle est associée à une valeur, nous l'ajoutons
|
|
|
30 |
String cle = it.next();
|
|
|
31 |
// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
|
|
|
32 |
String cleObjet = cle.replaceFirst("^cs_", "");
|
|
|
33 |
if (institution.get(cle).isString() != null) {
|
|
|
34 |
String valeur = institution.get(cle).isString().stringValue();
|
|
|
35 |
this.set(cleObjet, valeur);
|
|
|
36 |
} else {
|
|
|
37 |
// Sinon, nous ajoutons la clé avec une valeur vide
|
|
|
38 |
String valeur = " ";
|
|
|
39 |
this.set(cleObjet, valeur);
|
|
|
40 |
}
|
|
|
41 |
}
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
public String getId() {
|
|
|
45 |
return (String) renvoyerValeurCorrecte("id_structure");
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
public String getNom() {
|
|
|
49 |
return (String) renvoyerValeurCorrecte("nom");
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
public String getDescription() {
|
|
|
53 |
return (String) renvoyerValeurCorrecte("description");
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
public String getAdresse01() {
|
|
|
57 |
return (String) renvoyerValeurCorrecte("adresse_01");
|
|
|
58 |
}
|
|
|
59 |
|
|
|
60 |
public String getCodePostal() {
|
|
|
61 |
return (String) renvoyerValeurCorrecte("code_postal");
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
public String getVille() {
|
|
|
65 |
return (String) renvoyerValeurCorrecte("ville");
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
public String getRegion() {
|
|
|
69 |
return (String) renvoyerValeurCorrecte("region");
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
public String getPays() {
|
|
|
73 |
return (String) renvoyerValeurCorrecte("pays");
|
|
|
74 |
}
|
|
|
75 |
|
|
|
76 |
public String getTelephone() {
|
|
|
77 |
return (String) renvoyerValeurCorrecte("telephone");
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
public String getFax() {
|
|
|
81 |
return (String) renvoyerValeurCorrecte("fax");
|
|
|
82 |
}
|
|
|
83 |
|
|
|
84 |
public String getCourriel() {
|
|
|
85 |
return (String) renvoyerValeurCorrecte("courriel");
|
|
|
86 |
}
|
|
|
87 |
|
|
|
88 |
public String getConditionAcces() {
|
|
|
89 |
return (String) renvoyerValeurCorrecte("condition_acces");
|
|
|
90 |
}
|
|
|
91 |
}
|