Subversion Repositories eFlore/Applications.del

Rev

Rev 1496 | Rev 2050 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package org.tela_botanica.del.client.modeles;

import java.util.HashMap;

import org.tela_botanica.del.client.i18n.I18n;

import com.google.gwt.core.shared.GWT;


public class Utilisateur {

        private String nom = "";
        private String prenom = "";
        private String courriel = "";
        private String motDePasseHash = "";
        private String id = "0";
        private String sessionId = "";
        private String adminNiveau = "0";
        private boolean identifie = false;
        private HashMap<String, String> preferences = null;
        
        public Utilisateur(String sessionId, String id) {
                this.id = id;
                this.sessionId = sessionId;
        }
        
        public Utilisateur(String sessionId, String id, String prenom, String nom, String courriel, 
                        String motDePasseHash, String adminNiveau) {
                this(sessionId, id);
                this.prenom = prenom;
                this.nom = nom;
                this.courriel = courriel;
                this.motDePasseHash = motDePasseHash;
                this.adminNiveau = adminNiveau;
                identifie = true;
        }
        
        public String getMotDePasseHash() {
                return motDePasseHash;
        }
        
        public void setMotDePasseHash(String motDePasseHash) {
                this.motDePasseHash = motDePasseHash;
        }
        
        public String getNom() {
                return nom;
        }
        public void setNom(String nom) {
                this.nom = nom;
        }
        public String getPrenom() {
                return prenom;
        }
        public void setPrenom(String prenom) {
                this.prenom = prenom;
        }
        public String getCourriel() {
                return courriel;
        }
        public void setCourriel(String courriel) {
                this.courriel = courriel;
        }
        public String getId() {
                return id;
        }
        public void setId(String id) {
                this.id = id;
        }
        public boolean estIdentifie() {
                return identifie;
        }
        public void setIdentifie(boolean identifie) {
                this.identifie = identifie;
        }
        
        public String getNomPrenomFormate() {
                return identifie ? prenom+" "+nom : I18n.getVocabulary().anonyme();
        }
        
        public HashMap<String, String> getPreferences() {
                return preferences;
        }
        
        public void setPreferences(HashMap<String, String> preferences) {
                this.preferences = preferences;
        }
        
        public boolean etreAdmin() {
                return this.adminNiveau.equals("2") ? true : false;
        }
        
        public String toString() {
                String utilisateur = id + "\n" + nom + "\n" + prenom + "\n" + courriel + "\n" + motDePasseHash + "\n" + 
                        sessionId + "\n" + adminNiveau + "\n";
                return utilisateur;
        }
}