Search in sources :

Example 41 with DataSet

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);
}
Also used : DataSet(org.dashbuilder.dataset.DataSet) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) UserTaskInstanceWithVarsDesc(org.jbpm.services.api.model.UserTaskInstanceWithVarsDesc)

Aggregations

DataSet (org.dashbuilder.dataset.DataSet)41 Test (org.junit.Test)27 AbstractDisplayerTest (org.dashbuilder.displayer.client.AbstractDisplayerTest)25 AbstractDisplayer (org.dashbuilder.displayer.client.AbstractDisplayer)17 Displayer (org.dashbuilder.displayer.client.Displayer)13 ArrayList (java.util.ArrayList)12 RawDataSet (org.dashbuilder.dataset.RawDataSet)11 HashMap (java.util.HashMap)6 SelectorDisplayer (org.dashbuilder.renderer.client.selector.SelectorDisplayer)6 DataColumn (org.dashbuilder.dataset.DataColumn)3 DataSetLookup (org.dashbuilder.dataset.DataSetLookup)2 ProcessInstanceWithVarsDesc (org.jbpm.services.api.model.ProcessInstanceWithVarsDesc)2 UserTaskInstanceWithPotOwnerDesc (org.jbpm.services.api.model.UserTaskInstanceWithPotOwnerDesc)2 UserTaskInstanceWithVarsDesc (org.jbpm.services.api.model.UserTaskInstanceWithVarsDesc)2 Date (java.util.Date)1 List (java.util.List)1 DataSetBuilder (org.dashbuilder.dataset.DataSetBuilder)1 DataSetMetadata (org.dashbuilder.dataset.DataSetMetadata)1 DataColumnDef (org.dashbuilder.dataset.def.DataColumnDef)1 DataSetDef (org.dashbuilder.dataset.def.DataSetDef)1