KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > admin > security > user > UserDO


1 /*
2  * Copyright (c) 2001 - 2005 ivata limited.
3  * All rights reserved.
4  * -----------------------------------------------------------------------------
5  * ivata groupware may be redistributed under the GNU General Public
6  * License as published by the Free Software Foundation;
7  * version 2 of the License.
8  *
9  * These programs are free software; you can redistribute them and/or
10  * modify them under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; version 2 of the License.
12  *
13  * These programs are distributed in the hope that they will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * See the GNU General Public License in the file LICENSE.txt for more
18  * details.
19  *
20  * If you would like a copy of the GNU General Public License write to
21  *
22  * Free Software Foundation, Inc.
23  * 59 Temple Place - Suite 330
24  * Boston, MA 02111-1307, USA.
25  *
26  *
27  * To arrange commercial support and licensing, contact ivata at
28  * http://www.ivata.com/contact.jsp
29  * -----------------------------------------------------------------------------
30  * $Log: UserDO.java,v $
31  * Revision 1.4 2005/04/29 02:48:20 colinmacleod
32  * Data bugfixes.
33  * Changed primary key back to Integer.
34  *
35  * Revision 1.3 2005/04/10 20:09:48 colinmacleod
36  * Added new themes.
37  * Changed id type to String.
38  * Changed i tag to em and b tag to strong.
39  * Improved PicoContainerFactory with NanoContainer scripts.
40  *
41  * Revision 1.2 2005/04/09 17:19:57 colinmacleod
42  * Changed copyright text to GPL v2 explicitly.
43  *
44  * Revision 1.1.1.1 2005/03/10 17:51:42 colinmacleod
45  * Restructured ivata op around Hibernate/PicoContainer.
46  * Renamed ivata groupware.
47  *
48  * Revision 1.3 2004/12/31 19:28:04 colinmacleod
49  * Added override for displayValue.
50  *
51  * Revision 1.2 2004/11/03 16:10:10 colinmacleod
52  * Changed todo comments to TODO: all caps.
53  *
54  * Revision 1.1 2004/09/30 15:15:59 colinmacleod
55  * Split off addressbook elements into security subproject.
56  *
57  * Revision 1.2 2004/07/18 21:56:17 colinmacleod
58  * Removed person. This is a one-way relationship to make it faster.
59  *
60  * Revision 1.1 2004/07/13 19:15:26 colinmacleod
61  * Moved from business.addressbook to admin.security.
62  *
63  * Revision 1.3 2004/03/21 21:16:07 colinmacleod
64  * Shortened name to ivata op.
65  *
66  * Revision 1.2 2004/02/01 22:00:32 colinmacleod
67  * Added full names to author tags
68  *
69  * Revision 1.1.1.1 2004/01/27 20:57:52 colinmacleod
70  * Moved ivata openportal to SourceForge..
71  *
72  * Revision 1.8 2003/12/12 11:08:58 jano
73  * fixing aaddressbook functionaality
74  *
75  * Revision 1.7 2003/11/13 16:03:16 jano
76  * commitng everything to CVS
77  * can deploy and application is ruuning, can login into
78  *
79  * Revision 1.6 2003/11/03 11:28:24 jano
80  * commiting addressbook,
81  * tryinjg to fix deploying problem
82  *
83  * Revision 1.5 2003/10/17 12:36:12 jano
84  * fixing problems with building
85  * converting intranet -> portal
86  * Eclipse building
87  *
88  * Revision 1.4 2003/10/16 06:17:06 jano
89  * fixing comments
90  *
91  * Revision 1.3 2003/10/15 13:41:12 jano
92  * converting to XDoclet
93  *
94  * Revision 1.2 2003/10/15 13:18:02 colin
95  * fixing for XDoclet
96  *
97  * Revision 1.6 2003/09/11 13:10:48 jano
98  * fixing bugs with ranaming userName and with removing user from system
99  *
100  * Revision 1.5 2003/07/25 11:41:57 jano
101  * adding functionality for addressBook extension
102  *
103  * Revision 1.4 2003/05/01 12:13:22 jano
104  * tidy up names of sequeneces
105  *
106  * Revision 1.3 2003/04/09 08:52:14 jano
107  * handling data of removing user
108  *
109  * Revision 1.2 2003/02/25 14:38:13 colin
110  * implemented setModified methods on entity beans thro IvataEntityBean superclass
111  *
112  * Revision 1.1 2003/02/24 19:09:21 colin
113  * moved to business
114  *
115  * Revision 1.11 2003/02/04 17:43:45 colin
116  * copyright notice
117  *
118  * Revision 1.10 2003/01/09 13:32:51 jano
119  * I remove relationShip between user and Event
120  *
121  * Revision 1.9 2002/10/22 10:46:13 colin
122  * resurrected LibraryItemRight to fix problems when deleting library items
123  *
124  * Revision 1.8 2002/10/03 12:34:16 colin
125  * Removed LibraryItemRightBean - replaced with CMR on User
126  *
127  * Revision 1.7 2002/09/02 08:56:10 colin
128  * events relationship (dont know where it came from)
129  *
130  * Revision 1.6 2002/07/26 14:42:22 colin
131  * added a person CMR to the user
132  *
133  * Revision 1.5 2002/07/15 08:16:07 colin
134  * added person to create
135  *
136  * Revision 1.4 2002/07/04 12:29:28 jano
137  * i put readonly script to CVS and i will commit all SRC directory
138  *
139  * Revision 1.3 2002/06/28 13:15:23 colin
140  * first addressbook release
141  *
142  * Revision 1.2 2002/06/17 07:28:52 colin
143  * improved and extended javadoc documentation
144  * -----------------------------------------------------------------------------
145  */

146 package com.ivata.groupware.admin.security.user;
147
148
149 import java.util.Set JavaDoc;
150
151 import com.ivata.groupware.container.persistence.BaseDO;
152
153
154 /**
155  * <p>Each user within the system has a user name, and activation information
156  * such as a password. This class maintains this information.</p>
157  *
158  * @since 2002-05-05
159  * @author Colin MacLeod
160  * <a HREF='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
161  * @version $Revision: 1.4 $
162  *
163  * @hibernate.class
164  * table="person_user"
165  * @hibernate.cache
166  * usage="read-write"
167  */

168 public class UserDO extends BaseDO {
169     /**
170      * <p><code>true</code> if user was deleted, and created some data in system
171      * which we don't want to remove.</p>
172      */

173     private boolean deleted;
174
175     /**
176      * <p>Find out if a user is enabled or disabled.</p>
177      */

178     private boolean enabled;
179
180     /**
181      * <p>Each user is a member of several groups. By default, each user is a
182      * member of the group called "everyOne" </p>
183      */

184     private Set JavaDoc groups;
185
186     /**
187      * <p>The user name. This name must uniquely identify the user
188      * within the system, and should only contain alphanumeric characters.</p>
189      */

190     private String JavaDoc name;
191
192     /**
193      * <p>The user's password, if the authentication is not done through the
194      * <code>IMAP</code> webmail interface.</p>
195      */

196     private String JavaDoc password;
197
198     /**
199      * <p>If the user is deleted we will make new name.</p>
200      * @return userName
201      */

202     public final String JavaDoc getDisplayName() {
203         if (isDeleted()) {
204             return this.getName() + " (deleted)";
205         } else {
206             return this.getName();
207         }
208     }
209     /**
210      * <p>
211      * For a user, the value displayed in a choice box is just the user name,
212      * </p>
213      *
214      * @see com.ivata.mask.valueobject.ValueObject#getDisplayValue()
215      */

216     public final String JavaDoc getDisplayValue() {
217         return name;
218     }
219     /**
220      * <p>Each user is a member of several groups. By default, each user is a
221      * member of the group called "everyOne" </p>
222      *
223      * @hibernate.set
224      * role="person_group"
225      * table="person_group_member"
226      * @hibernate.collection-key
227      * column="person_user"
228      * @hibernate.collection-many-to-many
229      * class="com.ivata.groupware.business.addressbook.person.group.GroupDO"
230      * column="person_group"
231      */

232     public final Set JavaDoc getGroups() {
233         return groups;
234     }
235     /**
236      * <p>
237      * Unique identifier of this data object.
238      * </p>
239      *
240      * NOTE: this is a hibernate one-to-one relationship with person, so we
241      * need no generator here...
242      * @hibernate.id
243      * generator-class = "assigned"
244      */

245     public final Integer JavaDoc getId() {
246        return super.getId();
247     }
248     /**
249      * <p>Get the user name. This name must uniquely identify the user
250      * within the system, and should only contain alphanumeric characters.</p>
251      *
252      * @return new value for the user name. Should be unique within the intranet
253      * system.
254      *
255      * @hibernate.property
256      */

257     public final String JavaDoc getName() {
258         return name;
259     }
260     /**
261      * <p>Get the user's password, if the authentication is not done through the
262      * <code>IMAP</code> webmail interface.</p>
263      *
264      * @return new value of the user's password (encrypted).
265      *
266      * @hibernate.property
267      */

268     public final String JavaDoc getPassword() {
269         return password;
270     }
271     /**
272      * <p>True if user was deleted, and he did created some date in system which we don't want to remove.</p>
273      * @return
274      *
275      * @hibernate.property
276      */

277     public boolean isDeleted() {
278         return deleted;
279     }
280     /**
281      * <p>Find out if a user is enabled or disabled.</p>
282      *
283      * @return <code>true</code> if the user is currently enabled, or
284      * <code>false</code> if the user is prevented from accessing the
285      * system.
286      *
287      * TODO: change column to enabled
288      * @hibernate.property
289      * column="enable"
290      */

291     public boolean isEnabled() {
292         return enabled;
293     }
294
295     /**
296      * <p>Set to <code>true</code> if user was deleted, and created some data
297      * in the system which we don't want to remove.</p>
298      */

299     public final void setDeleted(final boolean deleted) {
300         this.deleted = deleted;
301     }
302
303     /**
304      * <p>Enable/disable this user. This prevents the usr from being able to
305      * login and access the system.</p>
306      *
307      * @param enable set to <code>true</code> to the enable the user, or
308      * <code>false</code> to prevent this user from accessing the system.
309      */

310     public final void setEnabled(final boolean enabled) {
311         this.enabled = enabled;
312     }
313
314     /**
315      * <p>Each user is a member of several groups. By default, each user is a
316      * member of the group called "everyOne" </p>
317      */

318     public final void setGroups(final Set JavaDoc groups) {
319         this.groups = groups;
320     }
321
322     /**
323      * <p>Sets the user name. This name must uniquely identify the user
324      * within the system, and should only contain alphanumeric characters.</p>
325      *
326      * @param name new value for the user name. Should be unique within the
327      * intranet system.
328      */

329     public final void setName(final String JavaDoc name) {
330         this.name = name;
331     }
332
333     /**
334      * <p>Set the user's password, if the authentication is not done through the
335      * <code>IMAP</code> webmail interface.</p>
336      *
337      * @param password new value of the user's password, already encrypted.
338      */

339     public final void setPassword(final String JavaDoc password) {
340         this.password = password;
341     }
342
343 }
344
Popular Tags