2 Replies Latest reply on Oct 1, 2012 6:51 AM by rahulamt

    Release task in LocalTaskService in jBPM5.2

    rahulamt

      Hi all,

       

      This is my use case: A task is pending with a Role. Some user with that role claims the task. Now the user do not want to work on that task. He want to release that task to role pool.

       

      The above action can be achieved through org.jbpm.task.TaskService.release(taskId, idRef). But unfortunately this API is not working.

       

      So I dug dip into the code details ,I could find the following in the LocalTaskService

       

      public void release(long taskId, String userId) {

              taskServiceSession.taskOperation(Operation.Release, taskId, userId, null, null, null);

          }

       

      and in the TaskServiceSession for this taskOperation

       

                     switch (operation) {

                      case Claim: {

                          taskClaimOperation(task);

                          break;

                      }

                      case Complete: {

                          taskCompleteOperation(task, data);

                          break;

                      }

                      case Fail: {

                          taskFailOperation(task, data);

                          break;

                      }

                      case Skip: {

                          taskSkipOperation(task, userId);

                          break;

                      }

                      case Remove: {

                                taskRemoveOperation(task, user);

                                break;

                      }

                      case Register: {

                                taskRegisterOperation(task, user);

                                break;

                      }

                  }

      there is no switch case for release operation. The same for the postTaskOperations.

       

       

      Can anyone explain? Am I not supposed to use release for the use case above described?

      Please help!!!

        • 1. Re: Release task in LocalTaskService in jBPM5.2
          rahulamt

          The cause is that the Task instance is not persisted in the database so the status is not updated.

           

          I am adding a case statement here after skip.

          case Skip: {

                                postTaskSkipOperation(task, userId);

                                break;

                            }

          case Release: {

                                      postTaskReleaseOperation(task);

                                      break;

                            }

           

          and in postTaskReleaseOperation(task); added the following...

           

           

          private void postTaskReleaseOperation(Task task) {

                              // We may add some even support trigger here.

                        persistInTransaction(task);    

                    }

          • 2. Re: Release task in LocalTaskService in jBPM5.2
            rahulamt

            I am using postgres database.

             

            I am facing the same issue with the claimed task.

            https://community.jboss.org/message/753466#753466

             

            Should I raise the jira issue for this?