Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 827 Rev 875
Line 17... Line 17...
17
 
17
 
18
	public static final String PREFIXE = "cp";
18
	public static final String PREFIXE = "cp";
19
	public static final String TELEPHONE_FIXE = "FIX";
19
	public static final String TELEPHONE_FIXE = "FIX";
20
	public static final String TELEPHONE_GSM = "GSM";
20
	public static final String TELEPHONE_GSM = "GSM";
-
 
21
	public static final String TELEPHONE_FAX = "FAX";
-
 
22
	public static final String ETRE_DECEDE = "30745";
Line 21... Line 23...
21
	public static final String TELEPHONE_FAX = "FAX";
23
	public static final String ETRE_VIVANT = "30746";
22
	
24
	
Line 23... Line 25...
23
	public Personne() {
25
	public Personne() {
Line 32... Line 34...
32
	@Override
34
	@Override
33
	protected String getPrefixe() {
35
	protected String getPrefixe() {
34
		return PREFIXE;
36
		return PREFIXE;
35
	}
37
	}
Line -... Line 38...
-
 
38
	
-
 
39
	public Object obtenirValeurChamp(String nomChamp)	{
-
 
40
		return renvoyerValeurCorrecte(nomChamp);
-
 
41
	}
-
 
42
	
-
 
43
	public Date getDate(String nomChamp)	{
-
 
44
		String strDate = renvoyerValeurCorrecte(nomChamp);
-
 
45
		Date dateRetour = null;
-
 
46
		try {
-
 
47
			if ((strDate != null) && (!strDate.equals("0000-00-00"))) {
-
 
48
				dateRetour = DateTimeFormat.getFormat("yyyy-MM-dd").parseStrict(strDate);
-
 
49
			}
-
 
50
		} catch (StringIndexOutOfBoundsException e)	{
-
 
51
			GWT.log("Impossible de parser la date " + strDate, e);
-
 
52
		}
-
 
53
		return dateRetour;		
-
 
54
	}
-
 
55
	
-
 
56
	public String getString(String nomChamp)	{
-
 
57
		return String.valueOf(renvoyerValeurCorrecte(nomChamp));
-
 
58
	}
-
 
59
	
-
 
60
	//Traitement des truks
-
 
61
	protected void remplacerTypeDansChaineDenormalise(String champ, String type, Object valeur) {
-
 
62
		if (valeur != null && !valeur.equals("")) {
-
 
63
			ajouterChaineDenormaliseAvecType(champ, type, valeur);
-
 
64
		} else {
-
 
65
			supprimerTypeDansChaineDenormalise(champ, type);
-
 
66
		}
-
 
67
	}
-
 
68
	/**
-
 
69
	 * Ajoute un nouvel élément sans type à une chaine dénormalisée.
-
 
70
	 * Champ de type "truk" contenant seulement des valeurs séparées par ";;".
-
 
71
	 * Si l'élément existe déjà, il ne sera pas ajouté.
-
 
72
	 * 
-
 
73
	 * @param champ le nom du champ dénormalisé
-
 
74
	 * @param valeur la valeur à ajouter
-
 
75
	 */
-
 
76
	protected void ajouterChaineDenormalise(String champ, Object valeur) {
-
 
77
		if (valeur instanceof String) {
-
 
78
			String chaineExistante = renvoyerValeurCorrecte(champ);
-
 
79
			if (chaineExistante.equals("")) {
-
 
80
				this.set(champ, valeur);
-
 
81
			} else {
-
 
82
				// Si la valeur à ajouter n'est pas déjà présente, nous l'ajoutons
-
 
83
				if (!chaineExistante.matches("(^|"+SEPARATEUR_VALEURS+")"+valeur+"("+SEPARATEUR_VALEURS+"|$)")) {
-
 
84
					this.set(champ, chaineExistante+SEPARATEUR_VALEURS+valeur);
-
 
85
				}
-
 
86
			}
-
 
87
		}
-
 
88
	}
36
	
89
	
37
	// ID PERSONNE
90
	// ID PERSONNE
38
	public String getId() {
91
	public String getId() {
39
		return renvoyerValeurCorrecte("id_personne");
92
		return renvoyerValeurCorrecte("id_personne");
-
 
93
	}
-
 
94
	public void setId(String personneId) {
-
 
95
		this.set("id_personne", personneId);
Line 40... Line 96...
40
	}
96
	}
41
	
97
	
42
	// ID PROJET
98
	// ID PROJET
43
	public String getIdProjet() {
99
	public String getIdProjet() {
Line 44... Line 100...
44
		return renvoyerValeurCorrecte("ce_projet");
100
		return renvoyerValeurCorrecte("ce_projet");
45
	}
101
	}
46
	
102
	
47
	// NOM COMPLET
103
	// NOM COMPLET
-
 
104
	public String getNomComplet() {
-
 
105
		return renvoyerValeurCorrecte("fmt_nom_complet");
-
 
106
	}
-
 
107
	public void setFmtNomComplet(String prefixe, String suffixe)	{
-
 
108
		String fmtNomComplet = "";
-
 
109
		if ((prefixe != null)&&(!prefixe.trim().equals("")))	{
-
 
110
			fmtNomComplet += prefixe + " ";
-
 
111
		}
-
 
112
		
-
 
113
		if ((this.getPrenom()!=null)&&(!this.getPrenom().trim().equals("")))	{
-
 
114
			fmtNomComplet += this.getPrenom() + " ";
-
 
115
		}
-
 
116
		
-
 
117
		if ((this.getNom()!=null)&&(!this.getNom().trim().equals("")))	{
-
 
118
			fmtNomComplet += this.getNom() + " ";
-
 
119
		}
-
 
120
		
-
 
121
		if ((suffixe!=null)&&(!suffixe.trim().equals("")))	{
-
 
122
			fmtNomComplet += suffixe;
-
 
123
		}
Line 48... Line 124...
48
	public String getNomComplet() {
124
		
49
		return renvoyerValeurCorrecte("fmt_nom_complet");
125
		this.set("fmt_nom_complet", UtilString.ucFirst(fmtNomComplet));
50
	}
126
	}
51
	
127
	
Line 57... Line 133...
57
	// PRÉNOM
133
	// PRÉNOM
58
	public String getPrenom() {
134
	public String getPrenom() {
59
		return renvoyerValeurCorrecte("prenom");
135
		return renvoyerValeurCorrecte("prenom");
60
	}
136
	}
Line 61... Line -...
61
	
-
 
62
	public Date getDate(String nomChamp)	{
-
 
63
		
-
 
64
		String strDate = renvoyerValeurCorrecte(nomChamp);
-
 
65
		
-
 
66
		Date dateRetour = null;
-
 
67
		try
-
 
68
		{
-
 
69
			if ((strDate != null) && (!strDate.equals("0000-00-00"))) {
-
 
70
				dateRetour = DateTimeFormat.getFormat("yyyy-MM-dd").parseStrict(strDate);
-
 
71
			}
-
 
72
		} catch (StringIndexOutOfBoundsException e)	{
-
 
73
			GWT.log("Impossible de parser la date " + strDate, e);
-
 
74
		}
-
 
75
		return dateRetour;		
-
 
76
	}
-
 
77
	
137
	
78
	// TÉLÉPHONE
138
	// TÉLÉPHONE
79
	public String getTelephone() {
139
	public String getTelephone() {
80
		return renvoyerValeurCorrecte("truk_telephone");
140
		return renvoyerValeurCorrecte("truk_telephone");
81
	}
141
	}
Line 127... Line 187...
127
	}
187
	}
128
	public String afficherSpecialite() {
188
	public String afficherSpecialite() {
129
		return getChaineDenormaliseUnique("ce_truk_specialite");
189
		return getChaineDenormaliseUnique("ce_truk_specialite");
130
	}
190
	}
Line -... Line 191...
-
 
191
	
131
	
192
	// NAISSANCE DATE
-
 
193
	public String getNaissanceDate()	{
-
 
194
		String dateNaiss = "";
-
 
195
		dateNaiss = get("naissance_date");
132
	public Object obtenirValeurChamp(String nomChamp)	{
196
		if (UtilString.isEmpty(dateNaiss)||dateNaiss.equals("0000-00-00"))	{
133
		return renvoyerValeurCorrecte(nomChamp);
197
			dateNaiss = Mediateur.i18nC.inconnue();
134
	}
-
 
135
	
-
 
136
	
198
		}
137
	public String getString(String champ)	{
-
 
138
		return String.valueOf(renvoyerValeurCorrecte(champ));
199
		return dateNaiss;
139
	}
-
 
140
	
200
	}
141
	public void setNaissanceDate(Date naissanceDate) {
201
	public void setNaissanceDate(Date naissanceDate) {
142
		if (naissanceDate != null) {
202
		if (naissanceDate != null) {
143
			this.set("naissance_date", DateTimeFormat.getFormat("yyyy-MM-dd").format(naissanceDate));
203
			this.set("naissance_date", DateTimeFormat.getFormat("yyyy-MM-dd").format(naissanceDate));
144
		}
204
		}
Line 145... Line -...
145
	}
-
 
146
	
205
	}
147
	public void setDeces(Date decesDate, String lieuDeces)	{
206
	
148
		set("ce_deces", "1");
207
	// NAISSANCE LIEU
149
		setDecesDate(decesDate);
208
	public String getNaissanceLieu() {
150
		set("deces_lieu", lieuDeces);
-
 
151
	}
209
		return renvoyerValeurCorrecte("naissance_lieu");
152
	
-
 
153
	public void setNonDecedee()	{
-
 
154
		set("ce_deces", "0");
210
	}
155
		setDecesDate(null);
211
	public void setNaissanceLieu(String naissanceLieu) {
Line -... Line 212...
-
 
212
		this.set("naissance_lieu", naissanceLieu);
156
		set("deces_lieu", "");
213
	}
157
	}
214
	
158
	
215
	// DÉCÉS
159
	public boolean estDecedee()	{
216
	public boolean estDecedee()	{
160
		String ceDeces = get("ce_deces");
217
		String ceDeces = getDeces();
161
		if ((ceDeces == null)||(ceDeces.equals("0")))	{
218
		if (ceDeces.isEmpty() || ceDeces.equals(ETRE_DECEDE))	{
162
			return false;
219
			return false;
163
		}	else	{
220
		} else {
-
 
221
			return true;
-
 
222
		}
164
			return true;
223
	}
165
		}
224
	public String getDeces()	{
166
	}
225
		return renvoyerValeurCorrecte("ce_deces");
-
 
226
	}
167
	
227
	public void setDeces(String deces)	{
168
	public void setDecesDate(Date decesDate) {
228
		set("ce_deces", deces);
169
		if (decesDate != null)	{
229
	}
-
 
230
	public void setDeces(Date decesDate, String lieuDeces)	{
170
			this.set("deces_date", DateTimeFormat.getFormat("yyyy-MM-dd").format(decesDate));
231
		set("ce_deces", ETRE_DECEDE);
-
 
232
		setDecesDate(decesDate);
-
 
233
		setDecesLieu(lieuDeces);
-
 
234
	}
-
 
235
	public void setNonDecedee()	{
171
		}	else	{
236
		set("ce_deces", ETRE_VIVANT);
Line -... Line 237...
-
 
237
		setDecesDate(null);
172
			this.set("deces_date", "");			
238
		setDecesLieu("");
173
		}
-
 
174
	}
239
	}
175
	
240
	
176
	public String getDecesDate()	{
241
	// DÉCÉS DATE
177
		String dateDeces = "";
242
	public String getDecesDate()	{
178
		dateDeces = get("deces_date");
243
		String dateDeces = renvoyerValeurCorrecte("deces_date");
179
		if (UtilString.isEmpty(dateDeces)||dateDeces.equals("0000-00-00"))	{
244
		if (UtilString.isEmpty(dateDeces) || dateDeces.equals("0000-00-00"))	{
180
			dateDeces = Mediateur.i18nC.inconnue();
-
 
181
		}
245
			dateDeces = Mediateur.i18nC.inconnue();
182
		return dateDeces;
246
		}
183
	}
-
 
184
	
247
		return dateDeces;
185
	public String getNaissanceDate()	{
-
 
186
		String dateNaiss = "";
248
	}
187
		dateNaiss = get("naissance_date");
-
 
188
		if (UtilString.isEmpty(dateNaiss)||dateNaiss.equals("0000-00-00"))	{
-
 
189
			dateNaiss = Mediateur.i18nC.inconnue();
-
 
190
		}
-
 
191
		return dateNaiss;
249
	public void setDecesDate(Date decesDate) {
192
	}
-
 
193
	
-
 
194
	public void setFmtNomComplet(String prefixe, String suffixe)	{
-
 
195
		String fmtNomComplet = "";
-
 
196
		if ((prefixe != null)&&(!prefixe.trim().equals("")))	{
-
 
197
			fmtNomComplet += prefixe + " ";
-
 
198
		}
-
 
199
		
-
 
200
		if ((this.getPrenom()!=null)&&(!this.getPrenom().trim().equals("")))	{
-
 
201
			fmtNomComplet += this.getPrenom() + " ";
-
 
202
		}
-
 
203
		
-
 
204
		if ((this.getNom()!=null)&&(!this.getNom().trim().equals("")))	{
-
 
205
			fmtNomComplet += this.getNom() + " ";
-
 
206
		}
250
		if (decesDate != null)	{
207
		
-
 
208
		if ((suffixe!=null)&&(!suffixe.trim().equals("")))	{
-
 
209
			fmtNomComplet += suffixe;
251
			this.set("deces_date", DateTimeFormat.getFormat("yyyy-MM-dd").format(decesDate));
Line 210... Line -...
210
		}
-
 
211
		
252
		}	else	{
212
		this.set("fmt_nom_complet", UtilString.ucFirst(fmtNomComplet));
-
 
213
	}
253
			this.set("deces_date", "");			
214
	
254
		}
215
	
-
 
216
	//Traitement des truks
-
 
217
	protected void remplacerTypeDansChaineDenormalise(String champ, String type, Object valeur) {
-
 
218
		if (valeur != null && !valeur.equals("")) {
255
	}
219
			ajouterChaineDenormaliseAvecType(champ, type, valeur);
-
 
220
		} else {
-
 
221
			supprimerTypeDansChaineDenormalise(champ, type);
-
 
222
		}
-
 
223
	}
-
 
224
	/**
-
 
225
	 * Ajoute un nouvel élément sans type à une chaine dénormalisée.
-
 
226
	 * Champ de type "truk" contenant seulement des valeurs séparées par ";;".
-
 
227
	 * Si l'élément existe déjà, il ne sera pas ajouté.
256
	
228
	 * 
-
 
229
	 * @param champ le nom du champ dénormalisé
-
 
230
	 * @param valeur la valeur à ajouter
-
 
231
	 */
257
	// DÉCÉS LIEU
232
	protected void ajouterChaineDenormalise(String champ, Object valeur) {
-
 
233
		if (valeur instanceof String) {
-
 
234
			String chaineExistante = renvoyerValeurCorrecte(champ);
-
 
235
			if (chaineExistante.equals("")) {
-
 
236
				this.set(champ, valeur);
-
 
237
			} else {
-
 
238
				// Si la valeur à ajouter n'est pas déjà présente, nous l'ajoutons
-
 
239
				if (!chaineExistante.matches("(^|"+SEPARATEUR_VALEURS+")"+valeur+"("+SEPARATEUR_VALEURS+"|$)")) {
258
	public String getDecesLieu() {
Line 240... Line 259...
240
					this.set(champ, chaineExistante+SEPARATEUR_VALEURS+valeur);
259
		return renvoyerValeurCorrecte("deces_lieu");
241
				}
260
	}