Interface CompositionAdminSession

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

public interface CompositionAdminSession extends OsidSession

This session creates, updates, and deletes Compositions . 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 Composition , a CompositionForm is requested using getCompositionFormForCreate() specifying the desired record Types or none if no record Types are needed. The returned CompositionForm 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 CompositionForm is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each CompositionForm corresponds to an attempted transaction.

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

The delete operations delete Compositions . To unmap a Composition from the current Repository , the CompositionRepositoryAssignmentSession should be used. These delete operations attempt to remove the Bid itself thus removing it from all known Repository catalogs.

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

  • Method Details

    • getRepositoryId

      Id getRepositoryId()
      Gets the Repository Id associated with this session.
      Returns:
      the Repository Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getRepository

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

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

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

      CompositionForm getCompositionFormForCreate(Type[] compositionRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the composition form for creating new compositions. A new form should be requested for each create transaction.
      Parameters:
      compositionRecordTypes - array of composition record types
      Returns:
      the composition form
      Throws:
      NullArgumentException - compositionRecordTypes is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - unable to get form for requested record types
      Compliance:
      mandatory - This method must be implemented.
    • createComposition

      Creates a new Composition .
      Parameters:
      compositionForm - the form for this Composition
      Returns:
      the new Composition
      Throws:
      IllegalStateException - compositionForm already used in a create transaction
      InvalidArgumentException - one or more of the form elements is invalid
      NullArgumentException - compositionForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - compositionForm did not originate from getCompositionFormForCreate()
      Compliance:
      mandatory - This method must be implemented.
    • canUpdateCompositions

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

      CompositionForm getCompositionFormForUpdate(Id compositionId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Gets the composition form for updating an existing composition. A new composition form should be requested for each update transaction.
      Parameters:
      compositionId - the Id of the Composition
      Returns:
      the composition form
      Throws:
      NotFoundException - compositionId is not found
      NullArgumentException - compositionId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • updateComposition

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

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

      void deleteComposition(Id compositionId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Deletes a Composition .
      Parameters:
      compositionId - the Id of the Composition to remove
      Throws:
      NotFoundException - compositionId not found
      NullArgumentException - compositionId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • deleteCompositionNode

      void deleteCompositionNode(Id compositionId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Deletes a Composition and all contained children.
      Parameters:
      compositionId - the Id of the Composition to remove
      Throws:
      NotFoundException - compositionId not found
      NullArgumentException - compositionId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • addCompositionChild

      void addCompositionChild(Id compositionId, Id childCompositionId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
      Adds a composition to a parent composition.
      Parameters:
      compositionId - the Id of a parent Composition
      childCompositionId - the Id of a child Composition
      Throws:
      AlreadyExistsException - childCompositionId is already a child of compositionId
      NotFoundException - compositionId or childCompositionId is not found
      NullArgumentException - compositionId or childCompositionId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • removeCompositionChild

      void removeCompositionChild(Id compositionId, Id childCompositionId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Removes a composition from a parent composition.
      Parameters:
      compositionId - the Id of a parent Composition
      childCompositionId - the Id of a child Composition
      Throws:
      NotFoundException - compositionId or childCompositionId is not found or not related
      NullArgumentException - compositionId or childCompositionId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageCompositionAliases

      boolean canManageCompositionAliases()
      Tests if this user can manage Id aliases for Compositions . 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 Composition aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasComposition

      void aliasComposition(Id compositionId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
      Adds an Id to a Composition for the purpose of creating compatibility. The primary Id of the Composition is determined by the provider. The new Id is an alias to the primary Id . If the alias is a pointer to another composition, it is reassigned to the given composition Id .
      Parameters:
      compositionId - the Id of a Composition
      aliasId - the alias Id
      Throws:
      AlreadyExistsException - aliasId is in use as a primary Id
      NotFoundException - compositionId not found
      NullArgumentException - compositionId or aliasId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.