Interface RelationshipDAO

  • All Superinterfaces:
    GenericDAO<Relationship>
    All Known Implementing Classes:
    RelationshipDAOImpl

    public interface RelationshipDAO
    extends GenericDAO<Relationship>
    Database Access Object Interface class for the Relationship object The implementation of this class is responsible for all database calls for the Relationship object and is autowired by spring This class should only be accessed from a single service and should never be exposed outside of the API
    • Method Detail

      • findByItem

        List<Relationship> findByItem​(Context context,
                                      Item item,
                                      boolean excludeTilted)
                               throws SQLException
        This method returns a list of Relationship objects that have the given Item object as a leftItem or a rightItem
        Parameters:
        context - The relevant DSpace context
        item - The item that should be either a leftItem or a rightItem of all the Relationship objects in the returned list
        excludeTilted - If true, excludes tilted relationships
        Returns:
        The list of Relationship objects that contain either a left or a right item that is equal to the given item
        Throws:
        SQLException - If something goes wrong
      • findByItem

        List<Relationship> findByItem​(Context context,
                                      Item item,
                                      Integer limit,
                                      Integer offset,
                                      boolean excludeTilted)
                               throws SQLException
        This method returns a list of Relationship objects that have the given Item object as a leftItem or a rightItem
        Parameters:
        context - The relevant DSpace context
        item - The item that should be either a leftItem or a rightItem of all the Relationship objects in the returned list
        limit - paging limit
        offset - paging offset
        excludeTilted - If true, excludes tilted relationships
        Returns:
        The list of Relationship objects that contain either a left or a right item that is equal to the given item
        Throws:
        SQLException - If something goes wrong
      • findNextLeftPlaceByLeftItem

        int findNextLeftPlaceByLeftItem​(Context context,
                                        Item item)
                                 throws SQLException
        This method returns the next leftplace integer to use for a relationship with this item as the leftItem
        Parameters:
        context - The relevant DSpace context
        item - The item to be matched on leftItem
        Returns:
        The next integer to be used for the leftplace of a relationship with the given item as a left item
        Throws:
        SQLException - If something goes wrong
      • findNextRightPlaceByRightItem

        int findNextRightPlaceByRightItem​(Context context,
                                          Item item)
                                   throws SQLException
        This method returns the next rightplace integer to use for a relationship with this item as the rightItem
        Parameters:
        context - The relevant DSpace context
        item - The item to be matched on rightItem
        Returns:
        The next integer to be used for the rightplace of a relationship with the given item as a right item
        Throws:
        SQLException - If something goes wrong
      • findByRelationshipType

        List<Relationship> findByRelationshipType​(Context context,
                                                  RelationshipType relationshipType)
                                           throws SQLException
        This method returns a list of Relationship objects for the given RelationshipType object. It will construct a list of all Relationship objects that have the given RelationshipType object as the relationshipType property
        Parameters:
        context - The relevant DSpace context
        relationshipType - The RelationshipType object to be checked on
        Returns:
        A list of Relationship objects that have the given RelationshipType object as the relationshipType property
        Throws:
        SQLException - If something goes wrong
      • findByRelationshipType

        List<Relationship> findByRelationshipType​(Context context,
                                                  RelationshipType relationshipType,
                                                  Integer limit,
                                                  Integer offset)
                                           throws SQLException
        This method returns a list of Relationship objects for the given RelationshipType object. It will construct a list of all Relationship objects that have the given RelationshipType object as the relationshipType property
        Parameters:
        context - The relevant DSpace context
        relationshipType - The RelationshipType object to be checked on
        limit - paging limit
        offset - paging offset
        Returns:
        A list of Relationship objects that have the given RelationshipType object as the relationshipType property
        Throws:
        SQLException - If something goes wrong
      • findByItemAndRelationshipType

        List<Relationship> findByItemAndRelationshipType​(Context context,
                                                         Item item,
                                                         RelationshipType relationshipType,
                                                         Integer limit,
                                                         Integer offset)
                                                  throws SQLException
        This method returns a list of Relationship objects for the given RelationshipType object. It will construct a list of all Relationship objects that have the given RelationshipType object as the relationshipType property
        Parameters:
        context - The relevant DSpace context
        relationshipType - The RelationshipType object to be checked on
        limit - paging limit
        offset - paging offset
        item - item to filter by
        Returns:
        A list of Relationship objects that have the given RelationshipType object as the relationshipType property
        Throws:
        SQLException - If something goes wrong
      • findByItemAndRelationshipType

        List<Relationship> findByItemAndRelationshipType​(Context context,
                                                         Item item,
                                                         RelationshipType relationshipType,
                                                         boolean isLeft,
                                                         Integer limit,
                                                         Integer offset)
                                                  throws SQLException
        This method returns a list of Relationship objects for the given RelationshipType object. It will construct a list of all Relationship objects that have the given RelationshipType object as the relationshipType property
        Parameters:
        context - The relevant DSpace context
        relationshipType - The RelationshipType object to be checked on
        limit - paging limit
        offset - paging offset
        item - item to filter by
        isLeft - Is item left or right
        Returns:
        A list of Relationship objects that have the given RelationshipType object as the relationshipType property
        Throws:
        SQLException - If something goes wrong
      • findByTypeName

        List<Relationship> findByTypeName​(Context context,
                                          String typeName)
                                   throws SQLException
        This method returns a list of Relationship objects for the given typeName
        Parameters:
        context - The relevant DSpace context
        typeName - The leftward or rightward typeName of the relationship type
        Returns:
        A list of Relationship objects that have the given RelationshipType object as the relationshipType property
        Throws:
        SQLException - If something goes wrong
      • findByTypeName

        List<Relationship> findByTypeName​(Context context,
                                          String typeName,
                                          Integer limit,
                                          Integer offset)
                                   throws SQLException
        This method returns a list of Relationship objects for the given typeName
        Parameters:
        context - The relevant DSpace context
        typeName - The leftward or rightward typeName of the relationship type
        limit - paging limit
        offset - paging offset
        Returns:
        A list of Relationship objects that have the given RelationshipType object as the relationshipType property
        Throws:
        SQLException - If something goes wrong
      • countRows

        int countRows​(Context context)
               throws SQLException
        Count total number of relationships (rows in relationship table)
        Parameters:
        context - context
        Returns:
        total count
        Throws:
        SQLException - if database error
      • countByRelationshipType

        int countByRelationshipType​(Context context,
                                    RelationshipType relationshipType)
                             throws SQLException
        Count total number of relationships (rows in relationship table) by a relationship type
        Parameters:
        context - context
        relationshipType - relationship type to filter by
        Returns:
        total count
        Throws:
        SQLException - if database error
      • countByItem

        int countByItem​(Context context,
                        Item item)
                 throws SQLException
        This method returns a count of Relationship objects that have the given Item object as a leftItem or a rightItem
        Parameters:
        context - The relevant DSpace context
        item - The item that should be either a leftItem or a rightItem of all the Relationship objects in the returned list
        Returns:
        The list of Relationship objects that contain either a left or a right item that is equal to the given item
        Throws:
        SQLException - If something goes wrong
      • countByItemAndRelationshipType

        int countByItemAndRelationshipType​(Context context,
                                           Item item,
                                           RelationshipType relationshipType,
                                           boolean isLeft)
                                    throws SQLException
        Count total number of relationships (rows in relationship table) by an item and a relationship type and a boolean indicating whether the item should be the leftItem or the rightItem
        Parameters:
        context - context
        relationshipType - relationship type to filter by
        item - item to filter by
        isLeft - Indicating whether the counted Relationships should have the given Item on the left side or not
        Returns:
        total count
        Throws:
        SQLException - if database error
      • countByTypeName

        int countByTypeName​(Context context,
                            String typeName)
                     throws SQLException
        Count total number of relationships (rows in relationship table) given a typeName
        Parameters:
        context - context
        typeName - the relationship typeName to filter by
        Returns:
        total count
        Throws:
        SQLException - if database error
      • findByItemAndRelationshipTypeAndList

        List<Relationship> findByItemAndRelationshipTypeAndList​(Context context,
                                                                UUID focusUUID,
                                                                RelationshipType relationshipType,
                                                                List<UUID> items,
                                                                boolean isLeft,
                                                                int offset,
                                                                int limit)
                                                         throws SQLException
        This method is used to retrieve relationships that match focusItem on the one hand and matches list of related items elsewhere.
        Parameters:
        context - DSpace context object
        focusUUID - UUID of Item that will match left side if the param isLeft is true otherwise right side
        relationshipType - Relationship type to filter by
        items - List of UUID that will use to filter other side respect the focusUUID
        isLeft - Indicating whether the counted Relationships should have the given Item on the left side or not
        limit - paging limit
        offset - paging offset
        Returns:
        Throws:
        SQLException - If database error
      • countByItemAndRelationshipTypeAndList

        int countByItemAndRelationshipTypeAndList​(Context context,
                                                  UUID focusUUID,
                                                  RelationshipType relationshipType,
                                                  List<UUID> items,
                                                  boolean isLeft)
                                           throws SQLException
        Count total number of relationships that match focusItem on the one hand and matches list of related items elsewhere.
        Parameters:
        context - DSpace context object
        focusUUID - UUID of Item that will match left side if the param isLeft is true otherwise right side
        relationshipType - Relationship type to filter by
        items - List of UUID that will use to filter other side respect the focusUUID
        isLeft - Indicating whether the counted Relationships should have the given Item on the left side or not
        Returns:
        Throws:
        SQLException - If database error