0 Replies Latest reply on Jun 16, 2006 2:46 PM by Michael H.

    Canceling a TaskInstance operates like ending this instance

    Michael H. Newbie

      I'd like to cancel the operation on a taskInstance and expect the following (intuitive?) behavior:

      task variable values should not be submitted to the process variables
      the taskInstance should not be marked as finished
      no transistion should be taken (because at least one taskInstance was not finished and we have still unfinished tasks)

      Unfortunately, jBPM behaves completely different :-(
      Maybe, because I have a completely different intuition?

      Here a little code snippet:

      Collection tasks = taskMgmtInstance.getUnfinishedTasks(processInstance.getRootToken());
      TaskInstance task;
      for(Iterator iter=tasks.iterator(); iter.hasNext();)
      {
       task = (TaskInstance) iter.next();
       task.setVariable("newFeature", true);
       task.cancel();
      }
      


      My task node is defined as follows:
      <task-node name="Do evaluate initial request">
       <task name="Change request?" swimlane="project manager" blocking="true">
       <controller>
       <variable name="newFeature" access="read,write,required"></variable>
       </controller>
       </task>
       <transition name="" to="New feature?"></transition>
      </task-node>
      


      In my example, the taskInstance's variable is submitted to the process, and the taskInstance is marked as completed.

      Any opinions would be appreciated.
      Michael