Subversion Repositories eFlore/Applications.coel

Rev

Rev 188 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
179 jp_milcent 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
 
8
public class StructureConservation extends aDonnee {
9
 
10
	public static final String PREFIXE = "csc";
11
 
12
	/**
13
	 * Constructeur vide
14
	 *
15
	 */
16
	public StructureConservation() {
17
 
18
	}
19
 
20
	/**
21
	 * Constructeur avec un objet JSON
22
	 *
23
	 * @param image
24
	 */
25
	public StructureConservation(JSONObject institution) {
26
		// L'objet JSON est une table de hachage
27
		Set<String> im = institution.keySet();
28
 
29
		// Parcourt pour chaque clé
30
		for (Iterator<String> it = im.iterator(); it.hasNext();) {
31
			// Si elle est associée à une valeur, nous l'ajoutons
32
			String cle = it.next();
33
			// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
34
			String cleObjet = cle.replaceFirst("^"+StructureConservation.PREFIXE+"_", "");
35
			// Sinon, nous ajoutons la clé avec une valeur vide
36
			String valeur = "";
37
			if (institution.get(cle).isString() != null) {
38
				valeur = institution.get(cle).isString().stringValue();
39
			}
40
			this.set(cleObjet, valeur);
41
		}
42
	}
43
 
44
	public void setFormationMark(String mf) {
45
		this.set("mark_formation", mf);
46
	}
47
 
48
	public void setFormation(String f) {
49
		this.set("formation", f);
50
	}
51
 
52
	public void setFormationInteret(String f) {
53
		this.set("mark_formation_interet", f);
54
	}
55
 
56
	public void setStockageLocal(String sl) {
57
		this.set("truk_stockage_local", sl);
58
	}
59
 
60
	public void setStockageMeuble(String sm) {
61
		this.set("truk_stockage_meuble", sm);
62
	}
63
 
64
	public void setStockageParametre(String sl) {
65
		this.set("truk_stockage_local", sl);
66
	}
67
 
68
	public void setCollectionCommune(String ccm) {
69
		this.set("mark_collection_commune", ccm);
70
	}
71
 
72
	public void setCollectionAutre(String ca) {
73
		this.set("truk_collection_autre", ca);
74
	}
75
 
76
	public void setAccesControle(String ac) {
77
		this.set("mark_acces_controle", ac);
78
	}
79
 
80
	public void setRestauration(String ccm) {
81
		this.set("mark_restauration", ccm);
82
	}
83
 
84
	public void setRestaurationOperation(String ro) {
85
		this.set("truk_restauration_operation", ro);
86
	}
87
 
88
	public void setMaterielConservation(String mc) {
89
		this.set("ce_materiel_conservation", mc);
90
	}
91
 
92
	public void setMaterielAutre(String ma) {
93
		this.set("truk_materiel_autre", ma);
94
	}
95
 
96
	public void setTraitement(String t) {
97
		this.set("mark_traitement", t);
98
	}
99
 
100
	public void setTraitements(String t) {
101
		this.set("truk_traitement", t);
102
	}
103
 
104
	public void setAcquisitionCollection(String ac) {
105
		this.set("mark_acquisition_collection", ac);
106
	}
107
 
108
	public void setAcquisitionEchantillon(String ae) {
109
		this.set("mark_acquisition_echantillon", ae);
110
	}
111
 
112
	public void setAcquisitionTraitement(String at) {
113
		this.set("mark_acquisition_traitement", at);
114
	}
115
 
116
	public void setAcquisitionTraitementPoison(String atp) {
117
		this.set("mark_acquisition_traitement_poison", atp);
118
	}
119
 
120
	public void setAcquisitionTraitementInsecte(String ati) {
121
		this.set("mark_acquisition_traitement_insecte", ati);
122
	}
123
 
124
	public String toString() {
125
		String sortie = "";
126
 
127
		// Champs du BaseModelData
128
		Set<String> proprietes = this.getProperties().keySet();
129
		for (Iterator<String> it = proprietes.iterator(); it.hasNext();) {
130
			String cle = it.next();
131
			sortie += cle+" : "+this.get(cle)+"\n";
132
		}
133
 
134
		return sortie;
135
	}
136
 
137
}