Package com.atlassian.crowd.embedded.spi
Interface GroupDao
- All Known Subinterfaces:
InternalGroupDao
- All Known Implementing Classes:
GroupDAOHibernate
public interface GroupDao
-
Method Summary
Modifier and TypeMethodDescriptionAdds a new group.Bulk add of groups.Add a new local group.findByExternalIds
(long directoryId, Set<String> externalIds) Searches the specified directory for group names of groups with the specified external idsfindByName
(long directoryId, String name) Finds group by name.findByNameWithAttributes
(long directoryId, String name) Finds group by name.findExternalIdsByNames
(long directoryId, Set<String> groupNames) Searches the specified directory for externalIds of groups with the specified namesgetAllExternalIds
(long directoryId) Return all group externalId in the given directory.long
getExternalGroupCount
(long directoryId) Gets the count of external groups for a directorylong
getGroupCount
(long directoryId) Return number of groups in given directory.getLocalGroupNames
(long directoryId) Return names of all local groups in given directory.void
Removes group.removeAllGroups
(long directoryId, Set<String> groupNames) Bulk remove all the given groups.void
removeAttribute
(Group group, String attributeName) Remove the attribute from the group.Renames group.<T> List<T>
search
(long directoryId, EntityQuery<T> query) Searches for group based on the given criteria.void
Stores attributes into group.Updates group.
-
Method Details
-
findByName
Finds group by name.- Parameters:
directoryId
- the ID of the directory to look for groupname
- 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 fromfindByName(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 groupname
- 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 existInvalidGroupException
- 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 existInvalidGroupException
- if a group with the same directory and name (case-insensitive) already exists
-
update
Updates group.- Parameters:
group
- group- Returns:
- the updated group
- Throws:
GroupNotFoundException
- if the group does not exist
-
rename
Renames group.- Parameters:
group
- groupnewName
- the new name- Returns:
- group with new name
- Throws:
GroupNotFoundException
- if the group does not existInvalidGroupException
- if a group with the same directory and name (case-insensitive) already exists
-
storeAttributes
Stores attributes into group. Any existing attributes matching the supplied attribute keys will be replaced.- Parameters:
group
- groupattributes
- attributes- Throws:
GroupNotFoundException
- if the group does not exist
-
removeAttribute
Remove the attribute from the group. Does nothing if the attribute doesn't exist.- Parameters:
group
- groupattributeName
- attribute to be removed- Throws:
GroupNotFoundException
- if the group does not exist
-
remove
Removes group.- Parameters:
group
- group- Throws:
GroupNotFoundException
- if the group does not exist
-
search
Searches for group based on the given criteria.- Parameters:
directoryId
- directory to perform the search operation onquery
- criteria- Returns:
- list (could be empty) of groups which match the criteria
-
addAll
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
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 operationgroupNames
- groups to be removed- Returns:
- batch result containing successes (removed groups) and failures (groups which were not removed)
-
getAllExternalIds
Return all group externalId in the given directory. If a group's externalId isnull
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
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
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
Searches the specified directory for group names of groups with the specified external ids- Parameters:
directoryId
- the id of the directory to searchexternalIds
- external ids of the groups to find- Returns:
- a map from external ids to group names
-
findExternalIdsByNames
Searches the specified directory for externalIds of groups with the specified names- Parameters:
directoryId
- the id of the directory to searchgroupNames
- names of the groups to find- Returns:
- a map from group names to external ids
-
getExternalGroupCount
Gets the count of external groups for a directory- Parameters:
directoryId
- the directory to count groups for- Returns:
- count of external groups
- Throws:
DirectoryNotFoundException
-