/* Get query results */
List<Object[]> queueResults = query.list();
List<BpmTask> result = new ArrayList<BpmTask>();
BpmTaskFactory taskFactory = new BpmTaskFactory(ctx);
/* Every row is one queue element with jbpm task as first column and process instance as second */
for(Object[] resultRow: queueResults)
{
HistoryTaskInstanceImpl taskInstance = (HistoryTaskInstanceImpl)resultRow[0];
ProcessInstance processInstance = (ProcessInstance)resultRow[1];
/* Map process and jbpm task to system's bpm task */
BpmTask task = taskFactory.create(taskInstance, processInstance);
result.add(task);
}
return result;