Interface EPersonService
-
- All Superinterfaces:
DSpaceObjectLegacySupportService<EPerson>,DSpaceObjectService<EPerson>
- All Known Implementing Classes:
EPersonServiceImpl
public interface EPersonService extends DSpaceObjectService<EPerson>, DSpaceObjectLegacySupportService<EPerson>
Service interface class for the EPerson object. The implementation of this class is responsible for all business logic calls for the EPerson object and is autowired by Spring.Methods for handling registration by email and forgotten passwords. When someone registers as a user, or forgets their password, the sendRegistrationInfo or sendForgotPasswordInfo methods can be used to send an email to the user. The email contains a special token, a long string which is randomly generated and thus hard to guess. When the user presents the token back to the system, the AccountManager can use the token to determine the identity of the eperson.
*NEW* now ignores expiration dates so that tokens never expire.
- Author:
- Peter Breton, kevinvandevelde at atmire.com
-
-
Field Summary
Fields Modifier and Type Field Description static MetadataFieldNameMD_FIRSTNAMEstatic MetadataFieldNameMD_LANGUAGEstatic MetadataFieldNameMD_LASTNAMEstatic MetadataFieldNameMD_PHONE-
Fields inherited from interface org.dspace.content.service.DSpaceObjectService
MD_COPYRIGHT_TEXT, MD_INTRODUCTORY_TEXT, MD_LICENSE, MD_NAME, MD_PROVENANCE_DESCRIPTION, MD_SHORT_DESCRIPTION, MD_SIDEBAR_TEXT, MD_SOURCE, MD_USER_FORMAT_DESCRIPTION
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description booleancheckPassword(Context context, EPerson ePerson, String attempt)Check EPerson's password.intcountByGroups(Context c, Set<Group> groups)Count all EPerson accounts which belong to at least one of the specified groups.intcountTotal(Context context)Count all accounts.EPersoncreate(Context context)Create a new epersonList<EPerson>findAll(Context context, int sortField)Deprecated.use the paginated methodfindAll(org.dspace.core.Context,int).List<EPerson>findAll(Context context, int sortField, int pageSize, int offset)Find all theEPersons in a specific order by field.EPersonfindByEmail(Context context, String email)Find the eperson by their email address.List<EPerson>findByGroups(Context c, Set<Group> groups)Retrieve all EPerson accounts which belong to at least one of the specified groups.List<EPerson>findByGroups(Context c, Set<Group> groups, int pageSize, int offset)Retrieve all EPerson accounts which belong to at least one of the specified groups, in a paginated fashion.EPersonfindByNetid(Context context, String netId)Find the eperson by their netid.EPersonfindByProfileItem(Context context, Item profile)Find the EPerson related to the given profile item.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.PasswordHashgetPasswordHash(EPerson ePerson)Return the EPerson's password hash.@NotNull EPersongetSystemEPerson(Context context)The "System EPerson" is a fake account that exists only to receive email.List<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.List<EPerson>searchNonMembers(Context context, String query, Group excludeGroup, int offset, int limit)Find the EPersons that match the search query which are NOT currently members of the given Group.intsearchNonMembersCount(Context context, String query, Group excludeGroup)Returns the total number of EPersons that match the search query which are NOT currently members of the given Group.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.voidsetPassword(EPerson ePerson, String password)Set the EPerson's password.voidsetPasswordHash(EPerson ePerson, PasswordHash password)Set the EPerson's password hash.-
Methods inherited from interface org.dspace.content.service.DSpaceObjectLegacySupportService
findByIdOrLegacyId, findByLegacyId, getSupportsTypeConstant
-
Methods inherited from interface org.dspace.content.service.DSpaceObjectService
addAndShiftRightMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, delete, find, getAdminObject, getIdentifiers, getMetadata, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getMetadataFirstValue, getName, getParentObject, getSupportsTypeConstant, getTypeText, moveMetadata, removeMetadataValues, replaceMetadata, setMetadataModified, setMetadataSingleValue, setMetadataSingleValue, update, updateLastModified
-
-
-
-
Field Detail
-
MD_FIRSTNAME
static final MetadataFieldName MD_FIRSTNAME
-
MD_LASTNAME
static final MetadataFieldName MD_LASTNAME
-
MD_PHONE
static final MetadataFieldName MD_PHONE
-
MD_LANGUAGE
static final MetadataFieldName MD_LANGUAGE
-
-
Method Detail
-
findByEmail
EPerson findByEmail(Context context, String email) throws SQLException
Find the eperson by their email address.- 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
EPerson findByNetid(Context context, String netId) throws SQLException
Find the eperson by their netid.- 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
List<EPerson> search(Context context, String query) throws SQLException
Find the epeople that match the search query across firstname, lastname or email.- 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
List<EPerson> search(Context context, String query, int offset, int limit) throws SQLException
Find the epeople that match the search query across firstname, lastname or email. This method also allows offsets and limits for pagination purposes.- Parameters:
context- The relevant DSpace Context.query- The search stringoffset- Inclusive offset (the position of the first result to return)limit- Maximum number of matches returned- Returns:
- List of matching EPerson objects
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
searchResultCount
int searchResultCount(Context context, String query) throws SQLException
Returns the total number of epeople returned by a specific query, without the overhead of creating the EPerson objects to store the results.- 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.
-
searchNonMembers
List<EPerson> searchNonMembers(Context context, String query, Group excludeGroup, int offset, int limit) throws SQLException
Find the EPersons that match the search query which are NOT currently members of the given Group. The search query is run against firstname, lastname or email.- Parameters:
context- DSpace contextquery- The search stringexcludeGroup- Group to exclude results from. Members of this group will never be returned.offset- Inclusive offset (the position of the first result to return)limit- Maximum number of matches returned- Returns:
- List of matching EPerson objects
- Throws:
SQLException- if error
-
searchNonMembersCount
int searchNonMembersCount(Context context, String query, Group excludeGroup) throws SQLException
Returns the total number of EPersons that match the search query which are NOT currently members of the given Group. The search query is run against firstname, lastname or email. Can be used with searchNonMembers() to support pagination- Parameters:
context- DSpace contextquery- The search stringexcludeGroup- Group to exclude results from. Members of this group will never be returned.- Returns:
- List of matching EPerson objects
- Throws:
SQLException- if error
-
findAll
@Deprecated List<EPerson> findAll(Context context, int sortField) throws SQLException
Deprecated.use the paginated methodfindAll(org.dspace.core.Context,int).Find all theEPersons in a specific order by field. The sortable fields are:IDLASTNAMEEMAILNETID
- 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
List<EPerson> findAll(Context context, int sortField, int pageSize, int offset) throws SQLException
Find all theEPersons in a specific order by field. The sortable fields are:IDLASTNAMEEMAILNETID
- 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.
-
getSystemEPerson
@NotNull @NotNull EPerson getSystemEPerson(Context context) throws SQLException
The "System EPerson" is a fake account that exists only to receive email. It has an email address that should be presumed usable. It does not exist in the database and is not complete.- Parameters:
context- current DSpace session.- Returns:
- an EPerson that can presumably receive email.
- Throws:
SQLException
-
create
EPerson create(Context context) throws SQLException, AuthorizeException
Create a new eperson- 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.
-
setPassword
void setPassword(EPerson ePerson, String password)
Set the EPerson's password.- Parameters:
ePerson- EPerson whose password we want to set.password- the new password.
-
setPasswordHash
void setPasswordHash(EPerson ePerson, PasswordHash password)
Set the EPerson's password hash.- Parameters:
ePerson- EPerson whose password hash we want to set.password- hashed password, or null to set row data to NULL.
-
getPasswordHash
PasswordHash getPasswordHash(EPerson ePerson)
Return the EPerson's password hash.- Parameters:
ePerson- EPerson whose password hash we want to get.- Returns:
- hash of the password, or null on failure (such as no password).
-
checkPassword
boolean checkPassword(Context context, EPerson ePerson, String attempt)
Check EPerson's password. Side effect: original unsalted MD5 hashes are converted using the current algorithm.- Parameters:
context- The relevant DSpace Context.ePerson- EPerson whose password we want to checkattempt- the password attempt- Returns:
- boolean successful/unsuccessful
-
findUnsalted
List<EPerson> findUnsalted(Context context) throws SQLException
Retrieve all accounts which have a password but do not have a digest algorithm- 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
List<EPerson> findNotActiveSince(Context context, Date date) throws SQLException
Retrieve all accounts which have not logged in since the specified date- 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.
-
getDeleteConstraints
List<String> getDeleteConstraints(Context context, EPerson ePerson) throws SQLException
Check 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, resourcepolicy or workflow-related tables.- 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
List<EPerson> findByGroups(Context c, Set<Group> groups) throws SQLException
Retrieve all EPerson accounts which belong to at least one of the specified groups.WARNING: This method may have bad performance issues for Groups with a very large number of members, as it will load all member EPerson objects into memory.
For better performance, use the paginated version of this method.
- 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.
-
findByGroups
List<EPerson> findByGroups(Context c, Set<Group> groups, int pageSize, int offset) throws SQLException
Retrieve all EPerson accounts which belong to at least one of the specified groups, in a paginated fashion.- Parameters:
c- The relevant DSpace Context.groups- 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:
- a list of epeople
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
countByGroups
int countByGroups(Context c, Set<Group> groups) throws SQLException
Count all EPerson accounts which belong to at least one of the specified groups. This provides the total number of results to expect from corresponding findByGroups() for pagination purposes.- Parameters:
c- The relevant DSpace Context.groups- 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- An exception that provides information on a database access error or other errors.
-
findEPeopleWithSubscription
List<EPerson> findEPeopleWithSubscription(Context context) throws SQLException
Retrieve all accounts which are subscribed to receive information about new items.- 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.
-
countTotal
int countTotal(Context context) throws SQLException
Count all accounts.- 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.
-
findByProfileItem
EPerson findByProfileItem(Context context, Item profile) throws SQLException
Find the EPerson related to the given profile item. If the given item is not a profile item, null is returned.- Parameters:
context- The relevant DSpace Context.profile- the profile item to search for- Returns:
- the EPerson, if any
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
-