public NodeInstanceList getProcessInstanceHistory(long processInstanceId, Boolean active, Boolean completed, Integer page, Integer pageSize) {
logger.debug("About to search for node instances with page {} and page size {}", page, pageSize);
Collection<NodeInstanceDesc> result = null;
if ((Boolean.TRUE.equals(active) && Boolean.TRUE.equals(completed)) || (active == null && completed == null)) {
logger.debug("Searching for active and completed node instances for process instance with id {}", processInstanceId);
result = runtimeDataService.getProcessInstanceFullHistory(processInstanceId, buildQueryContext(page, pageSize));
} else if (Boolean.TRUE.equals(active)) {
logger.debug("Searching for active node instances for process instance with id {}", processInstanceId);
result = runtimeDataService.getProcessInstanceHistoryActive(processInstanceId, buildQueryContext(page, pageSize));
} else if (Boolean.TRUE.equals(completed)) {
logger.debug("Searching for completed node instances for process instance with id {}", processInstanceId);
result = runtimeDataService.getProcessInstanceHistoryCompleted(processInstanceId, buildQueryContext(page, pageSize));
}
NodeInstanceList nodeInstanceList = convertToNodeInstanceList(result);
logger.debug("Returning result of node instances search: {}", nodeInstanceList);
return nodeInstanceList;
}