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);
}
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);
}
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);
}
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;
}
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();
}
Aggregations