Interface InternalRemoteDirectory

All Superinterfaces:
Attributes, FastEntityCountProvider, MultiValuesQueriesSupport, RemoteDirectory
All Known Implementing Classes:
AbstractInternalDirectory, CachingDirectory, InternalDirectory, InternalDirectoryForDelegation

public interface InternalRemoteDirectory extends RemoteDirectory, FastEntityCountProvider, MultiValuesQueriesSupport
This interface represents a specialised extension of RemoteDirectory that is used by InternalDirectories.

In particular, the findUserByName(String) and findGroupByName(String) have been redefined to return TimestampedUser and InternalDirectoryGroup. The InternalDirectoryGroup allows clients to determine whether the group is "local".

  • Method Details

    • findUserByName

      TimestampedUser findUserByName(String name) throws UserNotFoundException
      Description copied from interface: RemoteDirectory
      Finds the user that matches the supplied name.
      Specified by:
      findUserByName in interface RemoteDirectory
      Parameters:
      name - the name of the user (username).
      Returns:
      TimestampedUser entity.
      Throws:
      UserNotFoundException - a user with the supplied name does not exist.
    • findUserByExternalId

      TimestampedUser findUserByExternalId(String externalId) throws UserNotFoundException
      Description copied from interface: RemoteDirectory
      Finds the user that matches the supplied externalId. This is an optional method that may not be implemented on all directory types. Currently it is implemented for LDAP and Internal directories but not Crowd directories.
      Specified by:
      findUserByExternalId in interface RemoteDirectory
      Parameters:
      externalId - the externalId of the user
      Returns:
      TimestampedUser entity.
      Throws:
      UserNotFoundException - a user with the supplied externalId does not exist.
      See Also:
    • findGroupByName

      Description copied from interface: RemoteDirectory
      Finds the group that matches the supplied name.
      Specified by:
      findGroupByName in interface RemoteDirectory
      Parameters:
      name - the name of the group.
      Returns:
      InternalDirectoryGroup entity.
      Throws:
      GroupNotFoundException - a group with the supplied name does not exist.
    • addLocalGroup

      Adds a "local" group to the directory.

      This method can be used to store groups that aren't clones of "external" groups. For example, if an LDAP directory is cloned in an internal directory, it's possible to define "local" groups that exist internally but not in LDAP.

      This functionality was added to meet the functionality that Confluence provided.

      Parameters:
      group - template of the group to add.
      Returns:
      the added group retrieved from the underlying store.
      Throws:
      InvalidGroupException - The supplied group is invalid.
      OperationFailedException - underlying directory implementation failed to execute the operation.
    • addAllUsers

      Adds a collection of users to the directory.

      The bulk adding of users may be significantly faster than adding users one-by-one for large collections.

      Caller must ensure that the users don't already exist.

      Parameters:
      users - templates of users to add.
      Returns:
      result containing both successful and failed users
      Throws:
      IllegalArgumentException - if any of the users' directory ID does not match the directory's ID.
    • addAllGroups

      BatchResult<Group> addAllGroups(Set<GroupTemplate> groups)
      Adds a collection of groups to the directory.

      The bulk adding of groups may be significantly faster than adding groups one-by-one for large collections.

      Caller must ensure that the users don't already exist.

      Parameters:
      groups - templates of groups to add.
      Returns:
      result containing both successful and failed groups
      Throws:
      IllegalArgumentException - if any of the groups' directory ID does not match the directory's ID.
    • addAllUsersToGroup

      BatchResult<String> addAllUsersToGroup(Set<String> userNames, String groupName) throws GroupNotFoundException
      Adds a collection of users to a group.

      Caller must ensure that the memberships don't already exist.

      Parameters:
      userNames - names of users to add to group.
      groupName - name of group to add users to.
      Returns:
      result containing both successful and failed users
      Throws:
      GroupNotFoundException - group with supplied groupName does not exist.
    • removeAllUsers

      BatchResult<String> removeAllUsers(Set<String> usernames)
      Removes all users from the directory.

      If a user with the supplied username does not exist in the directory, the username will be ignored.

      Parameters:
      usernames - usernames of users to remove.
      Returns:
      batch result containing successes (removed users) and failures (users which were not removed)
    • removeAllGroups

      BatchResult<String> removeAllGroups(Set<String> groupNames)
      Removes all groups from the directory.

      If a group with the supplied group name does not exist in the directory, the group name will be ignored.

      Parameters:
      groupNames - names of groups to remove.
      Returns:
      batch result containing successes (removed groups) and failures (groups which were not removed)
    • isLocalUserStatusEnabled

      boolean isLocalUserStatusEnabled()
      Returns true if user active status is updated independently in the Crowd cache and the remote directory. Otherwise, user status is synchronised between the cache and the remote directory.
      Returns:
      true if user status in the cache is updated independently of the remote directory.
    • forceRenameUser

      User forceRenameUser(@Nonnull User oldUser, @Nonnull String newName) throws UserNotFoundException
      Forces a rename on the given user in this directory. This works like RemoteDirectory.renameUser(String, String), except it will still do the rename even if there is an existing user under the newName. In this case, it will first rename that existing user to a name that is known not to exist in this directory.
      Parameters:
      oldUser - the existing user.
      newName - desired name of user.
      Returns:
      renamed user.
      Throws:
      UserNotFoundException - if the "oldUser" does not exist.
      See Also:
    • getAllUserExternalIds

      @Nonnull Set<String> getAllUserExternalIds() throws OperationFailedException
      Retrieves all users externalIds found in this directory.
      Returns:
      set of all users externalIds
      Throws:
      OperationFailedException - underlying directory implementation failed to execute the operation.
    • addUserToGroups

      BatchResult<String> addUserToGroups(String username, Set<String> groupNames) throws UserNotFoundException
      Adds a user to many groups.

      This method assumes that user and groups already exist in the directory.

      Parameters:
      username - username of the user to whom we add groups
      groupNames - names of the groups
      Returns:
      result of the bulk operation containing successful and failed entities
      Throws:
      UserNotFoundException - when user with a given username does not exist
    • removeUsersFromGroup

      @ExperimentalApi BatchResult<String> removeUsersFromGroup(Set<String> usernames, String groupName) throws GroupNotFoundException, OperationFailedException
      Removes a collection of users from a group.
      Parameters:
      usernames - names of users to remove from group.
      groupName - name of group to remove users from.
      Returns:
      result containing both successful and failed users
      Throws:
      GroupNotFoundException - group with supplied groupName does not exist
      OperationFailedException - underlying directory implementation failed to execute the operation.
      Since:
      5.0.4
    • addAllGroupsToGroup

      @ExperimentalApi BatchResult<String> addAllGroupsToGroup(Collection<String> childGroupNames, String groupName) throws GroupNotFoundException
      Adds a collection of child groups to a group.

      Caller must ensure that the memberships don't already exist.

      Parameters:
      childGroupNames - names of child groups to add to group.
      groupName - name of group to add child groups to.
      Returns:
      result containing both successful and failed child groups
      Throws:
      GroupNotFoundException - group with supplied groupName cannot be found.
      Since:
      5.0.4
    • removeGroupsFromGroup

      @ExperimentalApi BatchResult<String> removeGroupsFromGroup(Collection<String> childGroupNames, String groupName) throws GroupNotFoundException, OperationFailedException
      Removes a collection of child groups from a group.
      Parameters:
      childGroupNames - names of child groups to remove from group.
      groupName - name of group to remove child groups from.
      Returns:
      result containing both successful and failed child groups
      Throws:
      GroupNotFoundException - group with supplied groupName cannot be found.
      OperationFailedException - underlying directory implementation failed to execute the operation.
      Since:
      5.0.4