Search in sources :

Example 21 with DataSet

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

the class UserTaskInstanceWithModifVarsQueryMapper method map.

@Override
public List<UserTaskInstanceWithPotOwnerDesc> map(Object result) {
    if (result instanceof DataSet) {
        DataSet dataSetResult = (DataSet) result;
        List<UserTaskInstanceWithPotOwnerDesc> mappedResult = new ArrayList<UserTaskInstanceWithPotOwnerDesc>();
        if (dataSetResult != null) {
            Map<Long, UserTaskInstanceWithPotOwnerDesc> tmp = new HashMap<Long, UserTaskInstanceWithPotOwnerDesc>();
            for (int i = 0; i < dataSetResult.getRowCount(); i++) {
                Long taskId = getColumnLongValue(dataSetResult, COLUMN_TASKID, i);
                UserTaskInstanceWithPotOwnerDesc ut = tmp.get(taskId);
                if (ut == null) {
                    ut = buildInstance(dataSetResult, i);
                    mappedResult.add(ut);
                    tmp.put(taskId, ut);
                } else if (!tmp.get(taskId).getPotentialOwners().contains(getColumnStringValue(dataSetResult, COLUMN_POTOWNER, i))) {
                    ((org.jbpm.kie.services.impl.model.UserTaskInstanceWithPotOwnerDesc) ut).addPotOwner(getColumnStringValue(dataSetResult, COLUMN_POTOWNER, i));
                }
                String varName = getColumnStringValue(dataSetResult, COLUMN_TASK_VAR_NAME, i);
                String varValue = getColumnStringValue(dataSetResult, COLUMN_TASK_VAR_VALUE, i);
                if (getColumnIntValue(dataSetResult, COLUMN_TASK_VAR_TYPE, i) == 0) {
                    ((org.jbpm.kie.services.impl.model.UserTaskInstanceWithPotOwnerDesc) ut).addInputdata(varName, varValue);
                } else {
                    ((org.jbpm.kie.services.impl.model.UserTaskInstanceWithPotOwnerDesc) ut).addOutputdata(varName, varValue);
                }
            }
        }
        return mappedResult;
    }
    throw new IllegalArgumentException("Unsupported result for mapping " + result);
}
Also used : UserTaskInstanceWithPotOwnerDesc(org.jbpm.services.api.model.UserTaskInstanceWithPotOwnerDesc) DataSet(org.dashbuilder.dataset.DataSet) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList)

Example 22 with DataSet

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

the class ContributorsDashboardTest method testAllCommits.

@Test
public void testAllCommits() {
    Displayer displayer = presenter.getAllCommitsDisplayer();
    DataSet dataSet = displayer.getDataSetHandler().getLastDataSet();
    assertDataSetValues(dataSet, new String[][] { { "user1", "repo1", "01/01/19 12:00", "Commit 1" }, { "user2", "repo1", "03/02/19 12:00", "Commit 2" }, { "user3", "repo2", "04/03/19 12:00", "Commit 3" }, { "user4", "repo2", "06/04/19 12:00", "Commit 4" }, { "user5", "repo3", "07/05/19 12:00", "Commit 5" }, { "user6", "repo3", "09/06/19 12:00", "Commit 6" }, { "user7", "repo4", "11/07/19 12:00", "Commit 7" }, { "user8", "repo4", "02/08/20 12:00", "Commit 8" }, { "", "", "", "" } }, 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 23 with DataSet

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

the class ContributorsDashboardTest method testSelectAuthorAndWeekOfDay.

@Test
public void testSelectAuthorAndWeekOfDay() throws Exception {
    // "user" selected
    authorSelectorDisplayer.filterUpdate(COLUMN_AUTHOR, 1);
    DataSet dataSet = allCommitsDisplayer.getDataSetHandler().getLastDataSet();
    assertEquals(dataSet.getRowCount(), 1);
    // "Tuesday" selected
    dayOfWeekSelectorDisplayer.filterUpdate(COLUMN_DATE, 2);
    dataSet = allCommitsDisplayer.getDataSetHandler().getLastDataSet();
    assertEquals(dataSet.getRowCount(), 1);
}
Also used : DataSet(org.dashbuilder.dataset.DataSet) Test(org.junit.Test) AbstractDisplayerTest(org.dashbuilder.displayer.client.AbstractDisplayerTest)

Example 24 with DataSet

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

the class ContributorsDashboardTest method testAlwaysShow7Days.

@Test
public void testAlwaysShow7Days() throws Exception {
    // "user" selected
    authorSelectorDisplayer.filterUpdate(COLUMN_AUTHOR, 1);
    DataSet dataSet = allCommitsDisplayer.getDataSetHandler().getLastDataSet();
    assertEquals(dataSet.getRowCount(), 1);
    // Bar chart must always show 7 bars, one per day of week
    dataSet = dayOfWeekSelectorDisplayer.getDataSetHandler().getLastDataSet();
    assertEquals(dataSet.getRowCount(), 7);
}
Also used : DataSet(org.dashbuilder.dataset.DataSet) Test(org.junit.Test) AbstractDisplayerTest(org.dashbuilder.displayer.client.AbstractDisplayerTest)

Example 25 with DataSet

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

the class ContributorsDashboardTest method testQuarterSelector.

@Test
public void testQuarterSelector() {
    Displayer displayer = presenter.getQuarterSelectorDisplayer();
    DataSet dataSet = displayer.getDataSetHandler().getLastDataSet();
    assertDataSetValues(dataSet, new String[][] { { "1", "3.00" }, { "2", "2.00" }, { "3", "2.00" }, { "4", "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)

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