* @param variables
*/
public void setProcessInstanceVariables(String processInstanceId, Map<String, Object> variables) {
ProcessInstance processInstance = ksession.getProcessInstance(new Long(processInstanceId));
if (processInstance != null) {
VariableScopeInstance variableScope = (VariableScopeInstance)
((org.jbpm.process.instance.ProcessInstance) processInstance)
.getContextInstance(VariableScope.VARIABLE_SCOPE);
if (variableScope == null) {
throw new IllegalArgumentException(
"Could not find variable scope for process instance " + processInstanceId);
}
for (Map.Entry<String, Object> entry: variables.entrySet()) {
variableScope.setVariable(entry.getKey(), entry.getValue());
}
} else {
throw new IllegalArgumentException("Could not find process instance " + processInstanceId);
}
}