public class MockDirectoryCache extends Object implements DirectoryCache
| Modifier and Type | Field and Description |
|---|---|
Map<String,Group> |
groupMap |
com.google.common.collect.SetMultimap<String,String> |
groupMembershipsMap |
Map<String,GroupWithAttributes> |
groupWithAttributesHashMap |
Map<String,Group> |
roleMap |
Map<String,User> |
userMap |
com.google.common.collect.SetMultimap<String,String> |
userMembershipsMap |
Map<String,UserWithAttributes> |
userWithAttributesHashMap |
| Constructor and Description |
|---|
MockDirectoryCache() |
| Modifier and Type | Method and Description |
|---|---|
void |
addGroupMembersForGroup(Group parentGroup,
Set<String> groups) |
void |
addGroupToGroup(String childGroup,
String parentGroup) |
void |
addOrUpdateCachedGroup(Group group) |
void |
addOrUpdateCachedGroups(Collection<? extends Group> groups,
Date syncStartDate) |
void |
addOrUpdateCachedUser(User user) |
void |
addOrUpdateCachedUsers(Collection<? extends User> users,
Date syncStartDate)
Synchronises a list of Users from an external directory in the local cache.
|
void |
addUserMembersForGroup(Group parentGroup,
Set<String> remoteUsers) |
void |
addUserToGroup(String username,
String groupName) |
void |
applySyncingGroupAttributes(String groupName,
Set<String> deletedAttributes,
Map<String,Set<String>> storedAttributes)
Removes any syncing group attributes listed in deletedAttributes, and store any that are listed in storedAttributes
If any non-syncing attributes are included, they will be ignored
|
void |
applySyncingUserAttributes(String userName,
Set<String> deletedAttributes,
Map<String,Set<String>> storedAttributes)
Removes any syncing user attributes listed in deletedAttributes, and store any that are listed in storedAttributes
If any non-syncing attributes are included, they will be ignored
|
void |
deleteCachedGroup(String groupname) |
void |
deleteCachedGroups(List<String> groupnames) |
void |
deleteCachedGroups(Set<String> groupnames) |
void |
deleteCachedGroupsByGuids(Set<String> guids) |
void |
deleteCachedGroupsNotIn(GroupType groupType,
List<? extends Group> remoteGroups,
Date syncStartDate) |
void |
deleteCachedGroupsNotInByExternalId(Collection<? extends Group> remoteGroups,
Date syncStartDate) |
void |
deleteCachedUser(String username) |
void |
deleteCachedUsersByGuid(Set<String> guids) |
void |
deleteCachedUsersNotIn(Collection<? extends User> users,
Date syncStartDate) |
void |
deleteGroupMembersForGroup(Group parentGroup,
Set<String> groups) |
void |
deleteUserMembersForGroup(Group parentGroup,
Set<String> remoteUsers) |
Map<String,String> |
findGroupsByExternalIds(Set<String> externalIds)
Searches the specified directory for group names of groups with the specified external ids
|
Map<String,String> |
findGroupsExternalIdsByNames(Set<String> groupNames)
Searches the specified directory for externalIds of groups with the specified names
|
GroupWithAttributes |
findGroupWithAttributesByName(String name) |
Map<String,String> |
findUsersByExternalIds(Set<String> externalIds)
Searches the specified directory for user names of users with the specified external ids, returns
a map from external id to username
|
UserWithAttributes |
findUserWithAttributesByName(String name) |
Set<String> |
getAllGroupGuids()
Returns a set of all group guids present in the cache excluding null values.
|
Set<String> |
getAllUserGuids()
Returns a set of all user guids present in the cache excluding null values.
|
Group |
getGroup(String name) |
long |
getGroupCount()
Counts groups in directory cache.
|
Collection<Group> |
getGroups() |
Group |
getRole(String name) |
Collection<Group> |
getRoles() |
long |
getUserCount()
Counts users in directory cache.
|
Collection<User> |
getUsers() |
boolean |
isGroupAttributeSyncCalled() |
boolean |
isUserAttributeSyncCalled() |
void |
removeGroupFromGroup(String childGroup,
String parentGroup) |
void |
removeUserFromGroup(String username,
String groupName) |
void |
syncGroupMembersForGroup(Group parentGroup,
Collection<String> groups) |
void |
syncGroupMembershipsAndMembersForGroup(String groupName,
Set<String> parentGroupNames,
Set<String> childGroupNames) |
void |
syncGroupMembershipsForUser(String childUsername,
Set<String> parentGroupNames) |
void |
syncUserMembersForGroup(Group parentGroup,
Collection<String> users) |
public final Map<String,UserWithAttributes> userWithAttributesHashMap
public final Map<String,GroupWithAttributes> groupWithAttributesHashMap
public final com.google.common.collect.SetMultimap<String,String> userMembershipsMap
public void addOrUpdateCachedUsers(Collection<? extends User> users, Date syncStartDate) throws OperationFailedException
DirectoryCache
If the syncStartDate is not null, then it is used to ensure we don't re-introduce stale data if a User is updated
locally after we did our search.
Some callers may intentionally choose to pass null - eg when com.atlassian.crowd.directory.ldap.cache.UsnChangedCacheRefresher does a partial synchronise.
addOrUpdateCachedUsers in interface DirectoryCacheusers - A list of Users from the external directory.syncStartDate - The date that the synchronise started (can be null).OperationFailedException - If the Internal Directory throws a OperationFailedException - which seems unlikely.public void deleteCachedUsersNotIn(Collection<? extends User> users, Date syncStartDate) throws OperationFailedException
deleteCachedUsersNotIn in interface DirectoryCacheOperationFailedExceptionpublic void deleteCachedUsersByGuid(Set<String> guids) throws OperationFailedException
deleteCachedUsersByGuid in interface DirectoryCacheOperationFailedExceptionpublic void deleteCachedGroups(Set<String> groupnames) throws OperationFailedException
deleteCachedGroups in interface DirectoryCacheOperationFailedExceptionpublic void addOrUpdateCachedGroups(Collection<? extends Group> groups, Date syncStartDate) throws OperationFailedException
addOrUpdateCachedGroups in interface DirectoryCacheOperationFailedExceptionpublic void deleteCachedGroupsByGuids(Set<String> guids) throws OperationFailedException
deleteCachedGroupsByGuids in interface DirectoryCacheOperationFailedExceptionpublic void deleteCachedGroupsNotIn(GroupType groupType, List<? extends Group> remoteGroups, Date syncStartDate) throws OperationFailedException
deleteCachedGroupsNotIn in interface DirectoryCacheOperationFailedExceptionpublic void deleteCachedGroupsNotInByExternalId(Collection<? extends Group> remoteGroups, Date syncStartDate) throws OperationFailedException
deleteCachedGroupsNotInByExternalId in interface DirectoryCacheOperationFailedExceptionpublic void deleteCachedGroups(List<String> groupnames) throws OperationFailedException
OperationFailedExceptionpublic Collection<User> getUsers()
public Collection<Group> getGroups()
public Collection<Group> getRoles()
public void syncUserMembersForGroup(Group parentGroup, Collection<String> users) throws OperationFailedException
syncUserMembersForGroup in interface DirectoryCacheOperationFailedExceptionpublic void addUserMembersForGroup(Group parentGroup, Set<String> remoteUsers) throws OperationFailedException
addUserMembersForGroup in interface DirectoryCacheOperationFailedExceptionpublic void deleteUserMembersForGroup(Group parentGroup, Set<String> remoteUsers) throws OperationFailedException
deleteUserMembersForGroup in interface DirectoryCacheOperationFailedExceptionpublic void syncGroupMembersForGroup(Group parentGroup, Collection<String> groups) throws OperationFailedException
syncGroupMembersForGroup in interface DirectoryCacheOperationFailedExceptionpublic void addGroupMembersForGroup(Group parentGroup, Set<String> groups) throws OperationFailedException
addGroupMembersForGroup in interface DirectoryCacheOperationFailedExceptionpublic void deleteGroupMembersForGroup(Group parentGroup, Set<String> groups) throws OperationFailedException
deleteGroupMembersForGroup in interface DirectoryCacheOperationFailedExceptionpublic void addOrUpdateCachedUser(User user) throws OperationFailedException
addOrUpdateCachedUser in interface DirectoryCacheOperationFailedExceptionpublic void deleteCachedUser(String username) throws OperationFailedException
deleteCachedUser in interface DirectoryCacheOperationFailedExceptionpublic void addOrUpdateCachedGroup(Group group) throws OperationFailedException
addOrUpdateCachedGroup in interface DirectoryCacheOperationFailedExceptionpublic void deleteCachedGroup(String groupname) throws OperationFailedException
deleteCachedGroup in interface DirectoryCacheOperationFailedExceptionpublic void addUserToGroup(String username, String groupName) throws OperationFailedException
addUserToGroup in interface DirectoryCacheOperationFailedExceptionpublic void removeUserFromGroup(String username, String groupName) throws OperationFailedException
removeUserFromGroup in interface DirectoryCacheOperationFailedExceptionpublic void addGroupToGroup(String childGroup, String parentGroup) throws OperationFailedException
addGroupToGroup in interface DirectoryCacheOperationFailedExceptionpublic void removeGroupFromGroup(String childGroup, String parentGroup) throws OperationFailedException
removeGroupFromGroup in interface DirectoryCacheOperationFailedExceptionpublic void syncGroupMembershipsForUser(String childUsername, Set<String> parentGroupNames) throws OperationFailedException
syncGroupMembershipsForUser in interface DirectoryCacheOperationFailedExceptionpublic void syncGroupMembershipsAndMembersForGroup(String groupName, Set<String> parentGroupNames, Set<String> childGroupNames) throws OperationFailedException
syncGroupMembershipsAndMembersForGroup in interface DirectoryCacheOperationFailedExceptionpublic Set<String> getAllUserGuids()
DirectoryCachegetAllUserGuids in interface DirectoryCachepublic long getUserCount()
DirectoryCachegetUserCount in interface DirectoryCachepublic Set<String> getAllGroupGuids() throws OperationFailedException
DirectoryCachegetAllGroupGuids in interface DirectoryCacheOperationFailedException - if the internal directory throes a OperationFailedExceptionpublic long getGroupCount()
throws OperationFailedException
DirectoryCachegetGroupCount in interface DirectoryCacheOperationFailedExceptionpublic UserWithAttributes findUserWithAttributesByName(String name) throws UserNotFoundException, OperationFailedException
findUserWithAttributesByName in interface DirectoryCacheUserNotFoundExceptionOperationFailedExceptionpublic Map<String,String> findUsersByExternalIds(Set<String> externalIds)
DirectoryCachefindUsersByExternalIds in interface DirectoryCacheexternalIds - the external ids of the users to search forpublic Map<String,String> findGroupsByExternalIds(Set<String> externalIds) throws OperationFailedException
DirectoryCachefindGroupsByExternalIds in interface DirectoryCacheexternalIds - external ids of the groups to findOperationFailedExceptionpublic Map<String,String> findGroupsExternalIdsByNames(Set<String> groupNames) throws OperationFailedException
DirectoryCachefindGroupsExternalIdsByNames in interface DirectoryCachegroupNames - names of the groups to findOperationFailedExceptionpublic GroupWithAttributes findGroupWithAttributesByName(String name) throws GroupNotFoundException, OperationFailedException
findGroupWithAttributesByName in interface DirectoryCacheGroupNotFoundExceptionOperationFailedExceptionpublic void applySyncingUserAttributes(String userName, Set<String> deletedAttributes, Map<String,Set<String>> storedAttributes) throws UserNotFoundException, OperationFailedException
DirectoryCacheapplySyncingUserAttributes in interface DirectoryCacheuserName - user to apply attributes todeletedAttributes - attribute keys that need to be deletedstoredAttributes - attributes and values that need to be saved (will overwrite any existing attributes with the same keys)UserNotFoundExceptionOperationFailedExceptionpublic void applySyncingGroupAttributes(String groupName, Set<String> deletedAttributes, Map<String,Set<String>> storedAttributes) throws GroupNotFoundException, OperationFailedException
DirectoryCacheapplySyncingGroupAttributes in interface DirectoryCachegroupName - group to apply attributes todeletedAttributes - attribute keys that need to be deletedstoredAttributes - attributes and values that need to be saved (will overwrite any existing attributes with the same keys)GroupNotFoundExceptionOperationFailedExceptionpublic boolean isUserAttributeSyncCalled()
public boolean isGroupAttributeSyncCalled()
Copyright © 2018 Atlassian. All rights reserved.