Package org.dspace.eperson.dao.impl
Class GroupDAOImpl
- All Implemented Interfaces:
DSpaceObjectDAO<Group>,DSpaceObjectLegacySupportDAO<Group>,GenericDAO<Group>,GroupDAO
Hibernate implementation of the Database Access Object interface class for the Group object.
This class is responsible for all database calls for the Group object and is autowired by spring
This class should never be accessed directly.
- Author:
- kevinvandevelde at atmire.com
-
Constructor Summary
Constructors -
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 DSpacevoidRemove an instance from the database.Find all groups ordered by name ascendingfindAll(Context context, List<MetadataField> sortMetadataFields, 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 class org.dspace.core.AbstractHibernateDSODAO
addMetadataLeftJoin, addMetadataSortQuery, addMetadataSortQuery, addMetadataValueWhereQuery, findByLegacyIdMethods inherited from class org.dspace.core.AbstractHibernateDAO
count, count, countLong, create, createQuery, createQuery, executeCriteriaQuery, findAll, findAll, findByID, findByID, findByID, findByX, findMany, findMany, findUnique, getCriteriaBuilder, getCriteriaQuery, getHibernateSession, iterate, list, list, list, list, save, singleResult, singleResult, uniqueResult, uniqueResultMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.dspace.content.dao.DSpaceObjectLegacySupportDAO
findByLegacyIdMethods inherited from interface org.dspace.core.GenericDAO
create, findAll, findAll, findByID, findByID, findByID, findMany, findUnique, save
-
Constructor Details
-
GroupDAOImpl
protected GroupDAOImpl()
-
-
Method Details
-
findByMetadataField
public List<Group> findByMetadataField(Context context, String searchValue, MetadataField metadataField) throws SQLException Description copied from interface:GroupDAOLook up groups based on their value for a certain metadata field (NOTE: name is not stored as metadata)- Specified by:
findByMetadataFieldin interfaceGroupDAO- 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
public List<Group> findAll(Context context, List<MetadataField> sortMetadataFields, int pageSize, int offset) throws SQLException Description copied from interface:GroupDAOFind all groups ordered by the specified metadata fields ascending- Specified by:
findAllin interfaceGroupDAO- Parameters:
context- The DSpace contextsortMetadataFields- 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
Description copied from interface:GroupDAOFind all groups ordered by name ascending- Specified by:
findAllin interfaceGroupDAO- 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
Description copied from interface:GroupDAOFind all groups that the given ePerson belongs to- Specified by:
findByEPersonin interfaceGroupDAO- 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
-
findByName
Description copied from interface:GroupDAOFind a group by its name (exact match)- Specified by:
findByNamein interfaceGroupDAO- 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
-
findByIdAndMembership
Description copied from interface:GroupDAOFind a group by its name and the membership of the given EPerson- Specified by:
findByIdAndMembershipin interfaceGroupDAO- 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
-
findByNameLike
public List<Group> findByNameLike(Context context, String groupName, int offset, int limit) throws SQLException Description copied from interface:GroupDAOFind a group by its name (fuzzy match)- Specified by:
findByNameLikein interfaceGroupDAO- 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
Description copied from interface:GroupDAOCount the number of groups that have a name that contains the given string- Specified by:
countByNameLikein interfaceGroupDAO- 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
public List<Group> findByNameLikeAndNotMember(Context context, String groupName, Group excludeParent, int offset, int limit) throws SQLException Description copied from interface:GroupDAOSearch 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.
- Specified by:
findByNameLikeAndNotMemberin interfaceGroupDAO- 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
public int countByNameLikeAndNotMember(Context context, String groupName, Group excludeParent) throws SQLException Description copied from interface:GroupDAOCount 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.
- Specified by:
countByNameLikeAndNotMemberin interfaceGroupDAO- 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
-
delete
Description copied from interface:GenericDAORemove an instance from the database.- Specified by:
deletein interfaceGenericDAO<Group>- Overrides:
deletein classAbstractHibernateDAO<Group>- Parameters:
context- current DSpace context.group- type of the instance to be removed.- Throws:
SQLException- passed through.
-
getGroup2GroupResults
public List<org.apache.commons.lang3.tuple.Pair<UUID,UUID>> getGroup2GroupResults(Context context, boolean flushQueries) throws SQLException Description copied from interface:GroupDAOGet a list of all direct parent - child group relations in the database- Specified by:
getGroup2GroupResultsin interfaceGroupDAO- Parameters:
context- The DSpace contextflushQueries- Flush all pending queries- Returns:
- A list of pairs indicating parent - child
- Throws:
SQLException- if database error
-
getEmptyGroups
Description copied from interface:GroupDAOReturn all empty groups- Specified by:
getEmptyGroupsin interfaceGroupDAO- Parameters:
context- The DSpace context- Returns:
- All empty groups
- Throws:
SQLException- if database error
-
countRows
Description copied from interface:GroupDAOCount the number of groups in DSpace- Specified by:
countRowsin interfaceGroupDAO- Parameters:
context- The DSpace context- Returns:
- The number of groups
- Throws:
SQLException- if database error
-
findByParent
public List<Group> findByParent(Context context, Group parent, int pageSize, int offset) throws SQLException Description copied from interface:GroupDAOFind all groups which are members of a given parent group. This provides the same behavior as group.getMemberGroups(), but in a paginated fashion.- Specified by:
findByParentin interfaceGroupDAO- 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
Description copied from interface:GroupDAOReturns 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.- Specified by:
countByParentin interfaceGroupDAO- Parameters:
context- The DSpace contextparent- Parent Group to search within- Returns:
- Number of Groups matching the query
- Throws:
SQLException- if database error
-