Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 318 Rev 602
Line 1... Line 1...
1
package org.tela_botanica.client.modeles;
1
package org.tela_botanica.client.modeles;
Line 2... Line 2...
2
 
2
 
3
import java.util.Iterator;
-
 
4
import java.util.List;
3
import java.util.Iterator;
Line 5... Line -...
5
import java.util.Set;
-
 
6
 
4
import java.util.Set;
Line 7... Line 5...
7
import com.extjs.gxt.ui.client.widget.form.CheckBox;
5
 
8
import com.google.gwt.json.client.JSONObject;
6
import com.google.gwt.json.client.JSONObject;
9
 
7
 
Line 20... Line 18...
20
	 * Constructeur vide
18
	 * Constructeur vide
21
	 * 
19
	 * 
22
	 */
20
	 */
23
	public StructureAPersonne() {
21
	public StructureAPersonne() {
24
		// Définition des valeurs par défaut de variables obligatoires vis à vis de l'utilisation de l'objet
22
		// Définition des valeurs par défaut de variables obligatoires vis à vis de l'utilisation de l'objet
25
		this.set("contact", false);
23
		set("contact", false);
26
		this.set("fonction", "");
24
		set("fonction", "");
27
		this.set("statut", "");
25
		set("statut", "");
28
		this.set("travail", 0);
26
		set("travail", 0);
29
	}
27
	}
Line 30... Line 28...
30
	
28
	
31
	/**
29
	/**
32
	 * Constructeur avec un objet JSON
30
	 * Constructeur avec un objet JSON
33
	 * 
31
	 * 
34
	 * @param 
32
	 * @param 
35
	 */
33
	 */
36
	public StructureAPersonne(JSONObject personnel) {
34
	public StructureAPersonne(JSONObject personnel) {
37
		// Définition des valeurs par défaut de variables obligatoires vis à vis de l'utilisation de l'objet
35
		// Définition des valeurs par défaut de variables obligatoires vis à vis de l'utilisation de l'objet
38
		this.set("contact", false);
36
		set("contact", false);
39
		this.set("fonction", "");
37
		set("fonction", "");
40
		this.set("statut", "");
38
		set("statut", "");
Line 41... Line 39...
41
		this.set("travail", 0);
39
		set("travail", 0);
42
		
40
		
Line 43... Line 41...
43
		// L'objet JSON est une table de hachage
41
		// L'objet JSON est une table de hachage
Line 53... Line 51...
53
				// Sinon, nous ajoutons la clé avec une valeur vide
51
				// Sinon, nous ajoutons la clé avec une valeur vide
54
				String valeur = "";
52
				String valeur = "";
55
				if (personnel.get(cle).isString() != null) {
53
				if (personnel.get(cle).isString() != null) {
56
					valeur = personnel.get(cle).isString().stringValue();
54
					valeur = personnel.get(cle).isString().stringValue();
57
				}
55
				}
58
				this.set(cleObjet, valeur);
56
				set(cleObjet, valeur);
59
				if (cle.equals("mark_contact")) {
57
				if (cle.equals("mark_contact")) {
60
					this.set("contact", (valeur.equals("1") ? true : false));
58
					set("contact", (valeur.equals("1") ? true : false));
61
				} else if (cle.equals("bota_travail_hebdo_tps")) {
59
				} else if (cle.equals("bota_travail_hebdo_tps")) {
62
					this.set("travail", Integer.parseInt(valeur));
60
					set("travail", Integer.parseInt(valeur));
63
				}
61
				}
64
			}
62
			}
65
			if (cle.startsWith(Personne.PREFIXE+"_")) {
63
			if (cle.startsWith(Personne.PREFIXE+"_")) {
66
				// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
64
				// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
67
				String cleObjet = cle.replaceFirst("^"+Personne.PREFIXE+"_", "");
65
				String cleObjet = cle.replaceFirst("^"+Personne.PREFIXE+"_", "");
Line 70... Line 68...
70
				if (personnel.get(cle).isString() != null) {
68
				if (personnel.get(cle).isString() != null) {
71
					valeur = personnel.get(cle).isString().stringValue();
69
					valeur = personnel.get(cle).isString().stringValue();
72
				}
70
				}
Line 73... Line 71...
73
				
71
				
74
				if (cleObjet.equals("truk_telephone")) {
72
				if (cleObjet.equals("truk_telephone")) {
75
					this.set("telephone", getInfoDenormaliseParType(valeur, "FIX"));
73
					set("telephone", valeur);
76
				} else if (cleObjet.equals("truk_fax")) {
74
					set("tel_fix", getInfoDenormaliseParType(valeur, Personne.TELEPHONE_FIXE));
77
					this.set("fax", getInfoDenormaliseParPosition(valeur, 1));
75
					set("tel_fax", getInfoDenormaliseParType(valeur, Personne.TELEPHONE_FAX));
78
				} else if (cleObjet.equals("truk_courriel")) {
76
				} else if (cleObjet.equals("truk_courriel")) {
79
					this.set("courriel", getInfoDenormaliseParPosition(valeur, 1));
77
					set("courriel", getInfoDenormaliseParPosition(valeur, 1));
80
				} else if (cleObjet.equals("ce_truk_specialite")) {
78
				} else if (cleObjet.equals("ce_truk_specialite")) {
81
					this.set("specialite", getInfoDenormaliseParPosition(valeur, 1));
79
					set("specialite", getInfoDenormaliseParPosition(valeur, 1));
82
				} else {
80
				} else {
83
					this.set(cleObjet, valeur);
81
					set(cleObjet, valeur);
84
				}
82
				}
85
			}
83
			}
86
		}
84
		}
Line 95... Line 93...
95
	public StructureAPersonne(String fonction, String roleId) {
93
	public StructureAPersonne(String fonction, String roleId) {
96
		setFonction(fonction);
94
		setFonction(fonction);
97
		setIdRole(roleId);
95
		setIdRole(roleId);
Line 98... Line 96...
98
		
96
		
99
		// Définition des valeurs par défaut de variables obligatoires vis à vis de l'utilisation de l'objet
97
		// Définition des valeurs par défaut de variables obligatoires vis à vis de l'utilisation de l'objet
100
		this.set("contact", false);
98
		set("contact", false);
101
		this.set("fonction", fonction);
99
		set("fonction", fonction);
102
		this.set("statut", "");
100
		set("statut", "");
103
		this.set("travail", 0);
101
		set("travail", 0);
Line 104... Line 102...
104
	}
102
	}
105
	
103
	
106
	/**
104
	/**
Line 112... Line 110...
112
	public StructureAPersonne(String fonction, String roleId, String codeEtat) {
110
	public StructureAPersonne(String fonction, String roleId, String codeEtat) {
113
		setFonction(fonction);
111
		setFonction(fonction);
114
		setIdRole(roleId);
112
		setIdRole(roleId);
Line 115... Line 113...
115
		
113
		
116
		// Définition des valeurs par défaut de variables obligatoires vis à vis de l'utilisation de l'objet
114
		// Définition des valeurs par défaut de variables obligatoires vis à vis de l'utilisation de l'objet
117
		this.set("contact", false);
115
		set("contact", false);
118
		this.set("fonction", fonction);
116
		set("fonction", fonction);
119
		this.set("statut", "");
117
		set("statut", "");
120
		this.set("travail", 0);
118
		set("travail", 0);
121
		this.set("etat", codeEtat);
119
		set("etat", codeEtat);
Line 122... Line 120...
122
	}
120
	}
123
	
121
	
124
	// ID
122
	// ID
Line 145... Line 143...
145
	// ID STRUCTURE
143
	// ID STRUCTURE
146
	public String getIdStructure() {
144
	public String getIdStructure() {
147
		return renvoyerValeurCorrecte("id_structure");
145
		return renvoyerValeurCorrecte("id_structure");
148
	}
146
	}
149
	public void setIdStructure(String is) {
147
	public void setIdStructure(String is) {
150
		this.set("id_structure", is);
148
		set("id_structure", is);
151
	}
149
	}
Line 152... Line 150...
152
	
150
	
153
	// ID PERSONNE
151
	// ID PERSONNE
154
	public String getIdPersonne() {
152
	public String getIdPersonne() {
155
		return renvoyerValeurCorrecte("id_personne");
153
		return renvoyerValeurCorrecte("id_personne");
156
	}
154
	}
157
	public void setIdPersonne(String ip) {
155
	public void setIdPersonne(String ip) {
158
		this.set("id_personne", ip);
156
		set("id_personne", ip);
Line 159... Line 157...
159
	}
157
	}
160
	
158
	
161
	// ID RôLE
159
	// ID RôLE
162
	public String getIdRole() {
160
	public String getIdRole() {
163
		return renvoyerValeurCorrecte("id_role");
161
		return renvoyerValeurCorrecte("id_role");
164
	}
162
	}
165
	public void setIdRole(String ir) {
163
	public void setIdRole(String ir) {
Line 166... Line 164...
166
		this.set("id_role", ir);
164
		set("id_role", ir);
167
	}
165
	}
168
	
166
	
169
	// FONCTION
167
	// FONCTION
170
	public String getFonction() {
168
	public String getFonction() {
171
		return renvoyerValeurCorrecte("ce_truk_fonction");
169
		return renvoyerValeurCorrecte("ce_truk_fonction");
172
	}
170
	}
173
	public void setFonction(String ctf) {
171
	public void setFonction(String ctf) {
174
		this.set("ce_truk_fonction", ctf);
172
		set("ce_truk_fonction", ctf);
175
	}
173
	}
Line 181... Line 179...
181
	// SERVICE
179
	// SERVICE
182
	public String getService() {
180
	public String getService() {
183
		return renvoyerValeurCorrecte("service");
181
		return renvoyerValeurCorrecte("service");
184
	}
182
	}
185
	public void setService(String s) {
183
	public void setService(String s) {
186
		this.set("service", s);
184
		set("service", s);
187
	}
185
	}
Line 188... Line 186...
188
	
186
	
189
	// STATUT
187
	// STATUT
190
	public String getStatut() {
188
	public String getStatut() {
191
		return renvoyerValeurCorrecte("ce_truk_statut");
189
		return renvoyerValeurCorrecte("ce_truk_statut");
192
	}
190
	}
193
	public void setStatut(String cts) {
191
	public void setStatut(String cts) {
194
		this.set("ce_truk_statut", cts);
192
		set("ce_truk_statut", cts);
195
	}
193
	}
196
	public void setStatut(String type, Object valeur) {
194
	public void setStatut(String type, Object valeur) {
197
		setChaineDenormaliseUnique("ce_truk_statut", type, valeur);
195
		setChaineDenormaliseUnique("ce_truk_statut", type, valeur);
Line 198... Line 196...
198
	}
196
	}
199
	
197
	
200
	// CONTACT
198
	// CONTACT
201
	public String getContact() {
199
	public String getContact() {
202
		return renvoyerValeurCorrecte("mark_contact");
200
		return renvoyerValeurCorrecte("mark_contact");
203
	}
201
	}
204
	public void setContact(String c) {
202
	public void setContact(String c) {
205
		//this.set("contact", (c.equals("1") ? true : false));
203
		//set("contact", (c.equals("1") ? true : false));
206
		this.set("mark_contact", c);
204
		set("mark_contact", c);
207
	}
205
	}
208
	public void setContact(Boolean c) {
206
	public void setContact(Boolean c) {
Line 209... Line 207...
209
		setContact((c.equals(Boolean.TRUE) ? "1" : "0"));
207
		setContact((c.equals(Boolean.TRUE) ? "1" : "0"));
210
	}
208
	}
211
	
209
	
212
	// BOTA TRAVAIL HEBDO TPS
210
	// BOTA TRAVAIL HEBDO TPS
213
	public String getBotaTravailHebdoTps() {
211
	public String getBotaTravailHebdoTps() {
214
		return renvoyerValeurCorrecte("bota_travail_hebdo_tps");
212
		return renvoyerValeurCorrecte("bota_travail_hebdo_tps");
215
	}
213
	}
Line 216... Line 214...
216
	public void setBotaTravailHebdoTps(String btht) {
214
	public void setBotaTravailHebdoTps(String btht) {
217
		this.set("bota_travail_hebdo_tps", btht);
215
		set("bota_travail_hebdo_tps", btht);
Line 218... Line 216...
218
	}
216
	}
219
	
217
	
220
	//+---------------------------------------------------------------------------------------------------------------+
218
	//+---------------------------------------------------------------------------------------------------------------+
221
	// CHAMPS PROVENANT de la TABLE COEL_PERSONNE
219
	// CHAMPS PROVENANT de la TABLE COEL_PERSONNE
222
	
220
	
223
	// PRÉNOM
221
	// PRÉNOM
224
	public String getPrenom() {
222
	public String getPrenom() {
Line 225... Line 223...
225
		return renvoyerValeurCorrecte("prenom");
223
		return renvoyerValeurCorrecte("prenom");
226
	}
224
	}
227
	public void setPrenom(String p) {
225
	public void setPrenom(String prenom) {
228
		this.set("prenom", p);
226
		set("prenom", prenom);
229
	}
227
	}
230
	
228
	
231
	// NOM
229
	// NOM
Line 232... Line 230...
232
	public String getNom() {
230
	public String getNom() {
233
		return renvoyerValeurCorrecte("nom");
231
		return renvoyerValeurCorrecte("nom");
234
	}
232
	}
235
	public void setNom(String n) {
233
	public void setNom(String nom) {
236
		this.set("nom", n);
234
		set("nom", nom);
237
	}
-
 
238
	
235
	}
239
	// TÉLÉPHONE
236
	
-
 
237
	// TÉLÉPHONE
-
 
238
	public String getTelephone() {
240
	public String getTelephone() {
239
		return renvoyerValeurCorrecte("telephone");
241
		return renvoyerValeurCorrecte("telephone");
240
	}
-
 
241
	public void setTelephone(String tel) {
-
 
242
		set("telephone", tel);
-
 
243
	}
-
 
244
	
242
	}
245
	// TÉLÉPHONE FIXE
Line 243... Line 246...
243
	public void setTelephone(String t) {
246
	public String getTelephoneFixe() {
244
		// Nous remplaçons le premier numéro de Téléphone FIX de la personne
247
		return getInfoDenormaliseParType(renvoyerValeurCorrecte("telephone"), Personne.TELEPHONE_FIXE);
245
		this.modifierChaineDenormaliseParType("telephone", "FIX", t);
248
	}
246
	}
-
 
247
	public String selectionnerTelephone(String type) {
-
 
248
		return getInfoDenormaliseParType(renvoyerValeurCorrecte("telephone"), type);
-
 
249
	}
-
 
250
	
249
	public void setTelephoneFixe(String fixe) {
251
	// FAX
250
		// Nous remplaçons le premier numéro de Téléphone FIX de la personne
-
 
251
		modifierChaineDenormaliseParType("telephone", Personne.TELEPHONE_FIXE, fixe);
252
	public String getFax() {
252
	}
253
		return renvoyerValeurCorrecte("fax");
253
	
Line 254... Line 254...
254
	}
254
	// TÉLÉPHONE FAX
255
	public void setFax(String f) {
255
	public String getFax() {
256
		// Nous remplaçons le numéro de Fax en position 1 (principal)
256
		return getInfoDenormaliseParType(renvoyerValeurCorrecte("telephone"), Personne.TELEPHONE_FAX);
257
		this.modifierChaineDenormaliseParPosition("fax", 1, f);
257
	}
258
	}
258
	public void setFax(String fax) {
259
	public String selectionnerFax(int position) {
259
		// Nous remplaçons le premier numéro de FAX de la personne
260
		return getInfoDenormaliseParPosition(renvoyerValeurCorrecte("fax"), position);
260
		modifierChaineDenormaliseParType("telephone", Personne.TELEPHONE_FAX, fax);
261
	}
261
	}
262
	
262
	
263
	// COURRIEL
263
	// COURRIEL
264
	public String getCourriel() {
264
	public String getCourriel() {
Line 265... Line 265...
265
		return renvoyerValeurCorrecte("courriel");
265
		return renvoyerValeurCorrecte("courriel");
266
	}
266
	}
267
	public void setCourriel(String c) {
267
	public void setCourriel(String courriel) {
268
		// Nous remplaçons le courriel en position 1 (principal)
268
		// Nous remplaçons le courriel en position 1 (principal)
269
		this.modifierChaineDenormaliseParPosition("courriel", 1, c);
269
		this.modifierChaineDenormaliseParPosition("courriel", 1, courriel);
270
	}
270
	}
271
	public String selectionnerCourriel(int position) {
271
	public String selectionnerCourriel(int position) {
272
		return getInfoDenormaliseParPosition(renvoyerValeurCorrecte("courriel"), position);
272
		return getInfoDenormaliseParPosition(renvoyerValeurCorrecte("courriel"), position);
273
	}
273
	}
274
	
274
	
275
	// SPÉCIALITÉ
275
	// SPÉCIALITÉ
276
	public String getSpecialite() {
276
	public String getSpecialite() {
277
		return renvoyerValeurCorrecte("specialite");
277
		return renvoyerValeurCorrecte("specialite");