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.
Modifier and Type | Method and Description |
---|---|
void |
aliasState(Id stateId,
Id aliasId)
Adds an
Id to a State for the purpose of
creating compatibility. |
boolean |
canCreateStates()
Tests if this user can create
States. |
boolean |
canCreateStateWithRecordTypes(Type[] stateRecordTypes)
Tests if this user can create a single
State using the
desired record types. |
boolean |
canDeleteStates()
Tests if this user can delete
States. |
boolean |
canManageStateAliases()
Tests if this user can manage
Id aliases for
States. |
boolean |
canUpdateStates()
Tests if this user can update
States. |
State |
createState(StateForm stateForm)
Creates a new
State. |
void |
deleteState(Id stateId)
Deletes a
State. |
Process |
getProcess()
Gets the
Process associated with this session. |
Id |
getProcessId()
Gets the
Process Id associated with this
session. |
StateForm |
getStateFormForCreate(Type[] stateRecordTypes)
Gets the state form for creating new states.
|
StateForm |
getStateFormForUpdate(Id stateId)
Gets the state form for updating an existing state.
|
void |
updateState(StateForm stateForm)
Updates an existing state.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getProcessId()
Process
Id
associated with this
session. Process Id
associated with this sessionmandatory
- This method must be implemented. Process getProcess() throws OperationFailedException, PermissionDeniedException
Process
associated with this session. Process
associated with this sessionOperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateStates()
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. false
if State
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateStateWithRecordTypes(Type[] stateRecordTypes)
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.stateRecordTypes
- array of state record types true
if State
creation using the
specified Types
is supported, false
otherwiseNullArgumentException
- stateRecordTypes
is null
mandatory
- This method must be implemented. StateForm getStateFormForCreate(Type[] stateRecordTypes) throws OperationFailedException, PermissionDeniedException
stateRecordTypes
- array of state record typesNullArgumentException
- stateRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. State createState(StateForm stateForm) throws OperationFailedException, PermissionDeniedException
State.
stateForm
- the form for this State
State
IllegalStateException
- stateForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- stateForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- stateForm
did not
originate from getStateFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateStates()
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. false
if State
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. StateForm getStateFormForUpdate(Id stateId) throws NotFoundException, OperationFailedException, PermissionDeniedException
stateId
- the Id
of the State
NotFoundException
- stateId
is not foundNullArgumentException
- stateId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateState(StateForm stateForm) throws OperationFailedException, PermissionDeniedException
stateForm
- the form containing the elements to be updatedIllegalStateException
- stateForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- stateId
or
stateForm
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- stateForm
did not
originate from getStateFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteStates()
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. false
if State
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteState(Id stateId) throws NotFoundException, OperationFailedException, PermissionDeniedException
State.
stateId
- the Id
of the State
to
removeNotFoundException
- stateId
not foundNullArgumentException
- stateId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageStateAliases()
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. false
if State
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasState(Id stateId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
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.
stateId
- the Id
of a State
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- stateId
not foundNullArgumentException
- aliasId
or
stateId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.