Class RelationshipRestRepository

    • Constructor Detail

      • RelationshipRestRepository

        public RelationshipRestRepository()
    • Method Detail

      • findAll

        public org.springframework.data.domain.Page<RelationshipRest> findAll​(Context context,
                                                                              org.springframework.data.domain.Pageable pageable)
        Description copied from class: DSpaceRestRepository
        Method to implement to support scroll of entity instances from the collection resource endpoint
        Specified by:
        findAll in class DSpaceRestRepository<RelationshipRest,​Integer>
        Parameters:
        context - the dspace context
        pageable - object embedding the requested pagination info
        Returns:
      • put

        public RelationshipRest put​(Context context,
                                    String contextPath,
                                    Integer id,
                                    List<String> stringList,
                                    Boolean itemToReplaceIsRight)
                             throws SQLException
        Method to replace either the right or left item of a relationship with a given new item Called by request mappings in RelationshipRestController - For replace right item (itemToReplaceIsRight = true) => Newly proposed changed relationship: left = old-left; right = new-item - For replace left item (itemToReplaceIsRight = false) => Newly proposed changed relationship: left = new-item; right = old-right
        Parameters:
        context -
        contextPath - What API call was made to get here
        id - ID of the relationship we wish to modify
        stringList - Item to replace either right or left item of relationship with
        itemToReplaceIsRight - Boolean to decide whether to replace right item (true) or left item (false)
        Returns:
        The (modified) relationship
        Throws:
        SQLException
      • findByLabel

        public org.springframework.data.domain.Page<RelationshipRest> findByLabel​(String label,
                                                                                  UUID dsoId,
                                                                                  org.springframework.data.domain.Pageable pageable)
                                                                           throws SQLException
        This method will find all the Relationship objects that a RelationshipType that corresponds to the given Label It's also possible to pass a DSO along to this method with a parameter which will only return Relationship objects that have this DSO as leftItem or rightItem. This endpoint is paginated
        Parameters:
        label - The label of a RelationshipType which the Relationships must have if they're to be returned
        dsoId - The dsoId of the object that has to be a leftItem or rightItem if this parameter is present
        pageable - The page object
        Returns:
        A page with all the RelationshipRest objects that correspond to the constraints
        Throws:
        SQLException - If something goes wrong
      • findByItemsAndType

        public org.springframework.data.domain.Page<RelationshipRest> findByItemsAndType​(Integer typeId,
                                                                                         String label,
                                                                                         UUID focusUUID,
                                                                                         Set<UUID> items,
                                                                                         org.springframework.data.domain.Pageable pageable)
                                                                                  throws SQLException
        This method is intended to be used when giving an item (focus) and a list of potentially related items we need to know which of these other items are already in a specific relationship with the focus item and, by exclusion which ones are not yet related.
        Parameters:
        typeId - The relationship type id to apply as a filter to the returned relationships
        label - The name of the relation as defined from the side of the 'focusItem'
        focusUUID - The uuid of the item to be checked on the side defined by 'relationshipLabel'
        items - The uuid of the items to be found on the other side of returned relationships
        pageable - The page information
        Returns:
        Throws:
        SQLException - If database error