| 102 |
jpm |
1 |
package org.tela_botanica.client.modeles;
|
|
|
2 |
|
| 350 |
gduche |
3 |
import java.util.Date;
|
| 102 |
jpm |
4 |
import java.util.Iterator;
|
|
|
5 |
import java.util.Set;
|
|
|
6 |
|
| 620 |
gduche |
7 |
import org.tela_botanica.client.util.UtilString;
|
|
|
8 |
|
| 350 |
gduche |
9 |
import com.google.gwt.core.client.GWT;
|
|
|
10 |
import com.google.gwt.i18n.client.DateTimeFormat;
|
| 102 |
jpm |
11 |
import com.google.gwt.json.client.JSONObject;
|
|
|
12 |
|
|
|
13 |
public class Personne extends aDonnee {
|
| 208 |
jp_milcent |
14 |
|
| 748 |
jpm |
15 |
private static final long serialVersionUID = -6974716696155349332L;
|
|
|
16 |
|
| 208 |
jp_milcent |
17 |
public static final String PREFIXE = "cp";
|
| 245 |
jp_milcent |
18 |
public static final String TELEPHONE_FIXE = "FIX";
|
|
|
19 |
public static final String TELEPHONE_GSM = "GSM";
|
| 602 |
jp_milcent |
20 |
public static final String TELEPHONE_FAX = "FAX";
|
| 208 |
jp_milcent |
21 |
|
| 103 |
jpm |
22 |
public Personne() {
|
|
|
23 |
}
|
|
|
24 |
|
| 775 |
jpm |
25 |
public Personne(JSONObject personne) {
|
|
|
26 |
initialiserModele(personne);
|
| 261 |
gduche |
27 |
//Ajout du champ courriel principal
|
|
|
28 |
this.set("courriel_princ", this.getInfoDenormaliseParPosition(this.renvoyerValeurCorrecte("truk_courriel"), 1));
|
| 102 |
jpm |
29 |
}
|
|
|
30 |
|
| 748 |
jpm |
31 |
@Override
|
|
|
32 |
protected String getPrefixe() {
|
|
|
33 |
return PREFIXE;
|
|
|
34 |
}
|
|
|
35 |
|
| 240 |
jp_milcent |
36 |
// ID PERSONNE
|
| 102 |
jpm |
37 |
public String getId() {
|
| 240 |
jp_milcent |
38 |
return renvoyerValeurCorrecte("id_personne");
|
| 102 |
jpm |
39 |
}
|
|
|
40 |
|
| 609 |
jp_milcent |
41 |
// ID PROJET
|
|
|
42 |
public String getIdProjet() {
|
|
|
43 |
return renvoyerValeurCorrecte("ce_projet");
|
|
|
44 |
}
|
|
|
45 |
|
| 240 |
jp_milcent |
46 |
// NOM COMPLET
|
|
|
47 |
public String getNomComplet() {
|
|
|
48 |
return renvoyerValeurCorrecte("fmt_nom_complet");
|
| 181 |
gduche |
49 |
}
|
|
|
50 |
|
| 240 |
jp_milcent |
51 |
// NOM
|
|
|
52 |
public String getNom() {
|
|
|
53 |
return renvoyerValeurCorrecte("nom");
|
| 181 |
gduche |
54 |
}
|
|
|
55 |
|
| 240 |
jp_milcent |
56 |
// PRÉNOM
|
|
|
57 |
public String getPrenom() {
|
|
|
58 |
return renvoyerValeurCorrecte("prenom");
|
| 238 |
aurelien |
59 |
}
|
|
|
60 |
|
| 350 |
gduche |
61 |
public Date getDate(String nomChamp) {
|
|
|
62 |
|
|
|
63 |
String strDate = renvoyerValeurCorrecte(nomChamp);
|
|
|
64 |
|
|
|
65 |
Date dateRetour = null;
|
|
|
66 |
try
|
|
|
67 |
{
|
|
|
68 |
if ((strDate != null) && (!strDate.equals("0000-00-00"))) {
|
|
|
69 |
dateRetour = DateTimeFormat.getFormat("yyyy-MM-dd").parseStrict(strDate);
|
|
|
70 |
}
|
|
|
71 |
} catch (StringIndexOutOfBoundsException e) {
|
|
|
72 |
GWT.log("Impossible de parser la date " + strDate, e);
|
|
|
73 |
}
|
|
|
74 |
return dateRetour;
|
|
|
75 |
}
|
|
|
76 |
|
| 240 |
jp_milcent |
77 |
// TÉLÉPHONE
|
|
|
78 |
public String getTelephone() {
|
|
|
79 |
return renvoyerValeurCorrecte("truk_telephone");
|
|
|
80 |
}
|
|
|
81 |
public void setTelephone(String t) {
|
|
|
82 |
this.set("truk_telephone", t);
|
|
|
83 |
}
|
| 245 |
jp_milcent |
84 |
public void ajouterTelephone(String type, Object valeur) {
|
| 240 |
jp_milcent |
85 |
ajouterChaineDenormaliseAvecType("truk_telephone", type, valeur);
|
|
|
86 |
}
|
| 245 |
jp_milcent |
87 |
public String selectionnerTelephone(String type) {
|
|
|
88 |
return getInfoDenormaliseParType(renvoyerValeurCorrecte("truk_telephone"), type);
|
|
|
89 |
}
|
| 240 |
jp_milcent |
90 |
|
|
|
91 |
// FAX
|
|
|
92 |
public String getFax() {
|
|
|
93 |
return renvoyerValeurCorrecte("truk_fax");
|
|
|
94 |
}
|
|
|
95 |
public void setFax(String f) {
|
|
|
96 |
this.set("truk_fax", f);
|
|
|
97 |
}
|
| 245 |
jp_milcent |
98 |
public void ajouterFax(Object valeur) {
|
| 240 |
jp_milcent |
99 |
ajouterChaineDenormalise("truk_fax", valeur);
|
|
|
100 |
}
|
| 245 |
jp_milcent |
101 |
public String selectionnerFax(int position) {
|
|
|
102 |
return getInfoDenormaliseParPosition(renvoyerValeurCorrecte("truk_fax"), position);
|
|
|
103 |
}
|
| 240 |
jp_milcent |
104 |
|
|
|
105 |
// COURRIEL
|
|
|
106 |
public String getCourriel() {
|
|
|
107 |
return renvoyerValeurCorrecte("truk_courriel");
|
|
|
108 |
}
|
|
|
109 |
public void setCourriel(String c) {
|
|
|
110 |
this.set("truk_courriel", c);
|
|
|
111 |
}
|
| 245 |
jp_milcent |
112 |
public void ajouterCourriel(String c) {
|
| 240 |
jp_milcent |
113 |
ajouterChaineDenormalise("truk_courriel", c);
|
|
|
114 |
}
|
| 245 |
jp_milcent |
115 |
public String selectionnerCourriel(int position) {
|
|
|
116 |
return getInfoDenormaliseParPosition(renvoyerValeurCorrecte("truk_courriel"), position);
|
|
|
117 |
}
|
| 240 |
jp_milcent |
118 |
|
|
|
119 |
// SPÉCIALITÉ
|
|
|
120 |
public String getSpecialite() {
|
|
|
121 |
return renvoyerValeurCorrecte("ce_truk_specialite");
|
|
|
122 |
}
|
|
|
123 |
public void setSpecialite(String s) {
|
|
|
124 |
// Pas de liste pour l'instant, donc tout passe dans "Autre".
|
|
|
125 |
setChaineDenormaliseUnique("ce_truk_specialite", "AUTRE", s);
|
|
|
126 |
}
|
| 245 |
jp_milcent |
127 |
public String afficherSpecialite() {
|
|
|
128 |
return getChaineDenormaliseUnique("ce_truk_specialite");
|
|
|
129 |
}
|
| 240 |
jp_milcent |
130 |
|
| 181 |
gduche |
131 |
public Object obtenirValeurChamp(String nomChamp) {
|
|
|
132 |
return renvoyerValeurCorrecte(nomChamp);
|
|
|
133 |
}
|
| 431 |
gduche |
134 |
|
|
|
135 |
|
|
|
136 |
public String getString(String champ) {
|
|
|
137 |
return String.valueOf(renvoyerValeurCorrecte(champ));
|
|
|
138 |
}
|
| 455 |
gduche |
139 |
|
|
|
140 |
public void setNaissanceDate(Date naissanceDate) {
|
|
|
141 |
if (naissanceDate != null) {
|
|
|
142 |
this.set("naissance_date", DateTimeFormat.getFormat("yyyy-MM-dd").format(naissanceDate));
|
|
|
143 |
}
|
|
|
144 |
}
|
|
|
145 |
|
|
|
146 |
public void setDecesDate(Date decesDate) {
|
|
|
147 |
if (decesDate != null) {
|
|
|
148 |
this.set("deces_date", DateTimeFormat.getFormat("yyyy-MM-dd").format(decesDate));
|
|
|
149 |
}
|
|
|
150 |
}
|
|
|
151 |
|
|
|
152 |
public void setFmtNomComplet(String prefixe, String suffixe) {
|
|
|
153 |
String fmtNomComplet = "";
|
|
|
154 |
if ((prefixe != null)&&(!prefixe.trim().equals(""))) {
|
|
|
155 |
fmtNomComplet += prefixe + " ";
|
|
|
156 |
}
|
|
|
157 |
|
|
|
158 |
if ((this.getPrenom()!=null)&&(!this.getPrenom().trim().equals(""))) {
|
|
|
159 |
fmtNomComplet += this.getPrenom() + " ";
|
|
|
160 |
}
|
|
|
161 |
|
|
|
162 |
if ((this.getNom()!=null)&&(!this.getNom().trim().equals(""))) {
|
|
|
163 |
fmtNomComplet += this.getNom() + " ";
|
|
|
164 |
}
|
|
|
165 |
|
|
|
166 |
if ((suffixe!=null)&&(!suffixe.trim().equals(""))) {
|
|
|
167 |
fmtNomComplet += suffixe;
|
|
|
168 |
}
|
|
|
169 |
|
| 620 |
gduche |
170 |
this.set("fmt_nom_complet", UtilString.ucFirst(fmtNomComplet));
|
| 455 |
gduche |
171 |
}
|
| 181 |
gduche |
172 |
|
| 102 |
jpm |
173 |
}
|