Subversion Repositories eFlore/Applications.coel

Rev

Rev 214 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 214 Rev 231
Line 2... Line 2...
2
 
2
 
3
import java.util.Iterator;
3
import java.util.Iterator;
4
import java.util.List;
4
import java.util.List;
Line -... Line 5...
-
 
5
import java.util.Set;
-
 
6
 
5
import java.util.Set;
7
import org.apache.commons.digester.SetRootRule;
6
 
8
 
Line 7... Line 9...
7
import com.extjs.gxt.ui.client.widget.form.CheckBox;
9
import com.extjs.gxt.ui.client.widget.form.CheckBox;
Line 20... Line 22...
20
	public StructureAPersonne() {
22
	public StructureAPersonne() {
21
		// Définition des valeurs par défaut de variables obligatoires vis à vis de l'utilisation de l'objet
23
		// Définition des valeurs par défaut de variables obligatoires vis à vis de l'utilisation de l'objet
22
		this.set("contact", false);
24
		this.set("contact", false);
23
		this.set("fonction", "");
25
		this.set("fonction", "");
24
		this.set("statut", "");
26
		this.set("statut", "");
-
 
27
		this.set("travail", 0);
25
	}
28
	}
Line 26... Line 29...
26
	
29
	
27
	/**
30
	/**
28
	 * Constructeur avec un objet JSON
31
	 * Constructeur avec un objet JSON
Line 32... Line 35...
32
	public StructureAPersonne(JSONObject personnel) {
35
	public StructureAPersonne(JSONObject personnel) {
33
		// Définition des valeurs par défaut de variables obligatoires vis à vis de l'utilisation de l'objet
36
		// Définition des valeurs par défaut de variables obligatoires vis à vis de l'utilisation de l'objet
34
		this.set("contact", false);
37
		this.set("contact", false);
35
		this.set("fonction", "");
38
		this.set("fonction", "");
36
		this.set("statut", "");
39
		this.set("statut", "");
-
 
40
		this.set("travail", 0);
Line 37... Line 41...
37
		
41
		
38
		// L'objet JSON est une table de hachage
42
		// L'objet JSON est une table de hachage
Line 39... Line 43...
39
		Set<String> im = personnel.keySet();
43
		Set<String> im = personnel.keySet();
Line 82... Line 86...
82
	}
86
	}
Line 83... Line 87...
83
	
87
	
84
	/**
88
	/**
85
	 * Constructeur avec la fonction à passer en paramètre
89
	 * Constructeur avec la fonction à passer en paramètre
86
	 * 
90
	 * 
-
 
91
	 * @param fonction fonction de la personne dans la structure.
87
	 * @param image
92
	 * @param role identifiant du rôle de la personne vis à vis de la structure.
88
	 */
93
	 */
89
	public StructureAPersonne(String fonction) {
94
	public StructureAPersonne(String fonction, String roleId) {
-
 
95
		setFonction(fonction);
-
 
96
		setIdRole(roleId);
90
		setFonction(fonction);
97
		
91
		// Définition des valeurs par défaut de variables obligatoires vis à vis de l'utilisation de l'objet
98
		// Définition des valeurs par défaut de variables obligatoires vis à vis de l'utilisation de l'objet
92
		this.set("contact", false);
99
		this.set("contact", false);
93
		this.set("fonction", "");
100
		this.set("fonction", "");
-
 
101
		this.set("statut", "");
94
		this.set("statut", "");
102
		this.set("travail", 0);
Line 95... Line 103...
95
	}
103
	}
96
	
104
	
97
	// ID
105
	// ID
98
	/** Génère un identifiant de StructureAPersonne.
106
	/** Génère un identifiant de StructureAPersonne.
99
	 * 
107
	 * 
100
	 * C'est une concaténation des clés primaires de la table coel_structure_a_personne séparées par un tiret "-".
108
	 * C'est une concaténation des clés primaires de la table coel_structure_a_personne séparées par un tiret "-".
101
	 * 
109
	 * 
102
	 * @return identifiant unique d'une relation "structure à personne".
110
	 * @return identifiant unique d'une relation "structure à personne".
103
	 */
111
	 */
-
 
112
	public String getId() {
-
 
113
		String idStructure = renvoyerValeurCorrecte("id_structure");
-
 
114
		String idPersonne = renvoyerValeurCorrecte("id_personne");
-
 
115
		String idRole = renvoyerValeurCorrecte("id_role");
-
 
116
		if (idStructure.equals("") && idPersonne.equals("") && idRole.equals("")) {
-
 
117
			return null;
-
 
118
		} else {
104
	public String getId() {
119
			return (idStructure+"-"+idPersonne+"-"+idRole);
Line 105... Line 120...
105
		return (renvoyerValeurCorrecte("id_structure")+"-"+renvoyerValeurCorrecte("id_personne")+"-"+renvoyerValeurCorrecte("id_role"));
120
		}
106
	}
121
	}
Line 138... Line 153...
138
	}
153
	}
139
	public void setFonction(String ctf) {
154
	public void setFonction(String ctf) {
140
		this.set("ce_truk_fonction", ctf);
155
		this.set("ce_truk_fonction", ctf);
141
	}
156
	}
142
	public void setFonction(String type, Object valeur) {
157
	public void setFonction(String type, Object valeur) {
143
		setChaineDenormalise("ce_truk_fonction", type, valeur);
158
		setChaineDenormaliseUnique("ce_truk_fonction", type, valeur);
144
	}
159
	}
Line 145... Line 160...
145
	
160
	
146
	
161
	
Line 157... Line 172...
157
		return renvoyerValeurCorrecte("ce_truk_statut");
172
		return renvoyerValeurCorrecte("ce_truk_statut");
158
	}
173
	}
159
	public void setStatut(String cts) {
174
	public void setStatut(String cts) {
160
		this.set("ce_truk_statut", cts);
175
		this.set("ce_truk_statut", cts);
161
	}
176
	}
162
	public void setSatut(String type, Object valeur) {
177
	public void setStatut(String type, Object valeur) {
163
		setChaineDenormalise("ce_truk_statut", type, valeur);
178
		setChaineDenormaliseUnique("ce_truk_statut", type, valeur);
164
	}
179
	}
Line 165... Line 180...
165
	
180
	
166
	// CONTACT
181
	// CONTACT
167
	public String getContact() {
182
	public String getContact() {
168
		return renvoyerValeurCorrecte("mark_contact");
183
		return renvoyerValeurCorrecte("mark_contact");
169
	}
184
	}
170
	public void setContact(String c) {
185
	public void setContact(String c) {
171
		this.set("contact", (c.equals("1") ? true : false));
186
		//this.set("contact", (c.equals("1") ? true : false));
172
		this.set("mark_contact", c);
187
		this.set("mark_contact", c);
173
	}
188
	}
174
	public void setContact(Boolean c) {
189
	public void setContact(Boolean c) {
175
		setContact((c.equals(Boolean.TRUE) ? "1" : "0"));
190
		setContact((c.equals(Boolean.TRUE) ? "1" : "0"));
Line 205... Line 220...
205
	// TÉLÉPHONE
220
	// TÉLÉPHONE
206
	public String getTelephone() {
221
	public String getTelephone() {
207
		return renvoyerValeurCorrecte("telephone");
222
		return renvoyerValeurCorrecte("telephone");
208
	}
223
	}
209
	public void setTelephone(String t) {
224
	public void setTelephone(String t) {
-
 
225
		// Nous remplaçons le premier numéro de Téléphone FIX de la personne
210
		this.set("telephone", t);
226
		this.setChaineDenormaliseParType("telephone", "FIX", t);
211
	}
227
	}
Line 212... Line 228...
212
	
228
	
213
	// FAX
229
	// FAX
214
	public String getFax() {
230
	public String getFax() {
215
		return renvoyerValeurCorrecte("fax");
231
		return renvoyerValeurCorrecte("fax");
216
	}
232
	}
-
 
233
	public void setFax(String f) {
217
	public void setFax(String f) {
234
		// Nous remplaçons le numéro de Fax en position 1 (principal)
218
		this.set("fax", f);
235
		this.setChaineDenormaliseParPosition("fax", 1, f);
Line 219... Line 236...
219
	}
236
	}
220
	
237
	
221
	// COURRIEL
238
	// COURRIEL
222
	public String getCourriel() {
239
	public String getCourriel() {
223
		return renvoyerValeurCorrecte("courriel");
240
		return renvoyerValeurCorrecte("courriel");
-
 
241
	}
224
	}
242
	public void setCourriel(String c) {
225
	public void setCourriel(String c) {
243
		// Nous remplaçons le courriel en position 1 (principal)
Line 226... Line 244...
226
		this.set("courriel", c);
244
		this.setChaineDenormaliseParPosition("courriel", 1, c);
227
	}
245
	}
228
	
246
	
229
	// SPÉCIALITÉ
247
	// SPÉCIALITÉ
230
	public String getSpecialite() {
248
	public String getSpecialite() {
-
 
249
		return renvoyerValeurCorrecte("specialite");
231
		return renvoyerValeurCorrecte("specialite");
250
	}
232
	}
251
	public void setSpecialite(String s) {
233
	public void setSpecialite(String s) {
252
		// Nous remplaçons le premier numéro de Téléphone FIX de la personne
234
		this.set("specialite", s);
253
		this.setChaineDenormaliseUnique("specialite", "AUTRE", s);