1 Reply Latest reply on Mar 27, 2007 10:38 AM by kukeltje

    Task Instances - How to mark as complete?

    catlinit

      A simple process definition of a couple of tasks:

      "<process-definition name='threeStep'>" +
       " <start-state name='start'>" +
       " <transition to='s1' />" +
       " </start-state>" +
       " <task-node name='s1'>" +
       " <task name='t1'/>" +
       " <transition to='s2' />" +
       " </task-node>" +
       " <task-node name='s2'>" +
       " <task name='t2'/>" +
       " <transition to='s3' />" +
       " </task-node>" +
       " <end-state name='s3' />" +
       "</process-definition>"
      

      Create this as an instance and signal() to start. Then, using the following gives the outstanding task instance t1

      processInstance.getTaskMgmtInstance().getUnfinishedTasks(processInstance.getRootToken())
      

      Use signal() to continue and then pauses at the next task, the line above now show t1 & t2 as unfinished. How do you mark the first task as finished?

      I've tried by obtaining the task instance and using end() but this complains
      the task is already ended:

      Collection c = processInstance.getTaskMgmtInstance().getUnfinishedTasks(processInstance.getRootToken());
       for (Iterator i = c.iterator(); i.hasNext(); ) {
       TaskInstance ti = (TaskInstance) i.next();
       ti.setEnd(now);
       ti.end(); // Mark complete
       }
      



      What is the correct way to interact with a task instance to ensure the state is set correctly before transitioning?

        • 1. Re: Task Instances - How to mark as complete?
          kukeltje

          use the source, (and the examples/testcases) in the source you'll see that the .end checks if end is not null. surprisingly, setEnd sets end so.....oh and in the api you'll also see that there is an .end(transition) so...... look at the examples........

          btw, it's so simple to use the source, much simpler and takes lots less time than typing this message.