com.atlassian.confluence.user.crowd
Class DefaultMembershipCache

java.lang.Object
  extended by com.atlassian.confluence.user.crowd.DefaultMembershipCache
All Implemented Interfaces:
MembershipCache

public final class DefaultMembershipCache
extends Object
implements MembershipCache

The cache maps a CachedCrowdMembershipCacheKey representing a user (or group) in a particular directory to a Map<String, String> where each entry in the map represents a group that the user (or group) is a member of. The key of each Map entry is the lowercase name of the user or child group. The value is the case-preserved actual name of the entity.

Since:
3.5

Constructor Summary
DefaultMembershipCache(com.atlassian.cache.CacheFactory cacheFactory)
           
 
Method Summary
 List<String> getGroupsForGroup(long directoryId, String groupName)
          Returns the list of groups names which the named group is a member of in the specified directory.
 List<String> getGroupsForUser(long directoryId, String userName)
          Returns the list of groups names which the named user is a member of in the specified directory.
 Boolean isGroupDirectMember(long directoryId, String groupName, String parentGroupName)
          Returns true if the parentGroupName is in the cached list of parents of the child group, false if parentGroupName is not in the list, or null if there is no cached list for the child group.
 Boolean isUserDirectMember(long directoryId, String userName, String groupName)
          Returns true if the groupName is in the cached list of parents of the user, false if groupName is not in the list, or null if there is no cached list for the user.
 void removeAllDirectoryMemberships(long directoryId)
          Removes any entries in the cache which relate to the specified directory.
 void removeAllGroupMemberships(long directoryId, String groupName)
          Removes any entries in the cache which contain the groupName in the specified directory.
 void removeAllUserMemberships(long directoryId, String userName)
          Removes any entries in the cache which contain the userName in the specified directory.
 void removeGroupGroupMemberships(long directoryId, String groupName)
          Removes any cached list of group names which are members of the named group in the specified directory.
 void removeUserGroupMemberships(long directoryId, String userName)
          Removes any cached list of user names which are members of the named group in the specified directory.
 void setGroupsForGroup(long directoryId, String groupName, Iterable<String> parentGroupNames)
          Caches the list of parent groupNames for each membership for the named group in the specified directory.
 void setGroupsForUser(long directoryId, String userName, Iterable<String> groupNames)
          Caches the list of parent groupNames for each membership for the named user in the specified directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMembershipCache

public DefaultMembershipCache(com.atlassian.cache.CacheFactory cacheFactory)
Method Detail

isUserDirectMember

public Boolean isUserDirectMember(long directoryId,
                                  String userName,
                                  String groupName)
Description copied from interface: MembershipCache
Returns true if the groupName is in the cached list of parents of the user, false if groupName is not in the list, or null if there is no cached list for the user.

Specified by:
isUserDirectMember in interface MembershipCache

isGroupDirectMember

public Boolean isGroupDirectMember(long directoryId,
                                   String groupName,
                                   String parentGroupName)
Description copied from interface: MembershipCache
Returns true if the parentGroupName is in the cached list of parents of the child group, false if parentGroupName is not in the list, or null if there is no cached list for the child group.

Specified by:
isGroupDirectMember in interface MembershipCache

setGroupsForUser

public void setGroupsForUser(long directoryId,
                             String userName,
                             Iterable<String> groupNames)
Description copied from interface: MembershipCache
Caches the list of parent groupNames for each membership for the named user in the specified directory.

Specified by:
setGroupsForUser in interface MembershipCache

setGroupsForGroup

public void setGroupsForGroup(long directoryId,
                              String groupName,
                              Iterable<String> parentGroupNames)
Description copied from interface: MembershipCache
Caches the list of parent groupNames for each membership for the named group in the specified directory.

Specified by:
setGroupsForGroup in interface MembershipCache

getGroupsForUser

public List<String> getGroupsForUser(long directoryId,
                                     String userName)
Description copied from interface: MembershipCache
Returns the list of groups names which the named user is a member of in the specified directory. or null if there is no cached list.

Specified by:
getGroupsForUser in interface MembershipCache

getGroupsForGroup

public List<String> getGroupsForGroup(long directoryId,
                                      String groupName)
Description copied from interface: MembershipCache
Returns the list of groups names which the named group is a member of in the specified directory. or null if there is no cached list.

Specified by:
getGroupsForGroup in interface MembershipCache

removeUserGroupMemberships

public void removeUserGroupMemberships(long directoryId,
                                       String userName)
Description copied from interface: MembershipCache
Removes any cached list of user names which are members of the named group in the specified directory. Does nothing if there is no corresponding entry in the cache.

Specified by:
removeUserGroupMemberships in interface MembershipCache

removeGroupGroupMemberships

public void removeGroupGroupMemberships(long directoryId,
                                        String groupName)
Description copied from interface: MembershipCache
Removes any cached list of group names which are members of the named group in the specified directory. Does nothing if there is no corresponding entry in the cache.

Specified by:
removeGroupGroupMemberships in interface MembershipCache

removeAllUserMemberships

public void removeAllUserMemberships(long directoryId,
                                     String userName)
Description copied from interface: MembershipCache
Removes any entries in the cache which contain the userName in the specified directory.

This can be a slow operation if the cache is large. This is a trade-off of the cache design, which is optimised for fast retrieval of all parent groups of a user or group.

Removes any GROUPS_FOR_USER entry in this cache if it contains this group.

Specified by:
removeAllUserMemberships in interface MembershipCache

removeAllGroupMemberships

public void removeAllGroupMemberships(long directoryId,
                                      String groupName)
Description copied from interface: MembershipCache
Removes any entries in the cache which contain the groupName in the specified directory.

This can be a slow operation if the cache is large. This is a trade-off of the cache design, which is optimised for fast retrieval of all parent groups of a user or group.

Removes any GROUPS_FOR_GROUP entry in this cache for the passed in group. Removes any GROUPS_FOR_USER entry in this cache if it contains this group.

Specified by:
removeAllGroupMemberships in interface MembershipCache

removeAllDirectoryMemberships

public void removeAllDirectoryMemberships(long directoryId)
Description copied from interface: MembershipCache
Removes any entries in the cache which relate to the specified directory.

This can be a slow operation if the cache is large. This is a trade-off of the cache design, which is optimised for fast retrieval of all parent groups of a user or group.

Specified by:
removeAllDirectoryMemberships in interface MembershipCache


Copyright © 2003-2013 Atlassian. All Rights Reserved.