Search in sources :

Example 6 with CustomFieldValueReport

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

the class TaskMonitorServiceImplTest method testGetTotalNumbersOfCustomFieldValueReport.

@Test
public void testGetTotalNumbersOfCustomFieldValueReport() throws InvalidArgumentException {
    List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
    List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
    List<String> categories = Collections.singletonList("EXTERN");
    List<String> domains = Collections.singletonList("DOMAIN_A");
    CustomField customField = CustomField.CUSTOM_1;
    List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
    List<MonitorQueryItem> expectedResult = new ArrayList<>();
    MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
    monitorQueryItem.setKey("Geschaeftsstelle A");
    monitorQueryItem.setNumberOfTasks(1);
    expectedResult.add(monitorQueryItem);
    doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfCustomFieldValues(workbasketIds, states, categories, domains, customField, customFieldValues);
    CustomFieldValueReport actualResult = cut.getCustomFieldValueReport(workbasketIds, states, categories, domains, customField, customFieldValues);
    verify(taskanaEngineImplMock, times(1)).openConnection();
    verify(taskanaEngineImplMock, times(2)).getConfiguration();
    verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
    verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
    verify(taskMonitorMapperMock, times(1)).getTaskCountOfCustomFieldValues(any(), any(), any(), any(), any(), any());
    verify(taskanaEngineImplMock, times(1)).returnConnection();
    verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
    assertNotNull(actualResult);
    assertEquals(actualResult.getRow("Geschaeftsstelle A").getTotalValue(), 1);
    assertEquals(actualResult.getSumRow().getTotalValue(), 1);
}
Also used : CustomFieldValueReport(pro.taskana.impl.report.impl.CustomFieldValueReport) DetailedMonitorQueryItem(pro.taskana.impl.report.impl.DetailedMonitorQueryItem) MonitorQueryItem(pro.taskana.impl.report.impl.MonitorQueryItem) CustomField(pro.taskana.CustomField) ArrayList(java.util.ArrayList) TaskState(pro.taskana.TaskState) Test(org.junit.Test)

Example 7 with CustomFieldValueReport

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

the class TaskMonitorServiceImpl method getCustomFieldValueReport.

@Override
public CustomFieldValueReport getCustomFieldValueReport(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 getCustomFieldValueReport(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();
        if (customField == null) {
            throw new InvalidArgumentException("CustomField canĀ“t be used as NULL-Parameter");
        }
        configureDaysToWorkingDaysConverter();
        CustomFieldValueReport report = new CustomFieldValueReport(columnHeaders);
        List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfCustomFieldValues(workbasketIds, states, categories, domains, customField, customFieldValues);
        report.addItems(monitorQueryItems, new DaysToWorkingDaysPreProcessor<>(columnHeaders, inWorkingDays));
        return report;
    } finally {
        taskanaEngineImpl.returnConnection();
        LOGGER.debug("exit from getCustomFieldValueReport().");
    }
}
Also used : InvalidArgumentException(pro.taskana.exceptions.InvalidArgumentException) CustomFieldValueReport(pro.taskana.impl.report.impl.CustomFieldValueReport) MonitorQueryItem(pro.taskana.impl.report.impl.MonitorQueryItem) DetailedMonitorQueryItem(pro.taskana.impl.report.impl.DetailedMonitorQueryItem)

Example 8 with CustomFieldValueReport

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

the class ProvideCustomFieldValueReportAccTest method testGetCustomFieldValueReportWithReportLineItemDefinitions.

@Test
public void testGetCustomFieldValueReportWithReportLineItemDefinitions() throws InvalidArgumentException {
    TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
    CustomField customField = CustomField.CUSTOM_1;
    List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
    CustomFieldValueReport report = taskMonitorService.getCustomFieldValueReport(null, null, null, null, customField, null, columnHeaders);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(reportToString(report, columnHeaders));
    }
    assertNotNull(report);
    assertEquals(3, report.rowSize());
    assertEquals(25, report.getRow("Geschaeftsstelle A").getTotalValue());
    assertEquals(10, report.getRow("Geschaeftsstelle B").getTotalValue());
    assertEquals(15, report.getRow("Geschaeftsstelle C").getTotalValue());
    assertArrayEquals(new int[] { 10, 9, 11, 0, 4, 0, 7, 4, 5 }, report.getSumRow().getCells());
    assertEquals(50, report.getSumRow().getTotalValue());
}
Also used : TaskMonitorService(pro.taskana.TaskMonitorService) CustomFieldValueReport(pro.taskana.impl.report.impl.CustomFieldValueReport) CustomField(pro.taskana.CustomField) TimeIntervalColumnHeader(pro.taskana.impl.report.impl.TimeIntervalColumnHeader) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 9 with CustomFieldValueReport

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

the class ProvideCustomFieldValueReportAccTest method testEachItemOfCustomFieldValueReportWithWorkbasketFilter.

@Test
public void testEachItemOfCustomFieldValueReportWithWorkbasketFilter() throws InvalidArgumentException {
    TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
    List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
    CustomField customField = CustomField.CUSTOM_1;
    List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
    CustomFieldValueReport report = taskMonitorService.getCustomFieldValueReport(workbasketIds, null, null, null, customField, null, columnHeaders);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(reportToString(report, columnHeaders));
    }
    assertNotNull(report);
    assertEquals(3, report.rowSize());
    int[] row1 = report.getRow("Geschaeftsstelle A").getCells();
    assertArrayEquals(new int[] { 6, 1, 1, 1, 1 }, row1);
    int[] row2 = report.getRow("Geschaeftsstelle B").getCells();
    assertArrayEquals(new int[] { 4, 1, 0, 0, 0 }, row2);
    int[] row3 = report.getRow("Geschaeftsstelle C").getCells();
    assertArrayEquals(new int[] { 3, 1, 0, 0, 1 }, row3);
}
Also used : TaskMonitorService(pro.taskana.TaskMonitorService) CustomFieldValueReport(pro.taskana.impl.report.impl.CustomFieldValueReport) CustomField(pro.taskana.CustomField) TimeIntervalColumnHeader(pro.taskana.impl.report.impl.TimeIntervalColumnHeader) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 10 with CustomFieldValueReport

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

the class ProvideCustomFieldValueReportAccTest method testEachItemOfCustomFieldValueReportWithCategoryFilter.

@Test
public void testEachItemOfCustomFieldValueReportWithCategoryFilter() throws InvalidArgumentException {
    TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
    List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
    CustomField customField = CustomField.CUSTOM_1;
    List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
    CustomFieldValueReport report = taskMonitorService.getCustomFieldValueReport(null, null, categories, null, customField, null, columnHeaders);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(reportToString(report, columnHeaders));
    }
    assertNotNull(report);
    assertEquals(3, report.rowSize());
    int[] row1 = report.getRow("Geschaeftsstelle A").getCells();
    assertArrayEquals(new int[] { 2, 1, 2, 1, 3 }, row1);
    int[] row2 = report.getRow("Geschaeftsstelle B").getCells();
    assertArrayEquals(new int[] { 2, 0, 0, 0, 0 }, row2);
    int[] row3 = report.getRow("Geschaeftsstelle C").getCells();
    assertArrayEquals(new int[] { 0, 2, 0, 0, 4 }, row3);
}
Also used : TaskMonitorService(pro.taskana.TaskMonitorService) CustomFieldValueReport(pro.taskana.impl.report.impl.CustomFieldValueReport) CustomField(pro.taskana.CustomField) TimeIntervalColumnHeader(pro.taskana.impl.report.impl.TimeIntervalColumnHeader) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Aggregations

CustomFieldValueReport (pro.taskana.impl.report.impl.CustomFieldValueReport)13 Test (org.junit.Test)12 CustomField (pro.taskana.CustomField)12 TaskMonitorService (pro.taskana.TaskMonitorService)10 TaskanaEngineConfigurationTest (pro.taskana.impl.configuration.TaskanaEngineConfigurationTest)10 TimeIntervalColumnHeader (pro.taskana.impl.report.impl.TimeIntervalColumnHeader)9 TaskState (pro.taskana.TaskState)3 DetailedMonitorQueryItem (pro.taskana.impl.report.impl.DetailedMonitorQueryItem)3 MonitorQueryItem (pro.taskana.impl.report.impl.MonitorQueryItem)3 ArrayList (java.util.ArrayList)2 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)1