Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 238 Rev 240
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 Personne extends aDonnee {
8
public class Personne extends aDonnee {
9
 
9
 
10
	public static final String PREFIXE = "cp";
10
	public static final String PREFIXE = "cp";
11
	
11
	
12
	/**
12
	/**
13
	 * Constructeur vide
13
	 * Constructeur vide
14
	 */
14
	 */
15
	public Personne() {
15
	public Personne() {
16
		
16
		
17
	}
17
	}
18
	
18
	
19
	/**
19
	/**
20
	 * Constructeur avec un objet JSON
20
	 * Constructeur avec un objet JSON
21
	 * 
21
	 * 
22
	 * @param image
22
	 * @param image
23
	 */
23
	 */
24
	public Personne(JSONObject liste) {
24
	public Personne(JSONObject liste) {
25
		// l'objet JSON est une table de hachage
25
		// l'objet JSON est une table de hachage
26
		Set<String> im = liste.keySet();
26
		Set<String> im = liste.keySet();
27
 
27
 
28
		// Parcourt pour chaque clé
28
		// Parcourt pour chaque clé
29
		for (Iterator<String> it = im.iterator(); it.hasNext();) {
29
		for (Iterator<String> it = im.iterator(); it.hasNext();) {
30
			// Si elle est associée à une valeur, nous l'ajoutons
30
			// Si elle est associée à une valeur, nous l'ajoutons
31
			String cle = it.next();
31
			String cle = it.next();
32
			// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
32
			// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
33
			String cleObjet = cle.replaceFirst("^cp_", "");
33
			String cleObjet = cle.replaceFirst("^cp_", "");
34
			if (liste.get(cle).isString() != null) {
34
			if (liste.get(cle).isString() != null) {
35
				String valeur = liste.get(cle).isString().stringValue();
35
				String valeur = liste.get(cle).isString().stringValue();
36
				this.set(cleObjet, valeur);
36
				this.set(cleObjet, valeur);
37
			} else {
37
			} else {
38
				// Sinon, nous ajoutons la clé avec une valeur vide
38
				// Sinon, nous ajoutons la clé avec une valeur vide
39
				String valeur = " ";
39
				String valeur = " ";
40
				this.set(cleObjet, valeur);
40
				this.set(cleObjet, valeur);
41
			}
41
			}
42
		}
42
		}
43
	}
43
	}
-
 
44
	
44
	
45
	// ID PERSONNE
45
	public String getId() {
46
	public String getId() {
46
		return (String) renvoyerValeurCorrecte("id_personne");
47
		return renvoyerValeurCorrecte("id_personne");
-
 
48
	}
47
	}
49
	
48
	
50
	// NOM COMPLET
49
	public String getNom()	{
51
	public String getNomComplet() {
-
 
52
		return renvoyerValeurCorrecte("fmt_nom_complet");
50
		return (String) renvoyerValeurCorrecte("nom");
53
	}
51
	}
54
	
52
	
55
	// NOM
-
 
56
	public String getNom() {
-
 
57
		return renvoyerValeurCorrecte("nom");
-
 
58
	}
-
 
59
	
-
 
60
	// PRÉNOM
-
 
61
	public String getPrenom() {
-
 
62
		return renvoyerValeurCorrecte("prenom");
-
 
63
	}
-
 
64
	
-
 
65
	// TÉLÉPHONE
-
 
66
	public String getTelephone() {
-
 
67
		return renvoyerValeurCorrecte("truk_telephone");
-
 
68
	}
-
 
69
	public void setTelephone(String t) {
-
 
70
		this.set("truk_telephone", t);
-
 
71
	}
-
 
72
	public void addTelephone(String type, Object valeur) {
-
 
73
		ajouterChaineDenormaliseAvecType("truk_telephone", type, valeur);
-
 
74
	}
-
 
75
	
-
 
76
	// FAX
-
 
77
	public String getFax() {
-
 
78
		return renvoyerValeurCorrecte("truk_fax");
-
 
79
	}
-
 
80
	public void setFax(String f) {
-
 
81
		this.set("truk_fax", f);
-
 
82
	}
-
 
83
	public void addFax(Object valeur) {
53
	public String getPrenom()	{
84
		ajouterChaineDenormalise("truk_fax", valeur);
54
		return (String) renvoyerValeurCorrecte("prenom");
85
	}
-
 
86
	
-
 
87
	// COURRIEL
-
 
88
	public String getCourriel() {
-
 
89
		return renvoyerValeurCorrecte("truk_courriel");
-
 
90
	}
-
 
91
	public void setCourriel(String c) {
-
 
92
		this.set("truk_courriel", c);
-
 
93
	}
-
 
94
	public void addCourriel(String c) {
-
 
95
		ajouterChaineDenormalise("truk_courriel", c);
-
 
96
	}
-
 
97
	
-
 
98
	// SPÉCIALITÉ
-
 
99
	public String getSpecialite() {
-
 
100
		return renvoyerValeurCorrecte("ce_truk_specialite");
55
	}
101
	}
56
	
102
	public void setSpecialite(String s) {
57
	public String getNomComplet()	{
103
		// Pas de liste pour l'instant, donc tout passe dans "Autre".
58
		return (String) renvoyerValeurCorrecte("fmt_nom_complet");
104
		setChaineDenormaliseUnique("ce_truk_specialite", "AUTRE", s);
59
	}
105
	}
60
	
106
	
61
	public Object obtenirValeurChamp(String nomChamp)	{
107
	public Object obtenirValeurChamp(String nomChamp)	{
62
		return renvoyerValeurCorrecte(nomChamp);
108
		return renvoyerValeurCorrecte(nomChamp);
63
	}
109
	}
64
 
110
 
65
}
111
}