Search in sources :

Example 6 with TimeIntervalColumnHeader

use of pro.taskana.impl.report.impl.TimeIntervalColumnHeader in project taskana by Taskana.

the class ProvideCategoryReportAccTest method testEachItemOfCategoryReportWithStateFilter.

@Test
public void testEachItemOfCategoryReportWithStateFilter() throws InvalidArgumentException {
    TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
    List<TaskState> states = Collections.singletonList(TaskState.READY);
    List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
    CategoryReport report = taskMonitorService.getCategoryReport(null, states, null, null, null, null, columnHeaders);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(reportToString(report, columnHeaders));
    }
    assertNotNull(report);
    assertEquals(3, report.rowSize());
    int[] row1 = report.getRow("EXTERN").getCells();
    assertArrayEquals(new int[] { 15, 8, 2, 6, 0 }, row1);
    int[] row2 = report.getRow("AUTOMATIC").getCells();
    assertArrayEquals(new int[] { 2, 1, 0, 1, 0 }, row2);
    int[] row3 = report.getRow("MANUAL").getCells();
    assertArrayEquals(new int[] { 2, 2, 2, 0, 0 }, row3);
}
Also used : TaskMonitorService(pro.taskana.TaskMonitorService) TaskState(pro.taskana.TaskState) TimeIntervalColumnHeader(pro.taskana.impl.report.impl.TimeIntervalColumnHeader) CategoryReport(pro.taskana.impl.report.impl.CategoryReport) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 7 with TimeIntervalColumnHeader

use of pro.taskana.impl.report.impl.TimeIntervalColumnHeader in project taskana by Taskana.

the class ProvideCategoryReportAccTest method testEachItemOfCategoryReportWithWorkbasketFilter.

@Test
public void testEachItemOfCategoryReportWithWorkbasketFilter() throws InvalidArgumentException {
    TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
    List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
    List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
    CategoryReport report = taskMonitorService.getCategoryReport(workbasketIds, null, null, null, null, null, columnHeaders);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(reportToString(report, columnHeaders));
    }
    assertNotNull(report);
    assertEquals(3, report.rowSize());
    int[] row1 = report.getRow("EXTERN").getCells();
    assertArrayEquals(new int[] { 10, 2, 0, 0, 0 }, row1);
    int[] row2 = report.getRow("AUTOMATIC").getCells();
    assertArrayEquals(new int[] { 2, 1, 0, 1, 1 }, row2);
    int[] row3 = report.getRow("MANUAL").getCells();
    assertArrayEquals(new int[] { 1, 0, 1, 0, 1 }, row3);
}
Also used : TaskMonitorService(pro.taskana.TaskMonitorService) TimeIntervalColumnHeader(pro.taskana.impl.report.impl.TimeIntervalColumnHeader) CategoryReport(pro.taskana.impl.report.impl.CategoryReport) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 8 with TimeIntervalColumnHeader

use of pro.taskana.impl.report.impl.TimeIntervalColumnHeader in project taskana by Taskana.

the class ProvideCategoryReportAccTest method testEachItemOfCategoryReportWithDomainFilter.

@Test
public void testEachItemOfCategoryReportWithDomainFilter() throws InvalidArgumentException {
    TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
    List<String> domains = Collections.singletonList("DOMAIN_A");
    List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
    CategoryReport report = taskMonitorService.getCategoryReport(null, null, null, domains, null, null, columnHeaders);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(reportToString(report, columnHeaders));
    }
    assertNotNull(report);
    assertEquals(3, report.rowSize());
    int[] row1 = report.getRow("EXTERN").getCells();
    assertArrayEquals(new int[] { 8, 4, 2, 4, 0 }, row1);
    int[] row2 = report.getRow("AUTOMATIC").getCells();
    assertArrayEquals(new int[] { 1, 0, 0, 1, 1 }, row2);
    int[] row3 = report.getRow("MANUAL").getCells();
    assertArrayEquals(new int[] { 2, 0, 0, 0, 3 }, row3);
}
Also used : TaskMonitorService(pro.taskana.TaskMonitorService) TimeIntervalColumnHeader(pro.taskana.impl.report.impl.TimeIntervalColumnHeader) CategoryReport(pro.taskana.impl.report.impl.CategoryReport) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 9 with TimeIntervalColumnHeader

use of pro.taskana.impl.report.impl.TimeIntervalColumnHeader in project taskana by Taskana.

the class ProvideCustomFieldValueReportAccTest method getListOfColumnHeaders.

private List<TimeIntervalColumnHeader> getListOfColumnHeaders() {
    List<TimeIntervalColumnHeader> columnHeaders = new ArrayList<>();
    columnHeaders.add(new TimeIntervalColumnHeader(Integer.MIN_VALUE, -11));
    columnHeaders.add(new TimeIntervalColumnHeader(-10, -6));
    columnHeaders.add(new TimeIntervalColumnHeader(-5, -2));
    columnHeaders.add(new TimeIntervalColumnHeader(-1));
    columnHeaders.add(new TimeIntervalColumnHeader(0));
    columnHeaders.add(new TimeIntervalColumnHeader(1));
    columnHeaders.add(new TimeIntervalColumnHeader(2, 5));
    columnHeaders.add(new TimeIntervalColumnHeader(6, 10));
    columnHeaders.add(new TimeIntervalColumnHeader(11, Integer.MAX_VALUE));
    return columnHeaders;
}
Also used : ArrayList(java.util.ArrayList) TimeIntervalColumnHeader(pro.taskana.impl.report.impl.TimeIntervalColumnHeader)

Example 10 with TimeIntervalColumnHeader

use of pro.taskana.impl.report.impl.TimeIntervalColumnHeader in project taskana by Taskana.

the class ProvideCustomFieldValueReportAccTest method reportToString.

private String reportToString(CustomFieldValueReport report, List<TimeIntervalColumnHeader> columnHeaders) {
    String formatColumWidth = "| %-7s ";
    String formatFirstColumn = "| %-36s  %-4s ";
    String formatFirstColumnFirstLine = "| %-29s %12s ";
    String formatFirstColumnSumLine = "| %-36s  %-5s";
    int reportWidth = columnHeaders == null ? 46 : columnHeaders.size() * 10 + 46;
    StringBuilder builder = new StringBuilder();
    builder.append("\n");
    for (int i = 0; i < reportWidth; i++) {
        builder.append("-");
    }
    builder.append("\n");
    builder.append(String.format(formatFirstColumnFirstLine, "Custom field values", "Total"));
    if (columnHeaders != null) {
        for (TimeIntervalColumnHeader def : columnHeaders) {
            if (def.getLowerAgeLimit() == Integer.MIN_VALUE) {
                builder.append(String.format(formatColumWidth, "< " + def.getUpperAgeLimit()));
            } else if (def.getUpperAgeLimit() == Integer.MAX_VALUE) {
                builder.append(String.format(formatColumWidth, "> " + def.getLowerAgeLimit()));
            } else if (def.getLowerAgeLimit() == def.getUpperAgeLimit()) {
                if (def.getLowerAgeLimit() == 0) {
                    builder.append(String.format(formatColumWidth, "today"));
                } else {
                    builder.append(String.format(formatColumWidth, def.getLowerAgeLimit()));
                }
            } else {
                builder.append(String.format(formatColumWidth, def.getLowerAgeLimit() + ".." + def.getUpperAgeLimit()));
            }
        }
    }
    builder.append("|\n");
    for (int i = 0; i < reportWidth; i++) {
        builder.append("-");
    }
    builder.append("\n");
    for (String rl : report.rowTitles()) {
        builder.append(String.format(formatFirstColumn, rl, report.getRow(rl).getTotalValue()));
        if (columnHeaders != null) {
            for (int cell : report.getRow(rl).getCells()) {
                builder.append(String.format(formatColumWidth, cell));
            }
        }
        builder.append("|\n");
        for (int i = 0; i < reportWidth; i++) {
            builder.append("-");
        }
        builder.append("\n");
    }
    builder.append(String.format(formatFirstColumnSumLine, "Total", report.getSumRow().getTotalValue()));
    for (int cell : report.getSumRow().getCells()) {
        builder.append(String.format(formatColumWidth, cell));
    }
    builder.append("|\n");
    for (int i = 0; i < reportWidth; i++) {
        builder.append("-");
    }
    builder.append("\n");
    return builder.toString();
}
Also used : TimeIntervalColumnHeader(pro.taskana.impl.report.impl.TimeIntervalColumnHeader)

Aggregations

TimeIntervalColumnHeader (pro.taskana.impl.report.impl.TimeIntervalColumnHeader)75 Test (org.junit.Test)57 TaskMonitorService (pro.taskana.TaskMonitorService)46 TaskanaEngineConfigurationTest (pro.taskana.impl.configuration.TaskanaEngineConfigurationTest)46 ArrayList (java.util.ArrayList)25 CustomField (pro.taskana.CustomField)19 DetailedMonitorQueryItem (pro.taskana.impl.report.impl.DetailedMonitorQueryItem)13 TaskState (pro.taskana.TaskState)12 DetailedClassificationReport (pro.taskana.impl.report.impl.DetailedClassificationReport)10 CategoryReport (pro.taskana.impl.report.impl.CategoryReport)9 ClassificationReport (pro.taskana.impl.report.impl.ClassificationReport)9 CustomFieldValueReport (pro.taskana.impl.report.impl.CustomFieldValueReport)9 WorkbasketLevelReport (pro.taskana.impl.report.impl.WorkbasketLevelReport)9 DetailedReportRow (pro.taskana.impl.report.impl.DetailedReportRow)8 SelectedItem (pro.taskana.impl.SelectedItem)6 AbstractAccTest (acceptance.AbstractAccTest)4 DaysToWorkingDaysConverter (pro.taskana.impl.DaysToWorkingDaysConverter)4 MonitorQueryItem (pro.taskana.impl.report.impl.MonitorQueryItem)4 WithAccessId (pro.taskana.security.WithAccessId)4 Task (pro.taskana.Task)3