001: /*
002: * @author <a href="mailto:novotny@gridsphere.org">Jason Novotny</a>
003: * @author <a href="mailto:oliver@wehrens.de">Oliver Wehrens</a>
004: * @version $Id: User.java 6385 2007-10-25 14:02:26Z wehrens $
005: */
006: package org.gridsphere.services.core.user;
007:
008: import java.util.Enumeration;
009:
010: /**
011: * The <code>User</code> interface is an abstract view on the user-specific data.
012: * Apart from a set of pre-defined, fixed set of attributes,
013: * the interface gives access to user profile data.
014: */
015: public interface User {
016:
017: /**
018: * Users locale preference stored as an attribute with this key
019: */
020: public static final String LOCALE = "gridsphere.user.locale";
021:
022: public static final String TIMEZONE = "gridsphere.user.timezone";
023:
024: public static final String THEME = "gridsphere.user.theme";
025:
026: public static final String DISABLED = "gridsphere.user.disabled";
027:
028: public static final String CREATEDATE = "gridsphere.user.createdate";
029:
030: /**
031: * Returns the value of the attribute with the given name,
032: * or null if no attribute with the given name exists.
033: *
034: * @param name the attribute name
035: * @return the attribute value
036: */
037: public Object getAttribute(String name);
038:
039: /**
040: * Sets the value of the attribute with the given name,
041: *
042: * @param name the attribute name
043: * @param value the attribute value
044: */
045: public void setAttribute(String name, String value);
046:
047: /**
048: * Returns an enumeration of names of all attributes available to this
049: * request. This method returns an empty enumeration if the request has
050: * no attributes available to it.
051: *
052: * @return an enumeration of attribute names
053: */
054: public Enumeration getAttributeNames();
055:
056: /**
057: * Returns the last name of the user.
058: *
059: * @return the last name
060: */
061: public String getLastName();
062:
063: /**
064: * Sets the last name of the user.
065: *
066: * @param lastName the last name
067: */
068: public void setLastName(String lastName);
069:
070: /**
071: * Returns the family (aka last) name of the user.
072: *
073: * @return the family name
074: */
075: public String getFirstName();
076:
077: /**
078: * Sets the first name of the user.
079: *
080: * @param firstName the first name
081: */
082: public void setFirstName(String firstName);
083:
084: /**
085: * Returns the full name of the user, or null if the full name is not
086: * available. The full name contains given names, family names and possibly
087: * a title or suffix. Therefore, the full name may be different from the
088: * concatenation of given and family name.
089: *
090: * @return the full name
091: */
092: public String getFullName();
093:
094: /**
095: * Sets the full name of the user, or null if the full name is not available.
096: * The full name contains given names, family names and possibly a title or suffix.
097: * Therefore, the full name may be different from the concatenation of given and family name.
098: *
099: * @param fullName the full name
100: */
101: public void setFullName(String fullName);
102:
103: /**
104: * Returns the organization affiliation association of the user
105: *
106: * @return the organization name
107: */
108: public String getOrganization();
109:
110: /**
111: * Sets the organization the user belongs to
112: *
113: * @param organization the organization name
114: */
115: public void setOrganization(String organization);
116:
117: /**
118: * Returns the given e-mail of the user or <code>null</code> if none
119: * is available.
120: *
121: * @return the email address
122: */
123: public String getEmailAddress();
124:
125: /**
126: * Sets the given e-mail of the user.
127: *
128: * @param emailAddress the email address
129: */
130: public void setEmailAddress(String emailAddress);
131:
132: /**
133: * Returns the internal unique user id.
134: *
135: * @return the internal unique user id
136: */
137: public String getID();
138:
139: /**
140: * Sets the internal unique user id.
141: *
142: * @param id the internal unique id
143: */
144: public void setID(String id);
145:
146: /**
147: * Returns the user id of the user, or <code>null</code> if the user id
148: * is not available. The userid is the user's login name
149: *
150: * @return the user id
151: * @see #getUserName
152: */
153: public String getUserID();
154:
155: /**
156: * Sets the user id of the user, or null if the user id is not available.
157: *
158: * @param userID the user id
159: */
160: public void setUserID(String userID);
161:
162: /**
163: * This is an alias for the getUserID method, which for all intensive
164: * purposes represents the name required for this user to login.
165: *
166: * @return String the user id
167: * @see #getUserID
168: */
169: public String getUserName();
170:
171: /**
172: * This is an alias for the setUserID method, which for all intensive
173: * purposes represents the name required for this user to login.
174: *
175: * @param userName the user name
176: */
177: public void setUserName(String userName);
178:
179: /**
180: * Returns the point of time that this user was last logged in, or
181: * <code>null</code> if this information is not available.
182: * The time is returned in number of milliseconds since January 1, 1970 GMT.
183: *
184: * @return the last login time
185: */
186: public Long getLastLoginTime();
187:
188: /**
189: * Sets the point of time that this user was last logged in, or null if this
190: * information is not available. The time is returned in number of milliseconds
191: * since January 1, 1970 GMT.
192: *
193: * @param lastLoginTime the last login time
194: */
195: public void setLastLoginTime(Long lastLoginTime);
196:
197: /**
198: * Returns the number of login occurences for this user
199: *
200: * @return the number of login occurences
201: */
202: public Integer getNumLogins();
203:
204: /**
205: * Sets the number of logins occurences for this user
206: *
207: * @param numLogins the last login time
208: */
209: public void setNumLogins(Integer numLogins);
210:
211: /**
212: * Returns a <code>String</code> representation of the User
213: *
214: * @return User information represented as a <code>String</code>
215: */
216: public String toString();
217: }
|