Querying Worklist Details

This chapter demonstrates some use cases to retrieve worklist information.

Retrieving Information on User and User Group Relations

The following example API usage demonstrates how to retrieve user and user group related information, precisely which users belong to which user groups.

The following query API is used in this example:

UserQuery userQuery = new UserQuery();
UserGroupQuery userGroupQuery = new UserGroupQuery();
UserGroups usergroups = queryService.getAllUserGroups(userGroupQuery);
for (UserGroup userGroup : usergroups) {
   System.out.println("userGroup****** " + userGroup.getId());
   UserQuery userQuery1 = userQuery.findAllForUserGroup(userGroup.getId());
   Users existingusers = queryService.getAllUsers(userQuery1);
   System.out.println("existingusers.getSize****** " + existingusers.getSize());
   for (User user : existingusers) {
        System.out.println("user" + user.getId());

Retrieving the Number of Activity Instances in the Worklist of a specific User

The following example API usage demonstrates how to retrieve information to find the number of activity instances that are currently in the worklist of a particular user.

This example uses the ActivityInstanceQuery.

ActivityInstanceQuery activityQuery = new ActivityInstanceQuery();
FilterOrTerm orFilter = activityQuery.getFilter().addOrTerm();
ActivityInstances activeInstances = queryService.getAllActivityInstances(activityQuery);
for (int y = 0; y < activeInstances.getSize(); y++) {
   ActivityInstance activity = (ActivityInstance) activeInstances.get(y);
   System.out.println(y +") Activity OID: "+ activity.getOID() +" / Performer: "+ activity.getPerformedByName());

Retrieving the Time required for an Activity Instance Execution

The following example demonstrates how to retrieve the time required for an activity instance execution.

This example uses the ActivityInstanceQuery.

ActivityInstanceQuery aiquery = ActivityInstanceQuery.findAlive("OrderProcessing");
Date date = new Date();
long timeInMS = date.getTime() - (3600 * 1000);
date = new Date(timeInMS);
ActivityInstances activityInstances_1 = queryService.getAllActivityInstances(aiquery);
System.out.println("Activity List ordered by start time ");
for (ActivityInstance activityInstance : activityInstances_1) {
   System.out.println("Activity Name: "+ activityInstance.getOID() + "Start Time: "+  activityInstance.getStartTime());