com.atlassian.crowd.embedded.spi
Interface GroupDao

All Known Subinterfaces:
InternalGroupDao
All Known Implementing Classes:
GroupDAOHibernate

public interface GroupDao


Method Summary
 Group add(Group group)
          Adds a new group.
 BatchResult<Group> addAll(Set<? extends Group> groups)
          Bulk add of groups.
 Group addLocal(Group group)
          Add a new local group.
 InternalDirectoryGroup findByName(long directoryId, String name)
          Finds group by name.
 GroupWithAttributes findByNameWithAttributes(long directoryId, String name)
          Finds group by name.
 void remove(Group group)
          Removes group.
 void removeAllGroups(long directoryId, Set<String> groupNames)
          Removes all the given groups.
 void removeAttribute(Group group, String attributeName)
          Remove attributes from group.
 Group rename(Group group, String newName)
          Renames group.
<T> List<T>
search(long directoryId, EntityQuery<T> query)
          Searches for group based on the given criteria.
 void storeAttributes(Group group, Map<String,Set<String>> attributes)
          Stores attributes into group.
 Group update(Group group)
          Updates group.
 

Method Detail

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

Group add(Group group)
          throws DirectoryNotFoundException
Adds a new group.

Parameters:
group - group
Returns:
the added group
Throws:
DirectoryNotFoundException - if the directory specified in group object does not exist

addLocal

Group addLocal(Group group)
               throws DirectoryNotFoundException
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

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

Group rename(Group group,
             String newName)
             throws GroupNotFoundException
Renames group.

Parameters:
group - group
newName - the new name
Returns:
group with new name
Throws:
GroupNotFoundException - if the group does not exist

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 attributes from group.

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)

Parameters:
groups - to be added
Returns:
a list of Groups that failed to be added
Throws:
DirectoryNotFoundException - if the directory cannot be found

removeAllGroups

void removeAllGroups(long directoryId,
                     Set<String> groupNames)
Removes all the given groups.

Parameters:
directoryId - directory to perform the operation
groupNames - groups to be removed


Copyright © 2013 Atlassian. All Rights Reserved.