Interface RelationshipService

All Superinterfaces:
DSpaceCRUDService<Relationship>
All Known Implementing Classes:
RelationshipServiceImpl

public interface RelationshipService extends DSpaceCRUDService<Relationship>
This Service will use the DAO classes to access the information about Relationships from the database
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    countByItem(Context context, Item item)
    This method returns a count of Relationship objects that have the given Item object as a leftItem or a rightItem
    int
    countByItem(Context context, Item item, boolean excludeTilted, boolean excludeNonLatest)
    This method returns a count of Relationship objects that have the given Item object as a leftItem or a rightItem
    int
    countByItemAndRelationshipType(Context context, Item item, RelationshipType relationshipType, boolean isLeft)
    Count total number of relationships (rows in relationship table) by a relationship type and a boolean indicating whether the relationship should contain the item on the left side or not NOTE: tilted relationships are NEVER excluded when fetching one relationship type
    int
    countByItemAndRelationshipType(Context context, Item item, RelationshipType relationshipType, boolean isLeft, boolean excludeNonLatest)
    Count total number of relationships (rows in relationship table) by a relationship type and a boolean indicating whether the relationship should contain the item on the left side or not NOTE: tilted relationships are NEVER excluded when fetching one relationship type
    int
    countByItemRelationshipTypeAndRelatedList(Context context, UUID focusUUID, RelationshipType relationshipType, List<UUID> items, boolean isLeft)
    Count total number of relationships that match focusItem on the one hand and matches list of related items elsewhere.
    int
    countByRelationshipType(Context context, RelationshipType relationshipType)
    Count total number of relationships (rows in relationship table) by a relationship type NOTE: tilted relationships are NEVER excluded when fetching one relationship type
    int
    countByTypeName(Context context, String typeName)
    Count total number of relationships (rows in relationship table) by a relationship leftward or rightward typeName
    int
    counts all relationships
    create(Context c, Item leftItem, Item rightItem, RelationshipType relationshipType, int leftPlace, int rightPlace)
    This method is used to construct a Relationship object with all it's variables, except the leftward label, rightward label and latest version status
    create(Context c, Item leftItem, Item rightItem, RelationshipType relationshipType, int leftPlace, int rightPlace, String leftwardValue, String rightwardValue)
    This method is used to construct a Relationship object with all it's variables, except the latest version status
    create(Context c, Item leftItem, Item rightItem, RelationshipType relationshipType, int leftPlace, int rightPlace, String leftwardValue, String rightwardValue, Relationship.LatestVersionStatus latestVersionStatus)
    This method is used to construct a Relationship object with all it's variables
    create(Context context, Relationship relationship)
    This method creates a relationship object in the database equal to the given relationship param if this is a valid relationship
    void
    delete(Context context, Relationship relationship, boolean copyToLeftItem, boolean copyToRightItem)
    This method is used to delete a Relationship whilst given the possibility to copy the Virtual Metadata created by this relationship to the left and/or right item
    findAll(Context context)
    Retrieves the full list of relationships currently in the system
    findAll(Context context, Integer limit, Integer offset)
    Retrieves the full list of relationships currently in the system
    findByItem(Context context, Item item)
    Retrieves the list of Relationships currently in the system for which the given Item is either a leftItem or a rightItem object
    findByItem(Context context, Item item, Integer limit, Integer offset, boolean excludeTilted)
    Retrieves the list of Relationships currently in the system for which the given Item is either a leftItem or a rightItem object
    findByItem(Context context, Item item, Integer limit, Integer offset, boolean excludeTilted, boolean excludeNonLatest)
    Retrieves the list of Relationships currently in the system for which the given Item is either a leftItem or a rightItem object
    findByItemAndRelationshipType(Context context, Item item, RelationshipType relationshipType)
    This method returns a list of Relationships for which the leftItem or rightItem is equal to the given Item object and for which the RelationshipType object is equal to the relationshipType property NOTE: tilted relationships are NEVER excluded when fetching one relationship type
    findByItemAndRelationshipType(Context context, Item item, RelationshipType relationshipType, boolean isLeft, int limit, int offset)
    This method returns a list of Relationships for which the leftItem or rightItem is equal to the given Item object and for which the RelationshipType object is equal to the relationshipType property NOTE: tilted relationships are NEVER excluded when fetching one relationship type
    findByItemAndRelationshipType(Context context, Item item, RelationshipType relationshipType, boolean isLeft, int limit, int offset, boolean excludeNonLatest)
    This method returns a list of Relationships for which the leftItem or rightItem is equal to the given Item object and for which the RelationshipType object is equal to the relationshipType property NOTE: tilted relationships are NEVER excluded when fetching one relationship type
    findByItemAndRelationshipType(Context context, Item item, RelationshipType relationshipType, int limit, int offset)
    This method returns a list of Relationships for which the leftItem or rightItem is equal to the given Item object and for which the RelationshipType object is equal to the relationshipType property NOTE: tilted relationships are NEVER excluded when fetching one relationship type
    findByItemAndRelationshipType(Context context, Item item, RelationshipType relationshipType, int limit, int offset, boolean excludeNonLatest)
    This method returns a list of Relationships for which the leftItem or rightItem is equal to the given Item object and for which the RelationshipType object is equal to the relationshipType property NOTE: tilted relationships are NEVER excluded when fetching one relationship type
    findByItemRelationshipTypeAndRelatedList(Context context, UUID focusUUID, RelationshipType relationshipType, List<UUID> items, boolean isLeft, int offset, int limit)
    This method is used to retrieve relationships that match focusItem on the one hand and matches list of related items elsewhere.
    findByLatestItemAndRelationshipType(Context context, Item latestItem, RelationshipType relationshipType, boolean isLeft)
    This method returns the UUIDs of all items that have a relationship with the given item, from the perspective of the other item.
    findByRelationshipType(Context context, RelationshipType relationshipType)
    This method returns a list of Relationship objects for which the relationshipType property is equal to the given RelationshipType object NOTE: tilted relationships are NEVER excluded when fetching one relationship type
    findByRelationshipType(Context context, RelationshipType relationshipType, Integer limit, Integer offset)
    This method returns a list of Relationship objects for which the relationshipType property is equal to the given RelationshipType object NOTE: tilted relationships are NEVER excluded when fetching one relationship type
    findByTypeName(Context context, String typeName)
    This method returns a list of Relationship objects for the given typeName
    findByTypeName(Context context, String typeName, Integer limit, Integer offset)
    This method returns a list of Relationship objects for the given typeName
    void
    forceDelete(Context context, Relationship relationship, boolean copyToLeftItem, boolean copyToRightItem)
    This method is used to delete a Relationship whilst given the possibility to copy the Virtual Metadata created by this relationship to the left and/or right item.
    move(Context context, Relationship relationship, Integer newLeftPlace, Integer newRightPlace)
    Move the given relationship to a new leftPlace and/or rightPlace.
    move(Context context, Relationship relationship, Item newLeftItem, Item newRightItem)
    Move the given relationship to a new leftItem and/or rightItem.
    void
    updateItem(Context context, Item relatedItem)
    This method will update the given item's metadata order.

    Methods inherited from interface org.dspace.service.DSpaceCRUDService

    create, delete, find, update, update
  • Method Details

    • findByItem

      List<Relationship> findByItem(Context context, Item item) throws SQLException
      Retrieves the list of Relationships currently in the system for which the given Item is either a leftItem or a rightItem object
      Parameters:
      context - The relevant DSpace context
      item - The Item that has to be the left or right item for the relationship to be included in the list
      Returns:
      The list of relationships for which each relationship adheres to the above listed constraint
      Throws:
      SQLException - If something goes wrong
    • findByItem

      List<Relationship> findByItem(Context context, Item item, Integer limit, Integer offset, boolean excludeTilted) throws SQLException
      Retrieves the list of Relationships currently in the system for which the given Item is either a leftItem or a rightItem object
      Parameters:
      context - The relevant DSpace context
      item - The Item that has to be the left or right item for the relationship to be included in the list
      limit - paging limit
      offset - paging offset
      excludeTilted - If true, excludes tilted relationships
      Returns:
      The list of relationships for which each relationship adheres to the above listed constraint
      Throws:
      SQLException - If something goes wrong
    • findByItem

      List<Relationship> findByItem(Context context, Item item, Integer limit, Integer offset, boolean excludeTilted, boolean excludeNonLatest) throws SQLException
      Retrieves the list of Relationships currently in the system for which the given Item is either a leftItem or a rightItem object
      Parameters:
      context - The relevant DSpace context
      item - The Item that has to be the left or right item for the relationship to be included in the list
      limit - paging limit
      offset - paging offset
      excludeTilted - If true, excludes tilted relationships
      excludeNonLatest - If true, excludes all relationships for which the other item has a more recent version that is relevant for this relationship
      Returns:
      The list of relationships for which each relationship adheres to the above listed constraint
      Throws:
      SQLException - If something goes wrong
    • findAll

      List<Relationship> findAll(Context context) throws SQLException
      Retrieves the full list of relationships currently in the system
      Parameters:
      context - The relevant DSpace context
      Returns:
      The list of all relationships currently in the system
      Throws:
      SQLException - If something goes wrong
    • findAll

      List<Relationship> findAll(Context context, Integer limit, Integer offset) throws SQLException
      Retrieves the full list of relationships currently in the system
      Parameters:
      context - The relevant DSpace context
      limit - paging limit
      offset - paging offset
      Returns:
      The list of all relationships currently in the system
      Throws:
      SQLException - If something goes wrong
    • create

      Relationship create(Context context, Relationship relationship) throws SQLException, AuthorizeException
      This method creates a relationship object in the database equal to the given relationship param if this is a valid relationship
      Parameters:
      context - The relevant DSpace context
      relationship - The relationship that will be created in the database if it is valid
      Returns:
      The created relationship with updated place variables
      Throws:
      SQLException - If something goes wrong
      AuthorizeException - If something goes wrong with authorizations
    • move

      Relationship move(Context context, Relationship relationship, Integer newLeftPlace, Integer newRightPlace) throws SQLException, AuthorizeException
      Move the given relationship to a new leftPlace and/or rightPlace. This will 1. verify whether the move is authorized 2. move the relationship to the specified left/right place 3. update the left/right place of other relationships and/or metadata in order to resolve the move without leaving any gaps At least one of the new places should be non-null, otherwise no changes will be made.
      Parameters:
      context - The relevant DSpace context
      relationship - The Relationship to move
      newLeftPlace - The value to set the leftPlace of this Relationship to
      newRightPlace - The value to set the rightPlace of this Relationship to
      Returns:
      The moved relationship with updated place variables
      Throws:
      SQLException - If something goes wrong
      AuthorizeException - If the user is not authorized to update the Relationship or its Items
    • move

      Relationship move(Context context, Relationship relationship, Item newLeftItem, Item newRightItem) throws SQLException, AuthorizeException
      Move the given relationship to a new leftItem and/or rightItem. This will 1. move the relationship to the last place in its current left or right Item. This ensures that we don't leave any gaps when moving the relationship to a new Item. If only one of the relationship's Items is changed,the order of relationships and metadatain the other will not be affected 2. insert the relationship into the new Item(s) At least one of the new Items should be non-null, otherwise no changes will be made.
      Parameters:
      context - The relevant DSpace context
      relationship - The Relationship to move
      newLeftItem - The value to set the leftItem of this Relationship to
      newRightItem - The value to set the rightItem of this Relationship to
      Returns:
      The moved relationship with updated left/right Items variables
      Throws:
      SQLException - If something goes wrong
      AuthorizeException - If the user is not authorized to update the Relationship or its Items
    • findByItemAndRelationshipType

      List<Relationship> findByItemAndRelationshipType(Context context, Item item, RelationshipType relationshipType) throws SQLException
      This method returns a list of Relationships for which the leftItem or rightItem is equal to the given Item object and for which the RelationshipType object is equal to the relationshipType property NOTE: tilted relationships are NEVER excluded when fetching one relationship type
      Parameters:
      context - The relevant DSpace context
      item - The Item object to be matched on the leftItem or rightItem for the relationship
      relationshipType - The RelationshipType object that will be used to check the Relationship on
      Returns:
      The list of Relationship objects that have the given Item object as leftItem or rightItem and for which the relationshipType property is equal to the given RelationshipType
      Throws:
      SQLException - If something goes wrong
    • findByItemAndRelationshipType

      List<Relationship> findByItemAndRelationshipType(Context context, Item item, RelationshipType relationshipType, int limit, int offset) throws SQLException
      This method returns a list of Relationships for which the leftItem or rightItem is equal to the given Item object and for which the RelationshipType object is equal to the relationshipType property NOTE: tilted relationships are NEVER excluded when fetching one relationship type
      Parameters:
      context - The relevant DSpace context
      item - The Item object to be matched on the leftItem or rightItem for the relationship
      relationshipType - The RelationshipType object that will be used to check the Relationship on
      Returns:
      The list of Relationship objects that have the given Item object as leftItem or rightItem and for which the relationshipType property is equal to the given RelationshipType
      Throws:
      SQLException - If something goes wrong
    • findByItemAndRelationshipType

      List<Relationship> findByItemAndRelationshipType(Context context, Item item, RelationshipType relationshipType, int limit, int offset, boolean excludeNonLatest) throws SQLException
      This method returns a list of Relationships for which the leftItem or rightItem is equal to the given Item object and for which the RelationshipType object is equal to the relationshipType property NOTE: tilted relationships are NEVER excluded when fetching one relationship type
      Parameters:
      context - The relevant DSpace context
      item - The Item object to be matched on the leftItem or rightItem for the relationship
      relationshipType - The RelationshipType object that will be used to check the Relationship on
      excludeNonLatest - If true, excludes all relationships for which the other item has a more recent version that is relevant for this relationship
      Returns:
      The list of Relationship objects that have the given Item object as leftItem or rightItem and for which the relationshipType property is equal to the given RelationshipType
      Throws:
      SQLException - If something goes wrong
    • findByItemAndRelationshipType

      List<Relationship> findByItemAndRelationshipType(Context context, Item item, RelationshipType relationshipType, boolean isLeft, int limit, int offset) throws SQLException
      This method returns a list of Relationships for which the leftItem or rightItem is equal to the given Item object and for which the RelationshipType object is equal to the relationshipType property NOTE: tilted relationships are NEVER excluded when fetching one relationship type
      Parameters:
      context - The relevant DSpace context
      item - The Item object to be matched on the leftItem or rightItem for the relationship
      relationshipType - The RelationshipType object that will be used to check the Relationship on
      isLeft - Is the item left or right
      Returns:
      The list of Relationship objects that have the given Item object as leftItem or rightItem and for which the relationshipType property is equal to the given RelationshipType
      Throws:
      SQLException - If something goes wrong
    • findByItemAndRelationshipType

      List<Relationship> findByItemAndRelationshipType(Context context, Item item, RelationshipType relationshipType, boolean isLeft, int limit, int offset, boolean excludeNonLatest) throws SQLException
      This method returns a list of Relationships for which the leftItem or rightItem is equal to the given Item object and for which the RelationshipType object is equal to the relationshipType property NOTE: tilted relationships are NEVER excluded when fetching one relationship type
      Parameters:
      context - The relevant DSpace context
      item - The Item object to be matched on the leftItem or rightItem for the relationship
      relationshipType - The RelationshipType object that will be used to check the Relationship on
      isLeft - Is the item left or right
      excludeNonLatest - If true, excludes all relationships for which the other item has a more recent version that is relevant for this relationship
      Returns:
      The list of Relationship objects that have the given Item object as leftItem or rightItem and for which the relationshipType property is equal to the given RelationshipType
      Throws:
      SQLException - If something goes wrong
    • findByLatestItemAndRelationshipType

      List<ItemUuidAndRelationshipId> findByLatestItemAndRelationshipType(Context context, Item latestItem, RelationshipType relationshipType, boolean isLeft) throws SQLException
      This method returns the UUIDs of all items that have a relationship with the given item, from the perspective of the other item. In other words, given a relationship with the given item, the given item should have "latest status" in order for the other item uuid to be returned. This method differs from the "excludeNonLatest" property in other methods, because in this method the current item should have "latest status" to return the other item, whereas with "excludeNonLatest" the other item should have "latest status" to be returned. This method is used to index items in solr; when searching for related items of one of the returned uuids, the given item should appear as a search result. NOTE: This method does not return Relationships for performance, because doing so would eagerly fetch the items on both sides, which is unnecessary. NOTE: tilted relationships are NEVER excluded when fetching one relationship type.
      Parameters:
      context - the DSpace context.
      latestItem - the target item; only relationships where this item has "latest status" should be considered.
      relationshipType - the relationship type for which relationships should be selected.
      isLeft - whether the entity type of the item occurs on the left or right side of the relationship type. This is redundant in most cases, but necessary because relationship types my have the same entity type on both sides.
      Returns:
      a list containing pairs of relationship ids and item uuids.
      Throws:
      SQLException - if something goes wrong.
    • updateItem

      void updateItem(Context context, Item relatedItem) throws SQLException, AuthorizeException
      This method will update the given item's metadata order. If the relationships for the item have been modified and will calculate the place based on a metadata field, this function will ensure the place is calculated.
      Parameters:
      context - The relevant DSpace context
      relatedItem - The Item for which the list of Relationship location is calculated based on a metadata field
      Throws:
      SQLException - If something goes wrong
      AuthorizeException - If the user is not authorized to update the item
    • findByRelationshipType

      List<Relationship> findByRelationshipType(Context context, RelationshipType relationshipType) throws SQLException
      This method returns a list of Relationship objects for which the relationshipType property is equal to the given RelationshipType object NOTE: tilted relationships are NEVER excluded when fetching one relationship type
      Parameters:
      context - The relevant DSpace context
      relationshipType - The RelationshipType object that will be used to check the Relationship on
      Returns:
      The list of Relationship objects for which the given RelationshipType object is equal to 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 which the relationshipType property is equal to the given RelationshipType object NOTE: tilted relationships are NEVER excluded when fetching one relationship type
      Parameters:
      context - The relevant DSpace context
      relationshipType - The RelationshipType object that will be used to check the Relationship on
      limit - paging limit
      offset - paging offset
      Returns:
      The list of Relationship objects for which the given RelationshipType object is equal to the relationshipType property
      Throws:
      SQLException - If something goes wrong
    • create

      Relationship create(Context c, Item leftItem, Item rightItem, RelationshipType relationshipType, int leftPlace, int rightPlace, String leftwardValue, String rightwardValue, Relationship.LatestVersionStatus latestVersionStatus) throws AuthorizeException, SQLException
      This method is used to construct a Relationship object with all it's variables
      Parameters:
      c - The relevant DSpace context
      leftItem - The leftItem Item object for the relationship
      rightItem - The rightItem Item object for the relationship
      relationshipType - The RelationshipType object for the relationship
      leftPlace - The leftPlace integer for the relationship
      rightPlace - The rightPlace integer for the relationship
      leftwardValue - The leftwardValue string for the relationship
      rightwardValue - The rightwardValue string for the relationship
      latestVersionStatus - The latestVersionStatus value for the relationship
      Returns:
      The created Relationship object with the given properties
      Throws:
      AuthorizeException - If something goes wrong
      SQLException - If something goes wrong
    • create

      Relationship create(Context c, Item leftItem, Item rightItem, RelationshipType relationshipType, int leftPlace, int rightPlace, String leftwardValue, String rightwardValue) throws AuthorizeException, SQLException
      This method is used to construct a Relationship object with all it's variables, except the latest version status
      Parameters:
      c - The relevant DSpace context
      leftItem - The leftItem Item object for the relationship
      rightItem - The rightItem Item object for the relationship
      relationshipType - The RelationshipType object for the relationship
      leftPlace - The leftPlace integer for the relationship
      rightPlace - The rightPlace integer for the relationship
      leftwardValue - The leftwardValue string for the relationship
      rightwardValue - The rightwardValue string for the relationship
      Returns:
      The created Relationship object with the given properties
      Throws:
      AuthorizeException - If something goes wrong
      SQLException - If something goes wrong
    • create

      Relationship create(Context c, Item leftItem, Item rightItem, RelationshipType relationshipType, int leftPlace, int rightPlace) throws AuthorizeException, SQLException
      This method is used to construct a Relationship object with all it's variables, except the leftward label, rightward label and latest version status
      Parameters:
      c - The relevant DSpace context
      leftItem - The leftItem Item object for the relationship
      rightItem - The rightItem Item object for the relationship
      relationshipType - The RelationshipType object for the relationship
      leftPlace - The leftPlace integer for the relationship
      rightPlace - The rightPlace integer for the relationship
      Returns:
      The created Relationship object with the given properties
      Throws:
      AuthorizeException - If something goes wrong
      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
    • countTotal

      int countTotal(Context context) throws SQLException
      counts all relationships
      Parameters:
      context - DSpace context object
      Returns:
      total relationships
      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 NOTE: tilted relationships are NEVER excluded when fetching one 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
    • countByItem

      int countByItem(Context context, Item item, boolean excludeTilted, boolean excludeNonLatest) 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
      excludeTilted - if true, excludes tilted relationships
      excludeNonLatest - if true, exclude relationships for which the opposite item is not the latest version that is relevant
      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 a relationship type and a boolean indicating whether the relationship should contain the item on the left side or not NOTE: tilted relationships are NEVER excluded when fetching one relationship type
      Parameters:
      context - context
      relationshipType - relationship type to filter by
      isLeft - Indicating whether the counted Relationships should have the given Item on the left side or not
      Returns:
      total count with the given parameters
      Throws:
      SQLException - if database error
    • countByItemAndRelationshipType

      int countByItemAndRelationshipType(Context context, Item item, RelationshipType relationshipType, boolean isLeft, boolean excludeNonLatest) throws SQLException
      Count total number of relationships (rows in relationship table) by a relationship type and a boolean indicating whether the relationship should contain the item on the left side or not NOTE: tilted relationships are NEVER excluded when fetching one relationship type
      Parameters:
      context - context
      relationshipType - relationship type to filter by
      isLeft - Indicating whether the counted Relationships should have the given Item on the left side
      excludeNonLatest - If true, excludes all relationships for which the other item has a more recent version that is relevant for this relationship
      Returns:
      total count with the given parameters
      Throws:
      SQLException - if database error
    • countByTypeName

      int countByTypeName(Context context, String typeName) throws SQLException
      Count total number of relationships (rows in relationship table) by a relationship leftward or rightward typeName
      Parameters:
      context - context
      typeName - typeName of relationship
      Returns:
      total count
      Throws:
      SQLException - if database error
    • delete

      void delete(Context context, Relationship relationship, boolean copyToLeftItem, boolean copyToRightItem) throws SQLException, AuthorizeException
      This method is used to delete a Relationship whilst given the possibility to copy the Virtual Metadata created by this relationship to the left and/or right item
      Parameters:
      context - The relevant DSpace context
      relationship - The relationship to be deleted
      copyToLeftItem - A boolean indicating whether we should copy metadata to the left item or not
      copyToRightItem - A boolean indicating whether we should copy metadata to the right item or not
      Throws:
      SQLException
      AuthorizeException
    • forceDelete

      void forceDelete(Context context, Relationship relationship, boolean copyToLeftItem, boolean copyToRightItem) throws SQLException, AuthorizeException
      This method is used to delete a Relationship whilst given the possibility to copy the Virtual Metadata created by this relationship to the left and/or right item. This method will bypass the cardinality checks on the RelationshipType for the given Relationship This should only be used during the deletion of items so that the min cardinality check can't disallow items to be deleted
      Parameters:
      context - The relevant DSpace context
      relationship - The relationship to be deleted
      copyToLeftItem - A boolean indicating whether we should copy metadata to the left item or not
      copyToRightItem - A boolean indicating whether we should copy metadata to the right item or not
      Throws:
      SQLException
      AuthorizeException
    • findByItemRelationshipTypeAndRelatedList

      List<Relationship> findByItemRelationshipTypeAndRelatedList(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
    • countByItemRelationshipTypeAndRelatedList

      int countByItemRelationshipTypeAndRelatedList(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