Search in sources :

Example 16 with DataSet

use of org.dashbuilder.dataset.DataSet in project kie-wb-common by kiegroup.

the class ContributorsDashboardTest method test_BZ1255279_fix.

@Test
public void test_BZ1255279_fix() {
    when(authorSelectorDisplayer.getView().getSelectedId()).thenReturn("1");
    authorSelectorDisplayer.onItemSelected();
    DataSet dataSet = allCommitsDisplayer.getDataSetHandler().getLastDataSet();
    assertDataSetValues(dataSet, new String[][] { { "user1", "repo1", "01/01/19 12:00", "Commit 1" } }, 0);
}
Also used : DataSet(org.dashbuilder.dataset.DataSet) Test(org.junit.Test) AbstractDisplayerTest(org.dashbuilder.displayer.client.AbstractDisplayerTest)

Example 17 with DataSet

use of org.dashbuilder.dataset.DataSet in project kie-wb-common by kiegroup.

the class ContributorsDashboardTest method testCommitsPerOrganization.

@Test
public void testCommitsPerOrganization() {
    Displayer displayer = presenter.getCommitsPerOrganization();
    DataSet dataSet = displayer.getDataSetHandler().getLastDataSet();
    assertDataSetValues(dataSet, new String[][] { { "org1", "2.00", "4.00", "org1", "4.00" }, { "org2", "2.00", "4.00", "org2", "4.00" }, { "emptyOrg", "1.00", "1.00", "emptyOrg", "1.00" } }, 0);
}
Also used : DataSet(org.dashbuilder.dataset.DataSet) SelectorDisplayer(org.dashbuilder.renderer.client.selector.SelectorDisplayer) AbstractDisplayer(org.dashbuilder.displayer.client.AbstractDisplayer) Displayer(org.dashbuilder.displayer.client.Displayer) Test(org.junit.Test) AbstractDisplayerTest(org.dashbuilder.displayer.client.AbstractDisplayerTest)

Example 18 with DataSet

use of org.dashbuilder.dataset.DataSet in project jbpm by kiegroup.

the class ProcessInstanceWithCustomVarsQueryMapper method map.

@Override
public List<ProcessInstanceWithVarsDesc> map(Object result) {
    if (result instanceof DataSet) {
        DataSet dataSetResult = (DataSet) result;
        List<ProcessInstanceWithVarsDesc> mappedResult = new ArrayList<ProcessInstanceWithVarsDesc>();
        Map<Long, ProcessInstanceWithVarsDesc> tmp = new HashMap<Long, ProcessInstanceWithVarsDesc>();
        if (dataSetResult != null) {
            for (int i = 0; i < dataSetResult.getRowCount(); i++) {
                Long processInstanceId = getColumnLongValue(dataSetResult, COLUMN_PROCESSINSTANCEID, i);
                ProcessInstanceWithVarsDesc pi = tmp.get(processInstanceId);
                if (pi == null) {
                    pi = buildInstance(dataSetResult, i);
                    mappedResult.add(pi);
                    tmp.put(processInstanceId, pi);
                }
                Map<String, Object> variables = readVariables(variablesMap, dataSetResult, i);
                ((org.jbpm.kie.services.impl.model.ProcessInstanceWithVarsDesc) pi).setVariables(variables);
            }
        }
        tmp = null;
        return mappedResult;
    }
    throw new IllegalArgumentException("Unsupported result for mapping " + result);
}
Also used : DataSet(org.dashbuilder.dataset.DataSet) ProcessInstanceWithVarsDesc(org.jbpm.services.api.model.ProcessInstanceWithVarsDesc) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList)

Example 19 with DataSet

use of org.dashbuilder.dataset.DataSet in project jbpm by kiegroup.

the class ProcessInstanceWithVarsQueryMapper method map.

@Override
public List<ProcessInstanceWithVarsDesc> map(Object result) {
    if (result instanceof DataSet) {
        DataSet dataSetResult = (DataSet) result;
        List<ProcessInstanceWithVarsDesc> mappedResult = new ArrayList<ProcessInstanceWithVarsDesc>();
        Map<Long, ProcessInstanceWithVarsDesc> tmp = new HashMap<Long, ProcessInstanceWithVarsDesc>();
        if (dataSetResult != null) {
            for (int i = 0; i < dataSetResult.getRowCount(); i++) {
                Long processInstanceId = getColumnLongValue(dataSetResult, COLUMN_PROCESSINSTANCEID, i);
                ProcessInstanceWithVarsDesc pi = tmp.get(processInstanceId);
                if (pi == null) {
                    pi = buildInstance(dataSetResult, i);
                    mappedResult.add(pi);
                    tmp.put(processInstanceId, pi);
                }
                // now add variable
                String varName = getColumnStringValue(dataSetResult, COLUMN_VAR_NAME, i);
                String varValue = getColumnStringValue(dataSetResult, COLUMN_VAR_VALUE, i);
                ((org.jbpm.kie.services.impl.model.ProcessInstanceWithVarsDesc) pi).addVariable(varName, varValue);
            }
        }
        tmp = null;
        return mappedResult;
    }
    throw new IllegalArgumentException("Unsupported result for mapping " + result);
}
Also used : DataSet(org.dashbuilder.dataset.DataSet) ProcessInstanceWithVarsDesc(org.jbpm.services.api.model.ProcessInstanceWithVarsDesc) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList)

Example 20 with DataSet

use of org.dashbuilder.dataset.DataSet in project jbpm by kiegroup.

the class UserTaskInstanceQueryMapper method map.

@Override
public List<UserTaskInstanceDesc> map(Object result) {
    if (result instanceof DataSet) {
        DataSet dataSetResult = (DataSet) result;
        List<UserTaskInstanceDesc> mappedResult = new ArrayList<UserTaskInstanceDesc>();
        if (dataSetResult != null) {
            for (int i = 0; i < dataSetResult.getRowCount(); i++) {
                UserTaskInstanceDesc ut = buildInstance(dataSetResult, i);
                mappedResult.add(ut);
            }
        }
        return mappedResult;
    }
    throw new IllegalArgumentException("Unsupported result for mapping " + result);
}
Also used : DataSet(org.dashbuilder.dataset.DataSet) ArrayList(java.util.ArrayList) UserTaskInstanceDesc(org.jbpm.services.api.model.UserTaskInstanceDesc)

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