Package com.atlassian.crowd.directory
Class DbCachingRemoteChangeOperations
java.lang.Object
com.atlassian.crowd.directory.DbCachingRemoteChangeOperations
- All Implemented Interfaces:
DirectoryCacheChangeOperations
public class DbCachingRemoteChangeOperations
extends Object
implements DirectoryCacheChangeOperations
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.crowd.directory.DirectoryCacheChangeOperations
DirectoryCacheChangeOperations.AddRemoveSets<T extends Object>, DirectoryCacheChangeOperations.GroupShadowingType, DirectoryCacheChangeOperations.GroupsToAddUpdateReplace -
Constructor Summary
ConstructorsConstructorDescriptionDbCachingRemoteChangeOperations(com.atlassian.crowd.embedded.spi.DirectoryDao directoryDao, RemoteDirectory remoteDirectory, InternalRemoteDirectory internalDirectory, SynchronisationStatusManager synchronisationStatusManager, MultiEventPublisher eventPublisher, com.atlassian.crowd.embedded.spi.UserDao userDao, com.atlassian.crowd.embedded.spi.GroupDao groupDao, GroupActionStrategy groupActionStrategy, CrowdDarkFeatureManager crowdDarkFeatureManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddGroupMembershipsForGroup(Group parentGroup, Collection<String> groupsToAdd) voidaddGroups(Set<GroupTemplate> groupsToAdd) voidaddGroupToGroup(String childGroup, String parentGroup) voidaddOrUpdateCachedGroup(Group group) voidaddOrUpdateCachedUser(User user) voidaddUserMembershipsForGroup(Group group, Set<String> usersToAdd) voidaddUsers(Set<UserTemplateWithCredentialAndAttributes> usersToAdd) voidaddUserToGroup(String username, String groupName) voidapplySyncingGroupAttributes(String groupName, Set<String> deletedAttributes, Map<String, Set<String>> storedAttributes) voidapplySyncingUserAttributes(String userName, Set<String> deletedAttributes, Map<String, Set<String>> storedAttributes) voiddeleteCachedGroup(String groupName) voiddeleteCachedGroups(Set<String> groupnames) voiddeleteCachedGroupsByGuids(Set<String> guids) voiddeleteCachedGroupsNotIn(GroupType groupType, List<? extends Group> remoteGroups, Date syncStartDate) voiddeleteCachedGroupsNotInByExternalId(Collection<? extends Group> remoteGroups, Date syncStartDate) voiddeleteCachedUser(String username) voiddeleteCachedUsersByGuid(Set<String> guids) voiddeleteCachedUsersNotIn(Collection<? extends User> remoteUsers, Date synchStartDate) voiddeleteCachedUsersNotInOld(Collection<? extends User> remoteUsers, Date synchStartDate) findGroupMembershipForGroupChanges(Group parentGroup, Collection<String> remoteGroups) findGroupsByExternalIds(Set<String> externalIds) findGroupsExternalIdsByNames(Set<String> groupNames) findGroupsToUpdate(Collection<? extends Group> remoteGroups, Date syncStartDate) findUserMembershipForGroupChanges(Group group, Collection<String> remoteUsers) findUsersByExternalIds(Set<String> externalIds) protected Directorylonglonglongcom.atlassian.crowd.directory.synchronisation.utils.AddUpdateSets<UserTemplateWithCredentialAndAttributes,UserTemplate> getUsersToAddAndUpdate(Collection<? extends User> remoteUsers, Date syncStartDate) Returns the users that need to be added or updated given the list of all remote users.com.atlassian.crowd.directory.synchronisation.utils.AddUpdateSets<UserTemplateWithCredentialAndAttributes,UserTemplate> getUsersToAddAndUpdateOld(Collection<? extends User> remoteUsers, Date syncStartDate) protected booleanhasChanged(User remoteUser, User internalUser) isGroupShadowed(Group remoteGroup) Returns true if the given remote Group should not have its memberships synchronised for any reason.protected static Map<String,TimestampedUser> protected static List<org.apache.commons.lang3.tuple.Pair<User,TimestampedUser>> matchUsers(Collection<? extends User> remoteUsers, Collection<? extends TimestampedUser> internalUsers) Returns list ofPair, wherePair.getLeft()is one ofremoteUsersandPair.getRight()is a matchedinternalUsersor null, if not matched.voidremoveGroupFromGroup(String childGroup, String parentGroup) voidremoveGroupMembershipsForGroup(Group parentGroup, Collection<String> groupsToRemove) voidremoveGroups(Collection<String> groupsToRemove) voidremoveUserFromGroup(String username, String groupName) voidremoveUserMembershipsForGroup(Group group, Set<String> usersToRemove) voidsyncGroupMembershipsAndMembersForGroup(String groupName, Set<String> parentGroupNames, Set<String> childGroupNames) voidsyncGroupMembershipsForUser(String childUsername, Set<String> parentGroupNames) voidupdateGroups(Collection<GroupTemplate> groupsToUpdate) voidupdateUsers(Collection<UserTemplate> usersToUpdate)
-
Constructor Details
-
DbCachingRemoteChangeOperations
public DbCachingRemoteChangeOperations(com.atlassian.crowd.embedded.spi.DirectoryDao directoryDao, RemoteDirectory remoteDirectory, InternalRemoteDirectory internalDirectory, SynchronisationStatusManager synchronisationStatusManager, MultiEventPublisher eventPublisher, com.atlassian.crowd.embedded.spi.UserDao userDao, com.atlassian.crowd.embedded.spi.GroupDao groupDao, GroupActionStrategy groupActionStrategy, CrowdDarkFeatureManager crowdDarkFeatureManager)
-
-
Method Details
-
addUsers
public void addUsers(Set<UserTemplateWithCredentialAndAttributes> usersToAdd) throws OperationFailedException - Specified by:
addUsersin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
updateUsers
- Specified by:
updateUsersin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
deleteCachedUsersByGuid
- Specified by:
deleteCachedUsersByGuidin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
deleteCachedUsersNotIn
public void deleteCachedUsersNotIn(Collection<? extends User> remoteUsers, Date synchStartDate) throws OperationFailedException - Specified by:
deleteCachedUsersNotInin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
deleteCachedUsersNotInOld
public void deleteCachedUsersNotInOld(Collection<? extends User> remoteUsers, Date synchStartDate) throws OperationFailedException - Throws:
OperationFailedException
-
findGroupsToUpdate
public DirectoryCacheChangeOperations.GroupsToAddUpdateReplace findGroupsToUpdate(Collection<? extends Group> remoteGroups, Date syncStartDate) throws OperationFailedException - Specified by:
findGroupsToUpdatein interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
removeGroups
- Specified by:
removeGroupsin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
addGroups
- Specified by:
addGroupsin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
updateGroups
- Specified by:
updateGroupsin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
deleteCachedGroupsNotIn
public void deleteCachedGroupsNotIn(GroupType groupType, List<? extends Group> remoteGroups, Date syncStartDate) throws OperationFailedException - Specified by:
deleteCachedGroupsNotInin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
deleteCachedGroupsNotInByExternalId
public void deleteCachedGroupsNotInByExternalId(Collection<? extends Group> remoteGroups, Date syncStartDate) throws OperationFailedException - Specified by:
deleteCachedGroupsNotInByExternalIdin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
deleteCachedGroups
- Specified by:
deleteCachedGroupsin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
deleteCachedGroupsByGuids
- Specified by:
deleteCachedGroupsByGuidsin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
hasChanged
-
findUserMembershipForGroupChanges
public DirectoryCacheChangeOperations.AddRemoveSets<String> findUserMembershipForGroupChanges(Group group, Collection<String> remoteUsers) throws OperationFailedException - Specified by:
findUserMembershipForGroupChangesin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
removeUserMembershipsForGroup
public void removeUserMembershipsForGroup(Group group, Set<String> usersToRemove) throws OperationFailedException - Specified by:
removeUserMembershipsForGroupin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
addUserMembershipsForGroup
public void addUserMembershipsForGroup(Group group, Set<String> usersToAdd) throws OperationFailedException - Specified by:
addUserMembershipsForGroupin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
findGroupMembershipForGroupChanges
public DirectoryCacheChangeOperations.AddRemoveSets<String> findGroupMembershipForGroupChanges(Group parentGroup, Collection<String> remoteGroups) throws OperationFailedException - Specified by:
findGroupMembershipForGroupChangesin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
addGroupMembershipsForGroup
public void addGroupMembershipsForGroup(Group parentGroup, Collection<String> groupsToAdd) throws OperationFailedException - Specified by:
addGroupMembershipsForGroupin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
removeGroupMembershipsForGroup
public void removeGroupMembershipsForGroup(Group parentGroup, Collection<String> groupsToRemove) throws OperationFailedException - Specified by:
removeGroupMembershipsForGroupin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
getLastSyncStartOrEnd
-
getDirectory
- Throws:
DirectoryNotFoundException
-
isGroupShadowed
public DirectoryCacheChangeOperations.GroupShadowingType isGroupShadowed(Group remoteGroup) throws OperationFailedException Returns true if the given remote Group should not have its memberships synchronised for any reason.- Specified by:
isGroupShadowedin interfaceDirectoryCacheChangeOperations- Parameters:
remoteGroup- The Group to test.- Returns:
- true if the given remote Group should not have its memberships synchronised for any reason.
- Throws:
OperationFailedException- If there is an error trying to find the group in the Internal Directory (should not occur).
-
getUsersToAddAndUpdate
public com.atlassian.crowd.directory.synchronisation.utils.AddUpdateSets<UserTemplateWithCredentialAndAttributes,UserTemplate> getUsersToAddAndUpdate(Collection<? extends User> remoteUsers, Date syncStartDate) throws OperationFailedException Returns the users that need to be added or updated given the list of all remote users. Only the internal users modified beforesyncStartDatewill be updated. This is done to avoid overriding changes made locally to a user after the synchronisation has started.- Specified by:
getUsersToAddAndUpdatein interfaceDirectoryCacheChangeOperations- Parameters:
remoteUsers- List of all remote users.syncStartDate- Date and time of the start of the synchronisation. Used to determine which users need to be synchronised. Can be null in which case all the users are synchronised.- Returns:
- a pair of Sets of users to update and update.
- Throws:
OperationFailedException- if the operation failed for any reason
-
matchUsers
protected static List<org.apache.commons.lang3.tuple.Pair<User,TimestampedUser>> matchUsers(Collection<? extends User> remoteUsers, Collection<? extends TimestampedUser> internalUsers) Returns list ofPair, wherePair.getLeft()is one ofremoteUsersandPair.getRight()is a matchedinternalUsersor null, if not matched. -
getUsersToAddAndUpdateOld
public com.atlassian.crowd.directory.synchronisation.utils.AddUpdateSets<UserTemplateWithCredentialAndAttributes,UserTemplate> getUsersToAddAndUpdateOld(Collection<? extends User> remoteUsers, Date syncStartDate) throws OperationFailedException - Throws:
OperationFailedException
-
mapUsersByExternalId
protected static Map<String,TimestampedUser> mapUsersByExternalId(Collection<TimestampedUser> users) -
addOrUpdateCachedUser
- Specified by:
addOrUpdateCachedUserin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
deleteCachedUser
- Specified by:
deleteCachedUserin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
addOrUpdateCachedGroup
- Specified by:
addOrUpdateCachedGroupin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
deleteCachedGroup
- Specified by:
deleteCachedGroupin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
addUserToGroup
- Specified by:
addUserToGroupin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
addGroupToGroup
- Specified by:
addGroupToGroupin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
removeUserFromGroup
- Specified by:
removeUserFromGroupin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
removeGroupFromGroup
public void removeGroupFromGroup(String childGroup, String parentGroup) throws OperationFailedException - Specified by:
removeGroupFromGroupin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
syncGroupMembershipsForUser
public void syncGroupMembershipsForUser(String childUsername, Set<String> parentGroupNames) throws OperationFailedException - Specified by:
syncGroupMembershipsForUserin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
syncGroupMembershipsAndMembersForGroup
public void syncGroupMembershipsAndMembersForGroup(String groupName, Set<String> parentGroupNames, Set<String> childGroupNames) throws OperationFailedException - Specified by:
syncGroupMembershipsAndMembersForGroupin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
findUserWithAttributesByName
public UserWithAttributes findUserWithAttributesByName(String name) throws UserNotFoundException, OperationFailedException - Specified by:
findUserWithAttributesByNamein interfaceDirectoryCacheChangeOperations- Throws:
UserNotFoundExceptionOperationFailedException
-
findGroupWithAttributesByName
public GroupWithAttributes findGroupWithAttributesByName(String name) throws GroupNotFoundException, OperationFailedException - Specified by:
findGroupWithAttributesByNamein interfaceDirectoryCacheChangeOperations- Throws:
GroupNotFoundExceptionOperationFailedException
-
findUsersByExternalIds
- Specified by:
findUsersByExternalIdsin interfaceDirectoryCacheChangeOperations
-
findGroupsByExternalIds
public Map<String,String> findGroupsByExternalIds(Set<String> externalIds) throws OperationFailedException - Specified by:
findGroupsByExternalIdsin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
findGroupsExternalIdsByNames
public Map<String,String> findGroupsExternalIdsByNames(Set<String> groupNames) throws OperationFailedException - Specified by:
findGroupsExternalIdsByNamesin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
applySyncingUserAttributes
public void applySyncingUserAttributes(String userName, Set<String> deletedAttributes, Map<String, Set<String>> storedAttributes) throws UserNotFoundException, OperationFailedException- Specified by:
applySyncingUserAttributesin interfaceDirectoryCacheChangeOperations- Throws:
UserNotFoundExceptionOperationFailedException
-
applySyncingGroupAttributes
public void applySyncingGroupAttributes(String groupName, Set<String> deletedAttributes, Map<String, Set<String>> storedAttributes) throws GroupNotFoundException, OperationFailedException- Specified by:
applySyncingGroupAttributesin interfaceDirectoryCacheChangeOperations- Throws:
GroupNotFoundExceptionOperationFailedException
-
getAllUserGuids
- Specified by:
getAllUserGuidsin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
getAllGroupGuids
- Specified by:
getAllGroupGuidsin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
getUserCount
- Specified by:
getUserCountin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
getGroupCount
- Specified by:
getGroupCountin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
getExternalCachedGroupCount
- Specified by:
getExternalCachedGroupCountin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-
getAllLocalGroupNames
- Specified by:
getAllLocalGroupNamesin interfaceDirectoryCacheChangeOperations- Throws:
OperationFailedException
-