Class EPersonDAOImpl

    • Constructor Detail

      • EPersonDAOImpl

        protected EPersonDAOImpl()
    • Method Detail

      • 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: EPersonDAO
        Search 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:
        search in interface EPersonDAO
        Parameters:
        context - DSpace context
        query - the text to search EPersons for
        queryFields - the metadata fields to search within (email is also included automatically)
        sortFields - the metadata field(s) to sort the results by
        offset - the position of the first result to return
        limit - 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: EPersonDAO
        Count 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:
        searchResultCount in interface EPersonDAO
        Parameters:
        context - DSpace context
        query - the text to search EPersons for
        queryFields - 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: EPersonDAO
        Search 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:
        searchNotMember in interface EPersonDAO
        Parameters:
        context - The DSpace context
        query - the text to search EPersons for
        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.
        offset - the position of the first result to return
        limit - 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: EPersonDAO
        Count 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:
        searchNotMemberCount in interface EPersonDAO
        Parameters:
        context - The DSpace context
        query - 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
      • findByGroups

        public List<EPerson> findByGroups​(Context context,
                                          Set<Group> groups,
                                          int pageSize,
                                          int offset)
                                   throws SQLException
        Description copied from interface: EPersonDAO
        Find 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:
        findByGroups in interface EPersonDAO
        Parameters:
        context - current Context
        groups - Set of group(s) to check membership in
        pageSize - number of EPerson objects to load at one time. Set to <=0 to disable pagination
        offset - 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: EPersonDAO
        Count 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:
        countByGroups in interface EPersonDAO
        Parameters:
        context - current 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
      • 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 Context
        queryString - String which defines the beginning "SELECT" for the SQL query
        queryParam - Actual text being searched for
        queryFields - List of metadata fields to search within
        excludeGroup - 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 return
        offset - the position of the first result to return
        Returns:
        built Query object
        Throws:
        SQLException - if error occurs