Class CachedCrowdGroupDao
- java.lang.Object
-
- com.atlassian.confluence.impl.user.crowd.CachedCrowdGroupDao
-
- All Implemented Interfaces:
InternalGroupDao<com.atlassian.crowd.model.group.InternalGroup>
,com.atlassian.crowd.embedded.spi.GroupDao
,org.springframework.beans.factory.InitializingBean
public class CachedCrowdGroupDao extends Object implements InternalGroupDao<com.atlassian.crowd.model.group.InternalGroup>, org.springframework.beans.factory.InitializingBean
A caching decorator for an InternalUserDao.
-
-
Constructor Summary
Constructors Constructor Description CachedCrowdGroupDao(InternalGroupDao<com.atlassian.crowd.model.group.InternalGroup> delegate, TransactionAwareCacheFactory cacheFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.atlassian.crowd.model.group.InternalGroup
add(com.atlassian.crowd.model.group.Group group)
Adds the passed in group by calling the delegate dao's add method.com.atlassian.crowd.util.BatchResult<com.atlassian.crowd.model.group.Group>
addAll(Set<? extends com.atlassian.crowd.model.group.Group> groups)
Removes all the adding groups from the cache and delegates to the addAll method of the delegate DAO.com.atlassian.crowd.model.group.InternalGroup
addLocal(com.atlassian.crowd.model.group.Group group)
void
afterPropertiesSet()
Map<String,String>
findByExternalIds(long directoryId, Set<String> externalIds)
com.atlassian.crowd.model.group.InternalDirectoryGroup
findByName(long directoryId, String name)
com.atlassian.crowd.model.group.GroupWithAttributes
findByNameWithAttributes(long directoryId, String name)
Map<String,String>
findExternalIdsByNames(long directoryId, Set<String> groupNames)
Set<String>
getAllExternalIds(long directoryId)
long
getExternalGroupCount(long directoryId)
long
getGroupCount(long directoryId)
Set<String>
getLocalGroupNames(long directoryId)
com.atlassian.crowd.model.group.InternalGroup
internalFindByGroup(com.atlassian.crowd.model.group.Group group)
Find the persistent group object that corresponds to the provided group.com.atlassian.crowd.model.group.InternalGroup
internalFindByName(long directoryId, String groupName)
Find a persistent group object from a given directory and group namevoid
remove(com.atlassian.crowd.model.group.Group group)
void
removeAllGroups(long directoryId)
Remove all groups from a particular directory (used when deleting an internal directory)com.atlassian.crowd.util.BatchResult<String>
removeAllGroups(long directoryId, Set<String> groupNames)
void
removeAttribute(com.atlassian.crowd.model.group.Group group, String attributeName)
com.atlassian.crowd.model.group.Group
rename(com.atlassian.crowd.model.group.Group group, String newName)
<T> List<T>
search(long directoryId, com.atlassian.crowd.search.query.entity.EntityQuery<T> query)
void
storeAttributes(com.atlassian.crowd.model.group.Group group, Map<String,Set<String>> attributes)
com.atlassian.crowd.model.group.Group
update(com.atlassian.crowd.model.group.Group group)
-
-
-
Constructor Detail
-
CachedCrowdGroupDao
public CachedCrowdGroupDao(InternalGroupDao<com.atlassian.crowd.model.group.InternalGroup> delegate, TransactionAwareCacheFactory cacheFactory)
- Since:
- 7.5
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet() throws Exception
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-
findByName
public com.atlassian.crowd.model.group.InternalDirectoryGroup findByName(long directoryId, String name) throws com.atlassian.crowd.exception.GroupNotFoundException
- Specified by:
findByName
in interfacecom.atlassian.crowd.embedded.spi.GroupDao
- Throws:
com.atlassian.crowd.exception.GroupNotFoundException
-
findByNameWithAttributes
public com.atlassian.crowd.model.group.GroupWithAttributes findByNameWithAttributes(long directoryId, String name) throws com.atlassian.crowd.exception.GroupNotFoundException
- Specified by:
findByNameWithAttributes
in interfacecom.atlassian.crowd.embedded.spi.GroupDao
- Throws:
com.atlassian.crowd.exception.GroupNotFoundException
-
addAll
public com.atlassian.crowd.util.BatchResult<com.atlassian.crowd.model.group.Group> addAll(Set<? extends com.atlassian.crowd.model.group.Group> groups) throws com.atlassian.crowd.exception.DirectoryNotFoundException
Removes all the adding groups from the cache and delegates to the addAll method of the delegate DAO.This method will not try and update the cache like
add(Group)
because:- We want to delegate to the "addAll" method on the delegate as its the fastest way to add a large number of groups, we can't just delegate to add method
- Unlike the add method, we don't get a reference to the added group so we can't reliably update the cache, so we just remove it.
- Specified by:
addAll
in interfacecom.atlassian.crowd.embedded.spi.GroupDao
- Parameters:
groups
- the groups to add- Returns:
- a BatchResult describing the result
- Throws:
com.atlassian.crowd.exception.DirectoryNotFoundException
- if the directory for any of the groups is not found
-
add
public com.atlassian.crowd.model.group.InternalGroup add(com.atlassian.crowd.model.group.Group group) throws com.atlassian.crowd.exception.DirectoryNotFoundException, com.atlassian.crowd.exception.InvalidGroupException
Adds the passed in group by calling the delegate dao's add method. Updates the cache to match the newly created group.- Specified by:
add
in interfacecom.atlassian.crowd.embedded.spi.GroupDao
- Specified by:
add
in interfaceInternalGroupDao<com.atlassian.crowd.model.group.InternalGroup>
- Parameters:
group
- the group to add- Returns:
- the added group
- Throws:
com.atlassian.crowd.exception.DirectoryNotFoundException
- if the directory cannot be found.com.atlassian.crowd.exception.InvalidGroupException
-
addLocal
public com.atlassian.crowd.model.group.InternalGroup addLocal(com.atlassian.crowd.model.group.Group group) throws com.atlassian.crowd.exception.DirectoryNotFoundException, com.atlassian.crowd.exception.InvalidGroupException
- Specified by:
addLocal
in interfacecom.atlassian.crowd.embedded.spi.GroupDao
- Specified by:
addLocal
in interfaceInternalGroupDao<com.atlassian.crowd.model.group.InternalGroup>
- Throws:
com.atlassian.crowd.exception.DirectoryNotFoundException
com.atlassian.crowd.exception.InvalidGroupException
-
update
public com.atlassian.crowd.model.group.Group update(com.atlassian.crowd.model.group.Group group) throws com.atlassian.crowd.exception.GroupNotFoundException
- Specified by:
update
in interfacecom.atlassian.crowd.embedded.spi.GroupDao
- Throws:
com.atlassian.crowd.exception.GroupNotFoundException
-
rename
public com.atlassian.crowd.model.group.Group rename(com.atlassian.crowd.model.group.Group group, String newName) throws com.atlassian.crowd.exception.GroupNotFoundException, com.atlassian.crowd.exception.InvalidGroupException
- Specified by:
rename
in interfacecom.atlassian.crowd.embedded.spi.GroupDao
- Throws:
com.atlassian.crowd.exception.GroupNotFoundException
com.atlassian.crowd.exception.InvalidGroupException
-
storeAttributes
public void storeAttributes(com.atlassian.crowd.model.group.Group group, Map<String,Set<String>> attributes) throws com.atlassian.crowd.exception.GroupNotFoundException
- Specified by:
storeAttributes
in interfacecom.atlassian.crowd.embedded.spi.GroupDao
- Throws:
com.atlassian.crowd.exception.GroupNotFoundException
-
removeAttribute
public void removeAttribute(com.atlassian.crowd.model.group.Group group, String attributeName) throws com.atlassian.crowd.exception.GroupNotFoundException
- Specified by:
removeAttribute
in interfacecom.atlassian.crowd.embedded.spi.GroupDao
- Throws:
com.atlassian.crowd.exception.GroupNotFoundException
-
remove
public void remove(com.atlassian.crowd.model.group.Group group) throws com.atlassian.crowd.exception.GroupNotFoundException
- Specified by:
remove
in interfacecom.atlassian.crowd.embedded.spi.GroupDao
- Throws:
com.atlassian.crowd.exception.GroupNotFoundException
-
search
public <T> List<T> search(long directoryId, com.atlassian.crowd.search.query.entity.EntityQuery<T> query)
- Specified by:
search
in interfacecom.atlassian.crowd.embedded.spi.GroupDao
-
internalFindByName
public com.atlassian.crowd.model.group.InternalGroup internalFindByName(long directoryId, String groupName) throws com.atlassian.crowd.exception.GroupNotFoundException
Description copied from interface:InternalGroupDao
Find a persistent group object from a given directory and group name- Specified by:
internalFindByName
in interfaceInternalGroupDao<com.atlassian.crowd.model.group.InternalGroup>
- Throws:
com.atlassian.crowd.exception.GroupNotFoundException
-
internalFindByGroup
public com.atlassian.crowd.model.group.InternalGroup internalFindByGroup(com.atlassian.crowd.model.group.Group group) throws com.atlassian.crowd.exception.GroupNotFoundException
Description copied from interface:InternalGroupDao
Find the persistent group object that corresponds to the provided group.- Specified by:
internalFindByGroup
in interfaceInternalGroupDao<com.atlassian.crowd.model.group.InternalGroup>
- Throws:
com.atlassian.crowd.exception.GroupNotFoundException
-
removeAllGroups
public void removeAllGroups(long directoryId)
Description copied from interface:InternalGroupDao
Remove all groups from a particular directory (used when deleting an internal directory)- Specified by:
removeAllGroups
in interfaceInternalGroupDao<com.atlassian.crowd.model.group.InternalGroup>
-
removeAllGroups
public com.atlassian.crowd.util.BatchResult<String> removeAllGroups(long directoryId, Set<String> groupNames)
- Specified by:
removeAllGroups
in interfacecom.atlassian.crowd.embedded.spi.GroupDao
-
getAllExternalIds
public Set<String> getAllExternalIds(long directoryId) throws com.atlassian.crowd.exception.DirectoryNotFoundException
- Specified by:
getAllExternalIds
in interfacecom.atlassian.crowd.embedded.spi.GroupDao
- Throws:
com.atlassian.crowd.exception.DirectoryNotFoundException
-
getGroupCount
public long getGroupCount(long directoryId) throws com.atlassian.crowd.exception.DirectoryNotFoundException
- Specified by:
getGroupCount
in interfacecom.atlassian.crowd.embedded.spi.GroupDao
- Throws:
com.atlassian.crowd.exception.DirectoryNotFoundException
-
getLocalGroupNames
public Set<String> getLocalGroupNames(long directoryId) throws com.atlassian.crowd.exception.DirectoryNotFoundException
- Specified by:
getLocalGroupNames
in interfacecom.atlassian.crowd.embedded.spi.GroupDao
- Throws:
com.atlassian.crowd.exception.DirectoryNotFoundException
-
findByExternalIds
public Map<String,String> findByExternalIds(long directoryId, Set<String> externalIds)
- Specified by:
findByExternalIds
in interfacecom.atlassian.crowd.embedded.spi.GroupDao
-
findExternalIdsByNames
public Map<String,String> findExternalIdsByNames(long directoryId, Set<String> groupNames)
- Specified by:
findExternalIdsByNames
in interfacecom.atlassian.crowd.embedded.spi.GroupDao
-
getExternalGroupCount
public long getExternalGroupCount(long directoryId) throws com.atlassian.crowd.exception.DirectoryNotFoundException
- Specified by:
getExternalGroupCount
in interfacecom.atlassian.crowd.embedded.spi.GroupDao
- Throws:
com.atlassian.crowd.exception.DirectoryNotFoundException
-
-