1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 package com.drazzib.netpisteur.configuration;
31
32 import java.net.MalformedURLException;
33 import java.net.URL;
34
35 import org.apache.commons.logging.Log;
36 import org.apache.commons.logging.LogFactory;
37
38 /**
39 * <P>
40 * <STRONG>Description </STRONG>
41 * <P>
42 * Represents an User
43 *
44 *
45 * @since 2002/03/18
46 * @author NetPisteur Team
47 */
48
49 public class Utilisateur extends Personne {
50
51 private static Log log = LogFactory.getLog(Utilisateur.class);
52
53 /**
54 * Represents the password of an user
55 */
56 private String motDePasse;
57
58 /**
59 * Represents the directory of an user
60 */
61 private String separateur;
62
63 /**
64 * Represents the default URL of an user
65 */
66 private String pageAccueil;
67
68 /**
69 * Utilisateur()
70 */
71 public Utilisateur() {
72 super();
73 this.motDePasse = "";
74 this.separateur = "";
75 this.pageAccueil = "";
76
77 }
78
79 /**
80 * Utilisateur(String unNom, String unPrenom, String unMotDePasse, String
81 * unSeparateur, URL unePageAccueil) : 2nd constructor
82 *
83 * @param unNom
84 * name of the user
85 * @param unPrenom
86 * firstname of the user
87 * @param unMotDePasse
88 * password of the person
89 * @param unSeparateur
90 * directory of the person
91 * @param unePageAccueil
92 * default url of the person
93 *
94 */
95 public Utilisateur(String unNom, String unPrenom, String unMotDePasse,
96 String unSeparateur, String unePageAccueil) {
97
98 super(unNom, unPrenom);
99 this.motDePasse = unMotDePasse;
100 this.separateur = unSeparateur;
101 this.pageAccueil = unePageAccueil;
102
103 }
104
105
106
107
108 /**
109 * setMotDePasse(String unMotDePasse) : set the password
110 *
111 * @param unMotDePasse
112 * a password
113 *
114 */
115 public void setMotDePasse(String unMotDePasse) {
116
117 this.motDePasse = unMotDePasse;
118
119 }
120
121 /**
122 * setSeparateur(String unSeparateur) : set the directory to store data
123 *
124 * @param unSeparateur
125 * a directory
126 *
127 */
128 public void setSeparateur(String unSeparateur) {
129
130 this.separateur = unSeparateur;
131
132 }
133
134 /**
135 * setPageAccueil(String unePageAccueil) : set the user's default url
136 *
137 * @param unePageAccueil
138 * an Url
139 *
140 */
141 public void setPageAccueil(String unePageAccueil) {
142
143 this.pageAccueil = unePageAccueil;
144
145 }
146
147
148
149
150 /**
151 * getMotDePasse() : return the password
152 *
153 * @return the password
154 *
155 */
156 public String getMotDePasse() {
157
158 return this.motDePasse;
159
160 }
161
162 public String getPage() {
163
164 return this.pageAccueil;
165
166 }
167
168 /**
169 * getSeparateur() : return the directory
170 *
171 * @return the directory
172 *
173 */
174 public String getSeparateur() {
175
176 return this.separateur;
177
178 }
179
180 /**
181 * getPageAccueil() : return the user's default url
182 *
183 * @return the user's default url
184 *
185 */
186 public URL getPageAccueil() {
187 URL startPage = null;
188
189 try {
190
191 if (this.pageAccueil == null) {
192
193 log.info("Page d'accueil non definie : page accueil par defaut");
194 startPage = new URL("http://www.yahoo.fr/");
195 }
196
197 else {
198 startPage = new URL(this.pageAccueil);
199
200 }
201
202 } catch (MalformedURLException ex) {
203 log.error("URL Invalide : " + this.pageAccueil);
204 }
205
206 return startPage;
207
208 }
209
210
211
212
213 public boolean equals(Object arg0) {
214 if (arg0 == this)
215 return true;
216
217 if (arg0 instanceof Utilisateur)
218 {
219 if (this.getNom() != null
220 && this.getNom().equals(((Utilisateur)arg0).getNom())
221 && this.getPrenom() != null
222 && this.getPrenom().equals(((Utilisateur)arg0).getPrenom()))
223 {
224 return true;
225 }
226 }
227
228 return false;
229 }
230
231 public String toString() {
232 StringBuffer oOut = new StringBuffer();
233
234 oOut.append("[Utilisateur]");
235 oOut.append("Nom:").append(this.getNom()).append("/");
236 oOut.append("Prenom:").append(this.getPrenom()).append("/");
237 oOut.append("Page:").append(this.getPage()).append("/");
238 oOut.append("Separateur:").append(this.getSeparateur());
239
240 return oOut.toString();
241 }
242
243 }
244