3 Replies Latest reply on Feb 18, 2010 4:17 PM by Sebastian Schneider

    Deleting a task with an ended execution

    Per Christian Henden Newbie

      Hi,


      I have some tasks related to an ended execution and want to delete (or cancel) these tasks.

      I'm not allowed to by taskService.deleteTask, it throws the exception shown below.

      Would it be a problem if TaskDelete allowed you to delete tasks with an ended execution?


      In org.jbpm.pvm.internal.history.events.TaskDelete

      ...

        public TaskDelete(TaskImpl task, String reason) {
          if (task.getExecution()!=null) {
            throw new JbpmException("tasks related to an execution must be completed. they cannot just be deleted");
          }

      ..

      }

       

      Suggested change:

          if (task.getExecution()!=null && !task.getExecution.isEnded()) {
            throw new  JbpmException("tasks related to an execution must be completed. they  cannot just be deleted");
          }

       

       

      Background:

      An execution in a fork reached an end activity  while the other executions of that fork had some tasks related to them. All executions ended. Now I want to get rid of those tasks.

       

      Other suggestions on how to overcome this issue is welcome