Subversion Repositories eFlore/Applications.del

Rev

Rev 1496 | Rev 1775 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1496 Rev 1667
1
package org.tela_botanica.del.client.modeles;
1
package org.tela_botanica.del.client.modeles;
2
 
2
 
3
import java.util.HashMap;
3
import java.util.HashMap;
4
 
4
 
5
import org.tela_botanica.del.client.i18n.I18n;
5
import org.tela_botanica.del.client.i18n.I18n;
-
 
6
 
-
 
7
import com.google.gwt.core.shared.GWT;
6
 
8
 
7
 
9
 
8
public class Utilisateur {
10
public class Utilisateur {
9
 
11
 
10
	private String nom = "";
12
	private String nom = "";
11
	private String prenom = "";
13
	private String prenom = "";
12
	private String courriel = "";
14
	private String courriel = "";
13
	private String motDePasseHash = "";
15
	private String motDePasseHash = "";
14
	private String id = "0";
16
	private String id = "0";
15
	private String sessionId = "";
17
	private String sessionId = "";
-
 
18
	private String adminNiveau = "0";
16
	private boolean identifie = false;
19
	private boolean identifie = false;
17
	private HashMap<String, String> preferences = null;
20
	private HashMap<String, String> preferences = null;
18
	
21
	
19
	public Utilisateur(String sessionId, String id) {
22
	public Utilisateur(String sessionId, String id) {
20
		this.id = id;
23
		this.id = id;
21
		this.sessionId = sessionId;
24
		this.sessionId = sessionId;
22
	}
25
	}
23
	
26
	
-
 
27
	public Utilisateur(String sessionId, String id, String prenom, String nom, String courriel, 
24
	public Utilisateur(String sessionId, String id, String prenom, String nom, String courriel, String motDePasseHash) {
28
			String motDePasseHash, String adminNiveau) {
25
		this(sessionId, id);
29
		this(sessionId, id);
26
		this.prenom = prenom;
30
		this.prenom = prenom;
27
		this.nom = nom;
31
		this.nom = nom;
28
		this.courriel = courriel;
32
		this.courriel = courriel;
29
		this.motDePasseHash = motDePasseHash;
33
		this.motDePasseHash = motDePasseHash;
-
 
34
		this.adminNiveau = adminNiveau;
30
		identifie = true;
35
		identifie = true;
31
	}
36
	}
32
	
37
	
33
	public String getMotDePasseHash() {
38
	public String getMotDePasseHash() {
34
		return motDePasseHash;
39
		return motDePasseHash;
35
	}
40
	}
36
	
41
	
37
	public void setMotDePasseHash(String motDePasseHash) {
42
	public void setMotDePasseHash(String motDePasseHash) {
38
		this.motDePasseHash = motDePasseHash;
43
		this.motDePasseHash = motDePasseHash;
39
	}
44
	}
40
	
45
	
41
	public String getNom() {
46
	public String getNom() {
42
		return nom;
47
		return nom;
43
	}
48
	}
44
	public void setNom(String nom) {
49
	public void setNom(String nom) {
45
		this.nom = nom;
50
		this.nom = nom;
46
	}
51
	}
47
	public String getPrenom() {
52
	public String getPrenom() {
48
		return prenom;
53
		return prenom;
49
	}
54
	}
50
	public void setPrenom(String prenom) {
55
	public void setPrenom(String prenom) {
51
		this.prenom = prenom;
56
		this.prenom = prenom;
52
	}
57
	}
53
	public String getCourriel() {
58
	public String getCourriel() {
54
		return courriel;
59
		return courriel;
55
	}
60
	}
56
	public void setCourriel(String courriel) {
61
	public void setCourriel(String courriel) {
57
		this.courriel = courriel;
62
		this.courriel = courriel;
58
	}
63
	}
59
	public String getId() {
64
	public String getId() {
60
		return id;
65
		return id;
61
	}
66
	}
62
	public void setId(String id) {
67
	public void setId(String id) {
63
		this.id = id;
68
		this.id = id;
64
	}
69
	}
65
	public boolean estIdentifie() {
70
	public boolean estIdentifie() {
66
		return identifie;
71
		return identifie;
67
	}
72
	}
68
	public void setIdentifie(boolean identifie) {
73
	public void setIdentifie(boolean identifie) {
69
		this.identifie = identifie;
74
		this.identifie = identifie;
70
	}
75
	}
71
	
76
	
72
	public String getNomPrenomFormate() {
77
	public String getNomPrenomFormate() {
73
		return identifie ? prenom+" "+nom : I18n.getVocabulary().anonyme();
78
		return identifie ? prenom+" "+nom : I18n.getVocabulary().anonyme();
74
	}
79
	}
75
	
80
	
76
	public HashMap<String, String> getPreferences() {
81
	public HashMap<String, String> getPreferences() {
77
		return preferences;
82
		return preferences;
78
	}
83
	}
79
	
84
	
80
	public void setPreferences(HashMap<String, String> preferences) {
85
	public void setPreferences(HashMap<String, String> preferences) {
81
		this.preferences = preferences;
86
		this.preferences = preferences;
82
	}
87
	}
-
 
88
	
-
 
89
	public boolean etreAdmin() {
-
 
90
		return this.adminNiveau.equals("2") ? true : false;
-
 
91
	}
-
 
92
	
-
 
93
	public String toString() {
-
 
94
		String utilisateur = id + "\n" + nom + "\n" + prenom + "\n" + courriel + "\n" + motDePasseHash + "\n" + 
-
 
95
			sessionId + "\n" + adminNiveau + "\n";
-
 
96
		return utilisateur;
-
 
97
	}
83
}
98
}