Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 769 Rev 896
Line 1... Line 1...
1
package org.tela_botanica.client.modeles;
1
package org.tela_botanica.client.modeles;
Line -... Line 2...
-
 
2
 
2
 
3
import java.util.HashMap;
3
import java.util.Iterator;
4
import java.util.Iterator;
Line -... Line 5...
-
 
5
import java.util.Set;
-
 
6
 
-
 
7
import com.google.gwt.core.client.GWT;
4
import java.util.Set;
8
import com.google.gwt.json.client.JSONArray;
-
 
9
import com.google.gwt.json.client.JSONNumber;
Line 5... Line 10...
5
 
10
import com.google.gwt.json.client.JSONObject;
Line 6... Line 11...
6
import com.google.gwt.json.client.JSONObject;
11
import com.google.gwt.json.client.JSONString;
Line 67... Line 72...
67
	 * @return String nom complet
72
	 * @return String nom complet
68
	 */
73
	 */
69
	public String getNomComplet() {
74
	public String getNomComplet() {
70
		return renvoyerValeurCorrecte("fmt_nom_complet");
75
		return renvoyerValeurCorrecte("fmt_nom_complet");
71
	}
76
	}
-
 
77
	
72
	public void setNomComplet(String nom_complet) {
78
	public void setNomComplet(String nom_complet) {
73
		set("fmt_nom_complet", nom_complet);
79
		set("fmt_nom_complet", nom_complet);
74
	}
80
	}
Line 75... Line 81...
75
 
81
 
Line 121... Line 127...
121
	/**
127
	/**
122
	 * Retourne vrai si utilisateur est identifié.
128
	 * Retourne vrai si utilisateur est identifié.
123
	 * @return boolean
129
	 * @return boolean
124
	 */
130
	 */
125
	public boolean isIdentifie() {
131
	public boolean isIdentifie() {
-
 
132
		if (get("identifie").equals(true) && getLicence().equals("1"))	{
126
		return get("identifie");
133
			return true;
-
 
134
		}	else	{
-
 
135
			return false;
-
 
136
		}
127
	}
137
	}
-
 
138
	
128
	public void setIdentification(Boolean bool) {
139
	public void setIdentification(Boolean bool) {
129
		set("identifie", bool);
140
		set("identifie", bool);
130
	}
141
	}
-
 
142
	
-
 
143
	/**
-
 
144
	 * Renvoie si l'utilisateur est présent dans l'annuaire ou non
-
 
145
	 * @return vrai s'il est présent
-
 
146
	 */
-
 
147
	public boolean existeDansAnnuaire()	{
-
 
148
		HashMap infosAnnuaire = (HashMap) get("infosAnnuaire");
-
 
149
		return !(infosAnnuaire == null || infosAnnuaire.size() == 0);
-
 
150
	}
-
 
151
	
-
 
152
	public HashMap<String, String> getInfosAnnuaire()	{
-
 
153
		if (existeDansAnnuaire())	{
-
 
154
			return (HashMap<String, String>) get("infosAnnuaire");
-
 
155
		} else	{
-
 
156
			return null;
-
 
157
		} 
-
 
158
		
-
 
159
	}
-
 
160
	
-
 
161
	public void setInfosAnnuaire(JSONObject infosAnnuaire)	{
-
 
162
		
-
 
163
		// l'objet JSON est une table de hachage
-
 
164
		Set<String> im = infosAnnuaire.keySet();
-
 
165
		HashMap<String, String> mapAnnuaire = new HashMap<String, String>();
Line -... Line 166...
-
 
166
		
-
 
167
		// Parcourt pour chaque clé
-
 
168
		for (Iterator<String> it = im.iterator(); it.hasNext();) {
-
 
169
 
-
 
170
			String cle = it.next();
-
 
171
			if (infosAnnuaire.get(cle).isString() != null) {
-
 
172
				String valeur = infosAnnuaire.get(cle).isString().stringValue();
-
 
173
				mapAnnuaire.put(cle, valeur);
-
 
174
			}
-
 
175
		}
-
 
176
		
-
 
177
		if (mapAnnuaire.size()>0)	{
-
 
178
			this.set("infosAnnuaire", mapAnnuaire);
-
 
179
		}
-
 
180
	}
-
 
181
	
-
 
182
	public void majUtilisateurInfoAnnuaire()	{
-
 
183
		HashMap<String, String> infosAnnuaire = (HashMap<String, String>) get("infosAnnuaire");
-
 
184
		setNom(infosAnnuaire.get("nom"));
-
 
185
		setPrenom(infosAnnuaire.get("prenom"));
-
 
186
		setLogin(infosAnnuaire.get("courriel"));
-
 
187
		setMotDePasse(infosAnnuaire.get("mot_de_passe"));
-
 
188
	}
-
 
189
	
-
 
190
	public void setLicence(String licence)	{
-
 
191
		this.set("licenceAcceptee", licence);
-
 
192
	}
-
 
193
	
-
 
194
	public String getLicence()	{
-
 
195
		if (this.get("licenceAcceptee") != null)	{
-
 
196
			return this.get("licenceAcceptee");
-
 
197
		} else {
-
 
198
			return "";
-
 
199
		}
131
		
200
	}
132
}
201
}