com.atlassian.confluence.user.crowd
Class CachedCrowdUserDao

java.lang.Object
  extended by com.atlassian.confluence.user.crowd.CachedCrowdUserDao
All Implemented Interfaces:
InternalUserDao, com.atlassian.crowd.embedded.spi.UserDao, org.springframework.beans.factory.InitializingBean

public class CachedCrowdUserDao
extends java.lang.Object
implements InternalUserDao, org.springframework.beans.factory.InitializingBean

A caching decorator for an InternalUserDao.


Constructor Summary
CachedCrowdUserDao(InternalUserDao delegate, com.atlassian.cache.CacheFactory cacheFactory, com.atlassian.event.api.EventPublisher eventPublisher)
           
 
Method Summary
 com.atlassian.crowd.model.user.User add(com.atlassian.crowd.model.user.User user, com.atlassian.crowd.embedded.api.PasswordCredential credential)
           
 com.atlassian.crowd.util.BatchResult<com.atlassian.crowd.model.user.User> addAll(java.util.Set<com.atlassian.crowd.model.user.UserTemplateWithCredentialAndAttributes> users)
          Removes all the adding users from the cache if they exist and delegates to the addAll method of the delegate DAO.
 void afterPropertiesSet()
           
 com.atlassian.crowd.model.user.TimestampedUser findByExternalId(long directoryId, java.lang.String externalId)
           
 com.atlassian.crowd.model.user.TimestampedUser findByName(long directoryId, java.lang.String userName)
           
 java.util.Collection<com.atlassian.crowd.model.user.InternalUser> findByNames(long directoryId, java.util.Collection<java.lang.String> userNames)
          Find all users from the list of user names
 com.atlassian.crowd.model.user.UserWithAttributes findByNameWithAttributes(long directoryId, java.lang.String userName)
           
 com.atlassian.crowd.embedded.api.PasswordCredential getCredential(long directoryId, java.lang.String userName)
           
 java.util.List<com.atlassian.crowd.embedded.api.PasswordCredential> getCredentialHistory(long directoryId, java.lang.String userName)
           
 com.atlassian.crowd.model.user.InternalUser internalFindByName(long directoryId, java.lang.String userName)
          Find a persistent user object from a given directory and user name
 com.atlassian.crowd.model.user.InternalUser internalFindByUser(com.atlassian.crowd.model.user.User user)
          Find the persistent user object that corresponds to the provided user.
 void remove(com.atlassian.crowd.model.user.User user)
           
 void removeAllUsers(long directoryId)
          Remove all users from a particular directory (used when deleting an internal directory)
 com.atlassian.crowd.util.BatchResult<java.lang.String> removeAllUsers(long directoryId, java.util.Set<java.lang.String> userNames)
           
 void removeAttribute(com.atlassian.crowd.model.user.User user, java.lang.String attributeName)
           
 com.atlassian.crowd.model.user.User rename(com.atlassian.crowd.model.user.User user, java.lang.String newName)
           
<T> java.util.List<T>
search(long directoryId, com.atlassian.crowd.search.query.entity.EntityQuery<T> query)
           
 void storeAttributes(com.atlassian.crowd.model.user.User user, java.util.Map<java.lang.String,java.util.Set<java.lang.String>> attributes)
           
 com.atlassian.crowd.model.user.User update(com.atlassian.crowd.model.user.User user)
           
 void updateCredential(com.atlassian.crowd.model.user.User user, com.atlassian.crowd.embedded.api.PasswordCredential credential, int maxCredentialHistory)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedCrowdUserDao

public CachedCrowdUserDao(InternalUserDao delegate,
                          com.atlassian.cache.CacheFactory cacheFactory,
                          com.atlassian.event.api.EventPublisher eventPublisher)
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

findByName

public com.atlassian.crowd.model.user.TimestampedUser findByName(long directoryId,
                                                                 java.lang.String userName)
                                                          throws com.atlassian.crowd.exception.UserNotFoundException
Specified by:
findByName in interface com.atlassian.crowd.embedded.spi.UserDao
Throws:
com.atlassian.crowd.exception.UserNotFoundException

findByExternalId

public com.atlassian.crowd.model.user.TimestampedUser findByExternalId(long directoryId,
                                                                       java.lang.String externalId)
                                                                throws com.atlassian.crowd.exception.UserNotFoundException
Specified by:
findByExternalId in interface com.atlassian.crowd.embedded.spi.UserDao
Throws:
com.atlassian.crowd.exception.UserNotFoundException

findByNameWithAttributes

public com.atlassian.crowd.model.user.UserWithAttributes findByNameWithAttributes(long directoryId,
                                                                                  java.lang.String userName)
                                                                           throws com.atlassian.crowd.exception.UserNotFoundException
Specified by:
findByNameWithAttributes in interface com.atlassian.crowd.embedded.spi.UserDao
Throws:
com.atlassian.crowd.exception.UserNotFoundException

getCredential

public com.atlassian.crowd.embedded.api.PasswordCredential getCredential(long directoryId,
                                                                         java.lang.String userName)
                                                                  throws com.atlassian.crowd.exception.UserNotFoundException
Specified by:
getCredential in interface com.atlassian.crowd.embedded.spi.UserDao
Throws:
com.atlassian.crowd.exception.UserNotFoundException

getCredentialHistory

public java.util.List<com.atlassian.crowd.embedded.api.PasswordCredential> getCredentialHistory(long directoryId,
                                                                                                java.lang.String userName)
                                                                                         throws com.atlassian.crowd.exception.UserNotFoundException
Specified by:
getCredentialHistory in interface com.atlassian.crowd.embedded.spi.UserDao
Throws:
com.atlassian.crowd.exception.UserNotFoundException

addAll

public com.atlassian.crowd.util.BatchResult<com.atlassian.crowd.model.user.User> addAll(java.util.Set<com.atlassian.crowd.model.user.UserTemplateWithCredentialAndAttributes> users)
Removes all the adding users from the cache if they exist and delegates to the addAll method of the delegate DAO.

This method will not try and update the cache like add(User, PasswordCredential) because:

Specified by:
addAll in interface com.atlassian.crowd.embedded.spi.UserDao
Parameters:
users - the users to add
Returns:
a BatchResult describing the result

add

public com.atlassian.crowd.model.user.User add(com.atlassian.crowd.model.user.User user,
                                               com.atlassian.crowd.embedded.api.PasswordCredential credential)
                                        throws com.atlassian.crowd.exception.UserAlreadyExistsException,
                                               java.lang.IllegalArgumentException,
                                               com.atlassian.crowd.exception.DirectoryNotFoundException
Specified by:
add in interface com.atlassian.crowd.embedded.spi.UserDao
Throws:
com.atlassian.crowd.exception.UserAlreadyExistsException
java.lang.IllegalArgumentException
com.atlassian.crowd.exception.DirectoryNotFoundException

storeAttributes

public void storeAttributes(com.atlassian.crowd.model.user.User user,
                            java.util.Map<java.lang.String,java.util.Set<java.lang.String>> attributes)
                     throws com.atlassian.crowd.exception.UserNotFoundException
Specified by:
storeAttributes in interface com.atlassian.crowd.embedded.spi.UserDao
Throws:
com.atlassian.crowd.exception.UserNotFoundException

update

public com.atlassian.crowd.model.user.User update(com.atlassian.crowd.model.user.User user)
                                           throws com.atlassian.crowd.exception.UserNotFoundException,
                                                  java.lang.IllegalArgumentException
Specified by:
update in interface com.atlassian.crowd.embedded.spi.UserDao
Throws:
com.atlassian.crowd.exception.UserNotFoundException
java.lang.IllegalArgumentException

updateCredential

public void updateCredential(com.atlassian.crowd.model.user.User user,
                             com.atlassian.crowd.embedded.api.PasswordCredential credential,
                             int maxCredentialHistory)
                      throws com.atlassian.crowd.exception.UserNotFoundException,
                             java.lang.IllegalArgumentException
Specified by:
updateCredential in interface com.atlassian.crowd.embedded.spi.UserDao
Throws:
com.atlassian.crowd.exception.UserNotFoundException
java.lang.IllegalArgumentException

rename

public com.atlassian.crowd.model.user.User rename(com.atlassian.crowd.model.user.User user,
                                                  java.lang.String newName)
                                           throws com.atlassian.crowd.exception.UserNotFoundException,
                                                  com.atlassian.crowd.exception.UserAlreadyExistsException,
                                                  java.lang.IllegalArgumentException
Specified by:
rename in interface com.atlassian.crowd.embedded.spi.UserDao
Throws:
com.atlassian.crowd.exception.UserNotFoundException
com.atlassian.crowd.exception.UserAlreadyExistsException
java.lang.IllegalArgumentException

removeAttribute

public void removeAttribute(com.atlassian.crowd.model.user.User user,
                            java.lang.String attributeName)
                     throws com.atlassian.crowd.exception.UserNotFoundException
Specified by:
removeAttribute in interface com.atlassian.crowd.embedded.spi.UserDao
Throws:
com.atlassian.crowd.exception.UserNotFoundException

remove

public void remove(com.atlassian.crowd.model.user.User user)
            throws com.atlassian.crowd.exception.UserNotFoundException
Specified by:
remove in interface com.atlassian.crowd.embedded.spi.UserDao
Throws:
com.atlassian.crowd.exception.UserNotFoundException

search

public <T> java.util.List<T> search(long directoryId,
                                    com.atlassian.crowd.search.query.entity.EntityQuery<T> query)
Specified by:
search in interface com.atlassian.crowd.embedded.spi.UserDao

internalFindByName

public com.atlassian.crowd.model.user.InternalUser internalFindByName(long directoryId,
                                                                      java.lang.String userName)
                                                               throws com.atlassian.crowd.exception.UserNotFoundException
Description copied from interface: InternalUserDao
Find a persistent user object from a given directory and user name

Specified by:
internalFindByName in interface InternalUserDao
Throws:
com.atlassian.crowd.exception.UserNotFoundException

internalFindByUser

public com.atlassian.crowd.model.user.InternalUser internalFindByUser(com.atlassian.crowd.model.user.User user)
                                                               throws com.atlassian.crowd.exception.UserNotFoundException
Description copied from interface: InternalUserDao
Find the persistent user object that corresponds to the provided user.

Specified by:
internalFindByUser in interface InternalUserDao
Throws:
com.atlassian.crowd.exception.UserNotFoundException

removeAllUsers

public void removeAllUsers(long directoryId)
Description copied from interface: InternalUserDao
Remove all users from a particular directory (used when deleting an internal directory)

Specified by:
removeAllUsers in interface InternalUserDao

findByNames

public java.util.Collection<com.atlassian.crowd.model.user.InternalUser> findByNames(long directoryId,
                                                                                     java.util.Collection<java.lang.String> userNames)
Description copied from interface: InternalUserDao
Find all users from the list of user names

Specified by:
findByNames in interface InternalUserDao
Returns:

removeAllUsers

public com.atlassian.crowd.util.BatchResult<java.lang.String> removeAllUsers(long directoryId,
                                                                             java.util.Set<java.lang.String> userNames)
Specified by:
removeAllUsers in interface com.atlassian.crowd.embedded.spi.UserDao


Copyright © 2003-2014 Atlassian. All Rights Reserved.