Interface WorkAdminSession

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

public interface WorkAdminSession extends OsidSession

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

Create and update operations differ in their usage. To create a Work , a WorkForm is requested using getWorkFormForCreate() specifying the desired record Types or none if no record Types are needed. The returned WorkForm 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 WorkForm is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each WorkForm corresponds to an attempted transaction.

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

The delete operations delete Works . To unmap a Work from the current Office , the WorkOfficeAssignmentSession should be used. These delete operations attempt to remove the Work itself thus removing it from all known Office catalogs.

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

  • Method Details

    • getOfficeId

      Id getOfficeId()
      Gets the Office Id associated with this session.
      Returns:
      the Office Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getOffice

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

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

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

      WorkForm getWorkFormForCreate(Type[] workRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the work form for creating new works. A new form should be requested for each create transaction.
      Parameters:
      workRecordTypes - array of work record types
      Returns:
      the work form
      Throws:
      NullArgumentException - workRecordTypes 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.
    • createWork

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

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

      Gets the work form for updating an existing work. A new work form should be requested for each update transaction.
      Parameters:
      workId - the Id of the Work
      Returns:
      the work form
      Throws:
      NotFoundException - workId is not found
      NullArgumentException - workId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • updateWork

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

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

      Deletes a Work .
      Parameters:
      workId - the Id of the Work to remove
      Throws:
      NotFoundException - workId not found
      NullArgumentException - workId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageWorkAliases

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

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

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

      Moves work to another process.
      Parameters:
      workId - the work Id
      processId - the new process Id
      Throws:
      AlreadyExistsException - work already part of process
      NotFoundException - processId or workId is not found
      NullArgumentException - processId or workId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageWorkStatus

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

      Marks work as complete.
      Parameters:
      workId - the work Id
      Throws:
      NotFoundException - workId is not found
      NullArgumentException - workId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • reopenWork

      Marks work as incomplete.
      Parameters:
      workId - the work Id
      Throws:
      NotFoundException - workId is not found
      NullArgumentException - workId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.