-
Bug
-
Resolution: Done
-
Major
-
jBPM 3.1.0
-
None
If you cancel a task instance by calling taskInstance.cancel(), it calls taskInstance.end() which leads to execution of the task controller in the same way as if the task has been completed normally.
An example: Imagine an order management system. A user "accidently" enteres an order which leads to the creation of a process instance and a task instance. He realises his mistake and cancels the process instance. If you now cancel the task instance (which is not done automatically, see references below), the task is ended, its token is signalled and the process execution continues (in my case with the creation of several objects) even it has been cancelled before.
My code for cancelling a process instance and is associated task instances looks like this:
JbpmContext context = JbpmConfiguration.getInstance().createJbpmContext();
try
{
ProcessInstance instance = context.loadProcessInstanceForUpdate(processInstanceId);
if (instance != null)
{
instance.end();
for (Iterator it = instance.getTaskMgmtInstance().getTaskInstances().iterator(); it.hasNext()
{
TaskInstance taskInstance = (TaskInstance) it.next();
if (!taskInstance.hasEnded())
}
}
}
finally
This issue might be related to:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=69609
http://jira.jboss.com/jira/browse/JBPM-392