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"?>
      
      <process-definition
       xmlns="urn:jbpm.org:jpdl-3.2"
       name="simple3">
       <start-state name="StatoIniz">
       <transition name="" to="state1"></transition>
       </start-state>
      
       <state name="state1">
       <transition name="" to="state2"></transition>
       </state>
      
       <state name="state2">
       <transition name="" to="Task1"></transition>
       </state>
      
       <task-node name="Task1">
       <task name="Task1">
       <assignment class='com.sample.action.SimpleAssignmentHandler' />
       </task>
       <transition name="" to="end1"></transition>
       </task-node>
      
       <end-state name="end1"></end-state>
      
      </process-definition>


      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
      Francesco