|
Jive Forums API (5.5.8) Developer Javadocs | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jivesoftware.base.ext.SimpleUserAdapter
public abstract class SimpleUserAdapter
An abstract adapter class to aid in creating custom user implementations. The "set" methods in this class throw UnsupportedOperationExceptions, which means the external user store will be read-only. You should extend this class to create your own User implementation and only override the methods of interest.
If your user store doesn't support all the fields present in the User interface (such as the name visible and email visible flags), you should use hardcoded values in your implementation or load and store these values from somewhere else.
User objects have "extended properties", which is a way to allow arbitrary data to be attached to users. It's generally advisable to use the jiveUserProp table that is built into the Jive database schema to store this information. This adapter class implements all the logic necessary to load and store properties from the jiveUserProp database table.
Important note: any extensions of this class must be Serializable, or clustering will not work correctly.
| Field Summary | |
|---|---|
protected java.util.Date |
creationDate
The date the user was created. |
protected java.lang.String |
email
The user's email address. |
protected boolean |
emailVisible
Flag to indicate whether the user's email address should be visible to other users. |
protected long |
ID
The user ID. |
protected java.util.Date |
modificationDate
The date the user was last modified. |
protected java.lang.String |
name
The user's full name. |
protected boolean |
nameVisible
Flag to indicate whether the user's name should be visible to other users. |
protected java.util.Map |
properties
Map of extended user properties. |
protected java.lang.String |
username
The username. |
| Constructor Summary | |
|---|---|
SimpleUserAdapter()
|
|
| Method Summary | |
|---|---|
void |
deleteProperty(java.lang.String name)
Deletes an extended property. |
boolean |
equals(java.lang.Object object)
|
int |
getCachedSize()
Returns the approximate size of the Object in bytes. |
java.util.Date |
getCreationDate()
Returns the date that the user was created. |
java.lang.String |
getEmail()
Returns the user's email address. |
long |
getID()
Returns the user's id. |
java.util.Date |
getModificationDate()
Returns the date that the user was last modified. |
java.lang.String |
getName()
Returns the user's name. |
java.lang.String |
getPasswordHash()
Returns the user's password in hashed form. |
Permissions |
getPermissions(AuthToken authToken)
Returns the permissions for the user that correspond to the passed-in AuthToken. |
java.lang.String |
getProperty(java.lang.String name)
Returns an extended property of the user. |
java.util.Iterator |
getPropertyNames()
Returns an Iterator for all the names of the extended user properties. |
java.lang.String |
getUsername()
Returns the user's username. |
int |
hashCode()
|
boolean |
isAuthorized(long permissionType)
Returns true if the handle on the object has the permission specified. |
boolean |
isEmailVisible()
Returns true if the user has chosen to make her email visible to other users. |
boolean |
isGetPasswordHashSupported()
Indicates whether retrieving a password hash is supported for this user. |
boolean |
isNameVisible()
Returns true if the user has chosen to make her name visible to other users. |
boolean |
isSetEmailSupported()
Indicates whether setting the email address is supported for this user. |
boolean |
isSetEmailVisibleSupported()
Indicates whether setting the visibility of the email address is supported for this user. |
boolean |
isSetNameSupported()
Indicates whether setting the full name is supported for this user. |
boolean |
isSetNameVisibleSupported()
Indicates whether setting the visibility of the name is supported for this user. |
boolean |
isSetPasswordHashSupported()
Indicates whether modifying the hash of the user's password is supported for this user. |
boolean |
isSetPasswordSupported()
Indicates whether modifying the user's password is supported. |
void |
setCreationDate(java.util.Date creationDate)
Sets the creation date of the user. |
void |
setEmail(java.lang.String email)
Sets the user's email address. |
void |
setEmailVisible(boolean visible)
Sets whether a user's email is visible to other users. |
void |
setModificationDate(java.util.Date modificationDate)
Sets the date the user was last modified. |
void |
setName(java.lang.String name)
Sets the user's name. |
void |
setNameVisible(boolean visible)
Sets whether a user's name is visible to other users. |
void |
setPassword(java.lang.String password)
Sets the users's password. |
void |
setPasswordHash(java.lang.String passwordHash)
Sets the user's password in hashed form. |
void |
setProperty(java.lang.String name,
java.lang.String value)
Sets an extended property of the user. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.jivesoftware.base.IntrospectiveUser |
|---|
isPropertyEditSupported, isReadOnly |
| Field Detail |
|---|
protected long ID
protected java.lang.String username
protected java.lang.String name
protected java.lang.String email
protected boolean nameVisible
protected boolean emailVisible
protected java.util.Date creationDate
protected java.util.Date modificationDate
protected java.util.Map properties
| Constructor Detail |
|---|
public SimpleUserAdapter()
| Method Detail |
|---|
public boolean isSetPasswordSupported()
IntrospectiveUser
isSetPasswordSupported in interface IntrospectiveUserpublic boolean isGetPasswordHashSupported()
IntrospectiveUser
isGetPasswordHashSupported in interface IntrospectiveUserpublic boolean isSetPasswordHashSupported()
IntrospectiveUser
isSetPasswordHashSupported in interface IntrospectiveUserpublic boolean isSetNameSupported()
IntrospectiveUser
isSetNameSupported in interface IntrospectiveUserpublic boolean isSetEmailSupported()
IntrospectiveUser
isSetEmailSupported in interface IntrospectiveUserpublic boolean isSetNameVisibleSupported()
IntrospectiveUser
isSetNameVisibleSupported in interface IntrospectiveUserpublic boolean isSetEmailVisibleSupported()
IntrospectiveUser
isSetEmailVisibleSupported in interface IntrospectiveUserpublic long getID()
User
getID in interface Userpublic java.lang.String getUsername()
User
getUsername in interface Userpublic java.lang.String getName()
User
getName in interface Userpublic void setName(java.lang.String name)
User
setName in interface Username - new name for the user.public void setPassword(java.lang.String password)
User
setPassword in interface Userpassword - new password for the user.public java.lang.String getPasswordHash()
UserIf your back-end user store does not support this operation, throw an UnsupportedOperationException.
getPasswordHash in interface Userpublic void setPasswordHash(java.lang.String passwordHash)
UserIf your back-end user store does not support this operation, throw an UnsupportedOperationException.
setPasswordHash in interface UserpasswordHash - the hashedPassword for the user.public java.lang.String getEmail()
UserIf your back-end user store does not support this operation, always return null.
getEmail in interface Userpublic void setEmail(java.lang.String email)
UserIf your back-end user store does not support this operation, throw an UnsupportedOperationException.
setEmail in interface Useremail - new email address for the user.public boolean isNameVisible()
User
isNameVisible in interface User
public void setNameVisible(boolean visible)
throws UnauthorizedException
User
setNameVisible in interface Uservisible - boolean value to determin if the name should be visible.
UnauthorizedException - if does not have administrator permissions.public boolean isEmailVisible()
User
isEmailVisible in interface User
public void setEmailVisible(boolean visible)
throws UnauthorizedException
User
setEmailVisible in interface Uservisible - boolean value to determin if the name should be visible.
UnauthorizedException - if does not have administrator permissions.public java.util.Date getCreationDate()
UserIf your back-end user store does not support this operation, throw an UnsupportedOperationException.
getCreationDate in interface User
public void setCreationDate(java.util.Date creationDate)
throws UnauthorizedException
User
setCreationDate in interface UsercreationDate - the date the user was created.
UnauthorizedException - if does not have administrator permissions.public java.util.Date getModificationDate()
User
getModificationDate in interface User
public void setModificationDate(java.util.Date modificationDate)
throws UnauthorizedException
User
setModificationDate in interface UsermodificationDate - the date the user was modified.
UnauthorizedException - if does not have administrator permissions.public java.lang.String getProperty(java.lang.String name)
User
getProperty in interface Username - the name of the property to get.
public void setProperty(java.lang.String name,
java.lang.String value)
throws UnauthorizedException
User
setProperty in interface Username - the name of the property to set.value - the new value for the property.
UnauthorizedException - if not allowed to edit.
public void deleteProperty(java.lang.String name)
throws UnauthorizedException
Username does not exist,
this method will do nothing.
deleteProperty in interface Username - the name of the property to delete.
UnauthorizedException - if not allowed to edit.public java.util.Iterator getPropertyNames()
User
This method should typically be implemented as:
if (auth.getUserID() == id) {
return new Permissions(Permissions.USER_ADMIN);
}
else {
return new Permissions(Permissions.NONE);
}
getPropertyNames in interface Userpublic boolean isAuthorized(long permissionType)
User
Because proxy objects will implement real security checking, this
method should be implemented as:
return true;.
isAuthorized in interface UserpermissionType - the permission to check for.Permissionspublic Permissions getPermissions(AuthToken authToken)
User
getPermissions in interface UserauthToken - the auth token to look up permissions with.public int getCachedSize()
Cacheable
getCachedSize in interface Cacheablepublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object object)
equals in class java.lang.Object
|
Jive Forums Project Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||