Subversion Repositories eFlore/Applications.coel

Rev

Rev 628 | Rev 748 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
453 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 CollectionBotanique extends aDonnee {
9
	public static final String PREFIXE = "ccb";
10
 
11
	public CollectionBotanique() {
12
	}
13
 
14
	public CollectionBotanique(JSONObject botanique) {
15
		// l'objet JSON est une table de hachage
16
		Set<String> im = botanique.keySet();
17
 
18
		// Parcourt pour chaque clé
19
		for (Iterator<String> it = im.iterator(); it.hasNext();) {
20
			// Si elle est associée à une valeur, nous l'ajoutons
21
			String cle = it.next();
22
			if (cle.startsWith(PREFIXE+"_")) {
23
				// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
24
				String cleObjet = cle.replaceFirst("^"+PREFIXE+"_", "");
25
				// Sinon, nous ajoutons la clé avec une valeur vide
26
				String valeur = "";
27
				if (botanique.get(cle).isString() != null) {
28
					valeur = botanique.get(cle).isString().stringValue();
29
				}
30
				this.set(cleObjet, valeur);
31
			}
32
		}
33
	}
34
 
628 jp_milcent 35
	// ID
36
	public String getId() {
37
		return renvoyerValeurCorrecte("id_collection");
38
	}
39
	public void setId(String idCollection) {
40
		this.set("id_collection", idCollection);
41
	}
42
 
683 jp_milcent 43
	// NBRE ECHANTILLON
44
	public String getNbreEchantillon() {
45
		return renvoyerValeurCorrecte("nbre_echantillon");
46
	}
47
	public void setNbreEchantillon(String type) {
48
		this.set("nbre_echantillon", type);
49
	}
50
 
628 jp_milcent 51
	// TYPE
52
	public String getType() {
53
		return renvoyerValeurCorrecte("ce_truk_type");
54
	}
55
	public void setType(String type) {
56
		this.set("ce_truk_type", type);
57
	}
453 jp_milcent 58
}