use of pro.taskana.impl.report.impl.TimeIntervalColumnHeader in project taskana by Taskana.
the class ProvideCustomFieldValueReportAccTest method testEachItemOfCustomFieldValueReportWithCustomFieldValueFilter.
@Test
public void testEachItemOfCustomFieldValueReportWithCustomFieldValueFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
CustomField customField = CustomField.CUSTOM_1;
List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
CustomFieldValueReport report = taskMonitorService.getCustomFieldValueReport(null, null, null, null, customField, customFieldValues, columnHeaders);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, columnHeaders));
}
assertNotNull(report);
assertEquals(1, report.rowSize());
int[] row1 = report.getRow("Geschaeftsstelle A").getCells();
assertArrayEquals(new int[] { 11, 4, 3, 4, 3 }, row1);
}
use of pro.taskana.impl.report.impl.TimeIntervalColumnHeader in project taskana by Taskana.
the class ProvideCustomFieldValueReportAccTest method testEachItemOfCustomFieldValueReportWithDomainFilter.
@Test
public void testEachItemOfCustomFieldValueReportWithDomainFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> domains = Collections.singletonList("DOMAIN_A");
CustomField customField = CustomField.CUSTOM_1;
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
CustomFieldValueReport report = taskMonitorService.getCustomFieldValueReport(null, null, null, domains, 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[] { 8, 1, 1, 4, 1 }, row1);
int[] row2 = report.getRow("Geschaeftsstelle B").getCells();
assertArrayEquals(new int[] { 2, 2, 0, 1, 0 }, row2);
int[] row3 = report.getRow("Geschaeftsstelle C").getCells();
assertArrayEquals(new int[] { 1, 1, 1, 0, 3 }, row3);
}
use of pro.taskana.impl.report.impl.TimeIntervalColumnHeader in project taskana by Taskana.
the class ProvideCustomFieldValueReportAccTest method getShortListOfColumnHeaders.
private List<TimeIntervalColumnHeader> getShortListOfColumnHeaders() {
List<TimeIntervalColumnHeader> columnHeaders = new ArrayList<>();
columnHeaders.add(new TimeIntervalColumnHeader(Integer.MIN_VALUE, -6));
columnHeaders.add(new TimeIntervalColumnHeader(-5, -1));
columnHeaders.add(new TimeIntervalColumnHeader(0));
columnHeaders.add(new TimeIntervalColumnHeader(1, 5));
columnHeaders.add(new TimeIntervalColumnHeader(6, Integer.MAX_VALUE));
return columnHeaders;
}
use of pro.taskana.impl.report.impl.TimeIntervalColumnHeader in project taskana by Taskana.
the class CreateTaskAccTest method testPrioDurationOfTaskFromAttachmentsAtCreate.
@WithAccessId(userName = "user_1_1", groupNames = { "group_1" })
@Test
public void testPrioDurationOfTaskFromAttachmentsAtCreate() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException {
TaskService taskService = taskanaEngine.getTaskService();
Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A");
// prio 8, SL P7D
newTask.setClassificationKey("L12010");
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
newTask.addAttachment(createAttachment(// prio 99, SL P2000D
"DOCTYPE_DEFAULT", createObjectReference("COMPANY_A", "SYSTEM_B", "INSTANCE_B", "ArchiveId", "12345678901234567890123456789012345678901234567890"), "E-MAIL", "2018-01-15", createSimpleCustomProperties(3)));
newTask.addAttachment(createAttachment(// prio 1, SL P1D
"L1060", createObjectReference("COMPANY_A", "SYSTEM_B", "INSTANCE_B", "ArchiveId", "12345678901234567890123456789012345678901234567890"), "E-MAIL", "2018-01-15", createSimpleCustomProperties(3)));
Task createdTask = taskService.createTask(newTask);
assertNotNull(createdTask.getId());
assertThat(createdTask.getCreator(), equalTo(CurrentUserContext.getUserid()));
Task readTask = taskService.getTask(createdTask.getId());
assertNotNull(readTask);
assertThat(readTask.getCreator(), equalTo(CurrentUserContext.getUserid()));
assertNotNull(readTask.getAttachments());
assertEquals(2, readTask.getAttachments().size());
assertNotNull(readTask.getAttachments().get(1).getCreated());
assertNotNull(readTask.getAttachments().get(1).getModified());
assertEquals(readTask.getAttachments().get(0).getCreated(), readTask.getAttachments().get(1).getModified());
// assertNotNull(readTask.getAttachments().get(0).getClassification());
assertNotNull(readTask.getAttachments().get(0).getObjectReference());
assertTrue(readTask.getPriority() == 99);
DaysToWorkingDaysConverter converter = DaysToWorkingDaysConverter.initialize(Collections.singletonList(new TimeIntervalColumnHeader(0)), Instant.now());
long calendarDays = converter.convertWorkingDaysToDays(readTask.getPlanned(), 1);
assertTrue(readTask.getDue().equals(readTask.getPlanned().plus(Duration.ofDays(calendarDays))));
}
use of pro.taskana.impl.report.impl.TimeIntervalColumnHeader in project taskana by Taskana.
the class GetTaskIdsOfCategoryReportAccTest method testGetTaskIdsOfCategoryReport.
@Test
public void testGetTaskIdsOfCategoryReport() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("EXTERN");
s1.setLowerAgeLimit(-5);
s1.setUpperAgeLimit(-2);
selectedItems.add(s1);
SelectedItem s2 = new SelectedItem();
s2.setKey("AUTOMATIC");
s2.setLowerAgeLimit(Integer.MIN_VALUE);
s2.setUpperAgeLimit(-11);
selectedItems.add(s2);
SelectedItem s3 = new SelectedItem();
s3.setKey("MANUAL");
s3.setLowerAgeLimit(0);
s3.setUpperAgeLimit(0);
selectedItems.add(s3);
List<String> ids = taskMonitorService.getTaskIdsOfCategoryReportLineItems(null, null, null, null, null, null, columnHeaders, selectedItems);
assertEquals(11, ids.size());
assertTrue(ids.contains("TKI:000000000000000000000000000000000006"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000020"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000021"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000022"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000023"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000024"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000026"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000027"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000028"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000031"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000032"));
}
Aggregations