Interface ProcedureAdminSession

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

public interface ProcedureAdminSession extends OsidSession

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

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

The delete operations delete Procedures . To unmap a Procedure from the current Cookbook , the ProcedureCookbookAssignmentSession should be used. These delete operations attempt to remove the Procedure itself thus removing it from all known Cookbook catalogs.

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

  • Method Details

    • getCookbookId

      Id getCookbookId()
      Gets the Cookbook Id associated with this session.
      Returns:
      the Cookbook Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getCookbook

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

      boolean canCreateProcedures()
      Tests if this user can create procedures. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a Procedure 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 Procedure creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateProcedureWithRecordTypes

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

      ProcedureForm getProcedureFormForCreate(Type[] procedureRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the procedure form for creating new procedures. A new form should be requested for each create transaction.
      Parameters:
      procedureRecordTypes - array of procedure record types
      Returns:
      the procedure form
      Throws:
      NullArgumentException - procedureRecordTypes 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.
    • createProcedure

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

      boolean canUpdateProcedures()
      Tests if this user can update procedures. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a Procedure 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 Procedure modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canUpdateProcedure

      boolean canUpdateProcedure(Id procedureId)
      Tests if this user can update a specified Procedure . A return of true does not guarantee successful authorization. A return of false indicates that it is known updating the Procedure 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.
      Parameters:
      procedureId - the Id of the Procedure
      Returns:
      false if procedure modification is not authorized, true otherwise
      Throws:
      NullArgumentException - procedureId is null
      Compliance:
      mandatory - This method must be implemented.
      Notes:
      If - the {@code procedureId} is not found, then it is acceptable to return false to indicate the lack of an update available.
    • getProcedureFormForUpdate

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

      void updateProcedure(ProcedureForm procedureForm) throws OperationFailedException, PermissionDeniedException
      Updates an existing procedure.
      Parameters:
      procedureForm - the form containing the elements to be updated
      Throws:
      IllegalStateException - procedureForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - procedureId or procedureForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - procedureForm did not originate from getProcedureFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteProcedures

      boolean canDeleteProcedures()
      Tests if this user can delete procedures. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting an Procedure 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 Procedure deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteProcedure

      boolean canDeleteProcedure(Id procedureId)
      Tests if this user can delete a specified Procedure . A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting the Procedure 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.
      Parameters:
      procedureId - the Id of the Procedure
      Returns:
      false if deletion of this Procedure is not authorized, true otherwise
      Throws:
      NullArgumentException - procedureId is null
      Compliance:
      mandatory - This method must be implemented.
      Notes:
      If - the {@code procedureId} is not found, then it is acceptable to return false to indicate the lack of a delete available.
    • deleteProcedure

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

      void deleteProcedures() throws OperationFailedException, PermissionDeniedException
      Deletes all Procedures in this Cookbook .
      Throws:
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageProcedureAliases

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

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