6 Replies Latest reply on Feb 3, 2010 1:39 PM by kukeltje

    JBPM 4.3 Why is taskService.addTaskComment() only allowed for completed tasks?

    ajonker

      This is not what I was expecting. On an active task, I try the following on task completion:

       

      taskService.addTaskComment(command.getTaskId(), command.getRemark());

      taskService.completeTask(command.getTaskId(), command.getOutcome());

       

      But I get a JBPMException:

       

      24806 [btpool0-1] WARN root  - Nested in org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.jbpm.api.JbpmException: task 10 doesn't exist:
      org.jbpm.api.JbpmException: task 10 doesn't exist
          at org.jbpm.pvm.internal.cmd.AddTaskCommentCmd.execute(AddTaskCommentCmd.java:51)
          at org.jbpm.pvm.internal.cmd.AddTaskCommentCmd.execute(AddTaskCommentCmd.java:35)
          at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)

       

       

      Searching a little in the sources showed me that adding comments to tasks is only allowed on HistoryTasks:

       

      org.jbpm.pvm.internal.cmd.AddTaskCommentCmd:

          HistoryTaskImpl historyTask = dbSession.get(HistoryTaskImpl.class, taskDbid);
          if (historyTask==null) {
            throw new JbpmException("task "+taskDbid+" doesn't exist");
          }

       

      Why can't I add comments to running tasks? When the task is completed, adding comments seems a bit silly since it's already completed.

       

      Kind regards,

       

      Arjan