Interface GroupDAO

    • Method Detail

      • findByMetadataField

        List<Group> findByMetadataField​(Context context,
                                        String searchValue,
                                        MetadataField metadataField)
                                 throws SQLException
        Look up groups based on their value for a certain metadata field (NOTE: name is not stored as metadata)
        Parameters:
        context - The DSpace context
        searchValue - The value to match
        metadataField - The metadata field to search in
        Returns:
        The groups that have a matching value for specified metadata field
        Throws:
        SQLException - if database error
      • findAll

        List<Group> findAll​(Context context,
                            List<MetadataField> metadataSortFields,
                            int pageSize,
                            int offset)
                     throws SQLException
        Find all groups ordered by the specified metadata fields ascending
        Parameters:
        context - The DSpace context
        sortMetadataFields - The metadata fields to sort on
        pageSize - how many results return
        offset - the position of the first result to return
        Returns:
        A list of all groups, ordered by metadata fields
        Throws:
        SQLException - if database error
      • findAll

        List<Group> findAll​(Context context,
                            int pageSize,
                            int offset)
                     throws SQLException
        Find all groups ordered by name ascending
        Parameters:
        context - The DSpace context
        pageSize - how many results return
        offset - the position of the first result to return
        Returns:
        A list of all groups, ordered by name
        Throws:
        SQLException - if database error
      • findByEPerson

        List<Group> findByEPerson​(Context context,
                                  EPerson ePerson)
                           throws SQLException
        Find all groups that the given ePerson belongs to
        Parameters:
        context - The DSpace context
        ePerson - The EPerson to match
        Returns:
        A list of all groups to which the given EPerson belongs
        Throws:
        SQLException - if database error
      • getGroup2GroupResults

        List<org.apache.commons.lang3.tuple.Pair<UUID,​UUID>> getGroup2GroupResults​(Context context,
                                                                                         boolean flushQueries)
                                                                                  throws SQLException
        Get a list of all direct parent - child group relations in the database
        Parameters:
        context - The DSpace context
        flushQueries - Flush all pending queries
        Returns:
        A list of pairs indicating parent - child
        Throws:
        SQLException - if database error
      • getEmptyGroups

        List<Group> getEmptyGroups​(Context context)
                            throws SQLException
        Return all empty groups
        Parameters:
        context - The DSpace context
        Returns:
        All empty groups
        Throws:
        SQLException - if database error
      • countRows

        int countRows​(Context context)
               throws SQLException
        Count the number of groups in DSpace
        Parameters:
        context - The DSpace context
        Returns:
        The number of groups
        Throws:
        SQLException - if database error
      • findByName

        Group findByName​(Context context,
                         String name)
                  throws SQLException
        Find a group by its name (exact match)
        Parameters:
        context - The DSpace context
        name - The name of the group to look for
        Returns:
        The group with the specified name
        Throws:
        SQLException - if database error
      • findByNameLike

        List<Group> findByNameLike​(Context context,
                                   String groupName,
                                   int offset,
                                   int limit)
                            throws SQLException
        Find a group by its name (fuzzy match)
        Parameters:
        context - The DSpace context
        groupName - Part of the group's name to search for
        offset - Offset to use for pagination (-1 to disable)
        limit - The maximum number of results to return (-1 to disable)
        Returns:
        Groups matching the query
        Throws:
        SQLException - if database error
      • countByNameLike

        int countByNameLike​(Context context,
                            String groupName)
                     throws SQLException
        Count the number of groups that have a name that contains the given string
        Parameters:
        context - The DSpace context
        groupName - Part of the group's name to search for
        Returns:
        The number of matching groups
        Throws:
        SQLException - if database error
      • findByIdAndMembership

        Group findByIdAndMembership​(Context context,
                                    UUID id,
                                    EPerson ePerson)
                             throws SQLException
        Find a group by its name and the membership of the given EPerson
        Parameters:
        context - The DSpace context
        id - The id of the group to look for
        ePerson - The EPerson which has to be a member
        Returns:
        The group with the specified name
        Throws:
        SQLException - if database error