Subversion Repositories eFlore/Applications.coel

Rev

Rev 179 | Rev 191 | Go to most recent revision | Details | Compare with Previous | 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
 
188 jp_milcent 44
	public String getFormationMark() {
45
		return renvoyerValeurCorrecte("mark_formation");
46
	}
179 jp_milcent 47
	public void setFormationMark(String mf) {
48
		this.set("mark_formation", mf);
49
	}
50
 
188 jp_milcent 51
	public String getFormation() {
52
		return renvoyerValeurCorrecte("formation");
53
	}
179 jp_milcent 54
	public void setFormation(String f) {
55
		this.set("formation", f);
56
	}
57
 
188 jp_milcent 58
	public String getFormationInteret() {
59
		return renvoyerValeurCorrecte("mark_formation_interet");
60
	}
179 jp_milcent 61
	public void setFormationInteret(String f) {
62
		this.set("mark_formation_interet", f);
63
	}
188 jp_milcent 64
 
65
	public String getStockageLocal() {
66
		return renvoyerValeurCorrecte("truk_stockage_local");
67
	}
179 jp_milcent 68
	public void setStockageLocal(String sl) {
69
		this.set("truk_stockage_local", sl);
70
	}
188 jp_milcent 71
	public void setStockageLocal(String type, String valeur) {
72
		String chaineExistante = renvoyerValeurCorrecte("truk_stockage_local");
73
		if (chaineExistante.equals("")) {
74
			this.set("truk_stockage_local", type+"##"+valeur);
75
		} else {
76
			this.set("truk_stockage_local", chaineExistante+";"+type+"##"+valeur);
77
		}
78
	}
179 jp_milcent 79
 
80
	public void setStockageMeuble(String sm) {
81
		this.set("truk_stockage_meuble", sm);
82
	}
83
 
84
	public void setStockageParametre(String sl) {
85
		this.set("truk_stockage_local", sl);
86
	}
87
 
88
	public void setCollectionCommune(String ccm) {
89
		this.set("mark_collection_commune", ccm);
90
	}
91
 
92
	public void setCollectionAutre(String ca) {
93
		this.set("truk_collection_autre", ca);
94
	}
95
 
96
	public void setAccesControle(String ac) {
97
		this.set("mark_acces_controle", ac);
98
	}
99
 
100
	public void setRestauration(String ccm) {
101
		this.set("mark_restauration", ccm);
102
	}
103
 
104
	public void setRestaurationOperation(String ro) {
105
		this.set("truk_restauration_operation", ro);
106
	}
107
 
108
	public void setMaterielConservation(String mc) {
109
		this.set("ce_materiel_conservation", mc);
110
	}
111
 
112
	public void setMaterielAutre(String ma) {
113
		this.set("truk_materiel_autre", ma);
114
	}
115
 
116
	public void setTraitement(String t) {
117
		this.set("mark_traitement", t);
118
	}
119
 
120
	public void setTraitements(String t) {
121
		this.set("truk_traitement", t);
122
	}
123
 
124
	public void setAcquisitionCollection(String ac) {
125
		this.set("mark_acquisition_collection", ac);
126
	}
127
 
128
	public void setAcquisitionEchantillon(String ae) {
129
		this.set("mark_acquisition_echantillon", ae);
130
	}
131
 
132
	public void setAcquisitionTraitement(String at) {
133
		this.set("mark_acquisition_traitement", at);
134
	}
135
 
136
	public void setAcquisitionTraitementPoison(String atp) {
137
		this.set("mark_acquisition_traitement_poison", atp);
138
	}
139
 
140
	public void setAcquisitionTraitementInsecte(String ati) {
141
		this.set("mark_acquisition_traitement_insecte", ati);
142
	}
143
 
144
	public String toString() {
145
		String sortie = "";
146
 
147
		// Champs du BaseModelData
148
		Set<String> proprietes = this.getProperties().keySet();
149
		for (Iterator<String> it = proprietes.iterator(); it.hasNext();) {
150
			String cle = it.next();
151
			sortie += cle+" : "+this.get(cle)+"\n";
152
		}
153
 
154
		return sortie;
155
	}
156
 
157
}