Interface StateAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, 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 Summary
Modifier and TypeMethodDescriptionvoidaliasState(Id stateId, Id aliasId) Adds anIdto aStatefor the purpose of creating compatibility.booleanTests if this user can createStates.booleancanCreateStateWithRecordTypes(Type[] stateRecordTypes) Tests if this user can create a singleStateusing the desired record types.booleanTests if this user can deleteStates.booleanTests if this user can manageIdaliases forStates.booleanTests if this user can updateStates.createState(StateForm stateForm) Creates a newState.voiddeleteState(Id stateId) Deletes aState.Gets theProcessassociated with this session.Gets theProcessIdassociated with this session.getStateFormForCreate(Type[] stateRecordTypes) Gets the state form for creating new states.getStateFormForUpdate(Id stateId) Gets the state form for updating an existing state.voidupdateState(StateForm stateForm) Updates an existing state.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionsModifier and TypeMethodDescriptionGets the agent authenticated to this session.Gets theIdof the agent authenticated to this session.Gets the rate of the service clock.getDate()Gets the service date which may be the current date or the effective date in which this session exists.Gets the effective agent in use by this session.Gets theIdof the effective agent in use by this session.Gets theDisplayTextformatTypepreference in effect for this session.Gets the locale indicating the localization preferences in effect for this session.booleanTests if an agent is authenticated to this session.Starts a new transaction for this sesson.booleanTests for the availability of transactions.
-
Method Details
-
getProcessId
Id getProcessId()Gets theProcessIdassociated with this session.- Returns:
- the
Process Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getProcess
Gets theProcessassociated with this session.- Returns:
- the
Processassociated with this session - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateStates
boolean canCreateStates()Tests if this user can createStates. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aStatewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifStatecreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateStateWithRecordTypes
Tests if this user can create a singleStateusing the desired record types. WhileProcessManager.getStateRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificState. Providing an empty array tests if aStatecan be created with no records.- Parameters:
stateRecordTypes- array of state record types- Returns:
trueifStatecreation using the specifiedTypesis supported,falseotherwise- Throws:
NullArgumentException-stateRecordTypesisnull- 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-stateRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createState
Creates a newState.- Parameters:
stateForm- the form for thisState- Returns:
- the new
State - Throws:
IllegalStateException-stateFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-stateFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-stateFormdid not originate fromgetStateFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateStates
boolean canUpdateStates()Tests if this user can updateStates. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aStatewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseifStatemodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getStateFormForUpdate
StateForm getStateFormForUpdate(Id stateId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the state form for updating an existing state. A new state form should be requested for each update transaction.- Parameters:
stateId- theIdof theState- Returns:
- the state form
- Throws:
NotFoundException-stateIdis not foundNullArgumentException-stateIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateState
Updates an existing state.- Parameters:
stateForm- the form containing the elements to be updated- Throws:
IllegalStateException-stateFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-stateIdorstateFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-stateFormdid not originate fromgetStateFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteStates
boolean canDeleteStates()Tests if this user can deleteStates. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aStatewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifStatedeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteState
void deleteState(Id stateId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aState.- Parameters:
stateId- theIdof theStateto remove- Throws:
NotFoundException-stateIdnot foundNullArgumentException-stateIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageStateAliases
boolean canManageStateAliases()Tests if this user can manageIdaliases forStates. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.- Returns:
falseifStatealiasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasState
void aliasState(Id stateId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aStatefor the purpose of creating compatibility. The primaryIdof theStateis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another state, it is reassigned to the given stateId.- Parameters:
stateId- theIdof aStatealiasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-stateIdnot foundNullArgumentException-aliasIdorstateIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-