4 Replies Latest reply on Jan 11, 2013 10:19 AM by aadav86

    How to get tasks based on a Process ID in jBPM5.3

    aadav86

      Hi,

       

      Is there any method to get the list of prospective tasks associated to a Processinstance..?

       

      Thanks,

      Aadav

        • 1. Re: How to get tasks based on a Process ID in jBPM5.3
          swiderski.maciej

          A dedicated method for this was added 5.4: getTasksByStatusByProcessId

           

          If you cannot upgrade to 5.4 then probably the only way is to use deprecated query method on taskClient as a workaround.

           

          HTH

          • 2. Re: How to get tasks based on a Process ID in jBPM5.3
            roxy1987

            You can connect using a TaskClient and get the tasks using the method suggested above :

             

             

            //Connect with the Human Task handler using the task client
            //Create a list of status of the tasks you are interested in.
            statusList.add(Status.Completed);
            statusList.add(Status.Reserved);
            statusList.add(Status.Ready);
            
             
            
            client.getTasksByStatusByProcessId(processInstanceId,statusList, "en-UK", responseHandler);
            List<TaskSummary> taskSummaryList = responseHandler.getResults();
            for(TaskSummary taskSummary : taskSummaryList)
            {
             //retrieve the details
             taskSummary.getId();
             taskSummary.getName();
             taskSummary.getCreatedOn();
             taskSummary.getActualOwner();
             taskSummary.getStatus();
            }
            1 of 1 people found this helpful
            • 3. Re: How to get tasks based on a Process ID in jBPM5.3
              aadav86

              Maciej Swiderski wrote:

               

              A dedicated method for this was added 5.4: getTasksByStatusByProcessId

               

              If you cannot upgrade to 5.4 then probably the only way is to use deprecated query method on taskClient as a workaround.

               

              HTH

               

               

              Thank you Maciejs..

               

               

              Aadav

              • 4. Re: How to get tasks based on a Process ID in jBPM5.3
                aadav86

                roxy1987 wrote:

                 

                You can connect using a TaskClient and get the tasks using the method suggested above :

                 

                 

                //Connect with the Human Task handler using the task client
                //Create a list of status of the tasks you are interested in.
                statusList.add(Status.Completed);
                statusList.add(Status.Reserved);
                statusList.add(Status.Ready);
                 
                 
                 
                client.getTasksByStatusByProcessId(processInstanceId,statusList, "en-UK", responseHandler);
                List<TaskSummary> taskSummaryList = responseHandler.getResults();
                for(TaskSummary taskSummary : taskSummaryList)
                {
                 //retrieve the details
                 taskSummary.getId();
                 taskSummary.getName();
                 taskSummary.getCreatedOn();
                 taskSummary.getActualOwner();
                 taskSummary.getStatus();
                }
                

                Thank you roxy1987