1 | package fr.alcatel.ether.app.user; |
---|
2 | |
---|
3 | /** |
---|
4 | * Objet métier Utilisateur |
---|
5 | * |
---|
6 | * @version $Id: User.java,v 1.1 2001/01/15 15:38:48 pn Exp $ |
---|
7 | * @author S. Barrau Huguet ALCATEL |
---|
8 | */ |
---|
9 | // JDK - io |
---|
10 | import java.io.Serializable; |
---|
11 | |
---|
12 | //import fr.alcatel.ether.persistency.*; |
---|
13 | //import fr.alcatel.ether.tools.*; |
---|
14 | //import fr.alcatel.ether.app.common.*; |
---|
15 | //import fr.alcatel.ether.app.experiment.*; |
---|
16 | //import fr.alcatel.ether.app.service.*; |
---|
17 | //import fr.alcatel.ether.app.order.*; |
---|
18 | //import fr.alcatel.ether.app.user.*; |
---|
19 | |
---|
20 | import java.util.*; |
---|
21 | |
---|
22 | public class User implements Serializable |
---|
23 | { |
---|
24 | /** Flag pour debug */ |
---|
25 | public static final boolean DEBUG = true; |
---|
26 | |
---|
27 | /** Identifiant */ |
---|
28 | int id; |
---|
29 | |
---|
30 | /** Login de l'utilisateur */ |
---|
31 | private String login; |
---|
32 | |
---|
33 | /** Nom de l'utilisateur */ |
---|
34 | private String name; |
---|
35 | |
---|
36 | /** Prénom de l'utilisateur */ |
---|
37 | private String firstName; |
---|
38 | |
---|
39 | /** Mot de passe */ |
---|
40 | private String password; |
---|
41 | |
---|
42 | /** Email */ |
---|
43 | private String email; |
---|
44 | |
---|
45 | /** Adresse IP */ |
---|
46 | private String ipAddress; |
---|
47 | |
---|
48 | /** Nom laboratoire */ |
---|
49 | private String laboratoryName; |
---|
50 | |
---|
51 | /** Adresse du laboratoire */ |
---|
52 | private String laboratoryAddress; |
---|
53 | |
---|
54 | /** Téléphone du laboratoire */ |
---|
55 | private String telephone; |
---|
56 | |
---|
57 | /** Nom du répertoire racine */ |
---|
58 | private String repository; |
---|
59 | |
---|
60 | /** Taille maximum du répertoire */ |
---|
61 | private int repositoryMaxSize; |
---|
62 | |
---|
63 | /** Taille maximum du transfert par réseau */ |
---|
64 | private int networkQuota; |
---|
65 | |
---|
66 | /** Durée de vie d'une commande dans le répertoire utilisateur */ |
---|
67 | private int orderLifeTime; |
---|
68 | |
---|
69 | /** Identifiant média par défaut */ |
---|
70 | private int mediaId; |
---|
71 | |
---|
72 | /** Role administrateur */ |
---|
73 | private String role; |
---|
74 | |
---|
75 | /** Role admin*/ |
---|
76 | public static String ADMINISTRATEUR = "A"; |
---|
77 | |
---|
78 | /** Role utilisateur simple */ |
---|
79 | public static String UTILISATEUR = "U"; |
---|
80 | |
---|
81 | /** |
---|
82 | * Constructeur |
---|
83 | * |
---|
84 | */ |
---|
85 | public User() |
---|
86 | { |
---|
87 | super(); |
---|
88 | } |
---|
89 | |
---|
90 | /** |
---|
91 | * Constructeur |
---|
92 | * |
---|
93 | * @param id identifiant |
---|
94 | */ |
---|
95 | public User( int id ) |
---|
96 | { |
---|
97 | super(); |
---|
98 | setId( id ); |
---|
99 | } |
---|
100 | |
---|
101 | /** |
---|
102 | * Positionne l'identifiant de l'utilisateur |
---|
103 | * |
---|
104 | * @param id identifiant de l'utilisateur |
---|
105 | */ |
---|
106 | public void setId( int id ){ this.id = id; } |
---|
107 | |
---|
108 | /** |
---|
109 | * Renvoie l'identifiant de l'utilisateur |
---|
110 | * |
---|
111 | * @return l'identifiant de l'utilisateur |
---|
112 | */ |
---|
113 | public int getId(){ return this.id; } |
---|
114 | |
---|
115 | public void setLogin( String login ){ this.login = login; } |
---|
116 | |
---|
117 | public String getLogin() |
---|
118 | { |
---|
119 | return this.login; |
---|
120 | } |
---|
121 | |
---|
122 | public void setName( String name ){ this.name = name; } |
---|
123 | |
---|
124 | public String getName(){ return this.name; } |
---|
125 | public void setFirstName( String firstname ){ this.firstName = firstname; } |
---|
126 | public String getFirstName(){ return this.firstName; } |
---|
127 | public void setPassword( String password ){ this.password = password; } |
---|
128 | public String getPassword(){ return this.password; } |
---|
129 | public void setEmail( String email ){ this.email = email; } |
---|
130 | public String getEmail(){ return this.email; } |
---|
131 | public void setIpAddress( String addip ){ this.ipAddress = addip; } |
---|
132 | public String getIpAddress(){ return this.ipAddress; } |
---|
133 | public void setLaboratoryName( String laboratoryName ){ this.laboratoryName = laboratoryName; } |
---|
134 | public String getLaboratoryName(){ return this.laboratoryName; } |
---|
135 | public void setLaboratoryAddress( String add ){ this.laboratoryAddress = add; } |
---|
136 | public String getLaboratoryAddress(){ return this.laboratoryAddress; } |
---|
137 | public void setTelephone( String telephone ){ this.telephone = telephone; } |
---|
138 | public String getTelephone(){ return this.telephone; } |
---|
139 | public void setRepository( String repository ){ this.repository = repository; } |
---|
140 | public String getRepository(){ return this.repository; } |
---|
141 | public void setNetworkQuota( int maxNetwork ){ this.networkQuota = maxNetwork; } |
---|
142 | public int getNetworkQuota(){ return this.networkQuota; } |
---|
143 | public void setRepositoryMaxSize( int maxRep ){ this.repositoryMaxSize = maxRep; } |
---|
144 | public int getRepositoryMaxSize(){ return this.repositoryMaxSize; } |
---|
145 | public void setOrderLifeTime( int time ){ this.orderLifeTime = time; } |
---|
146 | public int getOrderLifeTime(){ return this.orderLifeTime; } |
---|
147 | public void setMediaId( int media ){ this.mediaId = media; } |
---|
148 | public int getMediaId(){ return this.mediaId; } |
---|
149 | // public Media getMedia(){ return (Media)Config.media.get( new Integer( mediaId ) ); } |
---|
150 | public void setRole( String role ){ this.role = role; } |
---|
151 | public String getRole(){ return this.role; } |
---|
152 | |
---|
153 | /** |
---|
154 | * <p> Vérifier s'il le role de utilisateur est un administrateur.</p> |
---|
155 | * |
---|
156 | * @return true s'il y a des fichiers hors-ligne, false sinon |
---|
157 | */ |
---|
158 | public boolean isAdmin() |
---|
159 | { |
---|
160 | String role = getRole(); |
---|
161 | |
---|
162 | if ( role != null ) |
---|
163 | return role.equals( ADMINISTRATEUR ); |
---|
164 | else |
---|
165 | return false; |
---|
166 | } |
---|
167 | } |
---|