Interface ResourceRelationshipAdminSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
All Known Subinterfaces:
ResourceRelationshipBatchAdminSession

public interface ResourceRelationshipAdminSession extends OsidSession

This session creates, updates, and deletes ResourceRelationships . The data for create and update is provided by the consumer via the form object. OsidForms are requested for each create or update and may not be reused.

Create and update operations differ in their usage. To create a ResourceRelationship , a ResourceRelationshipForm is requested using geResourceRelationshipFormForCreate() specifying the nodes and desired record Types or none if no record Types are needed. The returned ResourceRelationshipForm will indicate that it is to be used with a create operation and can be used to examine metdata or validate data prior to creation. Once the ResourceRelationshipForm is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each ResourceRelationshipForm corresponds to an attempted transaction.

For updates, ResourceRelationshipForms are requested to the ResourceRelationship Id that is to be updated using getResourceRelationshipFormForUpdate() . Similarly, the ResourceRelationshipForm has metadata about the data that can be updated and it can perform validation before submitting the update. The ResourceRelationshipForm can only be used once for a successful update and cannot be reused.

The delete operations delete ResourceRelationships . To unmap s ResourceRelationship from the current Bin , the ResourceRelationshipBinAssignmentSession should be used. These delete operations attempt to remove the ResourceRelationship itself thus removing it from all known Bin catalogs.

This session includes an Id aliasing mechanism to assign an external Id to an internally assigned Id.

  • Method Details

    • getBinId

      Id getBinId()
      Gets the Bin Id associated with this session.
      Returns:
      the Bin Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getBin

      Gets the Bin associated with this session.
      Returns:
      the bin
      Throws:
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canCreateResourceRelationships

      boolean canCreateResourceRelationships()
      Tests if this user can create ResourceRelationships . A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a ResourceRelationship will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.
      Returns:
      false if ResourceRelationship creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateResourceRelationshipWithRecordTypes

      boolean canCreateResourceRelationshipWithRecordTypes(Type[] resourceRelationshipRecordTypes)
      Tests if this user can create a single ResourceRelationship using the desired record types. While ResourceManager.getResourceRelationshipRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific ResourceRelationship . Providing an empty array tests if a ResourceRelationship can be created with no records.
      Parameters:
      resourceRelationshipRecordTypes - array of resource relationship types
      Returns:
      true if ResourceRelationship creation using the specified record Types is supported, false otherwise
      Throws:
      NullArgumentException - resourceRelationshipRecordTypes is null
      Compliance:
      mandatory - This method must be implemented.
    • getResourceRelationshipFormForCreate

      ResourceRelationshipForm getResourceRelationshipFormForCreate(Id sourceResourceId, Id destinationResourceId, Type[] resourceRelationshipRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Gets the relationship form for creating new relationships. A new form should be requested for each create transaction.
      Parameters:
      sourceResourceId - the Id of the source Resource
      destinationResourceId - the Id of the destination Resource
      resourceRelationshipRecordTypes - array of resource relationship types
      Returns:
      the relationship form
      Throws:
      NotFoundException - sourceResourceId or destinationResourceId is not found
      NullArgumentException - resourceId or peerResourceId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - unable to get form with requested record types
      Compliance:
      mandatory - This method must be implemented.
    • createResourceRelationship

      ResourceRelationship createResourceRelationship(ResourceRelationshipForm resourceRelationshipForm) throws OperationFailedException, PermissionDeniedException
      Creates a new ResourceRelationship .
      Parameters:
      resourceRelationshipForm - the form for this ResourceRelationship
      Returns:
      the new ResourceRelationship
      Throws:
      IllegalStateException - resourceRelationshipForm already used in a create transaction
      InvalidArgumentException - one or more of the form elements is invalid
      NullArgumentException - resourceId, peerResourceId or resourceRelationshipForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - resourceRelationshipForm did not originate from getResourceRelationshipFormForCreate()
      Compliance:
      mandatory - This method must be implemented.
    • canUpdateResourceRelationships

      boolean canUpdateResourceRelationships()
      Tests if this user can update ResourceRelationships . A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a ResourceRelationship will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.
      Returns:
      false if relationship modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getResourceRelationshipFormForUpdate

      ResourceRelationshipForm getResourceRelationshipFormForUpdate(Id resourceRelationshipId) throws NotFoundException, OperationFailedException
      Gets the relationship form for updating an existing relationship. A new relationship form should be requested for each update transaction.
      Parameters:
      resourceRelationshipId - the Id of the ResourceRelationship
      Returns:
      the relationship form
      Throws:
      NotFoundException - resourceRelationshipId not found
      NullArgumentException - resourceRelationshipId or aliasId is null
      OperationFailedException - unable to complete request
      Compliance:
      mandatory - This method must be implemented.
    • updateResourceRelationship

      void updateResourceRelationship(ResourceRelationshipForm resourceRelationshipForm) throws OperationFailedException, PermissionDeniedException
      Updates an existing relationship.
      Parameters:
      resourceRelationshipForm - the form containing the elements to be updated
      Throws:
      IllegalStateException - resourceRelationshipForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - resourceRelationshipForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - resourceRelationshipForm did not originate from getResourceRelationshipFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteResourceRelationships

      boolean canDeleteResourceRelationships()
      Tests if this user can delete ResourceRelationships . A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting a ResourceRelationship will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.
      Returns:
      false if ResourceRelationship deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • deleteResourceRelationship

      void deleteResourceRelationship(Id resourceRelationshipId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Deletes the ResourceRelationship identified by the given Id .
      Parameters:
      resourceRelationshipId - the Id of the ResourceRelationship to delete
      Throws:
      NotFoundException - a ResourceRelationship was not found identified by the given Id
      NullArgumentException - resourceRelationshipId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageResourceRelationshipAliases

      boolean canManageResourceRelationshipAliases()
      Tests if this user can manage Id aliases for ResourceRelationships . A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.
      Returns:
      false if ResourceRelationship aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasResourceRelationship

      void aliasResourceRelationship(Id resourceRelationshipId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
      Adds an Id to a ResourceRelationship for the purpose of creating compatibility. The primary Id of the ResourceRelationship is determined by the provider. The new Id performs as an alias to the primary Id . If the alias is a pointer to another resource relationshp, it is reassigned to the given resource relationship Id .
      Parameters:
      resourceRelationshipId - the Id of a ResourceRelationship
      aliasId - the alias Id
      Throws:
      AlreadyExistsException - aliasId is already assigned
      NotFoundException - resourceRelationshipId not found
      NullArgumentException - resourceRelationshipId or aliasId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.