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
    Version:
    $Revision$
    Author:
    Peter Breton, kevinvandevelde at atmire.com
    • 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 null if 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 string
        offset - Inclusive offset
        limit - 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

        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.
      • findAll

        @Deprecated
        List<EPerson> findAll​(Context context,
                              int sortField)
                       throws SQLException
        Deprecated.
        use the paginated method. Find all the epeople in a specific order
        • ID
        • LASTNAME
        • EMAIL
        • NETID
        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 the epeople in a specific order
        • ID
        • LASTNAME
        • EMAIL
        • NETID
        Parameters:
        context - The relevant DSpace Context.
        sortField - which field to sort EPersons by
        pageSize - how many results return
        offset - 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

        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 check
        attempt - the password attempt
        Returns:
        boolean successful/unsuccessful
      • setMetadata

        @Deprecated
        void setMetadata​(Context context,
                         EPerson ePerson,
                         String field,
                         String value)
                  throws SQLException
        Deprecated.
        Set a metadata value (in the metadatavalue table) of the metadata field specified by 'field'.
        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

        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, workflowitem, or tasklistitem 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 accounts which belong to at least one of the specified groups.
        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

        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.