Interface EntityService

  • All Known Implementing Classes:
    EntityServiceImpl

    public interface EntityService
    This Service provides us with a few methods to return objects based on the Entity object. Since the Entity object isn't a database object, this method mostly outsources to getters for other services to return the wanted objects to then check for properties on either the list of relationships or the item included in the Entity.
    • Method Detail

      • findByItemId

        Entity findByItemId​(Context context,
                            UUID itemId)
                     throws SQLException
        This will construct an Entity object that will be returned with the Item that matches the ItemID that was passed along as well as a list of relationships for that Item.
        Parameters:
        context - The relevant DSpace context
        itemId - The ItemID for the Item that is to be used in the Entity object
        Returns:
        The constructed Entity object with the Item and the list of relationships
        Throws:
        SQLException - If something goes wrong
      • findByItemId

        Entity findByItemId​(Context context,
                            UUID itemId,
                            Integer limit,
                            Integer offset)
                     throws SQLException
        This will construct an Entity object that will be returned with the Item that matches the ItemID that was passed along as well as a list of relationships for that Item.
        Parameters:
        context - The relevant DSpace context
        itemId - The ItemID for the Item that is to be used in the Entity object
        limit - paging limit
        offset - paging offset
        Returns:
        The constructed Entity object with the Item and the list of relationships
        Throws:
        SQLException - If something goes wrong
      • getType

        EntityType getType​(Context context,
                           Entity entity)
                    throws SQLException
        Returns the EntityType for the Item that is attached to the Entity that is passed along to this method. The EntityType String logic is in the Metadata for that Item and will be searched on in the EntityTypeService to retrieve the actual EntityType object
        Parameters:
        context - The relevant DSpace context
        entity - The Entity object which contains the Item
        Returns:
        The EntityType that belongs to this Item
        Throws:
        SQLException - If something goes wrong
      • getLeftRelations

        List<Relationship> getLeftRelations​(Context context,
                                            Entity entity)
        Retrieves the list of relationships, which are attached to the Entity object that is passed along, where the left item object of each relationship is equal to the Item object of the Entity object that is passed along
        Parameters:
        context - The relevant DSpace context
        entity - The Entity object to be returned
        Returns:
        The list of relationships that have the Item in the Entity object as their left item
      • getRightRelations

        List<Relationship> getRightRelations​(Context context,
                                             Entity entity)
        Retrieves the list of relationships, which are attached to the Entity object that is passed along, where the right item object of each relationship is equal to the Item object of the Entity object that is passed along
        Parameters:
        context - The relevant DSpace context
        entity - The Entity object to be returned
        Returns:
        The list of relationships that have the Item in the Entity object as their right item
      • getRelationsByTypeName

        List<Relationship> getRelationsByTypeName​(Context context,
                                                  String typeName)
                                           throws SQLException
        Retrieves the list of relationships for which their relationshiptype has a left or right label that is equal to the passed along label String
        Parameters:
        context - The relevant DSpace context
        typeName - The label that needs to be in the relationshiptype of the relationship
        Returns:
        The list of relationships that have a relationshiptype with a left or right label that is equal to the label param
        Throws:
        SQLException - If something goes wrong
      • getRelationsByTypeName

        List<Relationship> getRelationsByTypeName​(Context context,
                                                  String typeName,
                                                  Integer limit,
                                                  Integer offset)
                                           throws SQLException
        Retrieves the list of relationships for which their relationshiptype has a left or right label that is equal to the passed along label String
        Parameters:
        context - The relevant DSpace context
        typeName - The label that needs to be in the relationshiptype of the relationship
        limit - paging limit
        offset - paging offset
        Returns:
        The list of relationships that have a relationshiptype with a left or right label that is equal to the label param
        Throws:
        SQLException - If something goes wrong
      • getAllRelationshipTypes

        List<RelationshipType> getAllRelationshipTypes​(Context context,
                                                       Entity entity)
                                                throws SQLException
        Retrieves the list of relationships that have a relationshiptype that contains the EntityType for the given Entity in either the leftEntityType or the rightEntityType variables
        Parameters:
        context - The relevant DSpace context
        entity - The Entity for which the EntityType should be checked for relationships
        Returns:
        The list of relationships that each contain a relationshiptype in which there is a right or left entity type that is equal to the entity type for the given entity
        Throws:
        SQLException - If something goes wrong
      • getAllRelationshipTypes

        List<RelationshipType> getAllRelationshipTypes​(Context context,
                                                       Entity entity,
                                                       Integer limit,
                                                       Integer offset)
                                                throws SQLException
        Retrieves the list of relationships that have a relationshiptype that contains the EntityType for the given Entity in either the leftEntityType or the rightEntityType variables
        Parameters:
        context - The relevant DSpace context
        entity - The Entity for which the EntityType should be checked for relationships
        limit - paging limit
        offset - paging offset
        Returns:
        The list of relationships that each contain a relationshiptype in which there is a right or left entity type that is equal to the entity type for the given entity
        Throws:
        SQLException - If something goes wrong
      • getLeftRelationshipTypes

        List<RelationshipType> getLeftRelationshipTypes​(Context context,
                                                        Entity entity)
                                                 throws SQLException
        Retrieves the list of relationships that have a relationshiptype that contains the EntityType for the given Entity in the leftEntityType
        Parameters:
        context - The relevant DSpace context
        entity - The Entity for which the EntityType should be checked for relationships
        Returns:
        The list of relationships that each contain a relationshiptype in which there is a left entity type that is equal to the entity type for the given entity
        Throws:
        SQLException - If something goes wrong
      • getLeftRelationshipTypes

        List<RelationshipType> getLeftRelationshipTypes​(Context context,
                                                        Entity entity,
                                                        boolean isLeft,
                                                        Integer limit,
                                                        Integer offset)
                                                 throws SQLException
        Retrieves the list of relationships that have a relationshiptype that contains the EntityType for the given Entity in the leftEntityType
        Parameters:
        context - The relevant DSpace context
        entity - The Entity for which the EntityType should be checked for relationships
        isLeft - Boolean value used to filter by left_type or right_type. If true left_type results only else right_type results.
        limit - paging limit
        offset - paging offset
        Returns:
        The list of relationships that each contain a relationshiptype in which there is a left entity type that is equal to the entity type for the given entity
        Throws:
        SQLException - If something goes wrong
      • getRightRelationshipTypes

        List<RelationshipType> getRightRelationshipTypes​(Context context,
                                                         Entity entity)
                                                  throws SQLException
        Retrieves the list of relationships that have a relationshiptype that contains the EntityType for the given Entity in the rightEntityType
        Parameters:
        context - The relevant DSpace context
        entity - The Entity for which the EntityType should be checked for relationships
        Returns:
        The list of relationships that each contain a relationshiptype in which there is a right entity type that is equal to the entity type for the given entity
        Throws:
        SQLException - If something goes wrong
      • getRightRelationshipTypes

        List<RelationshipType> getRightRelationshipTypes​(Context context,
                                                         Entity entity,
                                                         boolean isLeft,
                                                         Integer limit,
                                                         Integer offset)
                                                  throws SQLException
        Retrieves the list of relationships that have a relationshiptype that contains the EntityType for the given Entity in the rightEntityType
        Parameters:
        context - The relevant DSpace context
        entity - The Entity for which the EntityType should be checked for relationships
        isLeft - Boolean value used to filter by left_type or right_type. If true left_type results only else right_type results.
        limit - paging limit
        offset - paging offset
        Returns:
        The list of relationships that each contain a relationshiptype in which there is a right entity type that is equal to the entity type for the given entity
        Throws:
        SQLException - If something goes wrong
      • getRelationshipTypesByTypeName

        List<RelationshipType> getRelationshipTypesByTypeName​(Context context,
                                                              String typeName)
                                                       throws SQLException
        Retrieves a list of RelationshipType objects for which either their left or right label is equal to the label parameter that's being passed along
        Parameters:
        context - The relevant DSpace context
        typeName - The typeName for which the relationshiptype's labels must be checked
        Returns:
        The list of relationshiptypes that each contain a left or right label that is equal to the given label parameter
        Throws:
        SQLException - If something goes wrong
      • getRelationshipTypesByTypeName

        List<RelationshipType> getRelationshipTypesByTypeName​(Context context,
                                                              String type,
                                                              Integer limit,
                                                              Integer offset)
                                                       throws SQLException
        Retrieves a list of RelationshipType objects for which either their left or right label is equal to the label parameter that's being passed along
        Parameters:
        context - The relevant DSpace context
        type - The label for which the relationshiptype's labels must be checked
        limit - paging limit
        offset - paging offset
        Returns:
        The list of relationshiptypes that each contain a left or right label that is equal to the given label parameter
        Throws:
        SQLException - If something goes wrong