com.atlassian.crowd.directory
Class DbCachingRemoteChangeOperations

java.lang.Object
  extended by com.atlassian.crowd.directory.DbCachingRemoteChangeOperations

public class DbCachingRemoteChangeOperations
extends Object


Nested Class Summary
static class DirectoryCacheChangeOperations.AddRemoveSets<T>
           
static class DirectoryCacheChangeOperations.AddUpdateSets<A,U>
           
static class DirectoryCacheChangeOperations.GroupsToAddUpdateReplace
           
 
Constructor Summary
DbCachingRemoteChangeOperations(DirectoryDao directoryDao, RemoteDirectory remoteDirectory, InternalRemoteDirectory internalDirectory, SynchronisationStatusManager synchronisationStatusManager, com.atlassian.event.api.EventPublisher eventPublisher)
           
 
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 deleteCachedGroup(String groupName)
           
 void deleteCachedGroups(Set<String> groupnames)
           
 void deleteCachedGroupsNotIn(GroupType groupType, List<? extends Group> remoteGroups, Date syncStartDate)
           
 void deleteCachedUser(String username)
           
 void deleteCachedUsers(Set<String> usernames)
           
 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)
           
 DirectoryCacheChangeOperations.AddRemoveSets<String> findUserMembershipForGroupChanges(Group group, Collection<String> remoteUsers)
           
 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.
 boolean ignoreGroupOnSynchroniseMemberships(Group remoteGroup)
          Returns true if the given remote Group should not have its memberships synchronised for any reason.
 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(Set<UserTemplate> usersToUpdate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbCachingRemoteChangeOperations

public DbCachingRemoteChangeOperations(DirectoryDao directoryDao,
                                       RemoteDirectory remoteDirectory,
                                       InternalRemoteDirectory internalDirectory,
                                       SynchronisationStatusManager synchronisationStatusManager,
                                       com.atlassian.event.api.EventPublisher eventPublisher)
Method Detail

addUsers

public void addUsers(Set<UserTemplateWithCredentialAndAttributes> usersToAdd)
              throws OperationFailedException
Throws:
OperationFailedException

updateUsers

public void updateUsers(Set<UserTemplate> usersToUpdate)
                 throws OperationFailedException
Throws:
OperationFailedException

deleteCachedUsers

public void deleteCachedUsers(Set<String> usernames)
                       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

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

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

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


Copyright © 2013 Atlassian. All Rights Reserved.