Class CachedCrowdMembershipDao
- java.lang.Object
-
- com.atlassian.confluence.impl.user.crowd.CachedCrowdMembershipDao
-
- All Implemented Interfaces:
com.atlassian.crowd.embedded.spi.MembershipDao
public final class CachedCrowdMembershipDao extends Object implements com.atlassian.crowd.embedded.spi.MembershipDao
Caches membership information. Invalidation is done whenever any membership in the parent group changes.- Since:
- 3.5
- See Also:
DefaultMembershipCache
-
-
Constructor Summary
Constructors Constructor Description CachedCrowdMembershipDao(com.atlassian.crowd.embedded.spi.MembershipDao delegate, MembershipCache membershipCache, GroupMembershipCache parentGroupCache, GroupMembershipCache childGroupCache)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.atlassian.crowd.util.BatchResult<String>
addAllGroupsToGroup(long directoryId, Collection<String> childGroupNames, String parentGroupName)
com.atlassian.crowd.util.BatchResult<String>
addAllUsersToGroup(long directoryId, Collection<String> userNames, String groupName)
void
addGroupToGroup(long directoryId, String childGroupName, String parentGroupName)
void
addUserToGroup(long directoryId, String userName, String groupName)
com.atlassian.crowd.util.BatchResult<String>
addUserToGroups(long directoryId, String username, Set<String> groupNames)
static <T> List<T>
constrainResults(Collection<T> results, int startIndex, int maxResults)
com.atlassian.crowd.util.BoundedCount
countDirectMembersOfGroup(long directoryId, String groupName, int potentialMaxCount)
boolean
isGroupDirectMember(long directoryId, String childGroup, String parentGroupName)
boolean
isUserDirectMember(long directoryId, String userName, String groupName)
void
removeGroupFromGroup(long directoryId, String childGroupName, String parentGroupName)
com.atlassian.crowd.util.BatchResult<String>
removeGroupsFromGroup(long directoryId, Collection<String> childGroupNames, String parentGroupName)
void
removeUserFromGroup(long directoryId, String userName, String groupName)
com.atlassian.crowd.util.BatchResult<String>
removeUsersFromGroup(long directoryId, Collection<String> userNames, String parentGroupName)
<T> List<T>
search(long directoryId, com.atlassian.crowd.search.query.membership.MembershipQuery<T> query)
This implementation uses the existing cached data for searches returning strings, and for searches returning Group objects when searching for Groups as well.<T> com.google.common.collect.ListMultimap<String,T>
searchGroupedByName(long directoryId, com.atlassian.crowd.search.query.membership.MembershipQuery<T> query)
searchGroupedByName accepts a query with the set of group names to search.
-
-
-
Constructor Detail
-
CachedCrowdMembershipDao
public CachedCrowdMembershipDao(com.atlassian.crowd.embedded.spi.MembershipDao delegate, MembershipCache membershipCache, GroupMembershipCache parentGroupCache, GroupMembershipCache childGroupCache)
-
-
Method Detail
-
isUserDirectMember
public boolean isUserDirectMember(long directoryId, String userName, String groupName)
- Specified by:
isUserDirectMember
in interfacecom.atlassian.crowd.embedded.spi.MembershipDao
-
isGroupDirectMember
public boolean isGroupDirectMember(long directoryId, String childGroup, String parentGroupName)
- Specified by:
isGroupDirectMember
in interfacecom.atlassian.crowd.embedded.spi.MembershipDao
-
addUserToGroup
public void addUserToGroup(long directoryId, String userName, String groupName) throws com.atlassian.crowd.exception.UserNotFoundException, com.atlassian.crowd.exception.GroupNotFoundException, com.atlassian.crowd.exception.MembershipAlreadyExistsException
- Specified by:
addUserToGroup
in interfacecom.atlassian.crowd.embedded.spi.MembershipDao
- Throws:
com.atlassian.crowd.exception.UserNotFoundException
com.atlassian.crowd.exception.GroupNotFoundException
com.atlassian.crowd.exception.MembershipAlreadyExistsException
-
addUserToGroups
public com.atlassian.crowd.util.BatchResult<String> addUserToGroups(long directoryId, String username, Set<String> groupNames) throws com.atlassian.crowd.exception.UserNotFoundException
- Specified by:
addUserToGroups
in interfacecom.atlassian.crowd.embedded.spi.MembershipDao
- Throws:
com.atlassian.crowd.exception.UserNotFoundException
- Since:
- 7.19.5
-
addAllUsersToGroup
public com.atlassian.crowd.util.BatchResult<String> addAllUsersToGroup(long directoryId, Collection<String> userNames, String groupName) throws com.atlassian.crowd.exception.GroupNotFoundException
- Specified by:
addAllUsersToGroup
in interfacecom.atlassian.crowd.embedded.spi.MembershipDao
- Throws:
com.atlassian.crowd.exception.GroupNotFoundException
-
addGroupToGroup
public void addGroupToGroup(long directoryId, String childGroupName, String parentGroupName) throws com.atlassian.crowd.exception.GroupNotFoundException, com.atlassian.crowd.exception.MembershipAlreadyExistsException
- Specified by:
addGroupToGroup
in interfacecom.atlassian.crowd.embedded.spi.MembershipDao
- Throws:
com.atlassian.crowd.exception.GroupNotFoundException
com.atlassian.crowd.exception.MembershipAlreadyExistsException
-
addAllGroupsToGroup
public com.atlassian.crowd.util.BatchResult<String> addAllGroupsToGroup(long directoryId, Collection<String> childGroupNames, String parentGroupName) throws com.atlassian.crowd.exception.GroupNotFoundException
- Specified by:
addAllGroupsToGroup
in interfacecom.atlassian.crowd.embedded.spi.MembershipDao
- Throws:
com.atlassian.crowd.exception.GroupNotFoundException
-
removeUserFromGroup
public void removeUserFromGroup(long directoryId, String userName, String groupName) throws com.atlassian.crowd.exception.UserNotFoundException, com.atlassian.crowd.exception.GroupNotFoundException, com.atlassian.crowd.exception.MembershipNotFoundException
- Specified by:
removeUserFromGroup
in interfacecom.atlassian.crowd.embedded.spi.MembershipDao
- Throws:
com.atlassian.crowd.exception.UserNotFoundException
com.atlassian.crowd.exception.GroupNotFoundException
com.atlassian.crowd.exception.MembershipNotFoundException
-
removeUsersFromGroup
public com.atlassian.crowd.util.BatchResult<String> removeUsersFromGroup(long directoryId, Collection<String> userNames, String parentGroupName) throws com.atlassian.crowd.exception.GroupNotFoundException
- Specified by:
removeUsersFromGroup
in interfacecom.atlassian.crowd.embedded.spi.MembershipDao
- Throws:
com.atlassian.crowd.exception.GroupNotFoundException
-
removeGroupFromGroup
public void removeGroupFromGroup(long directoryId, String childGroupName, String parentGroupName) throws com.atlassian.crowd.exception.GroupNotFoundException, com.atlassian.crowd.exception.MembershipNotFoundException
- Specified by:
removeGroupFromGroup
in interfacecom.atlassian.crowd.embedded.spi.MembershipDao
- Throws:
com.atlassian.crowd.exception.GroupNotFoundException
com.atlassian.crowd.exception.MembershipNotFoundException
-
removeGroupsFromGroup
public com.atlassian.crowd.util.BatchResult<String> removeGroupsFromGroup(long directoryId, Collection<String> childGroupNames, String parentGroupName) throws com.atlassian.crowd.exception.GroupNotFoundException
- Specified by:
removeGroupsFromGroup
in interfacecom.atlassian.crowd.embedded.spi.MembershipDao
- Throws:
com.atlassian.crowd.exception.GroupNotFoundException
-
countDirectMembersOfGroup
public com.atlassian.crowd.util.BoundedCount countDirectMembersOfGroup(long directoryId, String groupName, int potentialMaxCount)
- Specified by:
countDirectMembersOfGroup
in interfacecom.atlassian.crowd.embedded.spi.MembershipDao
-
search
public <T> List<T> search(long directoryId, com.atlassian.crowd.search.query.membership.MembershipQuery<T> query)
This implementation uses the existing cached data for searches returning strings, and for searches returning Group objects when searching for Groups as well. Missing results for these kinds of searches will also be cached. Any other searches will simply delegate to the underlying implementation.- Specified by:
search
in interfacecom.atlassian.crowd.embedded.spi.MembershipDao
-
searchGroupedByName
public <T> com.google.common.collect.ListMultimap<String,T> searchGroupedByName(long directoryId, com.atlassian.crowd.search.query.membership.MembershipQuery<T> query)
searchGroupedByName accepts a query with the set of group names to search. Returns a multimap where key is the group name and the values are either parent or child group names. It can search for either for parent or child groups. Getting groups for users is not supported byHibernateMembershipDao.searchGroupedByName
at the moment.- Specified by:
searchGroupedByName
in interfacecom.atlassian.crowd.embedded.spi.MembershipDao
- Since:
- 7.11
-
constrainResults
public static <T> List<T> constrainResults(Collection<T> results, int startIndex, int maxResults)
-
-