Package org.dspace.eperson.dao.impl
Class EPersonDAOImpl
- java.lang.Object
-
- org.dspace.core.AbstractHibernateDAO<T>
-
- org.dspace.core.AbstractHibernateDSODAO<EPerson>
-
- org.dspace.eperson.dao.impl.EPersonDAOImpl
-
- All Implemented Interfaces:
DSpaceObjectDAO<EPerson>,DSpaceObjectLegacySupportDAO<EPerson>,GenericDAO<EPerson>,EPersonDAO
public class EPersonDAOImpl extends AbstractHibernateDSODAO<EPerson> implements EPersonDAO
Hibernate implementation of the Database Access Object interface class for the EPerson object. This class is responsible for all database calls for the EPerson object and is autowired by Spring. This class should never be accessed directly.- Author:
- kevinvandevelde at atmire.com
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedEPersonDAOImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcountByGroups(Context context, Set<Group> groups)Count total number of EPersons who are a member of one or more of the listed groups.intcountRows(Context context)List<EPerson>findAll(Context context, MetadataField metadataSortField, String sortField, int pageSize, int offset)List<EPerson>findAllSubscribers(Context context)EPersonfindByEmail(Context context, String email)List<EPerson>findByGroups(Context context, Set<Group> groups, int pageSize, int offset)Find all EPersons who are a member of one or more of the listed groups in a paginated fashion.EPersonfindByNetid(Context context, String netid)List<EPerson>findNotActiveSince(Context context, Date date)List<EPerson>findWithPasswordWithoutDigestAlgorithm(Context context)protected javax.persistence.QuerygetSearchQuery(Context context, String queryString, String queryParam, List<MetadataField> queryFields, List<MetadataField> sortFields, String sortField)protected javax.persistence.QuerygetSearchQuery(Context context, String queryString, String queryParam, List<MetadataField> queryFields, Group excludeGroup, List<MetadataField> sortFields, String sortField, int pageSize, int offset)Build a search query across EPersons based on the given metadata fields and sorted based on the given metadata field(s) or database column.List<EPerson>search(Context context, String query, List<MetadataField> queryFields, List<MetadataField> sortFields, int offset, int limit)Search all EPersons by the given MetadataField objects, sorting by the given sort fields.List<EPerson>searchNotMember(Context context, String query, List<MetadataField> queryFields, Group excludeGroup, List<MetadataField> sortFields, int offset, int limit)Search all EPersons via their firstname, lastname, email (fuzzy match), limited to those EPersons which are NOT a member of the given group.intsearchNotMemberCount(Context context, String query, List<MetadataField> queryFields, Group excludeGroup)Count number of EPersons that match a given search (fuzzy match) across firstname, lastname and email.intsearchResultCount(Context context, String query, List<MetadataField> queryFields)Count number of EPersons who match a search on the given metadata fields.-
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, delete, 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, delete, findAll, findAll, findByID, findByID, findMany, findUnique, save
-
-
-
-
Method Detail
-
findByEmail
public EPerson findByEmail(Context context, String email) throws SQLException
- Specified by:
findByEmailin interfaceEPersonDAO- Throws:
SQLException
-
findByNetid
public EPerson findByNetid(Context context, String netid) throws SQLException
- Specified by:
findByNetidin interfaceEPersonDAO- Throws:
SQLException
-
search
public List<EPerson> search(Context context, String query, List<MetadataField> queryFields, List<MetadataField> sortFields, int offset, int limit) throws SQLException
Description copied from interface:EPersonDAOSearch all EPersons by the given MetadataField objects, sorting by the given sort fields.NOTE: As long as a query is specified, the EPerson's email address is included in the search alongside any given metadata fields.
- Specified by:
searchin interfaceEPersonDAO- Parameters:
context- DSpace contextquery- the text to search EPersons forqueryFields- the metadata fields to search within (email is also included automatically)sortFields- the metadata field(s) to sort the results byoffset- the position of the first result to returnlimit- how many results return- Returns:
- List of matching EPerson objects
- Throws:
SQLException- if an error occurs
-
searchResultCount
public int searchResultCount(Context context, String query, List<MetadataField> queryFields) throws SQLException
Description copied from interface:EPersonDAOCount number of EPersons who match a search on the given metadata fields. This returns the count of total results for the same query using the 'search()', and therefore can be used to provide pagination.- Specified by:
searchResultCountin interfaceEPersonDAO- Parameters:
context- DSpace contextquery- the text to search EPersons forqueryFields- the metadata fields to search within (email is also included automatically)- Returns:
- total number of EPersons who match the query
- Throws:
SQLException- if an error occurs
-
searchNotMember
public List<EPerson> searchNotMember(Context context, String query, List<MetadataField> queryFields, Group excludeGroup, List<MetadataField> sortFields, int offset, int limit) throws SQLException
Description copied from interface:EPersonDAOSearch all EPersons via their firstname, lastname, email (fuzzy match), limited to those EPersons which are NOT a member of the given group. This may be used to search across EPersons which are valid to add as members to the given group.- Specified by:
searchNotMemberin interfaceEPersonDAO- Parameters:
context- The DSpace contextquery- the text to search EPersons forqueryFields- the metadata fields to search within (email is also included automatically)excludeGroup- Group to exclude results from. Members of this group will never be returned.offset- the position of the first result to returnlimit- how many results return- Returns:
- EPersons matching the query (which are not members of the given group)
- Throws:
SQLException- if database error
-
searchNotMemberCount
public int searchNotMemberCount(Context context, String query, List<MetadataField> queryFields, Group excludeGroup) throws SQLException
Description copied from interface:EPersonDAOCount number of EPersons that match a given search (fuzzy match) across firstname, lastname and email. This search is limited to those EPersons which are NOT a member of the given group. This may be used (with searchNotMember()) to perform a paginated search across EPersons which are valid to add to the given group.- Specified by:
searchNotMemberCountin interfaceEPersonDAO- Parameters:
context- The DSpace contextquery- querystring to fuzzy match against.queryFields- the metadata fields to search within (email is also included automatically)excludeGroup- Group to exclude results from. Members of this group will never be returned.- Returns:
- Groups matching the query (which are not members of the given parent)
- Throws:
SQLException- if database error
-
findAll
public List<EPerson> findAll(Context context, MetadataField metadataSortField, String sortField, int pageSize, int offset) throws SQLException
- Specified by:
findAllin interfaceEPersonDAO- Throws:
SQLException
-
findByGroups
public List<EPerson> findByGroups(Context context, Set<Group> groups, int pageSize, int offset) throws SQLException
Description copied from interface:EPersonDAOFind all EPersons who are a member of one or more of the listed groups in a paginated fashion. This returns EPersons ordered by UUID.- Specified by:
findByGroupsin interfaceEPersonDAO- Parameters:
context- current Contextgroups- Set of group(s) to check membership inpageSize- number of EPerson objects to load at one time. Set to <=0 to disable paginationoffset- number of page to load (starting with 1). Set to <=0 to disable pagination- Returns:
- List of all EPersons who are a member of one or more groups.
- Throws:
SQLException
-
countByGroups
public int countByGroups(Context context, Set<Group> groups) throws SQLException
Description copied from interface:EPersonDAOCount total number of EPersons who are a member of one or more of the listed groups. This provides the total number of results to expect from corresponding findByGroups() for pagination purposes.- Specified by:
countByGroupsin interfaceEPersonDAO- Parameters:
context- current Contextgroups- Set of group(s) to check membership in- Returns:
- total number of (unique) EPersons who are a member of one or more groups.
- Throws:
SQLException
-
findWithPasswordWithoutDigestAlgorithm
public List<EPerson> findWithPasswordWithoutDigestAlgorithm(Context context) throws SQLException
- Specified by:
findWithPasswordWithoutDigestAlgorithmin interfaceEPersonDAO- Throws:
SQLException
-
findNotActiveSince
public List<EPerson> findNotActiveSince(Context context, Date date) throws SQLException
- Specified by:
findNotActiveSincein interfaceEPersonDAO- Throws:
SQLException
-
getSearchQuery
protected javax.persistence.Query getSearchQuery(Context context, String queryString, String queryParam, List<MetadataField> queryFields, List<MetadataField> sortFields, String sortField) throws SQLException
- Throws:
SQLException
-
getSearchQuery
protected javax.persistence.Query getSearchQuery(Context context, String queryString, String queryParam, List<MetadataField> queryFields, Group excludeGroup, List<MetadataField> sortFields, String sortField, int pageSize, int offset) throws SQLException
Build a search query across EPersons based on the given metadata fields and sorted based on the given metadata field(s) or database column.NOTE: the EPerson's email address is included in the search alongside any given metadata fields.
- Parameters:
context- DSpace ContextqueryString- String which defines the beginning "SELECT" for the SQL queryqueryParam- Actual text being searched forqueryFields- List of metadata fields to search withinexcludeGroup- Optional Group which should be excluded from search. Any EPersons who are members of this group will not be included in the results.sortFields- Optional List of metadata fields to sort by (should not be specified if sortField is used)sortField- Optional database column to sort on (should not be specified if sortFields is used)pageSize- how many results returnoffset- the position of the first result to return- Returns:
- built Query object
- Throws:
SQLException- if error occurs
-
findAllSubscribers
public List<EPerson> findAllSubscribers(Context context) throws SQLException
- Specified by:
findAllSubscribersin interfaceEPersonDAO- Throws:
SQLException
-
countRows
public int countRows(Context context) throws SQLException
- Specified by:
countRowsin interfaceEPersonDAO- Throws:
SQLException
-
-