2 Replies Latest reply on Sep 12, 2012 12:24 PM by suprit chaudhary

    From Task to TaskSummary

    roberto sidoti Newbie

      Hi all,

      I'm using JBPM 5.3,

      If a read a list of Task objects using "client.query("from Task task where .... ", 100, 0, handler);" how can I convert that tasks to TaskSummary objects?

      Is there a Client method to do that?

      Tx in advance

      roby

        • 1. Re: From Task to TaskSummary
          Esteban Aliverti Master

          You have to do the conversoin manually or in the query (like jBPM does). This is the example of the 'TasksAssignedAsPotentialOwner' query:

           

          select

               new org.jbpm.task.query.TaskSummary(

               t.id,

               t.taskData.processInstanceId,

               name.text,

               subject.text,

               description.text,

               t.taskData.status,

               t.priority,

               t.taskData.skipable,

               actualOwner,

               createdBy,

               t.taskData.createdOn,

               t.taskData.activationTime,

               t.taskData.expirationTime,

               t.taskData.processId,

               t.taskData.processSessionId)

          from

              Task t

              left join t.taskData.createdBy as createdBy

              left join t.taskData.actualOwner as actualOwner

              left join t.subjects as subject

              left join t.descriptions as description

              left join t.names as name,

              OrganizationalEntity potentialOwners

          where ...

          • 2. Re: From Task to TaskSummary
            suprit chaudhary Newbie

            Sample Code:

             

            /// filter for task status

            List<Status> statusList = new ArrayList<Status>();

            statusList.add(Status.Created);

                       

            TaskService taskClient = new SyncTaskServiceWrapper(new AsyncMinaTaskClient());

            taskClient.connect();

                                   

            List<TaskSummary> taskSummaryList = taskClient.getTasksOwned(processId, statusList, "");

             

            Also ref: https://github.com/droolsjbpm/jbpm/blob/master/jbpm-examples/src/main/java/org/jbpm/examples/humantask/HumanTaskExample.java