activiti 流程变量
设置流程变量按照类型来说有两种方法,一种是在当前的流程实例上设置,一种在任务上设置
- 在流程实例上设置
/** Update or create a variable for an execution. If the variable is not already existing somewhere in the execution hierarchy,
* it will be created in the process instance (which is the root execution).
* @param executionId id of execution to set variable in, cannot be null.
* @param variableName name of variable to set, cannot be null.
* @param value value to set. When null is passed, the variable is not removed,
* only it's value will be set to null.
* @throws ActivitiObjectNotFoundException when no execution is found for the given executionId.
*/
void setVariable(String executionId, String variableName, Object value);
runtimeService.setVariable(executionId, variableName, value);
在当前流程实例设置后,在任何节点都能使用
- 列表内容
taskService.setVariable(taskId, variableName, value);
/** set variable on a task. If the variable is not already existing, it will be created in the
* most outer scope. This means the process instance in case this task is related to an
* execution. */
void setVariable(String taskId, String variableName, Object value);
在当前任务设置流程变量只有之后的节点才能用