Subversion Repositories eFlore/Applications.coel

Rev

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