use of pro.taskana.impl.report.impl.TimeIntervalColumnHeader in project taskana by Taskana.
the class ProvideDetailedClassificationReportAccTest method testEachItemOfDetailedClassificationReportNotInWorkingDays.
@Test
public void testEachItemOfDetailedClassificationReportNotInWorkingDays() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
DetailedClassificationReport report = taskMonitorService.getDetailedClassificationReport(null, null, null, null, null, null, columnHeaders, false);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, columnHeaders));
}
assertNotNull(report);
assertEquals(5, report.rowSize());
DetailedReportRow line1 = report.getRow("L10000");
assertArrayEquals(new int[] { 9, 0, 1, 0, 0 }, line1.getCells());
ReportRow<DetailedMonitorQueryItem> detailedLine1 = line1.getDetailRows().get("L11000");
assertArrayEquals(new int[] { 2, 0, 1, 0, 0 }, detailedLine1.getCells());
ReportRow<DetailedMonitorQueryItem> detailedLineNoAttachment1 = line1.getDetailRows().get("N/A");
assertArrayEquals(new int[] { 7, 0, 0, 0, 0 }, detailedLineNoAttachment1.getCells());
DetailedReportRow line2 = report.getRow("L20000");
assertArrayEquals(new int[] { 8, 0, 1, 0, 1 }, line2.getCells());
ReportRow<DetailedMonitorQueryItem> detailedLine2 = line2.getDetailRows().get("L22000");
assertArrayEquals(new int[] { 2, 0, 1, 0, 1 }, detailedLine2.getCells());
ReportRow<DetailedMonitorQueryItem> detailedLineNoAttachment2 = line2.getDetailRows().get("N/A");
assertArrayEquals(new int[] { 6, 0, 0, 0, 0 }, detailedLineNoAttachment2.getCells());
DetailedReportRow line3 = report.getRow("L30000");
assertArrayEquals(new int[] { 3, 0, 0, 0, 4 }, line3.getCells());
ReportRow<DetailedMonitorQueryItem> detailedLine3a = line3.getDetailRows().get("L33000");
assertArrayEquals(new int[] { 1, 0, 0, 0, 2 }, detailedLine3a.getCells());
ReportRow<DetailedMonitorQueryItem> detailedLine3b = line3.getDetailRows().get("L99000");
assertArrayEquals(new int[] { 0, 0, 0, 0, 1 }, detailedLine3b.getCells());
ReportRow<DetailedMonitorQueryItem> detailedLineNoAttachment3 = line3.getDetailRows().get("N/A");
assertArrayEquals(new int[] { 2, 0, 0, 0, 1 }, detailedLineNoAttachment3.getCells());
DetailedReportRow line4 = report.getRow("L40000");
assertArrayEquals(new int[] { 4, 0, 2, 0, 4 }, line4.getCells());
ReportRow<DetailedMonitorQueryItem> detailedLineNoAttachment4 = line4.getDetailRows().get("N/A");
assertArrayEquals(new int[] { 4, 0, 2, 0, 4 }, detailedLineNoAttachment4.getCells());
DetailedReportRow line5 = report.getRow("L50000");
assertArrayEquals(new int[] { 6, 0, 0, 0, 7 }, line5.getCells());
ReportRow<DetailedMonitorQueryItem> detailedLineNoAttachment5 = line5.getDetailRows().get("N/A");
assertArrayEquals(new int[] { 6, 0, 0, 0, 7 }, detailedLineNoAttachment5.getCells());
}
use of pro.taskana.impl.report.impl.TimeIntervalColumnHeader in project taskana by Taskana.
the class ProvideWorkbasketLevelReportAccTest 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;
}
use of pro.taskana.impl.report.impl.TimeIntervalColumnHeader in project taskana by Taskana.
the class ProvideWorkbasketLevelReportAccTest method reportToString.
private String reportToString(WorkbasketLevelReport report, List<TimeIntervalColumnHeader> reportLineItemDefinitions) {
String formatColumWidth = "| %-7s ";
String formatFirstColumn = "| %-36s %-4s ";
String formatFirstColumnFirstLine = "| %-29s %12s ";
String formatFirstColumnSumLine = "| %-36s %-5s";
int reportWidth = reportLineItemDefinitions == null ? 46 : reportLineItemDefinitions.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, "Workbasket levels", "Total"));
if (reportLineItemDefinitions != null) {
for (TimeIntervalColumnHeader def : reportLineItemDefinitions) {
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 (reportLineItemDefinitions != 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();
}
use of pro.taskana.impl.report.impl.TimeIntervalColumnHeader 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.TimeIntervalColumnHeader 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);
}
Aggregations