Subversion Repositories eFlore/Applications.coel

Rev

Rev 291 | Rev 858 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 291 Rev 748
Line 5... Line 5...
5
 
5
 
Line 6... Line 6...
6
import com.google.gwt.json.client.JSONObject;
6
import com.google.gwt.json.client.JSONObject;
Line 7... Line -...
7
 
-
 
8
public class Valeur extends aDonnee {
7
 
9
	
8
public class Valeur extends aDonnee {
10
	/**
9
	
11
	 * Constructeur avec un objet JSON
10
	private static final long serialVersionUID = 2278245640718653819L;
12
	 * 
11
 
13
	 * @param image
12
	public static final String PREFIXE = "cmlv";	
14
	 */
13
 
Line 15... Line 14...
15
	public Valeur(JSONObject liste) {
14
	public Valeur(JSONObject liste) {
16
		// l'objet JSON est une table de hachage
15
		// l'objet JSON est une table de hachage
17
		Set<String> im = liste.keySet();
16
		Set<String> im = liste.keySet();
18
 
17
 
19
		// Parcourt pour chaque clé
18
		// Parcourt pour chaque clé
20
		for (Iterator<String> it = im.iterator(); it.hasNext();) {
19
		for (Iterator<String> it = im.iterator(); it.hasNext();) {
21
			// Si elle est associée à une valeur, nous l'ajoutons
20
			// Si elle est associée à une valeur, nous l'ajoutons
22
			String cle = it.next();
21
			String cle = it.next();
23
			// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
22
			// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
24
			String cleObjet = cle.replaceFirst("^cmlv_", "");
23
			String cleObjet = cle.replaceFirst("^"+PREFIXE+"_", "");
25
			if (liste.get(cle).isString() != null) {
24
			if (liste.get(cle).isString() != null) {
Line 38... Line 37...
38
		this.set("nom", nom);
37
		this.set("nom", nom);
39
		this.set("abreviation", abr);
38
		this.set("abreviation", abr);
40
		this.set("description", description);
39
		this.set("description", description);
41
	}
40
	}
Line -... Line 41...
-
 
41
	
-
 
42
	@Override
-
 
43
	protected String getPrefixe() {
-
 
44
		return PREFIXE;
-
 
45
	}
42
	
46
	
43
	/** Accesseur à l'identifiant de la valeur.
47
	/** Accesseur à l'identifiant de la valeur.
44
	 * 
48
	 * 
45
	 * @return String l'identifiant de la valeur.
49
	 * @return String l'identifiant de la valeur.
46
	 */
50
	 */
Line 64... Line 68...
64
		return (String) renvoyerValeurCorrecte("abreviation");
68
		return (String) renvoyerValeurCorrecte("abreviation");
65
	}
69
	}
Line 66... Line 70...
66
	
70
	
67
	/** Accesseur à la description de la valeur.
71
	/** Accesseur à la description de la valeur.
68
	 * 
72
	 * 
69
	 * @return String la descripion de la valeur.
73
	 * @return String la description de la valeur.
70
	 */
74
	 */
71
	public String getDescription() {
75
	public String getDescription() {
72
		return (String) renvoyerValeurCorrecte("description");
76
		return (String) renvoyerValeurCorrecte("description");