org.ow2.bonita.facade
Interface RuntimeAPI


public interface RuntimeAPI

Main API responsible of workflow state change operations. Those operations concerns tasks, process instances and variables. Default states for tasks (aka manual activities), processes instances, activities and processes are:

Author:
Marc Blachon, Guillaume Porcher, Charles Souillard, Miguel Valdes, Pierre Vigneras
See Also:
TxHook

Method Summary
 void clearHistory()
           
 void deleteAllInstances(org.ow2.bonita.facade.uuid.ProcessDefinitionUUID processUUID)
          This method is only dedicated for bonita unit tests!
 void deleteInstance(org.ow2.bonita.facade.uuid.ProcessInstanceUUID instanceUUID)
          This method is only dedicated for bonita unit tests!
 void finishTask(org.ow2.bonita.facade.uuid.TaskUUID taskUUID)
          Finish the task.
 org.ow2.bonita.facade.uuid.ProcessInstanceUUID instantiateProcess(org.ow2.bonita.facade.uuid.ProcessDefinitionUUID processUUID)
          Create an instance of the specified process and start the execution.
 org.ow2.bonita.facade.uuid.ProcessInstanceUUID instantiateProcess(org.ow2.bonita.facade.uuid.ProcessDefinitionUUID processUUID, java.util.Map<java.lang.String,java.lang.Object> variables)
          create an instance of the specified process with the added variable map and start the execution.
 void resumeTask(org.ow2.bonita.facade.uuid.TaskUUID taskUUID)
          Resume the task if the task has SUSPENDED state.
 void setActivityVariable(org.ow2.bonita.facade.uuid.ActivityInstanceUUID activityUUID, java.lang.String variableId, java.lang.Object variableValue)
           
 void setActivityVariable(org.ow2.bonita.facade.uuid.ProcessInstanceUUID instanceUUID, java.lang.String activityId, java.lang.String variableId, java.lang.Object variableValue)
          Search for variable with id variableId into instance with UUID instanceUUID and within the activity with id activityId and set the given value to the found variable.
 void setInstanceVariable(org.ow2.bonita.facade.uuid.ProcessInstanceUUID instanceUUID, java.lang.String variableId, java.lang.Object variableValue)
          Search for variable with id variableId into instance with UUID instanceUUID and set the given value to the found variable.
 void startTask(org.ow2.bonita.facade.uuid.TaskUUID taskUUID)
          start the task.
 void suspendTask(org.ow2.bonita.facade.uuid.TaskUUID taskUUID)
          Suspend the task if the task has EXECUTING state.
 

Method Detail

instantiateProcess

org.ow2.bonita.facade.uuid.ProcessInstanceUUID instantiateProcess(org.ow2.bonita.facade.uuid.ProcessDefinitionUUID processUUID)
                                                                  throws ProcessNotFoundException
Create an instance of the specified process and start the execution. returned instance has STARTED state. If the first activity has StartMode=manual then a task has been created. If the first activity has StartMode=automatic then the automatic behavior of the activity has been started.

Parameters:
processUUID - the process UUID.
Returns:
the UUID of the created instance.
Throws:
ProcessNotFoundException - if the process has not been found.
BonitaInternalException - if an exception occurs.

instantiateProcess

org.ow2.bonita.facade.uuid.ProcessInstanceUUID instantiateProcess(org.ow2.bonita.facade.uuid.ProcessDefinitionUUID processUUID,
                                                                  java.util.Map<java.lang.String,java.lang.Object> variables)
                                                                  throws ProcessNotFoundException
create an instance of the specified process with the added variable map and start the execution. returned instance has STARTED state. If the first activity has StartMode=manual then a task has been created. If the first activity has StartMode=automatic then the automatic behavior of the activity has been started.

Parameters:
processUUID - the process UUID.
variables - variables added to the variables already set within the process definition.
Returns:
the UUID of the created instance.
Throws:
ProcessNotFoundException - if the process has not been found.
BonitaInternalException - if an exception occurs.

startTask

void startTask(org.ow2.bonita.facade.uuid.TaskUUID taskUUID)
               throws TaskNotFoundException,
                      IllegalTaskStateException
start the task. If successful, this operation changes task state from READY to EXECUTING.

Parameters:
taskUUID - the task UUID.
Throws:
TaskNotFoundException - if the task has not been found.
IllegalTaskStateException - if the state of the task has not READY state.
BonitaInternalException - if an exception occurs.

finishTask

void finishTask(org.ow2.bonita.facade.uuid.TaskUUID taskUUID)
                throws TaskNotFoundException,
                       IllegalTaskStateException
Finish the task. If successful, this operation changes task state from EXECUTING to FINISHED.

Parameters:
taskUUID - the task UUID.
Throws:
TaskNotFoundException - if the task has not been found.
IllegalTaskStateException - if the state of the task has not EXECUTING state.
BonitaInternalException - if an exception occurs.

suspendTask

void suspendTask(org.ow2.bonita.facade.uuid.TaskUUID taskUUID)
                 throws TaskNotFoundException,
                        IllegalTaskStateException,
                        UnAuthorizedUserException
Suspend the task if the task has EXECUTING state.
If successful, this operation changes task state from EXECUTING to SUSPENDED.

Parameters:
taskUUID - the task UUID.
Throws:
TaskNotFoundException - if the task has not been found.
IllegalTaskStateException - if the state of the task has not either READY or EXECUTING state.
UnAuthorizedUserException - if the user is not the user assigned to the task.
UnAuthorizedUserException - if task has not been assigned and the user is not in the list of candidates for the task.
BonitaInternalException - if an exception occurs.

resumeTask

void resumeTask(org.ow2.bonita.facade.uuid.TaskUUID taskUUID)
                throws TaskNotFoundException,
                       IllegalTaskStateException,
                       UnAuthorizedUserException
Resume the task if the task has SUSPENDED state. If successful, this operation changes task state from SUSPENDED to EXECUTING.

Parameters:
taskUUID - the task UUID.
Throws:
TaskNotFoundException - if the task has not been found.
IllegalTaskStateException - if the state of the task has not SUSPENDED state.
UnAuthorizedUserException - if the user is not the user assigned to the task.
UnAuthorizedUserException - if task has not been assigned and the user is not in the list of candidates for the task.
BonitaInternalException - if an exception occurs.

setInstanceVariable

void setInstanceVariable(org.ow2.bonita.facade.uuid.ProcessInstanceUUID instanceUUID,
                         java.lang.String variableId,
                         java.lang.Object variableValue)
                         throws InstanceNotFoundException
Search for variable with id variableId into instance with UUID instanceUUID and set the given value to the found variable.
The field selectedValue can contain only one value from the possibleValues list field.

Parameters:
instanceUUID - the instance UUID.
variableId - the variable id.
variableValue - the variable value.
Throws:
InstanceNotFoundException - if the instance has not been found.
BonitaInternalException - if an exception occurs.

setActivityVariable

void setActivityVariable(org.ow2.bonita.facade.uuid.ProcessInstanceUUID instanceUUID,
                         java.lang.String activityId,
                         java.lang.String variableId,
                         java.lang.Object variableValue)
                         throws InstanceNotFoundException,
                                ActivityNotFoundException
Search for variable with id variableId into instance with UUID instanceUUID and within the activity with id activityId and set the given value to the found variable.
The field selectedValue can contain only one value from the possibleValues list field.

Parameters:
instanceUUID - the instance UUID.
activityId - the activity id.
variableId - the variable id.
variableValue - the variable value.
Throws:
InstanceNotFoundException - if the instance has not been found.
ActivityNotFoundException - if the activity has not been found.
BonitaInternalException - if an exception occurs.

setActivityVariable

void setActivityVariable(org.ow2.bonita.facade.uuid.ActivityInstanceUUID activityUUID,
                         java.lang.String variableId,
                         java.lang.Object variableValue)
                         throws ActivityNotFoundException
Throws:
ActivityNotFoundException

deleteInstance

void deleteInstance(org.ow2.bonita.facade.uuid.ProcessInstanceUUID instanceUUID)
                    throws InstanceNotFoundException
This method is only dedicated for bonita unit tests!
Delete existing tasks from the instance with UUID instanceUUID from the task repository. Then delete the instance with UUID instanceUUID from the instance repository. Recorded data are currently not removed from the journal or/and the history.

Parameters:
instanceUUID - the instance UUID.
Throws:
BonitaInternalException - if an exception occurs.
InstanceNotFoundException

deleteAllInstances

void deleteAllInstances(org.ow2.bonita.facade.uuid.ProcessDefinitionUUID processUUID)
This method is only dedicated for bonita unit tests!
Delete all instances created for the process with UUID processUUID from the instance repository. Recorded data are currently not removed from the journal or/and the history.

Parameters:
processUUID - the process UUID.
Throws:
BonitaInternalException - if an exception occurs.

clearHistory

void clearHistory()