1 Reply Latest reply on Jan 22, 2008 3:00 AM by Frank

    How you know when the process is waiting for a Task ?

    Frank Newbie

      Hello, I need a little help with Task List.
      I have a Servlet which I use as front-end for a JBPM process.

      Here's one simple:

      <?xml version="1.0" encoding="UTF-8"?>
       <start-state name="StatoIniz">
       <transition name="" to="state1"></transition>
       <state name="state1">
       <transition name="" to="state2"></transition>
       <state name="state2">
       <transition name="" to="Task1"></transition>
       <task-node name="Task1">
       <task name="Task1">
       <assignment class='com.sample.action.SimpleAssignmentHandler' />
       <transition name="" to="end1"></transition>
       <end-state name="end1"></end-state>

      I want that when the user reaches "Task1" process stops and the Servlet prints "User you have Task1 in charge".

      I'm using "getTaskList" for this purpose....

      List taskInstances = jbpmContext.getTaskList("user");
       TaskInstance taskInstance = (TaskInstance) taskInstances.get(0);
       taskInstanceId = taskInstance.getId();
       String taskName = taskInstance.getTask().getName();
       out.println("You have in your TaskList "+taskName);

      The problem is getTaskList() returns the taskInstance Task1 also when the user is in state1 or state2. Why ?

      I only want this when the process has stopped and waiting for Task completion.

      Should I use a different Api for this purpose ?
      Thanks a lot