Package org.dspace.eperson.dao.impl
Class GroupDAOImpl
- java.lang.Object
-
- org.dspace.core.AbstractHibernateDAO<T>
-
- org.dspace.core.AbstractHibernateDSODAO<Group>
-
- org.dspace.eperson.dao.impl.GroupDAOImpl
-
- All Implemented Interfaces:
DSpaceObjectDAO<Group>,DSpaceObjectLegacySupportDAO<Group>,GenericDAO<Group>,GroupDAO
public class GroupDAOImpl extends AbstractHibernateDSODAO<Group> implements 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 Modifier Constructor Description protectedGroupDAOImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcountByNameLike(Context context, String groupName)Count the number of groups that have a name that contains the given stringintcountRows(Context context)Count the number of groups in DSpacevoiddelete(Context context, Group group)Remove an instance from the database.List<Group>findAll(Context context, int pageSize, int offset)Find all groups ordered by name ascendingList<Group>findAll(Context context, List<MetadataField> sortMetadataFields, int pageSize, int offset)Find all groups ordered by the specified metadata fields ascendingList<Group>findByEPerson(Context context, EPerson ePerson)Find all groups that the given ePerson belongs toGroupfindByIdAndMembership(Context context, UUID id, EPerson ePerson)Find a group by its name and the membership of the given EPersonList<Group>findByMetadataField(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)GroupfindByName(Context context, String name)Find a group by its name (exact match)List<Group>findByNameLike(Context context, String groupName, int offset, int limit)Find a group by its name (fuzzy match)List<Group>getEmptyGroups(Context context)Return all empty groupsList<org.apache.commons.lang3.tuple.Pair<UUID,UUID>>getGroup2GroupResults(Context context, boolean flushQueries)Get a list of all direct parent - child group relations in the database-
Methods inherited from class org.dspace.core.AbstractHibernateDSODAO
addMetadataLeftJoin, addMetadataSortQuery, addMetadataSortQuery, addMetadataValueWhereQuery, findByLegacyId
-
Methods inherited from class org.dspace.core.AbstractHibernateDAO
count, count, countLong, create, createQuery, executeCriteriaQuery, findAll, findAll, findByID, findByID, findByX, findMany, findMany, findUnique, getCriteriaBuilder, getCriteriaQuery, getHibernateSession, iterate, list, list, list, list, save, singleResult, singleResult, uniqueResult, uniqueResult
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.dspace.content.dao.DSpaceObjectLegacySupportDAO
findByLegacyId
-
Methods inherited from interface org.dspace.core.GenericDAO
create, findAll, findAll, findByID, findByID, findMany, findUnique, save
-
-
-
-
Method Detail
-
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 contextpageSize- 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
public List<Group> findAll(Context context, int pageSize, int offset) throws SQLException
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
public List<Group> findByEPerson(Context context, EPerson ePerson) throws SQLException
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
public Group findByName(Context context, String name) throws SQLException
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
public Group findByIdAndMembership(Context context, UUID id, EPerson ePerson) throws SQLException
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
public int countByNameLike(Context context, String groupName) throws SQLException
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
-
delete
public void delete(Context context, Group group) throws SQLException
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
public List<Group> getEmptyGroups(Context context) throws SQLException
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
public int countRows(Context context) throws SQLException
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
-
-