Clearspace API (2.5.29) Core Javadocs

com.jivesoftware.base
Interface UserManager


public interface UserManager

Centralized management of users in the Jive system including creating, retrieving, and deleting User objects.

Instructions for those that wish to implement this interface to provide a custom implementation appear in red. If you wish to use a custom implementation, you must set the Jive property UserManager.className with the name of your UserManager class. Your class must have a public, no-argument constructor. The class must also create and return User object implementations as necessary.

See Also:
User

Method Summary
 User createApplicationUser(User userTemplate)
          Creates a Clearspace-only user representation.
 User createUser(User userTemplate)
          Factory method for creating a new User with all required values: a password, email address, and unique username.
 void deleteUser(User user)
          Deletes a user.
 void deleteUserAndContent(User user)
          Deletes a user and the user's associated content (to maintain data consistency).
 void disableUser(User user)
          Disable the given user
 void enableUser(User user)
          Enable the given user
 int getApplicationUserCount()
          Returns the number of application users in the system.
 List<User> getApplicationUsers()
          Returns a list of application users - users who have active accounts and can authenticate with the system.
 List<User> getApplicationUsers(int start, int end)
          Returns a list of enabled application users from start to end params.
 int getAuthenticatedUserCount()
          Returns the number of application users in the system who have authenticated at least once.
 int getRecentUserCount(Date cutoffDate)
          Returns the number of application users in the system who have been created since a given date.
 int getTotalUserCount()
          Returns the number of user identities known to the system, including external relationships and representations of external users.
 User getUser(long userId)
          Retrives a user based on their unique system ID.
 User getUser(String userName)
          Loads the user by unique username.
 User getUser(User userTemplate)
          Returns a user matching the given user template.
 User getUser(User userTemplate, boolean caseInsensitive)
          Searches for a user with the given template.
 List<User> getUsers()
          Returns a list of all users including external users and relationships.
 List<User> getUsers(int startIndex, int numResults)
          Returns a set of users starting with the beginning and ending with the ending params.
 boolean isCreationSupported()
          Indicates whether user creation is supported.
 User updateUser(User user)
          Updates the existing user.
 

Method Detail

createUser

User createUser(User userTemplate)
                throws UserAlreadyExistsException,
                       UnsupportedOperationException,
                       EmailAlreadyExistsException
Factory method for creating a new User with all required values: a password, email address, and unique username.

Parameters:
userTemplate - User data that will be persisted to the application store and any user providers if they support creation.
Returns:
Full representation of the user including the new system ID of the user.
Throws:
UserAlreadyExistsException - if the username already exists in the system.
UnsupportedOperationException - if the back-end user store doesn't support this operation
EmailAlreadyExistsException - if the email is already in use in the system.

createApplicationUser

User createApplicationUser(User userTemplate)
                           throws UserAlreadyExistsException
Creates a Clearspace-only user representation. General use of this API shuold use the createUser method, this functionality is intended for system-level calls.

Parameters:
userTemplate - the template to use to create the new user
Returns:
the new user object
Throws:
UserAlreadyExistsException - if the user already exists in the system

getUser

User getUser(User userTemplate)
Returns a user matching the given user template. The actual search implementation is the discretion of the manager implementation, but will generally follow a hierarchial match strategy of searching by ID, username and email.

Note that unlike other methods on the API, this returns null if the user is not found.

Parameters:
userTemplate - the user template for the user to load
Returns:
a user matching the given user template or null if the user cannot be found

getUser

User getUser(User userTemplate,
             boolean caseInsensitive)
Searches for a user with the given template. String comparisons will be done in a case insensitive manner. This is generally not intended for common use and is mainly focused on serving authentication and migration.

Parameters:
userTemplate - the user template for the user to load
caseInsensitive - true if the case doesn't matter, false otherwise
Returns:
the user with the given template or null if the user cannot be found

getUser

User getUser(String userName)
             throws UserNotFoundException
Loads the user by unique username. UserNotFoundException is thrown if the user cannot be located.

Parameters:
userName - the username of the user to load
Returns:
the user associated with the provided username
Throws:
UserNotFoundException - if the user cannot be found

getUser

User getUser(long userId)
             throws UserNotFoundException
Retrives a user based on their unique system ID.

Parameters:
userId - the id of the user to load
Returns:
the user based on the unique system ID
Throws:
UserNotFoundException - if the user cannot be found

deleteUser

void deleteUser(User user)
                throws UnsupportedOperationException,
                       UserNotFoundException
Deletes a user. To maintain data consistency, deleting a user that has content is not allowed. An alternative to deleting a user (and thus deleting all of their content) is to ban the user from logging in.

Parameters:
user - the user to delete.
Throws:
UnauthorizedException - if not an administrator
UnsupportedOperationException - if the system of record does not support user updates
UserNotFoundException - if the user cannot be found
See Also:
deleteUserAndContent(User user)

deleteUserAndContent

void deleteUserAndContent(User user)
                          throws UnsupportedOperationException,
                                 UserNotFoundException
Deletes a user and the user's associated content (to maintain data consistency). An alternative to deleting a user and their content is to ban the user from logging in.

Parameters:
user - the user to delete.
Throws:
UnauthorizedException - if not an administrator
UnsupportedOperationException - if the system of record does not support user updates
UserNotFoundException - if the user cannot be found
See Also:
deleteUser(User user)

getApplicationUserCount

int getApplicationUserCount()
Returns the number of application users in the system. Only users who can authenticate with the system will be counted.

Returns:
the total number of application users

getApplicationUsers

List<User> getApplicationUsers()
Returns a list of application users - users who have active accounts and can authenticate with the system.

Returns:
a list of application users

getApplicationUsers

List<User> getApplicationUsers(int start,
                               int end)
Returns a list of enabled application users from start to end params.

Parameters:
start - the start index
end - the end index
Returns:
a list of enabled application users from start to end params.

getAuthenticatedUserCount

int getAuthenticatedUserCount()
Returns the number of application users in the system who have authenticated at least once.

Returns:
the total number of authenticated users

getTotalUserCount

int getTotalUserCount()
Returns the number of user identities known to the system, including external relationships and representations of external users.

Returns:
the number of user identities known to the system, including external relationships and representations of external users.

getRecentUserCount

int getRecentUserCount(Date cutoffDate)
Returns the number of application users in the system who have been created since a given date.

Parameters:
cutoffDate - The Date after which users created will be counted.
Returns:
the total number of application users

getUsers

List<User> getUsers()
Returns a list of all users including external users and relationships.

Returns:
a list of all users including external users and relationships.

getUsers

List<User> getUsers(int startIndex,
                    int numResults)
Returns a set of users starting with the beginning and ending with the ending params.

Parameters:
startIndex - the starting index of the result set
numResults - the number of results to return less rows)
Returns:
a set of users starting with the beginning and ending with the ending params.

isCreationSupported

boolean isCreationSupported()
Indicates whether user creation is supported. This will alsways default to true, but may be disabled depending on the configured user provider.

Returns:
true if user creation is supported.

updateUser

User updateUser(User user)
                throws UserNotFoundException,
                       UserAlreadyExistsException
Updates the existing user. The implementation of this method will varry substantially depending on the underlying user provider configuration.

Parameters:
user - the existing user
Returns:
the updated user
Throws:
UserNotFoundException - if the user cannot be found
UserAlreadyExistsException - if the underlying implementation doesn't allow for updating user information

enableUser

void enableUser(User user)
Enable the given user

Parameters:
user - the user to enable

disableUser

void disableUser(User user)
Disable the given user

Parameters:
user - the user to disable

Clearspace Project Page

Copyright © 1999-2007 Jive Software.