use of org.dashbuilder.dataset.DataSet in project jbpm by kiegroup.
the class UserTaskInstanceWithCustomVarsQueryMapper method map.
@Override
public List<UserTaskInstanceWithVarsDesc> map(Object result) {
if (result instanceof DataSet) {
DataSet dataSetResult = (DataSet) result;
List<UserTaskInstanceWithVarsDesc> mappedResult = new ArrayList<UserTaskInstanceWithVarsDesc>();
if (dataSetResult != null) {
Map<Long, UserTaskInstanceWithVarsDesc> tmp = new HashMap<Long, UserTaskInstanceWithVarsDesc>();
for (int i = 0; i < dataSetResult.getRowCount(); i++) {
Long taskId = getColumnLongValue(dataSetResult, COLUMN_TASKID, i);
UserTaskInstanceWithVarsDesc ut = tmp.get(taskId);
if (ut == null) {
ut = buildInstance(dataSetResult, i);
mappedResult.add(ut);
tmp.put(taskId, ut);
}
Map<String, Object> variables = readVariables(variablesMap, dataSetResult, i);
((org.jbpm.kie.services.impl.model.UserTaskInstanceWithVarsDesc) ut).setVariables(variables);
}
}
return mappedResult;
}
throw new IllegalArgumentException("Unsupported result for mapping " + result);
}
Aggregations