Subversion Repositories eFlore/Applications.coel

Rev

Rev 453 | Rev 477 | 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 Collection extends aDonnee {
9
 
468 jp_milcent 10
	private static final long serialVersionUID = 3295310312337145716L;
11
 
453 jp_milcent 12
	public static final String PREFIXE = "cc";
13
	private CollectionBotanique botanique = null;
14
 
15
	public Collection() {
16
	}
17
 
18
	public Collection(JSONObject collection) {
19
		// l'objet JSON est une table de hachage
20
		Set<String> im = collection.keySet();
21
 
22
		// Parcourt pour chaque clé
23
		for (Iterator<String> it = im.iterator(); it.hasNext();) {
24
			// Si elle est associée à une valeur, nous l'ajoutons
25
			String cle = it.next();
26
			if (cle.startsWith(PREFIXE+"_")) {
27
				// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
28
				String cleObjet = cle.replaceFirst("^"+PREFIXE+"_", "");
29
				// Sinon, nous ajoutons la clé avec une valeur vide
30
				String valeur = "";
31
				if (collection.get(cle).isString() != null) {
32
					valeur = collection.get(cle).isString().stringValue();
33
				}
34
				this.set(cleObjet, valeur);
35
			}
36
		}
37
	}
38
 
39
	// BOTANIQUE
40
	public CollectionBotanique getBotanique() {
41
		return botanique;
42
	}
43
	public void setBotanique(CollectionBotanique botaniqueAStocker) {
44
		botanique = botaniqueAStocker;
45
	}
46
 
47
	// ID
48
	public String getId() {
49
		return renvoyerValeurCorrecte("id_collection");
50
	}
51
	public void setId(String idCollection) {
52
		this.set("id_collection", idCollection);
53
	}
54
 
55
	// CE PROJET
56
	public String getIdProjet() {
57
		return renvoyerValeurCorrecte("ce_projet");
58
	}
59
	public void setIdProjet(String idProjet) {
60
		this.set("ce_projet", idProjet);
61
	}
62
 
63
	// CE STRUCTURE
64
	public String getIdStructure() {
65
		return renvoyerValeurCorrecte("ce_structure");
66
	}
67
	public void setIdStructure(String idStructure) {
68
		this.set("ce_structure", idStructure);
69
	}
70
 
71
	// GUID
72
	public String getGuid() {
73
		return renvoyerValeurCorrecte("guid");
74
	}
75
	public void setGuid(String guid) {
76
		this.set("guid", guid);
77
	}
78
 
79
	// NOM
80
	public String getNom() {
81
		return renvoyerValeurCorrecte("nom");
82
	}
83
	public void setNom(String nom) {
84
		this.set("nom", nom);
85
	}
86
 
87
	// TRUK IDENTIFIANT ALTERNATIF
88
	public String getIdAlternatif() {
89
		return renvoyerValeurCorrecte("truk_identifiant_alternatif");
90
	}
91
	public void setIdAlternatif(String idAlter) {
92
		this.set("truk_identifiant_alternatif", idAlter);
93
	}
468 jp_milcent 94
 
95
	// +--------------------------------------------------------------------------------------------------------------+
96
	// STRUCTURE NOM
97
	public String getStructureNom() {
98
		return renvoyerValeurCorrecte("structure_nom");
99
	}
453 jp_milcent 100
 
468 jp_milcent 101
	// STRUCTURE VILLE
102
	public String getStructureVille() {
103
		return renvoyerValeurCorrecte("structure_ville");
104
	}
105
 
453 jp_milcent 106
}