Subversion Repositories eFlore/Applications.coel

Rev

Rev 628 | Rev 748 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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