org.ow2.bonita.facade.impl
Class RuntimeAPIImpl

java.lang.Object
  extended by org.ow2.bonita.facade.impl.RuntimeReadOnlyAPIImpl
      extended by org.ow2.bonita.facade.impl.RuntimeAPIImpl
All Implemented Interfaces:
RuntimeAPI, RuntimeReadOnlyAPI

public class RuntimeAPIImpl
extends RuntimeReadOnlyAPIImpl
implements RuntimeAPI

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

Field Summary
 
Fields inherited from class org.ow2.bonita.facade.impl.RuntimeReadOnlyAPIImpl
LOG, queryAPI
 
Constructor Summary
RuntimeAPIImpl()
           
 
Method Summary
 void deleteAllInstances(java.lang.String processId)
          This method is only dedicated for bonita unit tests!
 void deleteInstance(java.lang.String instanceId)
          This method is only dedicated for bonita unit tests!
 void finishTask(java.lang.String taskId)
          Finish the task.
 java.lang.String instantiateProcess(java.lang.String processId)
          Create an instance of the specified process and return the instanceId
 java.lang.String instantiateProcess(java.lang.String processId, 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(java.lang.String taskId)
          Resume the task if the task has SUSPENDED state.
 void setVariable(java.lang.String instanceId, java.lang.String variableId, java.lang.Object variableValue)
          Search for variable with id variableId into instance with id instanceId and set the given value to the found variable.
 void setVariable(java.lang.String instanceId, java.lang.String activityId, java.lang.String variableId, java.lang.Object variableValue)
          Search for variable with id variableId into instance with id instanceId and within the activity with id activityId and set the given value to the found variable.
 void startTask(java.lang.String taskId)
          start the task.
 void suspendTask(java.lang.String taskId)
          Suspend the task if the task has EXECUTING state.
 
Methods inherited from class org.ow2.bonita.facade.impl.RuntimeReadOnlyAPIImpl
getInstance, getTask, getTaskList, getTaskList, getVariable, getVariable, getVariableDefinitions, getVariableDefinitions, getVariables, getVariables, getXpdlProcess
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ow2.bonita.facade.RuntimeReadOnlyAPI
getTaskList, getTaskList, getVariable, getVariable, getVariableDefinitions, getVariableDefinitions, getVariables, getVariables
 

Constructor Detail

RuntimeAPIImpl

public RuntimeAPIImpl()
Method Detail

instantiateProcess

public java.lang.String instantiateProcess(java.lang.String processId)
                                    throws ProcessNotFoundException
Create an instance of the specified process and return the instanceId

Specified by:
instantiateProcess in interface RuntimeAPI
Parameters:
processId - the process id.
Returns:
the id of the created instance.
Throws:
ProcessNotFoundException - if the process has not been found.

instantiateProcess

public java.lang.String instantiateProcess(java.lang.String processId,
                                           java.util.Map<java.lang.String,java.lang.Object> variables)
                                    throws ProcessNotFoundException
Description copied from interface: RuntimeAPI
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.

Specified by:
instantiateProcess in interface RuntimeAPI
Parameters:
processId - the process id.
variables - variables added to the variables already set within the process definition.
Returns:
the id of the created instance.
Throws:
ProcessNotFoundException - if the process has not been found.

deleteInstance

public void deleteInstance(java.lang.String instanceId)
Description copied from interface: RuntimeAPI
This method is only dedicated for bonita unit tests!
Delete existing tasks from the instance with id instanceId from the task repository. Then delete the instance with id instanceId from the instance repository. Recorded data are currently not removed from the history or/and the history.

Specified by:
deleteInstance in interface RuntimeAPI
Parameters:
instanceId - the instance id.

deleteAllInstances

public void deleteAllInstances(java.lang.String processId)
Description copied from interface: RuntimeAPI
This method is only dedicated for bonita unit tests!
Delete all instances created for the process with id processId from the instance repository. Recorded data are currently not removed from the history or/and the history.

Specified by:
deleteAllInstances in interface RuntimeAPI
Parameters:
processId - the process id.

startTask

public void startTask(java.lang.String taskId)
               throws TaskNotFoundException,
                      IllegalTaskStateException
Description copied from interface: RuntimeAPI
start the task. If successful, this operation changes task state from READY to EXECUTING.

Specified by:
startTask in interface RuntimeAPI
Parameters:
taskId - the task id.
Throws:
TaskNotFoundException - if the task has not been found.
IllegalTaskStateException - if the state of the task has not READY state.

finishTask

public void finishTask(java.lang.String taskId)
                throws TaskNotFoundException,
                       IllegalTaskStateException
Description copied from interface: RuntimeAPI
Finish the task. If successful, this operation changes task state from EXECUTING to FINISHED.

Specified by:
finishTask in interface RuntimeAPI
Parameters:
taskId - the task id.
Throws:
TaskNotFoundException - if the task has not been found.
IllegalTaskStateException - if the state of the task has not EXECUTING state.

suspendTask

public void suspendTask(java.lang.String taskId)
                 throws TaskNotFoundException,
                        IllegalTaskStateException,
                        UnAuthorizedUserException
Description copied from interface: RuntimeAPI
Suspend the task if the task has EXECUTING state.
If successful, this operation changes task state from EXECUTING to SUSPENDED.

Specified by:
suspendTask in interface RuntimeAPI
Parameters:
taskId - the task id.
Throws:
TaskNotFoundException - if the task has not been found.
IllegalTaskStateException - if the state of the task has not either READY or EXECUTING state.
UnAuthorizedUserException

resumeTask

public void resumeTask(java.lang.String taskId)
                throws TaskNotFoundException,
                       IllegalTaskStateException,
                       UnAuthorizedUserException
Description copied from interface: RuntimeAPI
Resume the task if the task has SUSPENDED state. If successful, this operation changes task state from SUSPENDED to EXECUTING.

Specified by:
resumeTask in interface RuntimeAPI
Parameters:
taskId - the task id.
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.

setVariable

public void setVariable(java.lang.String instanceId,
                        java.lang.String variableId,
                        java.lang.Object variableValue)
                 throws InstanceNotFoundException
Description copied from interface: RuntimeAPI
Search for variable with id variableId into instance with id instanceId and set the given value to the found variable.
The field selectedValue can contain only one value from the possibleValues list field.

Specified by:
setVariable in interface RuntimeAPI
Parameters:
instanceId - the instance id.
variableId - the variable id.
variableValue - the variable value.
Throws:
InstanceNotFoundException - if the instance has not been found.

setVariable

public void setVariable(java.lang.String instanceId,
                        java.lang.String activityId,
                        java.lang.String variableId,
                        java.lang.Object variableValue)
                 throws InstanceNotFoundException,
                        ActivityNotFoundException
Description copied from interface: RuntimeAPI
Search for variable with id variableId into instance with id instanceId 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.

Specified by:
setVariable in interface RuntimeAPI
Parameters:
instanceId - the instance id.
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.