KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > users > User


1 /*
2 Copyright (c) 2003 eInnovation Inc. All rights reserved
3
4 This library is free software; you can redistribute it and/or modify it under the terms
5 of the GNU Lesser General Public License as published by the Free Software Foundation;
6 either version 2.1 of the License, or (at your option) any later version.
7
8 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the GNU Lesser General Public License for more details.
11 */

12
13 package com.openedit.users;
14
15 import java.util.Collection JavaDoc;
16 import java.util.Date JavaDoc;
17 import java.util.List JavaDoc;
18
19
20 /**
21  * This interface represents a user.
22  *
23  * @author Eric and Matt
24  */

25 public interface User extends PropertyContainer
26 {
27     public static final String JavaDoc FIRST_NAME_PROPERTY = "firstName";
28     public static final String JavaDoc LAST_NAME_PROPERTY = "lastName";
29     public static final String JavaDoc EMAIL_PROPERTY = "email";
30     
31     /**
32      * Not a real property, just a string that can be used to refer to the
33      * username in, e.g., search indices.
34      */

35     public static final String JavaDoc USERNAME_PROPERTY = "user-name";
36
37     /**
38      * Retrieve this user's first name. This is a convenience method that is the same as calling
39      * <code>get( FIRST_NAME_PROPERTY )</code>.
40      *
41      * @return The user's first name, or <code>null</code> if the user has no first name
42      */

43     String JavaDoc getFirstName();
44
45     /**
46      * Retrieve this user's last name. This is a convenience method that is the same as calling
47      * <code>get( LAST_NAME_PROPERTY )</code>.
48      *
49      * @return The user's last name, or <code>null</code> if the user has no last name
50      */

51     String JavaDoc getLastName();
52
53     /**
54      * Retrieve this user's email address. This is a convenience method that is the same as
55      * calling <code>get( EMAIL_PROPERTY )</code>.
56      *
57      * @return The user's email address, or <code>null</code> if the user has no last name
58      */

59     String JavaDoc getEmail();
60     
61     /**
62      * Retrieve the date/time at which this user was created.
63      *
64      * @return The creation date
65      */

66     Date JavaDoc getCreationDate();
67     
68     /**
69      * Set this user's first name. This is a convenience method that is the
70      * same as calling <code>put( FIRST_NAME_PROPERTY, inFirstName )</code>.
71      *
72      * @param inFirstName The user's first name, or <code>null</code> to clear
73      * the first name
74      */

75     void setFirstName( String JavaDoc inFirstName );
76     
77     /**
78      * Set this user's last name. This is a convenience method that is the
79      * same as calling <code>put( LAST_NAME_PROPERTY, inLastName )</code>.
80      *
81      * @param inFirstName The user's last name, or <code>null</code> to clear
82      * the last name
83      */

84     void setLastName( String JavaDoc inLastName );
85     
86     /**
87      * Set this user's email address. This is a convenience method that is the
88      * same as calling <code>put( EMAIL_PROPERTY, inEmail )</code>.
89      *
90      * @param inFirstName The user's email address, or <code>null</code> to
91      * clear the email address
92      */

93     void setEmail( String JavaDoc inEmail );
94
95     /**
96      * Retrieve all the groups of which this user is a member.
97      *
98      * @return A collection of {@link Group}s
99      */

100     Collection JavaDoc getGroups();
101     
102     /**
103      * DOCUMENT ME!
104      * @return
105      */

106     public String JavaDoc getPassword();
107     
108     public String JavaDoc getClearPassword();
109     
110     /**
111      * Set this user's password to the given password.
112      *
113      * <p>
114      * FIXME: Do we need to pass in the old password too?
115      * </p>
116      *
117      * @param inPassword The new password
118      *
119      * @throws UserManagerException If the password could not be set
120      */

121     void setPassword(String JavaDoc inPassword) throws UserManagerException;
122
123     /**
124      * Retrieve the user's login name (e.g. "mavery").
125      *
126      * @return The login name
127      */

128     String JavaDoc getUserName();
129     /**
130      * Determine whether or not this user has the given permission, by looking through the user's
131      * groups.
132      *
133      * @param inPermission The permission
134      *
135      * @return <code>true</code> if this user has the given permission, <code>false</code> if not
136      */

137     boolean hasPermission(String JavaDoc inPermission);
138
139     boolean hasProperty(String JavaDoc inProperty);
140
141     public String JavaDoc getShortDescription();
142
143     void setUserName(String JavaDoc inUserName);
144     
145     public List JavaDoc listGroupPermissions();
146
147     public void addGroup(Group inGroup);
148     
149     void clearGroups();
150
151     void removeGroup(Group inGroup);
152
153     boolean isInGroup(Group inGroup);
154     
155     Object JavaDoc getProperty(String JavaDoc inPropertyName);
156
157     public PropertyContainer getPropertyContainer();
158 }
159
Popular Tags