use of pro.taskana.impl.report.impl.WorkbasketLevelReport in project taskana by Taskana.
the class TaskMonitorServiceImpl method getWorkbasketLevelReport.
@Override
public WorkbasketLevelReport getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states, List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues, List<TimeIntervalColumnHeader> columnHeaders, boolean inWorkingDays) throws InvalidArgumentException {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to getWorkbasketLevelReport(workbasketIds = {}, states = {}, categories = {}, " + "domains = {}, customField = {}, customFieldValues = {}, columnHeaders = {}, " + "inWorkingDays = {})", LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states), LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), customField, LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(columnHeaders), inWorkingDays);
}
try {
taskanaEngineImpl.openConnection();
configureDaysToWorkingDaysConverter();
WorkbasketLevelReport report = new WorkbasketLevelReport(columnHeaders);
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfWorkbaskets(workbasketIds, states, categories, domains, customField, customFieldValues);
report.addItems(monitorQueryItems, new DaysToWorkingDaysPreProcessor<>(columnHeaders, inWorkingDays));
return report;
} finally {
taskanaEngineImpl.returnConnection();
LOGGER.debug("exit from getWorkbasketLevelReport().");
}
}
use of pro.taskana.impl.report.impl.WorkbasketLevelReport in project taskana by Taskana.
the class ProvideWorkbasketLevelReportAccTest method testGetWorkbasketLevelReportWithReportLineItemDefinitions.
@Test
public void testGetWorkbasketLevelReportWithReportLineItemDefinitions() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
WorkbasketLevelReport report = taskMonitorService.getWorkbasketLevelReport(null, null, null, null, null, null, columnHeaders);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, columnHeaders));
}
int sumLineCount = IntStream.of(report.getSumRow().getCells()).sum();
assertNotNull(report);
assertEquals(3, report.rowSize());
assertEquals(20, report.getRow("USER_1_1").getTotalValue());
assertEquals(20, report.getRow("USER_1_2").getTotalValue());
assertEquals(10, report.getRow("USER_1_3").getTotalValue());
int[] sumRow = report.getSumRow().getCells();
assertArrayEquals(new int[] { 10, 9, 11, 0, 4, 0, 7, 4, 5 }, sumRow);
assertEquals(50, report.getSumRow().getTotalValue());
assertEquals(50, sumLineCount);
}
use of pro.taskana.impl.report.impl.WorkbasketLevelReport in project taskana by Taskana.
the class ProvideWorkbasketLevelReportAccTest method testEachItemOfWorkbasketLevelReportWithStateFilter.
@Test
public void testEachItemOfWorkbasketLevelReportWithStateFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TaskState> states = Collections.singletonList(TaskState.READY);
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
WorkbasketLevelReport report = taskMonitorService.getWorkbasketLevelReport(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("USER_1_1").getCells();
assertArrayEquals(new int[] { 13, 3, 1, 1, 0 }, row1);
int[] row2 = report.getRow("USER_1_2").getCells();
assertArrayEquals(new int[] { 4, 6, 3, 6, 0 }, row2);
int[] row3 = report.getRow("USER_1_3").getCells();
assertArrayEquals(new int[] { 2, 2, 0, 0, 0 }, row3);
}
use of pro.taskana.impl.report.impl.WorkbasketLevelReport in project taskana by Taskana.
the class ProvideWorkbasketLevelReportAccTest method testEachItemOfWorkbasketLevelReportWithDomainFilter.
@Test
public void testEachItemOfWorkbasketLevelReportWithDomainFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> domains = Collections.singletonList("DOMAIN_A");
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
WorkbasketLevelReport report = taskMonitorService.getWorkbasketLevelReport(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("USER_1_1").getCells();
assertArrayEquals(new int[] { 8, 1, 0, 1, 2 }, row1);
int[] row2 = report.getRow("USER_1_2").getCells();
assertArrayEquals(new int[] { 2, 2, 2, 4, 0 }, row2);
int[] row3 = report.getRow("USER_1_3").getCells();
assertArrayEquals(new int[] { 1, 1, 0, 0, 2 }, row3);
}
use of pro.taskana.impl.report.impl.WorkbasketLevelReport in project taskana by Taskana.
the class ProvideWorkbasketLevelReportAccTest method testEachItemOfWorkbasketLevelReportWithCategoryFilter.
@Test
public void testEachItemOfWorkbasketLevelReportWithCategoryFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
WorkbasketLevelReport report = taskMonitorService.getWorkbasketLevelReport(null, null, categories, null, null, null, columnHeaders);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, columnHeaders));
}
assertNotNull(report);
assertEquals(3, report.rowSize());
int[] row1 = report.getRow("USER_1_1").getCells();
assertArrayEquals(new int[] { 3, 1, 1, 1, 2 }, row1);
int[] row2 = report.getRow("USER_1_2").getCells();
assertArrayEquals(new int[] { 1, 1, 1, 0, 1 }, row2);
int[] row3 = report.getRow("USER_1_3").getCells();
assertArrayEquals(new int[] { 0, 1, 0, 0, 4 }, row3);
}
Aggregations