Package org.dspace.eperson
Class EPersonServiceImpl
- java.lang.Object
-
- org.dspace.content.DSpaceObjectServiceImpl<EPerson>
-
- org.dspace.eperson.EPersonServiceImpl
-
- All Implemented Interfaces:
DSpaceObjectLegacySupportService<EPerson>,DSpaceObjectService<EPerson>,EPersonService
public class EPersonServiceImpl extends DSpaceObjectServiceImpl<EPerson> implements EPersonService
Service implementation for the EPerson object. This class is responsible for all business logic calls for the EPerson object and is autowired by spring. This class should never be accessed directly.- Author:
- kevinvandevelde at atmire.com
-
-
Field Summary
Fields Modifier and Type Field Description protected AuthorizeServiceauthorizeServiceprotected EPersonDAOePersonDAOprotected ItemServiceitemServiceprotected SubscribeServicesubscribeService-
Fields inherited from class org.dspace.content.DSpaceObjectServiceImpl
choiceAuthorityService, handleService, metadataAuthorityService, metadataFieldService, metadataValueService, relationshipService
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedEPersonServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckPassword(Context context, EPerson ePerson, String attempt)Check EPerson's password.intcountTotal(Context context)Count all accounts.EPersoncreate(Context context)Create a new epersonvoiddelete(Context context, EPerson ePerson)EPersonfind(Context context, UUID id)Generic find for when the precise type of an Entity is not knownList<EPerson>findAll(Context context, int sortField)List<EPerson>findAll(Context context, int sortField, int pageSize, int offset)Find all the epeople in a specific orderIDLASTNAMEEMAILNETIDEPersonfindByEmail(Context context, String email)Find the eperson by their email address.List<EPerson>findByGroups(Context c, Set<Group> groups)Retrieve all accounts which belong to at least one of the specified groups.EPersonfindByIdOrLegacyId(Context context, String id)EPersonfindByLegacyId(Context context, int legacyId)Generic find for when the precise type of a DSO is not known, just the a pair of type number and database ID.EPersonfindByNetid(Context context, String netId)Find the eperson by their netid.List<EPerson>findEPeopleWithSubscription(Context context)Retrieve all accounts which are subscribed to receive information about new items.List<EPerson>findNotActiveSince(Context context, Date date)Retrieve all accounts which have not logged in since the specified dateList<EPerson>findUnsalted(Context context)Retrieve all accounts which have a password but do not have a digest algorithmList<String>getDeleteConstraints(Context context, EPerson ePerson)Check for presence of EPerson in tables that have constraints on EPersons.StringgetMetadata(EPerson dso, String field)Get the value of a metadata fieldPasswordHashgetPasswordHash(EPerson ePerson)Return the EPerson's password hash.intgetSupportsTypeConstant()Returns the Constants which this service supportsList<EPerson>search(Context context, String query)Find the epeople that match the search query across firstname, lastname or email.List<EPerson>search(Context context, String query, int offset, int limit)Find the epeople that match the search query across firstname, lastname or email.intsearchResultCount(Context context, String query)Returns the total number of epeople returned by a specific query, without the overhead of creating the EPerson objects to store the results.voidsetMetadata(Context context, EPerson ePerson, String field, String value)Set a metadata value (in the metadatavalue table) of the metadata field specified by 'field'.voidsetPassword(EPerson ePerson, String password)Set the EPerson's password.voidsetPasswordHash(EPerson ePerson, PasswordHash password)Set the EPerson's password hash.voidupdate(Context context, EPerson ePerson)voidupdateLastModified(Context context, EPerson dso)-
Methods inherited from class org.dspace.content.DSpaceObjectServiceImpl
addAndShiftRightMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, getAdminObject, getAuthoritiesAndConfidences, getElements, getElementsFilled, getIdentifiers, getMDValueByField, getMDValueByLegacyField, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getMetadataValuePlace, getName, getParentObject, getTypeText, match, moveMetadata, removeMetadataValues, replaceMetadata, setMetadataModified, setMetadataSingleValue
-
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.service.DSpaceObjectService
addAndShiftRightMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, getAdminObject, getIdentifiers, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getName, getParentObject, getTypeText, moveMetadata, removeMetadataValues, replaceMetadata, setMetadataModified, setMetadataSingleValue
-
-
-
-
Field Detail
-
ePersonDAO
@Autowired(required=true) protected EPersonDAO ePersonDAO
-
authorizeService
@Autowired(required=true) protected AuthorizeService authorizeService
-
itemService
@Autowired(required=true) protected ItemService itemService
-
subscribeService
@Autowired(required=true) protected SubscribeService subscribeService
-
-
Method Detail
-
find
public EPerson find(Context context, UUID id) throws SQLException
Description copied from interface:DSpaceObjectServiceGeneric find for when the precise type of an Entity is not known- Specified by:
findin interfaceDSpaceObjectService<EPerson>- Parameters:
context- - the contextid- - uuid within table of type'd dspace objects- Returns:
- the dspace object found, or null if it does not exist.
- Throws:
SQLException- only upon failure accessing the database.
-
findByIdOrLegacyId
public EPerson findByIdOrLegacyId(Context context, String id) throws SQLException
- Specified by:
findByIdOrLegacyIdin interfaceDSpaceObjectLegacySupportService<EPerson>- Throws:
SQLException
-
findByLegacyId
public EPerson findByLegacyId(Context context, int legacyId) throws SQLException
Description copied from interface:DSpaceObjectLegacySupportServiceGeneric find for when the precise type of a DSO is not known, just the a pair of type number and database ID.- Specified by:
findByLegacyIdin interfaceDSpaceObjectLegacySupportService<EPerson>- Parameters:
context- - the contextlegacyId- - the legacy id within table of type'd objects- Returns:
- the object found, or null if it does not exist.
- Throws:
SQLException- only upon failure accessing the database.
-
findByEmail
public EPerson findByEmail(Context context, String email) throws SQLException
Description copied from interface:EPersonServiceFind the eperson by their email address.- Specified by:
findByEmailin interfaceEPersonService- Parameters:
context- The relevant DSpace Context.email- EPerson's email to search by- Returns:
- EPerson, or
nullif none such exists. - Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
findByNetid
public EPerson findByNetid(Context context, String netId) throws SQLException
Description copied from interface:EPersonServiceFind the eperson by their netid.- Specified by:
findByNetidin interfaceEPersonService- Parameters:
context- The relevant DSpace Context.netId- Network ID- Returns:
- corresponding EPerson, or
null - Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
search
public List<EPerson> search(Context context, String query) throws SQLException
Description copied from interface:EPersonServiceFind the epeople that match the search query across firstname, lastname or email.- Specified by:
searchin interfaceEPersonService- Parameters:
context- The relevant DSpace Context.query- The search string- Returns:
- array of EPerson objects
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
search
public List<EPerson> search(Context context, String query, int offset, int limit) throws SQLException
Description copied from interface:EPersonServiceFind the epeople that match the search query across firstname, lastname or email. This method also allows offsets and limits for pagination purposes.- Specified by:
searchin interfaceEPersonService- Parameters:
context- The relevant DSpace Context.query- The search stringoffset- Inclusive offsetlimit- Maximum number of matches returned- Returns:
- array of EPerson objects
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
searchResultCount
public int searchResultCount(Context context, String query) throws SQLException
Description copied from interface:EPersonServiceReturns the total number of epeople returned by a specific query, without the overhead of creating the EPerson objects to store the results.- Specified by:
searchResultCountin interfaceEPersonService- Parameters:
context- The relevant DSpace Context.query- The search string- Returns:
- the number of epeople matching the query
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
findAll
public List<EPerson> findAll(Context context, int sortField) throws SQLException
- Specified by:
findAllin interfaceEPersonService- Parameters:
context- The relevant DSpace Context.sortField- which field to sort EPersons by- Returns:
- list of EPerson objects
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
findAll
public List<EPerson> findAll(Context context, int sortField, int pageSize, int offset) throws SQLException
Description copied from interface:EPersonServiceFind all the epeople in a specific orderIDLASTNAMEEMAILNETID
- Specified by:
findAllin interfaceEPersonService- Parameters:
context- The relevant DSpace Context.sortField- which field to sort EPersons bypageSize- how many results returnoffset- the position of the first result to return- Returns:
- list of EPerson objects
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
create
public EPerson create(Context context) throws SQLException, AuthorizeException
Description copied from interface:EPersonServiceCreate a new eperson- Specified by:
createin interfaceEPersonService- Parameters:
context- The relevant DSpace Context.- Returns:
- the created EPerson
- Throws:
SQLException- An exception that provides information on a database access error or other errors.AuthorizeException- Exception indicating the current user of the context does not have permission to perform a particular action.
-
delete
public void delete(Context context, EPerson ePerson) throws SQLException, AuthorizeException
- Specified by:
deletein interfaceDSpaceObjectService<EPerson>- Throws:
SQLExceptionAuthorizeException
-
getSupportsTypeConstant
public int getSupportsTypeConstant()
Description copied from interface:DSpaceObjectServiceReturns the Constants which this service supports- Specified by:
getSupportsTypeConstantin interfaceDSpaceObjectLegacySupportService<EPerson>- Specified by:
getSupportsTypeConstantin interfaceDSpaceObjectService<EPerson>- Returns:
- a org.dspace.core.Constants that represents a IndexableObject type
-
setPassword
public void setPassword(EPerson ePerson, String password)
Description copied from interface:EPersonServiceSet the EPerson's password.- Specified by:
setPasswordin interfaceEPersonService- Parameters:
ePerson- EPerson whose password we want to set.password- the new password.
-
setPasswordHash
public void setPasswordHash(EPerson ePerson, PasswordHash password)
Description copied from interface:EPersonServiceSet the EPerson's password hash.- Specified by:
setPasswordHashin interfaceEPersonService- Parameters:
ePerson- EPerson whose password hash we want to set.password- hashed password, or null to set row data to NULL.
-
getPasswordHash
public PasswordHash getPasswordHash(EPerson ePerson)
Description copied from interface:EPersonServiceReturn the EPerson's password hash.- Specified by:
getPasswordHashin interfaceEPersonService- Parameters:
ePerson- EPerson whose password hash we want to get.- Returns:
- hash of the password, or null on failure (such as no password).
-
checkPassword
public boolean checkPassword(Context context, EPerson ePerson, String attempt)
Description copied from interface:EPersonServiceCheck EPerson's password. Side effect: original unsalted MD5 hashes are converted using the current algorithm.- Specified by:
checkPasswordin interfaceEPersonService- Parameters:
context- The relevant DSpace Context.ePerson- EPerson whose password we want to checkattempt- the password attempt- Returns:
- boolean successful/unsuccessful
-
update
public void update(Context context, EPerson ePerson) throws SQLException, AuthorizeException
- Specified by:
updatein interfaceDSpaceObjectService<EPerson>- Overrides:
updatein classDSpaceObjectServiceImpl<EPerson>- Throws:
SQLExceptionAuthorizeException
-
getDeleteConstraints
public List<String> getDeleteConstraints(Context context, EPerson ePerson) throws SQLException
Description copied from interface:EPersonServiceCheck for presence of EPerson in tables that have constraints on EPersons. Called by delete() to determine whether the eperson can actually be deleted. An EPerson cannot be deleted if it exists in the item, workflowitem, or tasklistitem tables.- Specified by:
getDeleteConstraintsin interfaceEPersonService- Parameters:
context- The relevant DSpace Context.ePerson- EPerson to find- Returns:
- List of tables that contain a reference to the eperson.
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
findByGroups
public List<EPerson> findByGroups(Context c, Set<Group> groups) throws SQLException
Description copied from interface:EPersonServiceRetrieve all accounts which belong to at least one of the specified groups.- Specified by:
findByGroupsin interfaceEPersonService- Parameters:
c- The relevant DSpace Context.groups- set of eperson groups- Returns:
- a list of epeople
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
findEPeopleWithSubscription
public List<EPerson> findEPeopleWithSubscription(Context context) throws SQLException
Description copied from interface:EPersonServiceRetrieve all accounts which are subscribed to receive information about new items.- Specified by:
findEPeopleWithSubscriptionin interfaceEPersonService- Parameters:
context- The relevant DSpace Context.- Returns:
- a list of epeople
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
updateLastModified
public void updateLastModified(Context context, EPerson dso) throws SQLException
- Specified by:
updateLastModifiedin interfaceDSpaceObjectService<EPerson>- Throws:
SQLException
-
getMetadata
public String getMetadata(EPerson dso, String field)
Description copied from interface:DSpaceObjectServiceGet the value of a metadata field- Specified by:
getMetadatain interfaceDSpaceObjectService<EPerson>- Overrides:
getMetadatain classDSpaceObjectServiceImpl<EPerson>- Parameters:
dso- DSpaceObjectfield- the name of the metadata field to get- Returns:
- the value of the metadata field (or null if the column is an SQL NULL)
-
setMetadata
public void setMetadata(Context context, EPerson ePerson, String field, String value) throws SQLException
Description copied from interface:EPersonServiceSet a metadata value (in the metadatavalue table) of the metadata field specified by 'field'.- Specified by:
setMetadatain interfaceEPersonService- Parameters:
context- The relevant DSpace Context.ePerson- EPerson whose metadata we want to set.field- Metadata field we want to set (e.g. "phone").value- Metadata value we want to set- Throws:
SQLException- if the requested metadata field doesn't exist
-
findUnsalted
public List<EPerson> findUnsalted(Context context) throws SQLException
Description copied from interface:EPersonServiceRetrieve all accounts which have a password but do not have a digest algorithm- Specified by:
findUnsaltedin interfaceEPersonService- Parameters:
context- The relevant DSpace Context.- Returns:
- a list of epeople
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
findNotActiveSince
public List<EPerson> findNotActiveSince(Context context, Date date) throws SQLException
Description copied from interface:EPersonServiceRetrieve all accounts which have not logged in since the specified date- Specified by:
findNotActiveSincein interfaceEPersonService- Parameters:
context- The relevant DSpace Context.date- from which date- Returns:
- a list of epeople
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
countTotal
public int countTotal(Context context) throws SQLException
Description copied from interface:EPersonServiceCount all accounts.- Specified by:
countTotalin interfaceEPersonService- Parameters:
context- The relevant DSpace Context.- Returns:
- the total number of epeople
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
-