Interface GroupDao

All Known Subinterfaces:
InternalGroupDao
All Known Implementing Classes:
GroupDAOHibernate

public interface GroupDao
  • Method Details

    • findByName

      InternalDirectoryGroup findByName(long directoryId, String name) throws GroupNotFoundException
      Finds group by name.
      Parameters:
      directoryId - the ID of the directory to look for group
      name - group name
      Returns:
      group
      Throws:
      GroupNotFoundException - if the group does not exist
    • findByNameWithAttributes

      GroupWithAttributes findByNameWithAttributes(long directoryId, String name) throws GroupNotFoundException
      Finds group by name. This is different from findByName(long, String) in that it also returns the group attributes associated with the retrieved group.
      Parameters:
      directoryId - the ID of the directory to look for group
      name - group name
      Returns:
      group with attributes
      Throws:
      GroupNotFoundException - if the group does not exist
    • add

      Adds a new group.
      Parameters:
      group - group
      Returns:
      the added group
      Throws:
      DirectoryNotFoundException - if the directory specified in group object does not exist
      InvalidGroupException - if a group with the same directory and name (case-insensitive) already exists
    • addLocal

      Add a new local group. A local group is a group that does not exist in the remote directory. The implementation must take into account and also persist the fact that the group is only local.
      Parameters:
      group - group
      Returns:
      the added group
      Throws:
      DirectoryNotFoundException - if the directory specified in group object does not exist
      InvalidGroupException - if a group with the same directory and name (case-insensitive) already exists
    • update

      Group update(Group group) throws GroupNotFoundException
      Updates group.
      Parameters:
      group - group
      Returns:
      the updated group
      Throws:
      GroupNotFoundException - if the group does not exist
    • rename

      Renames group.
      Parameters:
      group - group
      newName - the new name
      Returns:
      group with new name
      Throws:
      GroupNotFoundException - if the group does not exist
      InvalidGroupException - if a group with the same directory and name (case-insensitive) already exists
    • storeAttributes

      void storeAttributes(Group group, Map<String,Set<String>> attributes) throws GroupNotFoundException
      Stores attributes into group. Any existing attributes matching the supplied attribute keys will be replaced.
      Parameters:
      group - group
      attributes - attributes
      Throws:
      GroupNotFoundException - if the group does not exist
    • removeAttribute

      void removeAttribute(Group group, String attributeName) throws GroupNotFoundException
      Remove the attribute from the group. Does nothing if the attribute doesn't exist.
      Parameters:
      group - group
      attributeName - attribute to be removed
      Throws:
      GroupNotFoundException - if the group does not exist
    • remove

      void remove(Group group) throws GroupNotFoundException
      Removes group.
      Parameters:
      group - group
      Throws:
      GroupNotFoundException - if the group does not exist
    • search

      <T> List<T> search(long directoryId, EntityQuery<T> query)
      Searches for group based on the given criteria.
      Parameters:
      directoryId - directory to perform the search operation on
      query - criteria
      Returns:
      list (could be empty) of groups which match the criteria
    • addAll

      BatchResult<Group> addAll(Set<? extends Group> groups) throws DirectoryNotFoundException
      Bulk add of groups. Will only add remote groups (ie. isLocal=false) Implementations must make sure that changes in bulk methods such as this are immediately visible to other bulk methods. For example, if this is run in a transaction, either that transaction must be committed when this method returns, or all other bulk method implementations must guarantee to reuse the same transaction.
      Parameters:
      groups - to be added
      Returns:
      a list of Groups that failed to be added
      Throws:
      DirectoryNotFoundException - if the directory cannot be found
    • removeAllGroups

      BatchResult<String> removeAllGroups(long directoryId, Set<String> groupNames)
      Bulk remove all the given groups. Implementations must make sure that changes in bulk methods such as this are immediately visible to other bulk methods. For example, if this is run in a transaction, either that transaction must be committed when this method returns, or all other bulk method implementations must guarantee to reuse the same transaction.
      Parameters:
      directoryId - directory to perform the operation
      groupNames - groups to be removed
      Returns:
      batch result containing successes (removed groups) and failures (groups which were not removed)
    • getAllExternalIds

      Set<String> getAllExternalIds(long directoryId) throws DirectoryNotFoundException
      Return all group externalId in the given directory. If a group's externalId is null or an empty String it won't be included.
      Parameters:
      directoryId - the ID of the directory
      Returns:
      set containing all externalIds with nulls filtered out
      Throws:
      DirectoryNotFoundException - when directory with given id does not exist
    • getGroupCount

      long getGroupCount(long directoryId) throws DirectoryNotFoundException
      Return number of groups in given directory.
      Parameters:
      directoryId - the ID of the directory
      Returns:
      group count
      Throws:
      DirectoryNotFoundException - when directory with given id does not exist
    • getLocalGroupNames

      Set<String> getLocalGroupNames(long directoryId) throws DirectoryNotFoundException
      Return names of all local groups in given directory.
      Parameters:
      directoryId - the ID of the directory
      Returns:
      names of all local groups in given directory
      Throws:
      DirectoryNotFoundException - when directory with given id does not exist
    • findByExternalIds

      Map<String,String> findByExternalIds(long directoryId, Set<String> externalIds)
      Searches the specified directory for group names of groups with the specified external ids
      Parameters:
      directoryId - the id of the directory to search
      externalIds - external ids of the groups to find
      Returns:
      a map from external ids to group names
    • findExternalIdsByNames

      Map<String,String> findExternalIdsByNames(long directoryId, Set<String> groupNames)
      Searches the specified directory for externalIds of groups with the specified names
      Parameters:
      directoryId - the id of the directory to search
      groupNames - names of the groups to find
      Returns:
      a map from group names to external ids
    • getExternalGroupCount

      long getExternalGroupCount(long directoryId) throws DirectoryNotFoundException
      Gets the count of external groups for a directory
      Parameters:
      directoryId - the directory to count groups for
      Returns:
      count of external groups
      Throws:
      DirectoryNotFoundException