Package org.dspace.eperson.dao
Interface GroupDAO
- All Superinterfaces:
DSpaceObjectDAO<Group>,DSpaceObjectLegacySupportDAO<Group>,GenericDAO<Group>
- All Known Implementing Classes:
GroupDAOImpl
Database Access Object interface class for the Group object.
The implementation of this class is responsible for all database calls for the Group object and is autowired by
spring
This class should only be accessed from a single service and should never be exposed outside of the API
- Author:
- kevinvandevelde at atmire.com
-
Method Summary
Modifier and TypeMethodDescriptionintcountByNameLike(Context context, String groupName) Count the number of groups that have a name that contains the given stringintcountByNameLikeAndNotMember(Context context, String groupName, Group excludeParent) Count number of groups that match a given name (fuzzy match), limited to those groups which are NOT a member of the given parent group.intcountByParent(Context context, Group parent) Returns the number of groups which are members of a given parent group.intCount the number of groups in DSpaceFind all groups ordered by name ascendingfindAll(Context context, List<MetadataField> metadataSortFields, int pageSize, int offset) Find all groups ordered by the specified metadata fields ascendingfindByEPerson(Context context, EPerson ePerson) Find all groups that the given ePerson belongs tofindByIdAndMembership(Context context, UUID id, EPerson ePerson) Find a group by its name and the membership of the given EPersonfindByMetadataField(Context context, String searchValue, MetadataField metadataField) Look up groups based on their value for a certain metadata field (NOTE: name is not stored as metadata)findByName(Context context, String name) Find a group by its name (exact match)findByNameLike(Context context, String groupName, int offset, int limit) Find a group by its name (fuzzy match)findByNameLikeAndNotMember(Context context, String groupName, Group excludeParent, int offset, int limit) Search all groups via their name (fuzzy match), limited to those groups which are NOT a member of the given parent group.findByParent(Context context, Group parent, int pageSize, int offset) Find all groups which are members of a given parent group.getEmptyGroups(Context context) Return all empty groupsgetGroup2GroupResults(Context context, boolean flushQueries) Get a list of all direct parent - child group relations in the databaseMethods inherited from interface org.dspace.content.dao.DSpaceObjectLegacySupportDAO
findByLegacyId
-
Method Details
-
findByMetadataField
List<Group> findByMetadataField(Context context, String searchValue, MetadataField metadataField) throws SQLException Look up groups based on their value for a certain metadata field (NOTE: name is not stored as metadata)- Parameters:
context- The DSpace contextsearchValue- The value to matchmetadataField- The metadata field to search in- Returns:
- The groups that have a matching value for specified metadata field
- Throws:
SQLException- if database error
-
findAll
List<Group> findAll(Context context, List<MetadataField> metadataSortFields, int pageSize, int offset) throws SQLException Find all groups ordered by the specified metadata fields ascending- Parameters:
context- The DSpace contextmetadataSortFields- The metadata fields to sort onpageSize- how many results returnoffset- the position of the first result to return- Returns:
- A list of all groups, ordered by metadata fields
- Throws:
SQLException- if database error
-
findAll
Find all groups ordered by name ascending- Parameters:
context- The DSpace contextpageSize- how many results returnoffset- the position of the first result to return- Returns:
- A list of all groups, ordered by name
- Throws:
SQLException- if database error
-
findByEPerson
Find all groups that the given ePerson belongs to- Parameters:
context- The DSpace contextePerson- The EPerson to match- Returns:
- A list of all groups to which the given EPerson belongs
- Throws:
SQLException- if database error
-
getGroup2GroupResults
List<org.apache.commons.lang3.tuple.Pair<UUID,UUID>> getGroup2GroupResults(Context context, boolean flushQueries) throws SQLException Get a list of all direct parent - child group relations in the database- Parameters:
context- The DSpace contextflushQueries- Flush all pending queries- Returns:
- A list of pairs indicating parent - child
- Throws:
SQLException- if database error
-
getEmptyGroups
Return all empty groups- Parameters:
context- The DSpace context- Returns:
- All empty groups
- Throws:
SQLException- if database error
-
countRows
Count the number of groups in DSpace- Parameters:
context- The DSpace context- Returns:
- The number of groups
- Throws:
SQLException- if database error
-
findByName
Find a group by its name (exact match)- Parameters:
context- The DSpace contextname- The name of the group to look for- Returns:
- The group with the specified name
- Throws:
SQLException- if database error
-
findByNameLike
List<Group> findByNameLike(Context context, String groupName, int offset, int limit) throws SQLException Find a group by its name (fuzzy match)- Parameters:
context- The DSpace contextgroupName- Part of the group's name to search foroffset- Offset to use for pagination (-1 to disable)limit- The maximum number of results to return (-1 to disable)- Returns:
- Groups matching the query
- Throws:
SQLException- if database error
-
countByNameLike
Count the number of groups that have a name that contains the given string- Parameters:
context- The DSpace contextgroupName- Part of the group's name to search for- Returns:
- The number of matching groups
- Throws:
SQLException- if database error
-
findByNameLikeAndNotMember
List<Group> findByNameLikeAndNotMember(Context context, String groupName, Group excludeParent, int offset, int limit) throws SQLException Search all groups via their name (fuzzy match), limited to those groups which are NOT a member of the given parent group. This may be used to search across groups which are valid to add to the given parent group.NOTE: The parent group itself is also excluded from the search.
- Parameters:
context- The DSpace contextgroupName- Group name to fuzzy match against.excludeParent- Parent Group to exclude results from. Groups under this parent will never be returned.offset- Offset to use for pagination (-1 to disable)limit- The maximum number of results to return (-1 to disable)- Returns:
- Groups matching the query (which are not members of the given parent)
- Throws:
SQLException- if database error
-
countByNameLikeAndNotMember
int countByNameLikeAndNotMember(Context context, String groupName, Group excludeParent) throws SQLException Count number of groups that match a given name (fuzzy match), limited to those groups which are NOT a member of the given parent group. This may be used (with findByNameLikeAndNotMember()) to search across groups which are valid to add to the given parent group.NOTE: The parent group itself is also excluded from the count.
- Parameters:
context- The DSpace contextgroupName- Group name to fuzzy match against.excludeParent- Parent Group to exclude results from. Groups under this parent will never be returned.- Returns:
- Groups matching the query (which are not members of the given parent)
- Throws:
SQLException- if database error
-
findByIdAndMembership
Find a group by its name and the membership of the given EPerson- Parameters:
context- The DSpace contextid- The id of the group to look forePerson- The EPerson which has to be a member- Returns:
- The group with the specified name
- Throws:
SQLException- if database error
-
findByParent
List<Group> findByParent(Context context, Group parent, int pageSize, int offset) throws SQLException Find all groups which are members of a given parent group. This provides the same behavior as group.getMemberGroups(), but in a paginated fashion.- Parameters:
context- The DSpace contextparent- Parent Group to search withinpageSize- how many results returnoffset- the position of the first result to return- Returns:
- Groups matching the query
- Throws:
SQLException- if database error
-
countByParent
Returns the number of groups which are members of a given parent group. This provides the same behavior as group.getMemberGroups().size(), but with better performance for large groups. This method may be used with findByParent() to perform pagination.- Parameters:
context- The DSpace contextparent- Parent Group to search within- Returns:
- Number of Groups matching the query
- Throws:
SQLException- if database error
-