Retrive all tasks list when process instance is completed

159 views
Skip to first unread message

pankaj kumar

unread,
May 30, 2019, 6:01:07 AM5/30/19
to jBPM Usage
Hello,

I need to retrieve all tasks for the process instance which is already completed. I am able to get those when process instance is active but not once completed. we want to populate completed process instance detailed history.I am using below Rest urls but works only for active instance:

/server/queries/tasks/instances/process/{processInstanceId}     --- status query parameter is available, but works only for active instances.

Is there any other way by which i can retrieve completed process instance information(process variables, tasks details etc.)as a history?

If anybody in the community has come across similar requirement then how did he achieve that?


Thanks,
Pankaj K.


Donato Marrazzo

unread,
May 30, 2019, 11:48:04 AM5/30/19
to jBPM Usage
check the query apis


Otherwise you can create custom queries.

pankaj kumar

unread,
Jun 4, 2019, 3:11:26 AM6/4/19
to jBPM Usage
Thanks Donato for your reply!

I found /server/queries/definitions/{queryName}/filtered-data API which returns all tasks after process completion as well.

Below is the output from swagger ui:

{
  "task-instance": [
    {
      "task-id": 103,
      "task-priority": 0,
      "task-name": "Task1",
      "task-subject": null,
      "task-description": "",
      "task-type": null,
      "task-form": null,
      "task-status": "Completed",
      "task-actual-owner": "bcadmin",
      "task-created-by": "bcadmin",
      "task-created-on": {
        "java.util.Date": 1559108197153
      },
      "task-activation-time": {
        "java.util.Date": 1559108197153
      },
      "task-expiration-time": null,
      "task-skippable": null,
      "task-workitem-id": null,
      "task-process-instance-id": 21,
      "task-parent-id": null,
      "task-process-id": "TestProject.sample",
      "task-container-id": "TestProject_1.0.0-SNAPSHOT",
      "task-pot-owners": null,
      "task-excl-owners": null,
      "task-business-admins": null,
      "task-input-data": null,
      "task-output-data": null
    }
  ]
}


But when i am using above api using "kie-server-client-7.12.0.Final.jar", it doesn't return full response JSON. Below is the code snippet i am using.
       
        String queryName = "jbpmHumanTasks";
        String mapper = "UserTasks";
       
        TaskQueryFilterSpec filterSpec = new TaskQueryFilterSpecBuilder().equalsTo(TaskField.PROCESSINSTANCEID, processInstanceId).get();
        List<TaskInstance> query = queryClient.query(queryName, mapper, filterSpec, page, pageSize, TaskInstance.class);

Output:
[TaskInstance{id=103, name='Task1', description='', status='Completed', actualOwner='XXXX', processInstanceId=21, processId='TestProject.sample', containerId='TestProject_1.0.0-SNAPSHOT'}, TaskInstance{id=104, name='Task2', description='', status='Completed', actualOwner='XXXX', processInstanceId=21, processId='TestProject.sample', containerId='TestProject_1.0.0-SNAPSHOT'}]

In both the cases, same end point url is being called, but response json is different.

Is there any switch to enable full response? or am i missing any parameter?


Thanks,
Pankaj K.

Donato Marrazzo

unread,
Jun 10, 2019, 6:54:56 AM6/10/19
to pankaj kumar, jBPM Usage
Hello,

sorry for the late reply.
From my experience, it perform exactly the same request and get back the same results.
Maybe, you are tricked by the serialization of query that skip the null values.
In order to get a full dump of the REST payload you can enable the debug.
Create this file src/main/resources/logback.xml

With this content:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d [%t] %-5p %m%n</pattern>
</encoder>
</appender>

<!-- To override the debug log level from the command line, use the VM option "-Dlogback.level.org.optaplanner=trace" -->
<logger name="org.kie" level="debug"/>

<root level="info">
<appender-ref ref="consoleAppender" />
</root>

</configuration>

Make sure that you have these dependencies:

        <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>runtime</scope>
        </dependency>


--
You received this message because you are subscribed to a topic in the Google Groups "jBPM Usage" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jbpm-usage/zX8ckqFubEI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jbpm-usage+...@googlegroups.com.
To post to this group, send email to jbpm-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbpm-usage/1d07bf60-67c0-48fd-8799-17822c680590%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pankaj Kumar

unread,
Jun 27, 2019, 12:38:16 AM6/27/19
to Donato Marrazzo, jBPM Usage
Thank you for your response. Yes, it was Jackson configuration. I fixed the issue by right configuration.

Thanks,
Pankaj K,
--
Best Regards,

Pankaj Kumar

Gracy Tirupathi

unread,
Mar 8, 2024, 3:45:14 AM3/8/24
to jBPM Usage
Does anybody knows the API in jbpm to retrieve variables data for a completed process , and also for a child process which is also completed
Reply all
Reply to author
Forward
0 new messages