com.atlassian.crowd.directory
Class DbCachingRemoteChangeOperations
java.lang.Object
com.atlassian.crowd.directory.DbCachingRemoteChangeOperations
public class DbCachingRemoteChangeOperations
- extends Object
|
Method Summary |
void |
addGroupMembershipsForGroup(Group parentGroup,
Collection<String> groupsToAdd)
|
void |
addGroups(Set<GroupTemplate> groupsToAdd)
|
void |
addGroupToGroup(String childGroup,
String parentGroup)
|
void |
addOrUpdateCachedGroup(Group group)
|
void |
addOrUpdateCachedUser(User user)
|
void |
addUserMembershipsForGroup(Group group,
Set<String> usersToAdd)
|
void |
addUsers(Set<UserTemplateWithCredentialAndAttributes> usersToAdd)
|
void |
addUserToGroup(String username,
String groupName)
|
void |
applySyncingGroupAttributes(String groupName,
Set<String> deletedAttributes,
Map<String,Set<String>> storedAttributes)
Remove 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 |
deleteCachedGroup(String groupName)
|
void |
deleteCachedGroups(Set<String> groupnames)
|
void |
deleteCachedGroupsNotIn(GroupType groupType,
List<? extends Group> remoteGroups,
Date syncStartDate)
|
void |
deleteCachedUser(String username)
|
void |
deleteCachedUsersByGuid(Set<String> guids)
|
void |
deleteCachedUsersNotIn(List<? extends User> remoteUsers,
Date synchStartDate)
|
DirectoryCacheChangeOperations.AddRemoveSets<String> |
findGroupMembershipForGroupChanges(Group parentGroup,
Collection<String> remoteGroups)
|
DirectoryCacheChangeOperations.GroupsToAddUpdateReplace |
findGroupsToUpdate(Collection<? extends Group> remoteGroups,
Date syncStartDate)
|
GroupWithAttributes |
findGroupWithAttributesByName(String name)
Delegate findGroupWithAttributesByName call to the underlying internal directory |
DirectoryCacheChangeOperations.AddRemoveSets<String> |
findUserMembershipForGroupChanges(Group group,
Collection<String> remoteUsers)
|
Set<String> |
getAllUserGuids()
|
protected Directory |
getDirectory()
|
long |
getUserCount()
|
DirectoryCacheChangeOperations.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. |
protected boolean |
hasChanged(User remoteUser,
User internalUser)
|
boolean |
ignoreGroupOnSynchroniseMemberships(Group remoteGroup)
Returns true if the given remote Group should not have its memberships synchronised for any reason. |
protected static Map<String,TimestampedUser> |
mapUsersByExternalId(Collection<TimestampedUser> users)
|
void |
removeGroupFromGroup(String childGroup,
String parentGroup)
|
void |
removeGroupMembershipsForGroup(Group parentGroup,
Collection<String> groupsToRemove)
|
void |
removeGroups(Collection<String> groupsToRemove)
|
void |
removeUserFromGroup(String username,
String groupName)
|
void |
removeUserMembershipsForGroup(Group group,
Set<String> usersToRemove)
|
void |
syncGroupMembershipsAndMembersForGroup(String groupName,
Set<String> parentGroupNames,
Set<String> childGroupNames)
|
void |
syncGroupMembershipsForUser(String childUsername,
Set<String> parentGroupNames)
|
void |
updateGroups(Collection<GroupTemplate> groupsToUpdate)
|
void |
updateUsers(Collection<UserTemplate> usersToUpdate)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DbCachingRemoteChangeOperations
public DbCachingRemoteChangeOperations(com.atlassian.crowd.embedded.spi.DirectoryDao directoryDao,
RemoteDirectory remoteDirectory,
InternalRemoteDirectory internalDirectory,
SynchronisationStatusManager synchronisationStatusManager,
com.atlassian.event.api.EventPublisher eventPublisher)
addUsers
public void addUsers(Set<UserTemplateWithCredentialAndAttributes> usersToAdd)
throws OperationFailedException
- Throws:
OperationFailedException
updateUsers
public void updateUsers(Collection<UserTemplate> usersToUpdate)
throws OperationFailedException
- Throws:
OperationFailedException
deleteCachedUsersByGuid
public void deleteCachedUsersByGuid(Set<String> guids)
throws OperationFailedException
- Throws:
OperationFailedException
deleteCachedUsersNotIn
public void deleteCachedUsersNotIn(List<? extends User> remoteUsers,
Date synchStartDate)
throws OperationFailedException
- Throws:
OperationFailedException
findGroupsToUpdate
public DirectoryCacheChangeOperations.GroupsToAddUpdateReplace findGroupsToUpdate(Collection<? extends Group> remoteGroups,
Date syncStartDate)
throws OperationFailedException
- Throws:
OperationFailedException
removeGroups
public void removeGroups(Collection<String> groupsToRemove)
throws OperationFailedException
- Throws:
OperationFailedException
addGroups
public void addGroups(Set<GroupTemplate> groupsToAdd)
throws OperationFailedException
- Throws:
OperationFailedException
updateGroups
public void updateGroups(Collection<GroupTemplate> groupsToUpdate)
throws OperationFailedException
- Throws:
OperationFailedException
deleteCachedGroupsNotIn
public void deleteCachedGroupsNotIn(GroupType groupType,
List<? extends Group> remoteGroups,
Date syncStartDate)
throws OperationFailedException
- Throws:
OperationFailedException
deleteCachedGroups
public void deleteCachedGroups(Set<String> groupnames)
throws OperationFailedException
- Throws:
OperationFailedException
hasChanged
protected boolean hasChanged(User remoteUser,
User internalUser)
findUserMembershipForGroupChanges
public DirectoryCacheChangeOperations.AddRemoveSets<String> findUserMembershipForGroupChanges(Group group,
Collection<String> remoteUsers)
throws OperationFailedException
- Throws:
OperationFailedException
removeUserMembershipsForGroup
public void removeUserMembershipsForGroup(Group group,
Set<String> usersToRemove)
throws OperationFailedException
- Throws:
OperationFailedException
addUserMembershipsForGroup
public void addUserMembershipsForGroup(Group group,
Set<String> usersToAdd)
throws OperationFailedException
- Throws:
OperationFailedException
findGroupMembershipForGroupChanges
public DirectoryCacheChangeOperations.AddRemoveSets<String> findGroupMembershipForGroupChanges(Group parentGroup,
Collection<String> remoteGroups)
throws OperationFailedException
- Throws:
OperationFailedException
addGroupMembershipsForGroup
public void addGroupMembershipsForGroup(Group parentGroup,
Collection<String> groupsToAdd)
throws OperationFailedException
- Throws:
OperationFailedException
removeGroupMembershipsForGroup
public void removeGroupMembershipsForGroup(Group parentGroup,
Collection<String> groupsToRemove)
throws OperationFailedException
- Throws:
OperationFailedException
getDirectory
protected Directory getDirectory()
throws DirectoryNotFoundException
- Throws:
DirectoryNotFoundException
ignoreGroupOnSynchroniseMemberships
public boolean ignoreGroupOnSynchroniseMemberships(Group remoteGroup)
throws OperationFailedException
- Returns true if the given remote Group should not have its memberships synchronised for any reason.
- 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 DirectoryCacheChangeOperations.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 before syncStartDate will be updated. This is done to avoid overriding changes made locally to
a user after the synchronisation has started.
- 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
mapUsersByExternalId
protected static Map<String,TimestampedUser> mapUsersByExternalId(Collection<TimestampedUser> users)
addOrUpdateCachedUser
public void addOrUpdateCachedUser(User user)
throws OperationFailedException
- Throws:
OperationFailedException
deleteCachedUser
public void deleteCachedUser(String username)
throws OperationFailedException
- Throws:
OperationFailedException
addOrUpdateCachedGroup
public void addOrUpdateCachedGroup(Group group)
throws OperationFailedException
- Throws:
OperationFailedException
deleteCachedGroup
public void deleteCachedGroup(String groupName)
throws OperationFailedException
- Throws:
OperationFailedException
addUserToGroup
public void addUserToGroup(String username,
String groupName)
throws OperationFailedException
- Throws:
OperationFailedException
addGroupToGroup
public void addGroupToGroup(String childGroup,
String parentGroup)
throws OperationFailedException
- Throws:
OperationFailedException
removeUserFromGroup
public void removeUserFromGroup(String username,
String groupName)
throws OperationFailedException
- Throws:
OperationFailedException
removeGroupFromGroup
public void removeGroupFromGroup(String childGroup,
String parentGroup)
throws OperationFailedException
- Throws:
OperationFailedException
syncGroupMembershipsForUser
public void syncGroupMembershipsForUser(String childUsername,
Set<String> parentGroupNames)
throws OperationFailedException
- Throws:
OperationFailedException
syncGroupMembershipsAndMembersForGroup
public void syncGroupMembershipsAndMembersForGroup(String groupName,
Set<String> parentGroupNames,
Set<String> childGroupNames)
throws OperationFailedException
- Throws:
OperationFailedException
findGroupWithAttributesByName
public GroupWithAttributes findGroupWithAttributesByName(String name)
throws GroupNotFoundException,
OperationFailedException
- Delegate findGroupWithAttributesByName call to the underlying internal directory
- Throws:
GroupNotFoundException
OperationFailedException
applySyncingGroupAttributes
public void applySyncingGroupAttributes(String groupName,
Set<String> deletedAttributes,
Map<String,Set<String>> storedAttributes)
throws GroupNotFoundException,
OperationFailedException
- Remove 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
- 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
getAllUserGuids
public Set<String> getAllUserGuids()
throws OperationFailedException
- Throws:
OperationFailedException
getUserCount
public long getUserCount()
throws OperationFailedException
- Throws:
OperationFailedException
Copyright © 2016 Atlassian. All Rights Reserved.