12.7. Retrieving Process And Task Information
RuntimeDataService and TaskQueryService. However, the TaskQueryService provides the same functionality as the RuntimeDataService and using it is not the preferred way to query tasks and processes.
RuntimeDataService interface can be used as the main source of information, as it provides an interface for retrieving data associated with the runtime. It can list process definitions, process instances, tasks for given users, node instance information and other. The service should provide all required information and still be as efficient as possible.
Example 12.1. Get All Process Definitions
Collection definitions = runtimeDataService.getProcesses(new QueryContext());
Example 12.2. Get Active Process Instances
Collection<processInstanceDesc> activeInstances = runtimeDataService .getProcessInstances(new QueryContext());
Example 12.3. Get Active Nodes for Given Process Instance
Collection<nodeInstanceDesc> activeNodes = runtimeDataService .getProcessInstanceHistoryActive(processInstanceId, new QueryContext());
Example 12.4. Get Tasks Assigned to Given User
List<taskSummary> taskSummaries = runtimeDataService
.getTasksAssignedAsPotentialOwner("john", new QueryFilter(0, 10));Example 12.5. Get Assigned Tasks as a Business Administrator
List<taskSummary> taskSummaries = runtimeDataService
.getTasksAssignedAsBusinessAdministrator("john", new QueryFilter(0, 10));RuntimeDataService is mentioned also in Chapter 18, CDI Integration.
RuntimeDataService then support two important arguments:
QueryContextQueryFilter(which is an extension ofQueryContext)
QueryContext allows you to set an offset (by using the offset argument), number of results (count), their order (orderBy) and ascending order (asc) as well.
QueryFilter inherits all of the mentioned attributes, it provides the same features, as well as some others: for example, it is possible to set the language, single result, maximum number of results or paging.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.