use of org.activiti.engine.history.HistoricProcessInstanceQuery in project midpoint by Evolveum.
the class ProcessInstanceManager method getActivitiToMidpoint.
private Map<String, String> getActivitiToMidpoint(Set<String> activeProcessInstances, OperationResult result) {
Map<String, String> rv = new HashMap<>();
int processWithoutTaskOidCount = 0;
HistoricProcessInstanceQuery query = activitiEngine.getHistoryService().createHistoricProcessInstanceQuery().includeProcessVariables().excludeSubprocesses(true);
List<HistoricProcessInstance> processes = query.list();
for (HistoricProcessInstance process : processes) {
String taskOid = (String) process.getProcessVariables().get(CommonProcessVariableNames.VARIABLE_MIDPOINT_TASK_OID);
rv.put(process.getId(), taskOid);
if (taskOid == null) {
processWithoutTaskOidCount++;
}
if (process.getEndTime() == null) {
activeProcessInstances.add(process.getId());
}
}
LOGGER.info("Found {} processes; among these, {} have no task OID. Active processes: {}", rv.size(), processWithoutTaskOidCount, activeProcessInstances.size());
return rv;
}
Aggregations