Interface StateAdminSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession

public interface StateAdminSession extends OsidSession

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

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

The delete operations delete States . To unmap a State from the current Process , the StateProcessAssignmentSession should be used. These delete operations attempt to remove the State itself thus removing it from all known Process catalogs.

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

  • Method Details

    • getProcessId

      Id getProcessId()
      Gets the Process Id associated with this session.
      Returns:
      the Process Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getProcess

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

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

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

      StateForm getStateFormForCreate(Type[] stateRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the state form for creating new states. A new form should be requested for each create transaction.
      Parameters:
      stateRecordTypes - array of state record types
      Returns:
      the state form
      Throws:
      NullArgumentException - stateRecordTypes 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.
    • createState

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

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

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

      void updateState(StateForm stateForm) throws OperationFailedException, PermissionDeniedException
      Updates an existing state.
      Parameters:
      stateForm - the form containing the elements to be updated
      Throws:
      IllegalStateException - stateForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - stateId or stateForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - stateForm did not originate from getStateFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteStates

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

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

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

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