public class ClearspaceUserProvider extends Object implements UserProvider
| Modifier and Type | Field and Description |
|---|---|
protected static String |
SEARCH_URL_PREFIX |
protected static String |
USER_URL_PREFIX |
| Constructor and Description |
|---|
ClearspaceUserProvider() |
| Modifier and Type | Method and Description |
|---|---|
User |
createUser(String username,
String password,
String name,
String email)
Creates user using the userService/users POST service.
|
void |
deleteUser(String username)
Deletes a user using the userService/users DELETE service.
|
Collection<User> |
findUsers(Set<String> fields,
String query)
Search for the user using the userService/search POST method.
|
Collection<User> |
findUsers(Set<String> fields,
String query,
int startIndex,
int numResults)
Search for the user using the userService/searchBounded POST method.
|
Set<String> |
getSearchFields()
Clearsapce can search using three fields: username, name and email.
|
int |
getUserCount()
Gets the user count using the userService/users/count GET service.
|
Collection<String> |
getUsernames()
Gets all usernames using the userService/userNames GET service.
|
Collection<User> |
getUsers()
Gets all users using the userService/userNames GET service.
|
Collection<User> |
getUsers(int startIndex,
int numResults)
Gets a bounded list of users using the userService/userNames GET service.
|
protected org.dom4j.Element |
getUserUpdateParams(String username)
Creates the parameters to send in a update user request based on the information of
username |
boolean |
isEmailRequired()
In Clearspace email is required
|
boolean |
isNameRequired()
In Clearspace name is optional.
|
boolean |
isReadOnly()
Returns true if Clearspace is a read only user provider.
|
User |
loadUser(String username)
Loads the user using the userService/users GET service.
|
void |
setCreationDate(String username,
Date creationDate)
Updates the creationDate of the user using the userService/update service.
|
void |
setEmail(String username,
String email)
Updates the email of the user using the userService/update service.
|
void |
setModificationDate(String username,
Date modificationDate)
Updates the modificationDate of the user using the userService/update service.
|
void |
setName(String username,
String name)
Updates the name of the user using the userService/update service.
|
protected void |
updateUser(org.dom4j.Element userUpdateParams)
Updates the user using the userService/users PUT service.
|
protected static final String USER_URL_PREFIX
protected static final String SEARCH_URL_PREFIX
public User loadUser(String username) throws UserNotFoundException
loadUser in interface UserProviderusername - the username of the user to loadUserNotFoundException - if the user could not be foundpublic User createUser(String username, String password, String name, String email) throws UserAlreadyExistsException
createUser in interface UserProviderusername - the username of the userpassword - the password of the username - the name of the user (optional)email - the email of the userUserAlreadyExistsException - If there is already a user with the usernameUnsupportedOperationException - If Clearspace is a read only providerpublic void deleteUser(String username)
deleteUser in interface UserProviderusername - the username of the user to deletepublic int getUserCount()
getUserCount in interface UserProviderpublic Collection<User> getUsers()
getUsers in interface UserProviderpublic Collection<String> getUsernames()
getUsernames in interface UserProviderpublic Collection<User> getUsers(int startIndex, int numResults)
getUsers in interface UserProviderstartIndex - the start indexnumResults - the number of resultpublic void setName(String username, String name) throws UserNotFoundException
setName in interface UserProviderusername - the username of the username - the new name of the userUserNotFoundException - if there is no user with that usernamepublic void setEmail(String username, String email) throws UserNotFoundException
setEmail in interface UserProviderusername - the username of the useremail - the new email of the userUserNotFoundException - if the user could not be foundpublic void setCreationDate(String username, Date creationDate) throws UserNotFoundException
setCreationDate in interface UserProviderusername - the username of the usercreationDate - the new email of the userUserNotFoundException - if the user could not be foundpublic void setModificationDate(String username, Date modificationDate) throws UserNotFoundException
setModificationDate in interface UserProviderusername - the username of the usermodificationDate - the new modificationDate of the userUserNotFoundException - if the user could not be foundprotected org.dom4j.Element getUserUpdateParams(String username) throws UserNotFoundException
usernameusername - the username of the userUserNotFoundException - if the user could not be foundprotected void updateUser(org.dom4j.Element userUpdateParams)
throws UserNotFoundException
userUpdateParams - the request parametersUserNotFoundException - if the user could not be foundpublic Set<String> getSearchFields() throws UnsupportedOperationException
getSearchFields in interface UserProviderUnsupportedOperationExceptionpublic Collection<User> findUsers(Set<String> fields, String query) throws UnsupportedOperationException
findUsers in interface UserProviderfields - the fields to search on.query - the query string.UnsupportedOperationException - if the provider does not
support the operation (this is an optional operation).public Collection<User> findUsers(Set<String> fields, String query, int startIndex, int numResults) throws UnsupportedOperationException
findUsers in interface UserProviderfields - the fields to search on.query - the query string.startIndex - the starting index in the search result to return.numResults - the number of users to return in the search result.UnsupportedOperationException - if the provider does not
support the operation (this is an optional operation).public boolean isReadOnly()
isReadOnly in interface UserProviderpublic boolean isNameRequired()
isNameRequired in interface UserProviderpublic boolean isEmailRequired()
isEmailRequired in interface UserProviderCopyright © 2003-2008 Jive Software.