3 Replies Latest reply on Mar 17, 2009 2:37 PM by Brad Davis

    Not getting TaskEndLog when canceling the TaskInstance

    Vikas Khengare Newbie

      Hi Friends,
      I am not getting TaskEndLog when I am canceling the TaskInstance bye TaskInstance.cancel() method.

      Here is what I am doing,

      TaskMgmtInstance tmi = i_token.getProcessInstance().getTaskMgmtInstance();
      Collection<TaskInstance> unfinishedTasks = tmi.getUnfinishedTasks(i_token);
       for (TaskInstance task : unfinishedTasks) {
       task.cancel();
       }


      & to get log
      LoggingSession logSession = context.getLoggingSession();
      Collection<ProcessLog> logs = logSession.findLogsByToken(process.getRootToken().getId());
      for (ProcessLog processLog : logs) {
       if (processLog.getClass().equals( org.jbpm.taskmgmt.log.TaskEndLog.class)) {
       System.out.println("Task is ENDED");
       }
      }


      If I have 5 steps in process and I have canceled the task on 4th step, then I am getting TaskEndLog for first 3 steps but NOT for 4th step in which I have canceled the task.

      On 4th step only TaskCreateLog event is firing but not TaskEndLog and as per documentation it should end the task. (that means it should fire TaskEndLog in jbpm_log table).

      Thanks

      regards
      Vikas