ResultSet resultSet = selectStmt.executeQuery();
Map<String, WorkflowSummary> classNameToSummary = new HashMap<String, WorkflowSummary>();
while (resultSet.next()) {
String instanceClassname=resultSet.getString(1);
WorkflowSummary summary = classNameToSummary.get(instanceClassname);
if (summary==null){
summary= new WorkflowSummary();
summary.setClassDescription(new WorkflowClassMetaData(instanceClassname, "", 1L, 1L, 1L,""));
summary.setStateSummary(new WorkflowStateSummary(new HashMap<WorkflowInstanceState, Integer>()));
classNameToSummary.put(instanceClassname, summary);
for (WorkflowInstanceState s : WorkflowInstanceState.values())
summary.getStateSummary().getNumberOfWorkflowInstancesWithState().put(s,0);
}
int status = resultSet.getInt(2);
int count = resultSet.getInt(3);
summary.getStateSummary().getNumberOfWorkflowInstancesWithState().put(DBProcessingStateWorkaround.fromKey(status).asWorkflowInstanceState(), count);
}
resultSet.close();
return new ArrayList<WorkflowSummary>(classNameToSummary.values());
} catch (SQLException e) {
throw new RuntimeException(e);