com.atlassian.user.impl.delegation
Class DelegatingUserManager

java.lang.Object
  extended bycom.atlassian.user.impl.delegation.DelegatingUserManager
All Implemented Interfaces:
EntityManager, UserManager
Direct Known Subclasses:
DelegatingListUserManager

public class DelegatingUserManager
extends java.lang.Object
implements UserManager


Constructor Summary
DelegatingUserManager(java.util.List userManagers)
           
 
Method Summary
 void alterPassword(User user, java.lang.String plainTextPass)
          Encrypts the plain password, sets it on the user, and saves the user.
 User createUser(java.lang.String username)
          Creates a new user with the username provided.
 RepositoryIdentifier getIdentifier()
           
protected  UserManager getMatchingUserManager(User user)
          Helper method to locate the first userManager responsible for the given user, in the delegation.
 RepositoryIdentifier getRepository(Entity entity)
           
 User getUser(java.lang.String username)
           
 java.util.List getUserManagers()
           
 Pager getUserNames()
           
 Pager getUsers()
           
 boolean isCreative()
          Used to detemine whether an entity can be created (eg, can call UserManager.createUser(String) or GroupManager.createGroup(String)
 boolean isReadOnly(User user)
           
 void removeUser(User user)
          Removes the specified user from the repository.
 void saveUser(User user)
          Persists any changes made to the user to the storage system used by this user manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatingUserManager

public DelegatingUserManager(java.util.List userManagers)
Method Detail

getUsers

public Pager getUsers()
               throws EntityException
Specified by:
getUsers in interface UserManager
Returns:
a Pager holding all users being managed.
Throws:
EntityException

getUserNames

public Pager getUserNames()
                   throws EntityException
Specified by:
getUserNames in interface UserManager
Returns:
a Pager holding the names of all users being managed.
Throws:
EntityException

getUser

public User getUser(java.lang.String username)
             throws EntityException
Specified by:
getUser in interface UserManager
Returns:
- an User if one could be found, otherwise null.
Throws:
EntityException - - representing the exception which prohibited looking for or retrieving the user.

createUser

public User createUser(java.lang.String username)
                throws EntityException
Description copied from interface: UserManager
Creates a new user with the username provided. Returns the newly created user.

Specified by:
createUser in interface UserManager
Returns:
the created user
Throws:
EntityException - If user cannot be created in any user managers.

alterPassword

public void alterPassword(User user,
                          java.lang.String plainTextPass)
                   throws EntityException
Encrypts the plain password, sets it on the user, and saves the user.

Specified by:
alterPassword in interface UserManager
Throws:
EntityException

saveUser

public void saveUser(User user)
              throws EntityException
Description copied from interface: UserManager
Persists any changes made to the user to the storage system used by this user manager.

To ensure consistent behaviour across all repository types, clients must call this method after using User.setEmail(String), User.setFullName(String) or User.setPassword(String).

Specified by:
saveUser in interface UserManager
Throws:
EntityException

removeUser

public void removeUser(User user)
                throws EntityException
Description copied from interface: UserManager
Removes the specified user from the repository.

Specified by:
removeUser in interface UserManager
Throws:
EntityException

isReadOnly

public boolean isReadOnly(User user)
                   throws EntityException
Specified by:
isReadOnly in interface UserManager
Returns:
true indicates that information on the user object cannot be altered in the storage system (see RepositoryIdentifier), false indicates that the storage system will save changes or that this UserManager does not know about the User.
Throws:
EntityException

getIdentifier

public RepositoryIdentifier getIdentifier()
Specified by:
getIdentifier in interface EntityManager
Returns:
the RepositoryIdentifier which is managed by this instance.

getRepository

public RepositoryIdentifier getRepository(Entity entity)
                                   throws EntityException
Specified by:
getRepository in interface EntityManager
Returns:
the RepositoryIdentifier in which the entity is stored, otherwise null.
Throws:
EntityException

isCreative

public boolean isCreative()
Used to detemine whether an entity can be created (eg, can call UserManager.createUser(String) or GroupManager.createGroup(String)

Specified by:
isCreative in interface EntityManager
Returns:
true to indicate that Entity objects can be created by this manager, or false to indicate not.

getMatchingUserManager

protected UserManager getMatchingUserManager(User user)
                                      throws EntityException
Helper method to locate the first userManager responsible for the given user, in the delegation.

Throws:
EntityException

getUserManagers

public java.util.List getUserManagers()
Returns:
an unmodifiable list of UserManagers which this manager delegates to, in the order of delegation.


Copyright © 2005-2008 Atlassian Software Systems Pty Ltd. All Rights Reserved.