Package com.atlassian.crowd.directory
Class DirectoryCacheImplUsingChangeOperations
java.lang.Object
com.atlassian.crowd.directory.DirectoryCacheImplUsingChangeOperations
- All Implemented Interfaces:
DirectoryCache
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addGroupMembersForGroup
(Group parentGroup, Set<String> remoteGroups) void
addGroupToGroup
(String childGroup, String parentGroup) void
addOrUpdateCachedGroup
(Group group) void
addOrUpdateCachedGroups
(Collection<? extends Group> remoteGroups, Date syncStartDate) void
addOrUpdateCachedUser
(User user) addOrUpdateCachedUsers
(Collection<? extends User> remoteUsers, 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 ignoredvoid
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 ignoredvoid
deleteCachedGroup
(String groupName) 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> remoteGroups) void
deleteUserMembersForGroup
(Group parentGroup, Set<String> remoteUsers) findGroupsByExternalIds
(Set<String> externalIds) Searches the specified directory for group names of groups with the specified external idsfindGroupsExternalIdsByNames
(Set<String> groupNames) Searches the specified directory for externalIds of groups with the specified namesfindUsersByExternalIds
(Set<String> externalIds) Searches the specified directory for user names of users with the specified external ids, returns a map from external id to usernameReturns a set of all group guids present in the cache excluding null values.Returns a set of all local group names.Returns a set of all user guids present in the cache excluding null values.long
Counts external cached groups in the directory cachelong
Counts groups in directory cache.long
Counts users in directory cache.void
removeGroupFromGroup
(String childGroup, String parentGroup) void
removeUserFromGroup
(String username, String groupName) void
syncGroupMembersForGroup
(Group parentGroup, Collection<String> remoteGroups) void
syncGroupMembershipsAndMembersForGroup
(String groupName, Set<String> parentGroupNames, Set<String> childGroupNames) void
syncGroupMembershipsForUser
(String childUsername, Set<String> parentGroupNames) void
syncUserMembersForGroup
(Group parentGroup, Collection<String> remoteUsers)
-
Constructor Details
-
DirectoryCacheImplUsingChangeOperations
-
-
Method Details
-
addOrUpdateCachedUsers
public AddUpdateSets<UserTemplateWithCredentialAndAttributes,UserTemplate> addOrUpdateCachedUsers(Collection<? extends User> remoteUsers, Date syncStartDate) throws OperationFailedException Description copied from interface:DirectoryCache
Synchronises a list of Users from an external directory in the local cache.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.- Specified by:
addOrUpdateCachedUsers
in interfaceDirectoryCache
- Parameters:
remoteUsers
- A list of Users from the external directory.syncStartDate
- The date that the synchronise started (can be null).- Throws:
OperationFailedException
- If the Internal Directory throws a OperationFailedException - which seems unlikely.
-
deleteCachedUsersByGuid
- Specified by:
deleteCachedUsersByGuid
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
addOrUpdateCachedGroups
public void addOrUpdateCachedGroups(Collection<? extends Group> remoteGroups, Date syncStartDate) throws OperationFailedException - Specified by:
addOrUpdateCachedGroups
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
deleteCachedGroupsNotIn
public void deleteCachedGroupsNotIn(GroupType groupType, List<? extends Group> remoteGroups, Date syncStartDate) throws OperationFailedException - Specified by:
deleteCachedGroupsNotIn
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
deleteCachedGroupsNotInByExternalId
public void deleteCachedGroupsNotInByExternalId(Collection<? extends Group> remoteGroups, Date syncStartDate) throws OperationFailedException - Specified by:
deleteCachedGroupsNotInByExternalId
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
syncUserMembersForGroup
public void syncUserMembersForGroup(Group parentGroup, Collection<String> remoteUsers) throws OperationFailedException - Specified by:
syncUserMembersForGroup
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
addUserMembersForGroup
public void addUserMembersForGroup(Group parentGroup, Set<String> remoteUsers) throws OperationFailedException - Specified by:
addUserMembersForGroup
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
deleteUserMembersForGroup
public void deleteUserMembersForGroup(Group parentGroup, Set<String> remoteUsers) throws OperationFailedException - Specified by:
deleteUserMembersForGroup
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
syncGroupMembersForGroup
public void syncGroupMembersForGroup(Group parentGroup, Collection<String> remoteGroups) throws OperationFailedException - Specified by:
syncGroupMembersForGroup
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
addGroupMembersForGroup
public void addGroupMembersForGroup(Group parentGroup, Set<String> remoteGroups) throws OperationFailedException - Specified by:
addGroupMembersForGroup
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
deleteGroupMembersForGroup
public void deleteGroupMembersForGroup(Group parentGroup, Set<String> remoteGroups) throws OperationFailedException - Specified by:
deleteGroupMembersForGroup
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
deleteCachedGroups
- Specified by:
deleteCachedGroups
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
deleteCachedGroupsByGuids
- Specified by:
deleteCachedGroupsByGuids
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
deleteCachedUsersNotIn
public void deleteCachedUsersNotIn(Collection<? extends User> users, Date syncStartDate) throws OperationFailedException - Specified by:
deleteCachedUsersNotIn
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
addOrUpdateCachedUser
- Specified by:
addOrUpdateCachedUser
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
deleteCachedUser
- Specified by:
deleteCachedUser
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
addOrUpdateCachedGroup
- Specified by:
addOrUpdateCachedGroup
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
deleteCachedGroup
- Specified by:
deleteCachedGroup
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
addUserToGroup
- Specified by:
addUserToGroup
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
removeUserFromGroup
- Specified by:
removeUserFromGroup
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
addGroupToGroup
- Specified by:
addGroupToGroup
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
removeGroupFromGroup
public void removeGroupFromGroup(String childGroup, String parentGroup) throws OperationFailedException - Specified by:
removeGroupFromGroup
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
syncGroupMembershipsForUser
public void syncGroupMembershipsForUser(String childUsername, Set<String> parentGroupNames) throws OperationFailedException - Specified by:
syncGroupMembershipsForUser
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
syncGroupMembershipsAndMembersForGroup
public void syncGroupMembershipsAndMembersForGroup(String groupName, Set<String> parentGroupNames, Set<String> childGroupNames) throws OperationFailedException - Specified by:
syncGroupMembershipsAndMembersForGroup
in interfaceDirectoryCache
- Throws:
OperationFailedException
-
getAllUserGuids
Description copied from interface:DirectoryCache
Returns a set of all user guids present in the cache excluding null values.- Specified by:
getAllUserGuids
in interfaceDirectoryCache
- Returns:
- set of all user guids present in the cache
- Throws:
OperationFailedException
- if the internal directory throes a OperationFailedException
-
getAllGroupGuids
Description copied from interface:DirectoryCache
Returns a set of all group guids present in the cache excluding null values.- Specified by:
getAllGroupGuids
in interfaceDirectoryCache
- Returns:
- set of all group guids present in the cache
- Throws:
OperationFailedException
- if the internal directory throes a OperationFailedException
-
getAllLocalGroupNames
Description copied from interface:DirectoryCache
Returns a set of all local group names.- Specified by:
getAllLocalGroupNames
in interfaceDirectoryCache
- Returns:
- set of all local group names.
- Throws:
OperationFailedException
- if the internal directory throes a OperationFailedException
-
getUserCount
Description copied from interface:DirectoryCache
Counts users in directory cache.- Specified by:
getUserCount
in interfaceDirectoryCache
- Returns:
- user count
- Throws:
OperationFailedException
-
getGroupCount
Description copied from interface:DirectoryCache
Counts groups in directory cache.- Specified by:
getGroupCount
in interfaceDirectoryCache
- Returns:
- group count
- Throws:
OperationFailedException
-
getExternalCachedGroupCount
Description copied from interface:DirectoryCache
Counts external cached groups in the directory cache- Specified by:
getExternalCachedGroupCount
in interfaceDirectoryCache
- Returns:
- external cached group count
- Throws:
OperationFailedException
- if the internal directory throws a OperationFailedException
-
findUserWithAttributesByName
public UserWithAttributes findUserWithAttributesByName(String name) throws UserNotFoundException, OperationFailedException - Specified by:
findUserWithAttributesByName
in interfaceDirectoryCache
- Throws:
UserNotFoundException
OperationFailedException
-
findUsersByExternalIds
Description copied from interface:DirectoryCache
Searches the specified directory for user names of users with the specified external ids, returns a map from external id to username- Specified by:
findUsersByExternalIds
in interfaceDirectoryCache
- Parameters:
externalIds
- the external ids of the users to search for
-
findGroupsByExternalIds
public Map<String,String> findGroupsByExternalIds(Set<String> externalIds) throws OperationFailedException Description copied from interface:DirectoryCache
Searches the specified directory for group names of groups with the specified external ids- Specified by:
findGroupsByExternalIds
in interfaceDirectoryCache
- Parameters:
externalIds
- external ids of the groups to find- Returns:
- a map from external ids to group names
- Throws:
OperationFailedException
-
findGroupsExternalIdsByNames
public Map<String,String> findGroupsExternalIdsByNames(Set<String> groupNames) throws OperationFailedException Description copied from interface:DirectoryCache
Searches the specified directory for externalIds of groups with the specified names- Specified by:
findGroupsExternalIdsByNames
in interfaceDirectoryCache
- Parameters:
groupNames
- names of the groups to find- Returns:
- a map from group names to external ids
- Throws:
OperationFailedException
-
findGroupWithAttributesByName
public GroupWithAttributes findGroupWithAttributesByName(String name) throws GroupNotFoundException, OperationFailedException - Specified by:
findGroupWithAttributesByName
in interfaceDirectoryCache
- Throws:
GroupNotFoundException
OperationFailedException
-
applySyncingUserAttributes
public void applySyncingUserAttributes(String userName, Set<String> deletedAttributes, Map<String, Set<String>> storedAttributes) throws UserNotFoundException, OperationFailedExceptionDescription copied from interface:DirectoryCache
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- Specified by:
applySyncingUserAttributes
in interfaceDirectoryCache
- Parameters:
userName
- 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)- Throws:
UserNotFoundException
OperationFailedException
-
applySyncingGroupAttributes
public void applySyncingGroupAttributes(String groupName, Set<String> deletedAttributes, Map<String, Set<String>> storedAttributes) throws GroupNotFoundException, OperationFailedExceptionDescription copied from interface:DirectoryCache
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- Specified by:
applySyncingGroupAttributes
in interfaceDirectoryCache
- Parameters:
groupName
- 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)- Throws:
GroupNotFoundException
OperationFailedException
-