TSK-1687: Provide REST API for WorkbasketReports, structured by priority instead of days (#1685)
* TSK-1687: Added WorkbasketPriorityReport Java and REST API * TSK-1687: Added Tests * TSK-1687: Adapted Tests, because of extended monitor test data * TSK-1687: PR amends (remember to squash and rebase)
This commit is contained in:
parent
54428045dd
commit
fe292ea5b5
|
@ -1,8 +1,10 @@
|
|||
-- WORKBASKET TABLE (ID , KEY , CREATED , MODIFIED , NAME , DOMAIN , TYPE , DESCRIPTION , OWNER , CUSTOM_1 , CUSTOM_2 , CUSTOM_3 , CUSTOM_4 , ORG_LEVEL_1 , ORG_LEVEL_2 , ORG_LEVEL_3 , ORG_LEVEL_4 , MARKED_FOR_DELETION );
|
||||
INSERT INTO WORKBASKET VALUES ('WBI:000000000000000000000000000000000001', 'USER-1-1', RELATIVE_DATE(0) , RELATIVE_DATE(0) , 'PPK User 1 KSC 1', 'MONITOR_TEST_DOMAIN', 'PERSONAL', 'Monitor Test Postkorb 1', 'John' , '' , '' , '' , '' , 'org1' , '' , '' , '' , FALSE );
|
||||
INSERT INTO WORKBASKET VALUES ('WBI:000000000000000000000000000000000002', 'USER-1-2', RELATIVE_DATE(0) , RELATIVE_DATE(0) , 'PPK User 1 KSC 2', 'MONITOR_TEST_DOMAIN', 'PERSONAL', 'Monitor Test Postkorb 2', 'John' , '' , '' , '' , '' , '' , '' , '' , '' , FALSE );
|
||||
INSERT INTO WORKBASKET VALUES ('WBI:000000000000000000000000000000000003', 'USER-1-3', RELATIVE_DATE(0) , RELATIVE_DATE(0) , 'PPK User 1 KSC 3', 'MONITOR_TEST_DOMAIN', 'PERSONAL', 'Monitor Test Postkorb 3', 'John' , '' , '' , '' , '' , 'org1' , '' , '' , '' , FALSE );
|
||||
INSERT INTO WORKBASKET VALUES ('WBI:000000000000000000000000000000000004', 'USER-1-4', RELATIVE_DATE(0) , RELATIVE_DATE(0) , 'PPK User 1 KSC 4', 'MONITOR_TEST_DOMAIN', 'PERSONAL', 'Monitor Test Postkorb 4', 'John' , '' , '' , '' , '' , '' , '' , '' , '' , FALSE );
|
||||
-- WORKBASKET TABLE (ID , KEY , CREATED , MODIFIED , NAME , DOMAIN , TYPE , DESCRIPTION , OWNER , CUSTOM_1 , CUSTOM_2 , CUSTOM_3 , CUSTOM_4 , ORG_LEVEL_1 , ORG_LEVEL_2 , ORG_LEVEL_3 , ORG_LEVEL_4 , MARKED_FOR_DELETION );
|
||||
INSERT INTO WORKBASKET VALUES ('WBI:000000000000000000000000000000000001', 'USER-1-1' , RELATIVE_DATE(0) , RELATIVE_DATE(0) , 'PPK User 1 KSC 1', 'MONITOR_TEST_DOMAIN', 'PERSONAL', 'Monitor Test Postkorb 1', 'John' , '' , '' , '' , '' , 'org1' , '' , '' , '' , FALSE );
|
||||
INSERT INTO WORKBASKET VALUES ('WBI:000000000000000000000000000000000002', 'USER-1-2' , RELATIVE_DATE(0) , RELATIVE_DATE(0) , 'PPK User 1 KSC 2', 'MONITOR_TEST_DOMAIN', 'PERSONAL', 'Monitor Test Postkorb 2', 'John' , '' , '' , '' , '' , '' , '' , '' , '' , FALSE );
|
||||
INSERT INTO WORKBASKET VALUES ('WBI:000000000000000000000000000000000003', 'USER-1-3' , RELATIVE_DATE(0) , RELATIVE_DATE(0) , 'PPK User 1 KSC 3', 'MONITOR_TEST_DOMAIN', 'PERSONAL', 'Monitor Test Postkorb 3', 'John' , '' , '' , '' , '' , 'org1' , '' , '' , '' , FALSE );
|
||||
INSERT INTO WORKBASKET VALUES ('WBI:000000000000000000000000000000000004', 'USER-1-4' , RELATIVE_DATE(0) , RELATIVE_DATE(0) , 'PPK User 1 KSC 4', 'MONITOR_TEST_DOMAIN', 'PERSONAL', 'Monitor Test Postkorb 4', 'John' , '' , '' , '' , '' , '' , '' , '' , '' , FALSE );
|
||||
INSERT INTO WORKBASKET VALUES ('WBI:000000000000000000000000000000000005', 'GPK-1' , RELATIVE_DATE(0) , RELATIVE_DATE(0) , 'GPK GruppenPk 1' , 'MONITOR_TEST_DOMAIN', 'GROUP' , 'Monitor Test Postkorb 5', 'John' , '' , '' , '' , '' , '' , '' , '' , '' , FALSE );
|
||||
INSERT INTO WORKBASKET VALUES ('WBI:000000000000000000000000000000000006', 'TPK-VIP-1', RELATIVE_DATE(0) , RELATIVE_DATE(0) , 'TPK VIP 1' , 'MONITOR_TEST_DOMAIN', 'TOPIC' , 'Monitor Test Postkorb 6', 'John' , '' , '' , '' , '' , '' , '' , '' , '' , FALSE );
|
||||
|
||||
-- CLASSIFICATION TABLE (ID , KEY , PARENT_ID , PARENT_KEY, CATEGORY , TYPE , DOMAIN , VALID_IN_DOMAIN, CREATED , MODIFIED ,NAME , DESCRIPTION , PRIORITY, SERVICE_LEVEL, APPLICATION_ENTRY_POINT, CUSTOM_1 , CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, CUSTOM_6, CUSTOM_7, CUSTOM_8 );
|
||||
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000001', 'L10000', '' , '' , 'EXTERN' , 'TASK', 'DOMAIN_A', TRUE , RELATIVE_DATE(0) , RELATIVE_DATE(0) , 'OLD-Leistungsfall' , 'OLD-Leistungsfall' , 3 , 'P1D' , '' , 'VNR,RVNR,KOLVNR' , '' , '' , '' , '' , '' , '' , '' );
|
||||
|
@ -79,3 +81,8 @@ INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000047', 'ETI:0000000
|
|||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000048', 'ETI:000000000000000000000000000000000048', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(210) , 'Task48', 'teamlead-2', 'Some description.', 'Some custom Note', 1 , -1 , 'CLAIMED', 'MANUAL' , 'L40000' , 'CLI:000000000000000000000000000000000004', 'WBI:000000000000000000000000000000000001', 'USER-1-1' , 'DOMAIN_A', 'BPI21' , 'PBPI21' , 'John', 'MyCompany1', 'MySystem1', 'MyInstance1', 'MyType1', 'MyValue1', true , false , null , 'NONE' , null , 'Geschaeftsstelle A' , 'Vollkasko' , null , null , null , null , null , null , null , null , null , null , null , null , null , 'VALUE_48' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000049', 'ETI:000000000000000000000000000000000049', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(28000) , 'Task49', 'teamlead-2', 'Some description.', 'Some custom Note', 1 , -1 , 'CLAIMED', 'MANUAL' , 'L40000' , 'CLI:000000000000000000000000000000000004', 'WBI:000000000000000000000000000000000003', 'USER-1-3' , 'DOMAIN_A', 'BPI21' , 'PBPI21' , 'John', 'MyCompany1', 'MySystem1', 'MyInstance1', 'MyType1', 'MyValue1', true , false , null , 'NONE' , null , 'Geschaeftsstelle C' , 'Vollkasko' , null , null , null , null , null , null , null , null , null , null , null , null , null , 'VALUE_49' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000050', 'ETI:000000000000000000000000000000000050', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) ,RELATIVE_DATE(700000), 'Task50', 'teamlead-2', 'Some description.', 'Some custom Note', 1 , -1 , 'CLAIMED', 'MANUAL' , 'L40000' , 'CLI:000000000000000000000000000000000004', 'WBI:000000000000000000000000000000000002', 'USER-1-2' , 'DOMAIN_C', 'BPI21' , 'PBPI21' , 'John', 'MyCompany1', 'MySystem1', 'MyInstance1', 'MyType1', 'MyValue1', true , false , null , 'NONE' , null , 'Geschaeftsstelle A' , 'Teilkasko' , null , null , null , null , null , null , null , null , null , null , null , null , null , 'VALUE_50' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
||||
-- Task for TransferAccTest
|
||||
INSERT INTO TASK VALUES('TKI:100000000000000000000000000000000098', 'ETI:100000000000000000000000000000000098', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(7) , 'Task51', 'teamlead-1', 'Some description.', 'Some custom Note', 305 , -1 , 'READY' , 'EXTERN' , 'L50000' , 'CLI:000000000000000000000000000000000005', 'WBI:000000000000000000000000000000000005', 'GPK-1' , 'DOMAIN_C', 'BPI21' , 'PBPI21' , 'John', 'MyCompany1', 'MySystem1', 'MyInstance1', 'MyType1', 'MyValue1', true , false , null , 'NONE' , null , 'Geschaeftsstelle B' , 'Teilkasko' , null , null , null , null , null , null , null , null , null , null , null , null , null , 'VALUE_41' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
||||
INSERT INTO TASK VALUES('TKI:200000000000000000000000000000000099', 'ETI:200000000000000000000000000000000099', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(14) , 'Task52', 'teamlead-1', 'Some description.', 'Some custom Note', 505 , -1 , 'CLAIMED', 'EXTERN' , 'L50000' , 'CLI:000000000000000000000000000000000005', 'WBI:000000000000000000000000000000000005', 'GPK-1' , 'DOMAIN_C', 'BPI21' , 'PBPI21' , 'John', 'MyCompany1', 'MySystem1', 'MyInstance1', 'MyType1', 'MyValue1', true , false , null , 'NONE' , null , 'Geschaeftsstelle C' , 'Teilkasko' , null , null , null , null , null , null , null , null , null , null , null , null , null , 'VALUE_42' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
||||
INSERT INTO TASK VALUES('TKI:200000000000000000000000000000000100', 'ETI:200000000000000000000000000000000100', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(14) , 'Task53', 'teamlead-2', 'Some description.', 'Some custom Note', 605 , -1 , 'CLAIMED', 'EXTERN' , 'L50000' , 'CLI:000000000000000000000000000000000005', 'WBI:000000000000000000000000000000000006', 'TPK-VIP-1' , 'DOMAIN_B', 'BPI21' , 'PBPI21' , 'John', 'MyCompany1', 'MySystem1', 'MyInstance1', 'MyType1', 'MyValue1', true , false , null , 'NONE' , null , 'Geschaeftsstelle C' , 'Vollkasko' , null , null , null , null , null , null , null , null , null , null , null , null , null , 'VALUE_43' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
||||
INSERT INTO TASK VALUES('TKI:200000000000000000000000000000000101', 'ETI:200000000000000000000000000000000101', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(14) , 'Task54', 'teamlead-2', 'Some description.', 'Some custom Note', 305 , -1 , 'CLAIMED', 'AUTOMATIC' , 'L30000' , 'CLI:000000000000000000000000000000000003', 'WBI:000000000000000000000000000000000006', 'TPK-VIP-1' , 'DOMAIN_A', 'BPI21' , 'PBPI21' , 'John', 'MyCompany1', 'MySystem1', 'MyInstance1', 'MyType1', 'MyValue1', true , false , null , 'NONE' , null , 'Geschaeftsstelle C' , 'Teilkasko' , null , null , null , null , null , null , null , null , null , null , null , null , null , 'VALUE_44' , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
|
||||
|
|
|
@ -5,6 +5,7 @@ import pro.taskana.monitor.api.reports.ClassificationReport;
|
|||
import pro.taskana.monitor.api.reports.TaskCustomFieldValueReport;
|
||||
import pro.taskana.monitor.api.reports.TaskStatusReport;
|
||||
import pro.taskana.monitor.api.reports.TimestampReport;
|
||||
import pro.taskana.monitor.api.reports.WorkbasketPriorityReport;
|
||||
import pro.taskana.monitor.api.reports.WorkbasketReport;
|
||||
import pro.taskana.task.api.TaskCustomField;
|
||||
|
||||
|
@ -12,17 +13,23 @@ import pro.taskana.task.api.TaskCustomField;
|
|||
public interface MonitorService {
|
||||
|
||||
/**
|
||||
* Provides a {@link WorkbasketReport.Builder} for creating a {@link WorkbasketReport}, list the
|
||||
* task ids of this report and list the values of an entered custom attribute.
|
||||
* Provides a {@link WorkbasketReport.Builder} for creating a {@link WorkbasketReport}.
|
||||
*
|
||||
* @return a {@link WorkbasketReport.Builder}
|
||||
*/
|
||||
WorkbasketReport.Builder createWorkbasketReportBuilder();
|
||||
|
||||
/**
|
||||
* Provides a {@link WorkbasketPriorityReport.Builder} for creating a {@link
|
||||
* WorkbasketPriorityReport}.
|
||||
*
|
||||
* @return a {@link WorkbasketReport.Builder}
|
||||
*/
|
||||
WorkbasketPriorityReport.Builder createWorkbasketPriorityReportBuilder();
|
||||
|
||||
/**
|
||||
* Provides a {@link ClassificationCategoryReport.Builder} for creating a {@link
|
||||
* ClassificationCategoryReport}, list the task ids of this report and list the values of an
|
||||
* entered custom attribute.
|
||||
* ClassificationCategoryReport}.
|
||||
*
|
||||
* @return a {@link ClassificationCategoryReport.Builder}
|
||||
*/
|
||||
|
@ -30,8 +37,7 @@ public interface MonitorService {
|
|||
|
||||
/**
|
||||
* Provides a {@link ClassificationReport.Builder} for creating a {@link ClassificationReport} or
|
||||
* a DetailedClassificationReport, list the task ids of these reports and list the values of an
|
||||
* entered custom attribute.
|
||||
* a {@link pro.taskana.monitor.api.reports.ClassificationReport.DetailedClassificationReport}.
|
||||
*
|
||||
* @return a {@link ClassificationReport.Builder}
|
||||
*/
|
||||
|
@ -39,7 +45,7 @@ public interface MonitorService {
|
|||
|
||||
/**
|
||||
* Provides a {@link TaskCustomFieldValueReport.Builder} for creating a {@link
|
||||
* TaskCustomFieldValueReport} and list the values of an entered custom attribute.
|
||||
* TaskCustomFieldValueReport}.
|
||||
*
|
||||
* @param taskCustomField the customField whose values should appear in the report
|
||||
* @return a {@link TaskCustomFieldValueReport.Builder}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package pro.taskana.monitor.api.reports;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -110,6 +111,19 @@ public abstract class Report<I extends QueryItem, H extends ColumnHeader<? super
|
|||
return new SingleRow<>(key, columnSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Report [reportRows="
|
||||
+ reportRows
|
||||
+ ", sumRow="
|
||||
+ sumRow
|
||||
+ ", rowDesc="
|
||||
+ Arrays.toString(rowDesc)
|
||||
+ ", columnHeaders="
|
||||
+ columnHeaders
|
||||
+ "]";
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for {@link Report}.
|
||||
*
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package pro.taskana.monitor.api.reports;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.monitor.api.reports.header.ColumnHeader;
|
||||
import pro.taskana.monitor.api.reports.header.PriorityColumnHeader;
|
||||
import pro.taskana.monitor.api.reports.item.PriorityQueryItem;
|
||||
import pro.taskana.monitor.api.reports.row.Row;
|
||||
import pro.taskana.task.api.models.Task;
|
||||
import pro.taskana.workbasket.api.WorkbasketType;
|
||||
import pro.taskana.workbasket.api.models.Workbasket;
|
||||
|
||||
/**
|
||||
* A WorkbasketReport aggregates {@linkplain Task} related data.
|
||||
*
|
||||
* <p>Each {@linkplain Row} represents a {@linkplain Workbasket}.
|
||||
*
|
||||
* <p>Each {@linkplain ColumnHeader} represents a {@linkplain Task#getPriority() priority range}.
|
||||
*/
|
||||
public class WorkbasketPriorityReport extends Report<PriorityQueryItem, PriorityColumnHeader> {
|
||||
|
||||
public WorkbasketPriorityReport(List<PriorityColumnHeader> priorityColumnHeaders) {
|
||||
super(priorityColumnHeaders, new String[] {"WORKBASKET"});
|
||||
}
|
||||
|
||||
/** Builder for {@link WorkbasketPriorityReport}. */
|
||||
public interface Builder extends Report.Builder<PriorityQueryItem, PriorityColumnHeader> {
|
||||
|
||||
@Override
|
||||
WorkbasketPriorityReport buildReport() throws NotAuthorizedException;
|
||||
|
||||
/**
|
||||
* Adds {@linkplain WorkbasketType WorkbasketTypes} to the builder. The created report will only
|
||||
* contain Tasks from {@linkplain Workbasket}s with one of the provided types.
|
||||
*
|
||||
* @param workbasketTypes the workbasketTypes to include in the report
|
||||
* @return the builder
|
||||
*/
|
||||
Builder workbasketTypeIn(WorkbasketType... workbasketTypes);
|
||||
|
||||
/**
|
||||
* Adds a list of {@linkplain PriorityColumnHeader}s to the builder to subdivide the report into
|
||||
* clusters.
|
||||
*
|
||||
* @param columnHeaders the column headers the report should consist of.
|
||||
* @return the builder
|
||||
*/
|
||||
Builder withColumnHeaders(List<PriorityColumnHeader> columnHeaders);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package pro.taskana.monitor.api.reports.header;
|
||||
|
||||
import pro.taskana.monitor.api.reports.item.PriorityQueryItem;
|
||||
|
||||
public class PriorityColumnHeader implements ColumnHeader<PriorityQueryItem> {
|
||||
|
||||
private final int lowerBoundInc;
|
||||
private final int upperBoundInc;
|
||||
|
||||
public PriorityColumnHeader(int lowerBoundInc, int upperBoundInc) {
|
||||
this.lowerBoundInc = lowerBoundInc;
|
||||
this.upperBoundInc = upperBoundInc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
if (lowerBoundInc == Integer.MIN_VALUE) {
|
||||
return "<" + upperBoundInc;
|
||||
} else if (upperBoundInc == Integer.MAX_VALUE) {
|
||||
return ">" + lowerBoundInc;
|
||||
} else {
|
||||
return lowerBoundInc + " - " + upperBoundInc;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fits(PriorityQueryItem item) {
|
||||
return lowerBoundInc <= item.getPriority() && upperBoundInc >= item.getPriority();
|
||||
}
|
||||
}
|
|
@ -22,8 +22,7 @@ public class TimeIntervalColumnHeader implements ColumnHeader<AgeQueryItem> {
|
|||
private final int upperAgeLimit;
|
||||
|
||||
public TimeIntervalColumnHeader(int ageInDays) {
|
||||
this.lowerAgeLimit = ageInDays;
|
||||
this.upperAgeLimit = ageInDays;
|
||||
this(ageInDays, ageInDays);
|
||||
}
|
||||
|
||||
public TimeIntervalColumnHeader(int lowerAgeLimit, int upperAgeLimit) {
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package pro.taskana.monitor.api.reports.item;
|
||||
|
||||
public class PriorityQueryItem implements QueryItem {
|
||||
|
||||
private String workbasketKey;
|
||||
private int count;
|
||||
private int priority;
|
||||
|
||||
public int getPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return workbasketKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getValue() {
|
||||
return count;
|
||||
}
|
||||
}
|
|
@ -1,13 +1,8 @@
|
|||
package pro.taskana.monitor.api.reports.item;
|
||||
|
||||
import pro.taskana.monitor.api.reports.Report;
|
||||
import pro.taskana.monitor.api.reports.row.Row;
|
||||
|
||||
/**
|
||||
* A QueryItem is en entity on which a {@link Report} is based on. Its value will be added to the
|
||||
* existing cell value during the insertion into a report. Its key will determine in which {@link
|
||||
* Row} the item will be inserted.
|
||||
*/
|
||||
/** A QueryItem is en entity on which a {@link Report} is based on. */
|
||||
public interface QueryItem {
|
||||
|
||||
/**
|
||||
|
@ -17,5 +12,10 @@ public interface QueryItem {
|
|||
*/
|
||||
String getKey();
|
||||
|
||||
/**
|
||||
* Its value will be added to the existing cell value during the insertion into a report.
|
||||
*
|
||||
* @return the value
|
||||
*/
|
||||
int getValue();
|
||||
}
|
||||
|
|
|
@ -39,13 +39,12 @@ public class TaskQueryItem implements QueryItem {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaskQueryItem ["
|
||||
+ "domain= "
|
||||
+ this.workbasketKey
|
||||
+ ", state= "
|
||||
+ this.state.name()
|
||||
+ ", count= "
|
||||
+ this.count
|
||||
return "TaskQueryItem [workbasketKey="
|
||||
+ workbasketKey
|
||||
+ ", state="
|
||||
+ state
|
||||
+ ", count="
|
||||
+ count
|
||||
+ "]";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,10 @@ import pro.taskana.monitor.api.TaskTimestamp;
|
|||
import pro.taskana.monitor.api.reports.TimeIntervalReportBuilder;
|
||||
import pro.taskana.monitor.api.reports.item.DetailedMonitorQueryItem;
|
||||
import pro.taskana.monitor.api.reports.item.MonitorQueryItem;
|
||||
import pro.taskana.monitor.api.reports.item.PriorityQueryItem;
|
||||
import pro.taskana.monitor.api.reports.item.TaskQueryItem;
|
||||
import pro.taskana.monitor.api.reports.item.TimestampQueryItem;
|
||||
import pro.taskana.monitor.internal.reports.WorkbasketPriorityReportBuilderImpl;
|
||||
import pro.taskana.task.api.TaskCustomField;
|
||||
import pro.taskana.task.api.TaskState;
|
||||
|
||||
|
@ -115,4 +117,11 @@ public interface MonitorMapper {
|
|||
@Param("now") Instant now,
|
||||
@Param("status") TaskTimestamp status,
|
||||
@Param("report") TimeIntervalReportBuilder<?, ?, ?> report);
|
||||
|
||||
@SelectProvider(type = MonitorMapperSqlProvider.class, method = "getTaskCountByPriority")
|
||||
@Result(column = "WORKBASKET_KEY", property = "workbasketKey")
|
||||
@Result(column = "COUNT", property = "count")
|
||||
@Result(column = "PRIORITY", property = "priority")
|
||||
List<PriorityQueryItem> getTaskCountByPriority(
|
||||
@Param("report") WorkbasketPriorityReportBuilderImpl report);
|
||||
}
|
||||
|
|
|
@ -275,6 +275,20 @@ public class MonitorMapperSqlProvider {
|
|||
+ CLOSING_SCRIPT_TAG;
|
||||
}
|
||||
|
||||
public static String getTaskCountByPriority() {
|
||||
StringBuilder whereStatements = new StringBuilder();
|
||||
whereIn("report.workbasketType", "W.TYPE", whereStatements);
|
||||
return OPENING_SCRIPT_TAG
|
||||
+ "SELECT T.WORKBASKET_KEY, T.PRIORITY, COUNT(T.PRIORITY) as COUNT "
|
||||
+ "FROM TASK as T "
|
||||
+ "INNER JOIN WORKBASKET as W ON W.ID = T.WORKBASKET_ID "
|
||||
+ OPENING_WHERE_TAG
|
||||
+ whereStatements
|
||||
+ CLOSING_WHERE_TAG
|
||||
+ "GROUP BY T.WORKBASKET_KEY, T.PRIORITY"
|
||||
+ CLOSING_SCRIPT_TAG;
|
||||
}
|
||||
|
||||
private static String timeIntervalWhereStatements() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
SqlProviderUtil.whereIn("report.workbasketIds", "T.WORKBASKET_ID", sb);
|
||||
|
|
|
@ -7,12 +7,14 @@ import pro.taskana.monitor.api.reports.ClassificationReport;
|
|||
import pro.taskana.monitor.api.reports.TaskCustomFieldValueReport;
|
||||
import pro.taskana.monitor.api.reports.TaskStatusReport;
|
||||
import pro.taskana.monitor.api.reports.TimestampReport;
|
||||
import pro.taskana.monitor.api.reports.WorkbasketPriorityReport;
|
||||
import pro.taskana.monitor.api.reports.WorkbasketReport;
|
||||
import pro.taskana.monitor.internal.reports.ClassificationCategoryReportBuilderImpl;
|
||||
import pro.taskana.monitor.internal.reports.ClassificationReportBuilderImpl;
|
||||
import pro.taskana.monitor.internal.reports.TaskCustomFieldValueReportBuilderImpl;
|
||||
import pro.taskana.monitor.internal.reports.TaskStatusReportBuilderImpl;
|
||||
import pro.taskana.monitor.internal.reports.TimestampReportBuilderImpl;
|
||||
import pro.taskana.monitor.internal.reports.WorkbasketPriorityReportBuilderImpl;
|
||||
import pro.taskana.monitor.internal.reports.WorkbasketReportBuilderImpl;
|
||||
import pro.taskana.task.api.TaskCustomField;
|
||||
|
||||
|
@ -33,6 +35,11 @@ public class MonitorServiceImpl implements MonitorService {
|
|||
return new WorkbasketReportBuilderImpl(taskanaEngine, monitorMapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkbasketPriorityReport.Builder createWorkbasketPriorityReportBuilder() {
|
||||
return new WorkbasketPriorityReportBuilderImpl(taskanaEngine, monitorMapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassificationCategoryReport.Builder createClassificationCategoryReportBuilder() {
|
||||
return new ClassificationCategoryReportBuilderImpl(taskanaEngine, monitorMapper);
|
||||
|
|
|
@ -69,7 +69,7 @@ public class TimestampReportBuilderImpl
|
|||
status.stream()
|
||||
// This can also be implemented into a single sql query which combines all statuses
|
||||
// with the union operator. That would reduce the readability of the sql template.
|
||||
// That's why "the loop" is done outside of mybatis.
|
||||
// That's why "the loop" is done outside mybatis.
|
||||
.map(this::getTasksCountForStatusGroupedByOrgLevel)
|
||||
.flatMap(Collection::stream)
|
||||
.collect(Collectors.toList());
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
package pro.taskana.monitor.internal.reports;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import pro.taskana.common.api.TaskanaRole;
|
||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.common.internal.InternalTaskanaEngine;
|
||||
import pro.taskana.monitor.api.reports.WorkbasketPriorityReport;
|
||||
import pro.taskana.monitor.api.reports.WorkbasketPriorityReport.Builder;
|
||||
import pro.taskana.monitor.api.reports.header.PriorityColumnHeader;
|
||||
import pro.taskana.monitor.api.reports.item.PriorityQueryItem;
|
||||
import pro.taskana.monitor.internal.MonitorMapper;
|
||||
import pro.taskana.workbasket.api.WorkbasketType;
|
||||
|
||||
public class WorkbasketPriorityReportBuilderImpl implements WorkbasketPriorityReport.Builder {
|
||||
|
||||
private final InternalTaskanaEngine taskanaEngine;
|
||||
private final MonitorMapper monitorMapper;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private WorkbasketType[] workbasketType;
|
||||
|
||||
private List<PriorityColumnHeader> columnHeaders;
|
||||
|
||||
public WorkbasketPriorityReportBuilderImpl(
|
||||
InternalTaskanaEngine taskanaEngine, MonitorMapper monitorMapper) {
|
||||
this.taskanaEngine = taskanaEngine;
|
||||
this.monitorMapper = monitorMapper;
|
||||
columnHeaders = Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkbasketPriorityReport buildReport() throws NotAuthorizedException {
|
||||
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN);
|
||||
|
||||
WorkbasketPriorityReport report = new WorkbasketPriorityReport(columnHeaders);
|
||||
List<PriorityQueryItem> items =
|
||||
taskanaEngine.executeInDatabaseConnection(
|
||||
() -> monitorMapper.getTaskCountByPriority(this));
|
||||
report.addItems(items);
|
||||
return report;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder workbasketTypeIn(WorkbasketType... workbasketTypes) {
|
||||
this.workbasketType = workbasketTypes;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder withColumnHeaders(List<PriorityColumnHeader> columnHeaders) {
|
||||
this.columnHeaders = columnHeaders;
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -20,7 +20,6 @@ import pro.taskana.monitor.internal.preprocessor.DaysToWorkingDaysReportPreProce
|
|||
import pro.taskana.workbasket.api.WorkbasketService;
|
||||
import pro.taskana.workbasket.api.models.WorkbasketSummary;
|
||||
|
||||
/** The implementation of WorkbasketReportBuilder. */
|
||||
public class WorkbasketReportBuilderImpl
|
||||
extends TimeIntervalReportBuilderImpl<Builder, MonitorQueryItem, TimeIntervalColumnHeader>
|
||||
implements WorkbasketReport.Builder {
|
||||
|
|
|
@ -94,13 +94,13 @@ class ProvideClassificationCategoryReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(report).isNotNull();
|
||||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
|
||||
assertThat(report.getRow("EXTERN").getTotalValue()).isEqualTo(33);
|
||||
assertThat(report.getRow("AUTOMATIC").getTotalValue()).isEqualTo(7);
|
||||
assertThat(report.getRow("EXTERN").getTotalValue()).isEqualTo(36);
|
||||
assertThat(report.getRow("AUTOMATIC").getTotalValue()).isEqualTo(8);
|
||||
assertThat(report.getRow("MANUAL").getTotalValue()).isEqualTo(10);
|
||||
assertThat(report.getRow("EXTERN").getCells()).isEmpty();
|
||||
assertThat(report.getRow("AUTOMATIC").getCells()).isEmpty();
|
||||
assertThat(report.getRow("MANUAL").getCells()).isEmpty();
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(54);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -118,13 +118,13 @@ class ProvideClassificationCategoryReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(report).isNotNull();
|
||||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
|
||||
assertThat(report.getRow("EXTERN").getTotalValue()).isEqualTo(33);
|
||||
assertThat(report.getRow("AUTOMATIC").getTotalValue()).isEqualTo(7);
|
||||
assertThat(report.getRow("EXTERN").getTotalValue()).isEqualTo(36);
|
||||
assertThat(report.getRow("AUTOMATIC").getTotalValue()).isEqualTo(8);
|
||||
assertThat(report.getRow("MANUAL").getTotalValue()).isEqualTo(10);
|
||||
|
||||
int[] sumRow = report.getSumRow().getCells();
|
||||
assertThat(sumRow).isEqualTo(new int[] {10, 9, 11, 0, 4, 0, 7, 4, 5});
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
|
||||
assertThat(sumRow).isEqualTo(new int[] {10, 9, 11, 0, 4, 0, 8, 7, 5});
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(54);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -143,10 +143,10 @@ class ProvideClassificationCategoryReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
|
||||
int[] row1 = report.getRow("EXTERN").getCells();
|
||||
assertThat(row1).isEqualTo(new int[] {15, 8, 2, 6, 2});
|
||||
assertThat(row1).isEqualTo(new int[] {15, 8, 2, 7, 4});
|
||||
|
||||
int[] row2 = report.getRow("AUTOMATIC").getCells();
|
||||
assertThat(row2).isEqualTo(new int[] {2, 1, 0, 1, 3});
|
||||
assertThat(row2).isEqualTo(new int[] {2, 1, 0, 1, 4});
|
||||
|
||||
int[] row3 = report.getRow("MANUAL").getCells();
|
||||
assertThat(row3).isEqualTo(new int[] {2, 2, 2, 0, 4});
|
||||
|
@ -184,10 +184,10 @@ class ProvideClassificationCategoryReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
|
||||
int[] row1 = report.getRow("EXTERN").getCells();
|
||||
assertThat(row1).isEqualTo(new int[] {0, 3, 30, 0, 0});
|
||||
assertThat(row1).isEqualTo(new int[] {0, 3, 33, 0, 0});
|
||||
|
||||
int[] row2 = report.getRow("AUTOMATIC").getCells();
|
||||
assertThat(row2).isEqualTo(new int[] {0, 0, 7, 0, 0});
|
||||
assertThat(row2).isEqualTo(new int[] {0, 0, 8, 0, 0});
|
||||
|
||||
int[] row3 = report.getRow("MANUAL").getCells();
|
||||
assertThat(row3).isEqualTo(new int[] {0, 0, 10, 0, 0});
|
||||
|
@ -208,10 +208,10 @@ class ProvideClassificationCategoryReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
|
||||
int[] row1 = report.getRow("EXTERN").getCells();
|
||||
assertThat(row1).isEqualTo(new int[] {23, 0, 2, 0, 8});
|
||||
assertThat(row1).isEqualTo(new int[] {23, 0, 2, 0, 11});
|
||||
|
||||
int[] row2 = report.getRow("AUTOMATIC").getCells();
|
||||
assertThat(row2).isEqualTo(new int[] {3, 0, 0, 0, 4});
|
||||
assertThat(row2).isEqualTo(new int[] {3, 0, 0, 0, 5});
|
||||
|
||||
int[] row3 = report.getRow("MANUAL").getCells();
|
||||
assertThat(row3).isEqualTo(new int[] {4, 0, 2, 0, 4});
|
||||
|
@ -262,7 +262,7 @@ class ProvideClassificationCategoryReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
|
||||
int[] row1 = report.getRow("EXTERN").getCells();
|
||||
assertThat(row1).isEqualTo(new int[] {15, 8, 2, 6, 0});
|
||||
assertThat(row1).isEqualTo(new int[] {15, 8, 2, 7, 0});
|
||||
|
||||
int[] row2 = report.getRow("AUTOMATIC").getCells();
|
||||
assertThat(row2).isEqualTo(new int[] {2, 1, 0, 1, 0});
|
||||
|
@ -289,7 +289,7 @@ class ProvideClassificationCategoryReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(report.rowSize()).isEqualTo(2);
|
||||
|
||||
int[] row1 = report.getRow("AUTOMATIC").getCells();
|
||||
assertThat(row1).isEqualTo(new int[] {2, 1, 0, 1, 3});
|
||||
assertThat(row1).isEqualTo(new int[] {2, 1, 0, 1, 4});
|
||||
|
||||
int[] row2 = report.getRow("MANUAL").getCells();
|
||||
assertThat(row2).isEqualTo(new int[] {2, 2, 2, 0, 4});
|
||||
|
@ -316,7 +316,7 @@ class ProvideClassificationCategoryReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(row1).isEqualTo(new int[] {8, 4, 2, 4, 0});
|
||||
|
||||
int[] row2 = report.getRow("AUTOMATIC").getCells();
|
||||
assertThat(row2).isEqualTo(new int[] {1, 0, 0, 1, 1});
|
||||
assertThat(row2).isEqualTo(new int[] {1, 0, 0, 1, 2});
|
||||
|
||||
int[] row3 = report.getRow("MANUAL").getCells();
|
||||
assertThat(row3).isEqualTo(new int[] {2, 0, 0, 0, 3});
|
||||
|
@ -366,10 +366,10 @@ class ProvideClassificationCategoryReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
|
||||
int[] row1 = report.getRow("EXTERN").getCells();
|
||||
assertThat(row1).isEqualTo(new int[] {6, 5, 1, 3, 2});
|
||||
assertThat(row1).isEqualTo(new int[] {6, 5, 1, 4, 4});
|
||||
|
||||
int[] row2 = report.getRow("AUTOMATIC").getCells();
|
||||
assertThat(row2).isEqualTo(new int[] {1, 1, 0, 0, 2});
|
||||
assertThat(row2).isEqualTo(new int[] {1, 1, 0, 0, 3});
|
||||
|
||||
int[] row3 = report.getRow("MANUAL").getCells();
|
||||
assertThat(row3).isEqualTo(new int[] {1, 1, 0, 0, 2});
|
||||
|
|
|
@ -95,15 +95,15 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
|
|||
|
||||
assertThat(report.getRow("L10000").getTotalValue()).isEqualTo(10);
|
||||
assertThat(report.getRow("L20000").getTotalValue()).isEqualTo(10);
|
||||
assertThat(report.getRow("L30000").getTotalValue()).isEqualTo(7);
|
||||
assertThat(report.getRow("L30000").getTotalValue()).isEqualTo(8);
|
||||
assertThat(report.getRow("L40000").getTotalValue()).isEqualTo(10);
|
||||
assertThat(report.getRow("L50000").getTotalValue()).isEqualTo(13);
|
||||
assertThat(report.getRow("L50000").getTotalValue()).isEqualTo(16);
|
||||
assertThat(report.getRow("L10000").getCells()).isEmpty();
|
||||
assertThat(report.getRow("L20000").getCells()).isEmpty();
|
||||
assertThat(report.getRow("L30000").getCells()).isEmpty();
|
||||
assertThat(report.getRow("L40000").getCells()).isEmpty();
|
||||
assertThat(report.getRow("L50000").getCells()).isEmpty();
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(54);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -123,12 +123,12 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
|
|||
|
||||
assertThat(report.getRow("L10000").getTotalValue()).isEqualTo(10);
|
||||
assertThat(report.getRow("L20000").getTotalValue()).isEqualTo(10);
|
||||
assertThat(report.getRow("L30000").getTotalValue()).isEqualTo(7);
|
||||
assertThat(report.getRow("L30000").getTotalValue()).isEqualTo(8);
|
||||
assertThat(report.getRow("L40000").getTotalValue()).isEqualTo(10);
|
||||
assertThat(report.getRow("L50000").getTotalValue()).isEqualTo(13);
|
||||
assertThat(report.getRow("L50000").getTotalValue()).isEqualTo(16);
|
||||
|
||||
assertThat(report.getSumRow().getCells()).isEqualTo(new int[] {10, 9, 11, 0, 4, 0, 7, 4, 5});
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
|
||||
assertThat(report.getSumRow().getCells()).isEqualTo(new int[] {10, 9, 11, 0, 4, 0, 8, 7, 5});
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(54);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -153,13 +153,13 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(row2).isEqualTo(new int[] {5, 3, 1, 1, 0});
|
||||
|
||||
int[] row3 = report.getRow("L30000").getCells();
|
||||
assertThat(row3).isEqualTo(new int[] {2, 1, 0, 1, 3});
|
||||
assertThat(row3).isEqualTo(new int[] {2, 1, 0, 1, 4});
|
||||
|
||||
int[] row4 = report.getRow("L40000").getCells();
|
||||
assertThat(row4).isEqualTo(new int[] {2, 2, 2, 0, 4});
|
||||
|
||||
int[] row5 = report.getRow("L50000").getCells();
|
||||
assertThat(row5).isEqualTo(new int[] {3, 3, 0, 5, 2});
|
||||
assertThat(row5).isEqualTo(new int[] {3, 3, 0, 6, 4});
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -197,13 +197,13 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(row2).isEqualTo(new int[] {0, 1, 9, 0, 0});
|
||||
|
||||
int[] row3 = report.getRow("L30000").getCells();
|
||||
assertThat(row3).isEqualTo(new int[] {0, 0, 7, 0, 0});
|
||||
assertThat(row3).isEqualTo(new int[] {0, 0, 8, 0, 0});
|
||||
|
||||
int[] row4 = report.getRow("L40000").getCells();
|
||||
assertThat(row4).isEqualTo(new int[] {0, 0, 10, 0, 0});
|
||||
|
||||
int[] row5 = report.getRow("L50000").getCells();
|
||||
assertThat(row5).isEqualTo(new int[] {0, 0, 13, 0, 0});
|
||||
assertThat(row5).isEqualTo(new int[] {0, 0, 16, 0, 0});
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -227,13 +227,13 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(row2).isEqualTo(new int[] {8, 0, 1, 0, 1});
|
||||
|
||||
int[] row3 = report.getRow("L30000").getCells();
|
||||
assertThat(row3).isEqualTo(new int[] {3, 0, 0, 0, 4});
|
||||
assertThat(row3).isEqualTo(new int[] {3, 0, 0, 0, 5});
|
||||
|
||||
int[] row4 = report.getRow("L40000").getCells();
|
||||
assertThat(row4).isEqualTo(new int[] {4, 0, 2, 0, 4});
|
||||
|
||||
int[] row5 = report.getRow("L50000").getCells();
|
||||
assertThat(row5).isEqualTo(new int[] {6, 0, 0, 0, 7});
|
||||
assertThat(row5).isEqualTo(new int[] {6, 0, 0, 0, 10});
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -299,7 +299,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(row4).isEqualTo(new int[] {2, 2, 2, 0, 0});
|
||||
|
||||
int[] row5 = report.getRow("L50000").getCells();
|
||||
assertThat(row5).isEqualTo(new int[] {3, 3, 0, 5, 0});
|
||||
assertThat(row5).isEqualTo(new int[] {3, 3, 0, 6, 0});
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -320,7 +320,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(report.rowSize()).isEqualTo(2);
|
||||
|
||||
int[] row1 = report.getRow("L30000").getCells();
|
||||
assertThat(row1).isEqualTo(new int[] {2, 1, 0, 1, 3});
|
||||
assertThat(row1).isEqualTo(new int[] {2, 1, 0, 1, 4});
|
||||
|
||||
int[] row2 = report.getRow("L40000").getCells();
|
||||
assertThat(row2).isEqualTo(new int[] {2, 2, 2, 0, 4});
|
||||
|
@ -350,7 +350,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(row2).isEqualTo(new int[] {3, 1, 1, 1, 0});
|
||||
|
||||
int[] row3 = report.getRow("L30000").getCells();
|
||||
assertThat(row3).isEqualTo(new int[] {1, 0, 0, 1, 1});
|
||||
assertThat(row3).isEqualTo(new int[] {1, 0, 0, 1, 2});
|
||||
|
||||
int[] row4 = report.getRow("L40000").getCells();
|
||||
assertThat(row4).isEqualTo(new int[] {2, 0, 0, 0, 3});
|
||||
|
@ -416,13 +416,13 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(row2).isEqualTo(new int[] {1, 2, 0, 0, 0});
|
||||
|
||||
int[] row3 = report.getRow("L30000").getCells();
|
||||
assertThat(row3).isEqualTo(new int[] {1, 1, 0, 0, 2});
|
||||
assertThat(row3).isEqualTo(new int[] {1, 1, 0, 0, 3});
|
||||
|
||||
int[] row4 = report.getRow("L40000").getCells();
|
||||
assertThat(row4).isEqualTo(new int[] {1, 1, 0, 0, 2});
|
||||
|
||||
int[] row5 = report.getRow("L50000").getCells();
|
||||
assertThat(row5).isEqualTo(new int[] {2, 1, 0, 3, 2});
|
||||
assertThat(row5).isEqualTo(new int[] {2, 1, 0, 4, 4});
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
|
|
@ -144,10 +144,10 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(row2.getFoldableRowCount()).isEqualTo(2);
|
||||
|
||||
FoldableRow<DetailedMonitorQueryItem> row3 = report.getRow("L30000");
|
||||
assertThat(row3.getTotalValue()).isEqualTo(7);
|
||||
assertThat(row3.getTotalValue()).isEqualTo(8);
|
||||
assertThat(row3.getFoldableRow("L33000").getTotalValue()).isEqualTo(3);
|
||||
assertThat(row3.getFoldableRow("L99000").getTotalValue()).isEqualTo(1);
|
||||
assertThat(row3.getFoldableRow("N/A").getTotalValue()).isEqualTo(3);
|
||||
assertThat(row3.getFoldableRow("N/A").getTotalValue()).isEqualTo(4);
|
||||
assertThat(row3.getCells()).isEmpty();
|
||||
assertThat(row3.getFoldableRowCount()).isEqualTo(3);
|
||||
|
||||
|
@ -158,12 +158,12 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(row4.getFoldableRowCount()).isEqualTo(1);
|
||||
|
||||
FoldableRow<DetailedMonitorQueryItem> row5 = report.getRow("L50000");
|
||||
assertThat(row5.getTotalValue()).isEqualTo(13);
|
||||
assertThat(row5.getFoldableRow("N/A").getTotalValue()).isEqualTo(13);
|
||||
assertThat(row5.getTotalValue()).isEqualTo(16);
|
||||
assertThat(row5.getFoldableRow("N/A").getTotalValue()).isEqualTo(16);
|
||||
assertThat(row5.getCells()).isEmpty();
|
||||
assertThat(row5.getFoldableRowCount()).isEqualTo(1);
|
||||
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(54);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -183,13 +183,13 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
|
|||
|
||||
assertThat(report.getRow("L10000").getTotalValue()).isEqualTo(10);
|
||||
assertThat(report.getRow("L20000").getTotalValue()).isEqualTo(10);
|
||||
assertThat(report.getRow("L30000").getTotalValue()).isEqualTo(7);
|
||||
assertThat(report.getRow("L30000").getTotalValue()).isEqualTo(8);
|
||||
assertThat(report.getRow("L40000").getTotalValue()).isEqualTo(10);
|
||||
assertThat(report.getRow("L50000").getTotalValue()).isEqualTo(13);
|
||||
assertThat(report.getRow("L50000").getTotalValue()).isEqualTo(16);
|
||||
|
||||
int[] sumRow = report.getSumRow().getCells();
|
||||
assertThat(sumRow).isEqualTo(new int[] {10, 9, 11, 0, 4, 0, 7, 4, 5});
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
|
||||
assertThat(sumRow).isEqualTo(new int[] {10, 9, 11, 0, 4, 0, 8, 7, 5});
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(54);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -242,7 +242,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(detailedLineNoAttachment2.getCells()).isEqualTo(new int[] {4, 2, 0, 0, 0});
|
||||
|
||||
FoldableRow<DetailedMonitorQueryItem> line3 = report.getRow("L30000");
|
||||
assertThat(line3.getCells()).isEqualTo(new int[] {2, 1, 0, 1, 3});
|
||||
assertThat(line3.getCells()).isEqualTo(new int[] {2, 1, 0, 1, 4});
|
||||
|
||||
Row<DetailedMonitorQueryItem> detailedLine3a = line3.getFoldableRow("L33000");
|
||||
assertThat(detailedLine3a.getCells()).isEqualTo(new int[] {0, 1, 0, 1, 1});
|
||||
|
@ -251,7 +251,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(detailedLine3b.getCells()).isEqualTo(new int[] {0, 0, 0, 0, 1});
|
||||
|
||||
Row<DetailedMonitorQueryItem> detailedLineNoAttachment3 = line3.getFoldableRow("N/A");
|
||||
assertThat(detailedLineNoAttachment3.getCells()).isEqualTo(new int[] {2, 0, 0, 0, 1});
|
||||
assertThat(detailedLineNoAttachment3.getCells()).isEqualTo(new int[] {2, 0, 0, 0, 2});
|
||||
|
||||
FoldableRow<DetailedMonitorQueryItem> line4 = report.getRow("L40000");
|
||||
assertThat(line4.getCells()).isEqualTo(new int[] {2, 2, 2, 0, 4});
|
||||
|
@ -260,10 +260,10 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(detailedLineNoAttachment4.getCells()).isEqualTo(new int[] {2, 2, 2, 0, 4});
|
||||
|
||||
FoldableRow<DetailedMonitorQueryItem> line5 = report.getRow("L50000");
|
||||
assertThat(line5.getCells()).isEqualTo(new int[] {3, 3, 0, 5, 2});
|
||||
assertThat(line5.getCells()).isEqualTo(new int[] {3, 3, 0, 6, 4});
|
||||
|
||||
Row<DetailedMonitorQueryItem> detailedLineNoAttachment5 = line5.getFoldableRow("N/A");
|
||||
assertThat(detailedLineNoAttachment5.getCells()).isEqualTo(new int[] {3, 3, 0, 5, 2});
|
||||
assertThat(detailedLineNoAttachment5.getCells()).isEqualTo(new int[] {3, 3, 0, 6, 4});
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -300,7 +300,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(detailedLineNoAttachment2.getCells()).isEqualTo(new int[] {0, 1, 5, 0, 0});
|
||||
|
||||
FoldableRow<DetailedMonitorQueryItem> line3 = report.getRow("L30000");
|
||||
assertThat(line3.getCells()).isEqualTo(new int[] {0, 0, 7, 0, 0});
|
||||
assertThat(line3.getCells()).isEqualTo(new int[] {0, 0, 8, 0, 0});
|
||||
|
||||
Row<DetailedMonitorQueryItem> detailedLine3a = line3.getFoldableRow("L33000");
|
||||
assertThat(detailedLine3a.getCells()).isEqualTo(new int[] {0, 0, 3, 0, 0});
|
||||
|
@ -309,7 +309,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(detailedLine3b.getCells()).isEqualTo(new int[] {0, 0, 1, 0, 0});
|
||||
|
||||
Row<DetailedMonitorQueryItem> detailedLineNoAttachment3 = line3.getFoldableRow("N/A");
|
||||
assertThat(detailedLineNoAttachment3.getCells()).isEqualTo(new int[] {0, 0, 3, 0, 0});
|
||||
assertThat(detailedLineNoAttachment3.getCells()).isEqualTo(new int[] {0, 0, 4, 0, 0});
|
||||
|
||||
FoldableRow<DetailedMonitorQueryItem> line4 = report.getRow("L40000");
|
||||
assertThat(line4.getCells()).isEqualTo(new int[] {0, 0, 10, 0, 0});
|
||||
|
@ -318,10 +318,10 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(detailedLineNoAttachment4.getCells()).isEqualTo(new int[] {0, 0, 10, 0, 0});
|
||||
|
||||
FoldableRow<DetailedMonitorQueryItem> line5 = report.getRow("L50000");
|
||||
assertThat(line5.getCells()).isEqualTo(new int[] {0, 0, 13, 0, 0});
|
||||
assertThat(line5.getCells()).isEqualTo(new int[] {0, 0, 16, 0, 0});
|
||||
|
||||
Row<DetailedMonitorQueryItem> detailedLineNoAttachment5 = line5.getFoldableRow("N/A");
|
||||
assertThat(detailedLineNoAttachment5.getCells()).isEqualTo(new int[] {0, 0, 13, 0, 0});
|
||||
assertThat(detailedLineNoAttachment5.getCells()).isEqualTo(new int[] {0, 0, 16, 0, 0});
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -432,10 +432,10 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(detailedLineNoAttachment4.getCells()).isEqualTo(new int[] {2, 2, 2, 0, 0});
|
||||
|
||||
FoldableRow<DetailedMonitorQueryItem> line5 = report.getRow("L50000");
|
||||
assertThat(line5.getCells()).isEqualTo(new int[] {3, 3, 0, 5, 0});
|
||||
assertThat(line5.getCells()).isEqualTo(new int[] {3, 3, 0, 6, 0});
|
||||
|
||||
Row<DetailedMonitorQueryItem> detailedLineNoAttachment5 = line5.getFoldableRow("N/A");
|
||||
assertThat(detailedLineNoAttachment5.getCells()).isEqualTo(new int[] {3, 3, 0, 5, 0});
|
||||
assertThat(detailedLineNoAttachment5.getCells()).isEqualTo(new int[] {3, 3, 0, 6, 0});
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -471,7 +471,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(detailedLineNoAttachment2.getCells()).isEqualTo(new int[] {6, 0, 0, 0, 0});
|
||||
|
||||
FoldableRow<DetailedMonitorQueryItem> line3 = report.getRow("L30000");
|
||||
assertThat(line3.getCells()).isEqualTo(new int[] {3, 0, 0, 0, 4});
|
||||
assertThat(line3.getCells()).isEqualTo(new int[] {3, 0, 0, 0, 5});
|
||||
|
||||
Row<DetailedMonitorQueryItem> detailedLine3a = line3.getFoldableRow("L33000");
|
||||
assertThat(detailedLine3a.getCells()).isEqualTo(new int[] {1, 0, 0, 0, 2});
|
||||
|
@ -480,7 +480,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(detailedLine3b.getCells()).isEqualTo(new int[] {0, 0, 0, 0, 1});
|
||||
|
||||
Row<DetailedMonitorQueryItem> detailedLineNoAttachment3 = line3.getFoldableRow("N/A");
|
||||
assertThat(detailedLineNoAttachment3.getCells()).isEqualTo(new int[] {2, 0, 0, 0, 1});
|
||||
assertThat(detailedLineNoAttachment3.getCells()).isEqualTo(new int[] {2, 0, 0, 0, 2});
|
||||
|
||||
FoldableRow<DetailedMonitorQueryItem> line4 = report.getRow("L40000");
|
||||
assertThat(line4.getCells()).isEqualTo(new int[] {4, 0, 2, 0, 4});
|
||||
|
@ -489,10 +489,10 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(detailedLineNoAttachment4.getCells()).isEqualTo(new int[] {4, 0, 2, 0, 4});
|
||||
|
||||
FoldableRow<DetailedMonitorQueryItem> line5 = report.getRow("L50000");
|
||||
assertThat(line5.getCells()).isEqualTo(new int[] {6, 0, 0, 0, 7});
|
||||
assertThat(line5.getCells()).isEqualTo(new int[] {6, 0, 0, 0, 10});
|
||||
|
||||
Row<DetailedMonitorQueryItem> detailedLineNoAttachment5 = line5.getFoldableRow("N/A");
|
||||
assertThat(detailedLineNoAttachment5.getCells()).isEqualTo(new int[] {6, 0, 0, 0, 7});
|
||||
assertThat(detailedLineNoAttachment5.getCells()).isEqualTo(new int[] {6, 0, 0, 0, 10});
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -513,7 +513,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(report.rowSize()).isEqualTo(2);
|
||||
|
||||
FoldableRow<DetailedMonitorQueryItem> line1 = report.getRow("L30000");
|
||||
assertThat(line1.getCells()).isEqualTo(new int[] {2, 1, 0, 1, 3});
|
||||
assertThat(line1.getCells()).isEqualTo(new int[] {2, 1, 0, 1, 4});
|
||||
|
||||
Row<DetailedMonitorQueryItem> detailedLine1a = line1.getFoldableRow("L33000");
|
||||
assertThat(detailedLine1a.getCells()).isEqualTo(new int[] {0, 1, 0, 1, 1});
|
||||
|
@ -522,7 +522,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(detailedLine1b.getCells()).isEqualTo(new int[] {0, 0, 0, 0, 1});
|
||||
|
||||
Row<DetailedMonitorQueryItem> detailedLine1WithoutAttachment = line1.getFoldableRow("N/A");
|
||||
assertThat(detailedLine1WithoutAttachment.getCells()).isEqualTo(new int[] {2, 0, 0, 0, 1});
|
||||
assertThat(detailedLine1WithoutAttachment.getCells()).isEqualTo(new int[] {2, 0, 0, 0, 2});
|
||||
|
||||
FoldableRow<DetailedMonitorQueryItem> line2 = report.getRow("L40000");
|
||||
assertThat(line2.getCells()).isEqualTo(new int[] {2, 2, 2, 0, 4});
|
||||
|
@ -567,13 +567,13 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(detailedLineNoAttachment2.getCells()).isEqualTo(new int[] {2, 1, 0, 0, 0});
|
||||
|
||||
FoldableRow<DetailedMonitorQueryItem> line3 = report.getRow("L30000");
|
||||
assertThat(line3.getCells()).isEqualTo(new int[] {1, 0, 0, 1, 1});
|
||||
assertThat(line3.getCells()).isEqualTo(new int[] {1, 0, 0, 1, 2});
|
||||
|
||||
Row<DetailedMonitorQueryItem> detailedLine3 = line3.getFoldableRow("L33000");
|
||||
assertThat(detailedLine3.getCells()).isEqualTo(new int[] {0, 0, 0, 1, 1});
|
||||
|
||||
Row<DetailedMonitorQueryItem> detailedLineNoAttachment3 = line3.getFoldableRow("N/A");
|
||||
assertThat(detailedLineNoAttachment3.getCells()).isEqualTo(new int[] {1, 0, 0, 0, 0});
|
||||
assertThat(detailedLineNoAttachment3.getCells()).isEqualTo(new int[] {1, 0, 0, 0, 1});
|
||||
|
||||
FoldableRow<DetailedMonitorQueryItem> line4 = report.getRow("L40000");
|
||||
assertThat(line4.getCells()).isEqualTo(new int[] {2, 0, 0, 0, 3});
|
||||
|
|
|
@ -89,13 +89,13 @@ class ProvideTaskCustomFieldValueReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
|
||||
assertThat(report.getRow("Geschaeftsstelle A").getTotalValue()).isEqualTo(25);
|
||||
assertThat(report.getRow("Geschaeftsstelle B").getTotalValue()).isEqualTo(10);
|
||||
assertThat(report.getRow("Geschaeftsstelle C").getTotalValue()).isEqualTo(15);
|
||||
assertThat(report.getRow("Geschaeftsstelle B").getTotalValue()).isEqualTo(11);
|
||||
assertThat(report.getRow("Geschaeftsstelle C").getTotalValue()).isEqualTo(18);
|
||||
assertThat(report.getRow("Geschaeftsstelle A").getCells()).isEmpty();
|
||||
assertThat(report.getRow("Geschaeftsstelle B").getCells()).isEmpty();
|
||||
assertThat(report.getRow("Geschaeftsstelle C").getCells()).isEmpty();
|
||||
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(54);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -109,13 +109,13 @@ class ProvideTaskCustomFieldValueReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(report).isNotNull();
|
||||
assertThat(report.rowSize()).isEqualTo(2);
|
||||
|
||||
assertThat(report.getRow("Vollkasko").getTotalValue()).isEqualTo(21);
|
||||
assertThat(report.getRow("Teilkasko").getTotalValue()).isEqualTo(29);
|
||||
assertThat(report.getRow("Vollkasko").getTotalValue()).isEqualTo(22);
|
||||
assertThat(report.getRow("Teilkasko").getTotalValue()).isEqualTo(32);
|
||||
|
||||
assertThat(report.getRow("Vollkasko").getCells()).isEmpty();
|
||||
assertThat(report.getRow("Teilkasko").getCells()).isEmpty();
|
||||
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(54);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -135,12 +135,12 @@ class ProvideTaskCustomFieldValueReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
|
||||
assertThat(report.getRow("Geschaeftsstelle A").getTotalValue()).isEqualTo(25);
|
||||
assertThat(report.getRow("Geschaeftsstelle B").getTotalValue()).isEqualTo(10);
|
||||
assertThat(report.getRow("Geschaeftsstelle C").getTotalValue()).isEqualTo(15);
|
||||
assertThat(report.getRow("Geschaeftsstelle B").getTotalValue()).isEqualTo(11);
|
||||
assertThat(report.getRow("Geschaeftsstelle C").getTotalValue()).isEqualTo(18);
|
||||
|
||||
assertThat(report.getSumRow().getCells()).isEqualTo(new int[] {10, 9, 11, 0, 4, 0, 7, 4, 5});
|
||||
assertThat(report.getSumRow().getCells()).isEqualTo(new int[] {10, 9, 11, 0, 4, 0, 8, 7, 5});
|
||||
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(54);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -178,10 +178,10 @@ class ProvideTaskCustomFieldValueReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(row1).isEqualTo(new int[] {11, 4, 3, 4, 3});
|
||||
|
||||
int[] row2 = report.getRow("Geschaeftsstelle B").getCells();
|
||||
assertThat(row2).isEqualTo(new int[] {5, 3, 0, 2, 0});
|
||||
assertThat(row2).isEqualTo(new int[] {5, 3, 0, 3, 0});
|
||||
|
||||
int[] row3 = report.getRow("Geschaeftsstelle C").getCells();
|
||||
assertThat(row3).isEqualTo(new int[] {3, 4, 1, 1, 6});
|
||||
assertThat(row3).isEqualTo(new int[] {3, 4, 1, 1, 9});
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -203,10 +203,10 @@ class ProvideTaskCustomFieldValueReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(row1).isEqualTo(new int[] {0, 1, 24, 0, 0});
|
||||
|
||||
int[] row2 = report.getRow("Geschaeftsstelle B").getCells();
|
||||
assertThat(row2).isEqualTo(new int[] {0, 1, 9, 0, 0});
|
||||
assertThat(row2).isEqualTo(new int[] {0, 1, 10, 0, 0});
|
||||
|
||||
int[] row3 = report.getRow("Geschaeftsstelle C").getCells();
|
||||
assertThat(row3).isEqualTo(new int[] {0, 1, 14, 0, 0});
|
||||
assertThat(row3).isEqualTo(new int[] {0, 1, 17, 0, 0});
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -227,10 +227,10 @@ class ProvideTaskCustomFieldValueReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(row1).isEqualTo(new int[] {15, 0, 3, 0, 7});
|
||||
|
||||
int[] row2 = report.getRow("Geschaeftsstelle B").getCells();
|
||||
assertThat(row2).isEqualTo(new int[] {8, 0, 0, 0, 2});
|
||||
assertThat(row2).isEqualTo(new int[] {8, 0, 0, 0, 3});
|
||||
|
||||
int[] row3 = report.getRow("Geschaeftsstelle C").getCells();
|
||||
assertThat(row3).isEqualTo(new int[] {7, 0, 1, 0, 7});
|
||||
assertThat(row3).isEqualTo(new int[] {7, 0, 1, 0, 10});
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -281,7 +281,7 @@ class ProvideTaskCustomFieldValueReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(row1).isEqualTo(new int[] {11, 4, 3, 4, 0});
|
||||
|
||||
int[] row2 = report.getRow("Geschaeftsstelle B").getCells();
|
||||
assertThat(row2).isEqualTo(new int[] {5, 3, 0, 2, 0});
|
||||
assertThat(row2).isEqualTo(new int[] {5, 3, 0, 3, 0});
|
||||
|
||||
int[] row3 = report.getRow("Geschaeftsstelle C").getCells();
|
||||
assertThat(row3).isEqualTo(new int[] {3, 4, 1, 1, 0});
|
||||
|
@ -311,7 +311,7 @@ class ProvideTaskCustomFieldValueReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(row2).isEqualTo(new int[] {2, 0, 0, 0, 0});
|
||||
|
||||
int[] row3 = report.getRow("Geschaeftsstelle C").getCells();
|
||||
assertThat(row3).isEqualTo(new int[] {0, 2, 0, 0, 4});
|
||||
assertThat(row3).isEqualTo(new int[] {0, 2, 0, 0, 5});
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -338,7 +338,7 @@ class ProvideTaskCustomFieldValueReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(row2).isEqualTo(new int[] {2, 2, 0, 1, 0});
|
||||
|
||||
int[] row3 = report.getRow("Geschaeftsstelle C").getCells();
|
||||
assertThat(row3).isEqualTo(new int[] {1, 1, 1, 0, 3});
|
||||
assertThat(row3).isEqualTo(new int[] {1, 1, 1, 0, 4});
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
|
|
@ -33,7 +33,7 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
void should_ThrowException_IfUserIsNotAuthorized() {
|
||||
void should_ThrowException_When_UserIsNotAuthorized() {
|
||||
assertThatThrownBy(() -> MONITOR_SERVICE.createTaskStatusReportBuilder().buildReport())
|
||||
.isInstanceOf(NotAuthorizedException.class);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
|
|||
@WithAccessId(user = "businessadmin")
|
||||
@WithAccessId(user = "taskadmin")
|
||||
@TestTemplate
|
||||
void should_ThrowException_IfUserIsNotAdminOrMonitor() {
|
||||
void should_ThrowException_When_UserIsNotAdminOrMonitor() {
|
||||
assertThatThrownBy(() -> MONITOR_SERVICE.createTaskStatusReportBuilder().buildReport())
|
||||
.isInstanceOf(NotAuthorizedException.class);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
|
|||
@WithAccessId(user = "admin")
|
||||
@WithAccessId(user = "monitor")
|
||||
@TestTemplate
|
||||
void should_BuildReport_IfUserIsAdminOrMonitor() {
|
||||
void should_BuildReport_When_UserIsAdminOrMonitor() {
|
||||
assertThatCode(() -> MONITOR_SERVICE.createTaskStatusReportBuilder().buildReport())
|
||||
.doesNotThrowAnyException();
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
|
|||
void should_AugmentDisplayNames_When_ReportIsBuild() throws Exception {
|
||||
TaskStatusReport report = MONITOR_SERVICE.createTaskStatusReportBuilder().buildReport();
|
||||
|
||||
assertThat(report.getRows()).hasSize(3);
|
||||
assertThat(report.getRows()).hasSize(5);
|
||||
assertThat(report.getRow("USER-1-1").getDisplayName()).isEqualTo("PPK User 1 KSC 1");
|
||||
assertThat(report.getRow("USER-1-2").getDisplayName()).isEqualTo("PPK User 1 KSC 2");
|
||||
assertThat(report.getRow("USER-1-3").getDisplayName()).isEqualTo("PPK User 1 KSC 3");
|
||||
|
@ -87,7 +87,7 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
|
|||
TaskStatusReport report = MONITOR_SERVICE.createTaskStatusReportBuilder().buildReport();
|
||||
|
||||
assertThat(report).isNotNull();
|
||||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
assertThat(report.rowSize()).isEqualTo(5);
|
||||
|
||||
Row<TaskQueryItem> row1 = report.getRow("USER-1-1");
|
||||
assertThat(row1.getCells()).isEqualTo(new int[] {18, 2, 0, 0, 0});
|
||||
|
@ -102,8 +102,8 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(row3.getTotalValue()).isEqualTo(10);
|
||||
|
||||
Row<TaskQueryItem> sumRow = report.getSumRow();
|
||||
assertThat(sumRow.getCells()).isEqualTo(new int[] {41, 9, 0, 0, 0});
|
||||
assertThat(sumRow.getTotalValue()).isEqualTo(50);
|
||||
assertThat(sumRow.getCells()).isEqualTo(new int[] {42, 12, 0, 0, 0});
|
||||
assertThat(sumRow.getTotalValue()).isEqualTo(54);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -116,7 +116,7 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
|
|||
.buildReport();
|
||||
|
||||
assertThat(report).isNotNull();
|
||||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
assertThat(report.rowSize()).isEqualTo(5);
|
||||
|
||||
Row<TaskQueryItem> row1 = report.getRow("USER-1-1");
|
||||
assertThat(row1.getCells()).isEqualTo(new int[] {15, 2, 0, 0, 0});
|
||||
|
@ -131,8 +131,8 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(row3.getTotalValue()).isEqualTo(6);
|
||||
|
||||
Row<TaskQueryItem> sumRow = report.getSumRow();
|
||||
assertThat(sumRow.getCells()).isEqualTo(new int[] {32, 6, 0, 0, 0});
|
||||
assertThat(sumRow.getTotalValue()).isEqualTo(38);
|
||||
assertThat(sumRow.getCells()).isEqualTo(new int[] {33, 8, 0, 0, 0});
|
||||
assertThat(sumRow.getTotalValue()).isEqualTo(41);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -145,7 +145,7 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
|
|||
.buildReport();
|
||||
|
||||
assertThat(report).isNotNull();
|
||||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
assertThat(report.rowSize()).isEqualTo(4);
|
||||
|
||||
Row<TaskQueryItem> row1 = report.getRow("USER-1-1");
|
||||
assertThat(row1.getCells()).isEqualTo(new int[] {18});
|
||||
|
@ -160,8 +160,8 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(row3.getTotalValue()).isEqualTo(4);
|
||||
|
||||
Row<TaskQueryItem> sumRow = report.getSumRow();
|
||||
assertThat(sumRow.getCells()).isEqualTo(new int[] {41});
|
||||
assertThat(sumRow.getTotalValue()).isEqualTo(41);
|
||||
assertThat(sumRow.getCells()).isEqualTo(new int[] {42});
|
||||
assertThat(sumRow.getTotalValue()).isEqualTo(42);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor", groups = "admin")
|
||||
|
@ -199,15 +199,15 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
|
|||
MONITOR_SERVICE.createTaskStatusReportBuilder().priorityMinimum(5).buildReport();
|
||||
|
||||
assertThat(report).isNotNull();
|
||||
assertThat(report.rowSize()).isEqualTo(2);
|
||||
assertThat(report.rowSize()).isEqualTo(4);
|
||||
|
||||
Row<TaskQueryItem> row1 = report.getRow("USER-1-1");
|
||||
assertThat(row1.getCells()).isEqualTo(new int[] {3, 1, 0, 0, 0});
|
||||
assertThat(row1.getTotalValue()).isEqualTo(4);
|
||||
|
||||
Row<TaskQueryItem> sumRow = report.getSumRow();
|
||||
assertThat(sumRow.getCells()).isEqualTo(new int[] {3, 2, 0, 0, 0});
|
||||
assertThat(sumRow.getTotalValue()).isEqualTo(5);
|
||||
assertThat(sumRow.getCells()).isEqualTo(new int[] {4, 5, 0, 0, 0});
|
||||
assertThat(sumRow.getTotalValue()).isEqualTo(9);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
|
|
@ -66,7 +66,7 @@ class ProvideTimestampReportAccTest extends AbstractReportAccTest {
|
|||
|
||||
assertThat(report.rowSize()).isEqualTo(2);
|
||||
assertThat(report.getRow("CREATED").getCells())
|
||||
.isEqualTo(new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26});
|
||||
.isEqualTo(new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27});
|
||||
assertThat(report.getRow("COMPLETED").getCells())
|
||||
.isEqualTo(new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
package acceptance.report;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatCode;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestTemplate;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import pro.taskana.common.api.exceptions.MismatchedRoleException;
|
||||
import pro.taskana.common.test.security.JaasExtension;
|
||||
import pro.taskana.common.test.security.WithAccessId;
|
||||
import pro.taskana.monitor.api.MonitorService;
|
||||
import pro.taskana.monitor.api.reports.Report;
|
||||
import pro.taskana.monitor.api.reports.WorkbasketPriorityReport;
|
||||
import pro.taskana.monitor.api.reports.header.PriorityColumnHeader;
|
||||
import pro.taskana.monitor.api.reports.row.Row;
|
||||
import pro.taskana.workbasket.api.WorkbasketType;
|
||||
|
||||
/** Acceptance test for all "workbasket priority report" scenarios. */
|
||||
@ExtendWith(JaasExtension.class)
|
||||
class ProvideWorkbasketPriorityReportAccTest extends AbstractReportAccTest {
|
||||
|
||||
private static final MonitorService MONITOR_SERVICE = taskanaEngine.getMonitorService();
|
||||
|
||||
private static final List<PriorityColumnHeader> LOW_TEST_HEADERS =
|
||||
Arrays.asList(
|
||||
new PriorityColumnHeader(Integer.MIN_VALUE, 1),
|
||||
new PriorityColumnHeader(2, Integer.MAX_VALUE));
|
||||
|
||||
private static final List<PriorityColumnHeader> DEFAULT_TEST_HEADERS =
|
||||
Arrays.asList(
|
||||
new PriorityColumnHeader(Integer.MIN_VALUE, 249),
|
||||
new PriorityColumnHeader(250, 500),
|
||||
new PriorityColumnHeader(501, Integer.MAX_VALUE));
|
||||
|
||||
@WithAccessId(user = "admin")
|
||||
@WithAccessId(user = "monitor")
|
||||
@TestTemplate
|
||||
void should_NotThrowExceptions_When_UserIsAdminOrMonitor() {
|
||||
assertThatCode(() -> MONITOR_SERVICE.createWorkbasketPriorityReportBuilder().buildReport())
|
||||
.doesNotThrowAnyException();
|
||||
}
|
||||
|
||||
@WithAccessId(user = "user-1-1")
|
||||
@WithAccessId(user = "businessadmin")
|
||||
@TestTemplate
|
||||
void should_ThrowMismatchedRoleException_When_UserDoesNotHaveCorrectRole() {
|
||||
assertThatThrownBy(() -> MONITOR_SERVICE.createWorkbasketPriorityReportBuilder().buildReport())
|
||||
.isInstanceOf(MismatchedRoleException.class);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
@Test
|
||||
void should_BuildReport_When_UserIsAuthorized() throws Exception {
|
||||
WorkbasketPriorityReport priorityReport =
|
||||
MONITOR_SERVICE
|
||||
.createWorkbasketPriorityReportBuilder()
|
||||
.withColumnHeaders(LOW_TEST_HEADERS)
|
||||
.buildReport();
|
||||
int[] expectedCells = {45, 9};
|
||||
assertThat(priorityReport)
|
||||
.extracting(Report::getSumRow)
|
||||
.extracting(Row::getCells)
|
||||
.isEqualTo(expectedCells);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
@Test
|
||||
void should_OnlyIncludeWantedWorkbasketTypesReport_When_UsingWorkbasketTypeIn() throws Exception {
|
||||
WorkbasketPriorityReport priorityReport =
|
||||
MONITOR_SERVICE
|
||||
.createWorkbasketPriorityReportBuilder()
|
||||
.withColumnHeaders(DEFAULT_TEST_HEADERS)
|
||||
.workbasketTypeIn(WorkbasketType.GROUP, WorkbasketType.TOPIC)
|
||||
.buildReport();
|
||||
int[] expectedCells = {0, 2, 2};
|
||||
assertThat(priorityReport)
|
||||
.extracting(Report::getSumRow)
|
||||
.extracting(Row::getCells)
|
||||
.isEqualTo(expectedCells);
|
||||
}
|
||||
}
|
|
@ -43,7 +43,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
|
|||
@Test
|
||||
void should_AugmentDisplayNames_When_ReportIsBuild() throws Exception {
|
||||
WorkbasketReport report = MONITOR_SERVICE.createWorkbasketReportBuilder().buildReport();
|
||||
assertThat(report.getRows()).hasSize(3);
|
||||
assertThat(report.getRows()).hasSize(5);
|
||||
assertThat(report.getRow("USER-1-1").getDisplayName()).isEqualTo("PPK User 1 KSC 1");
|
||||
assertThat(report.getRow("USER-1-2").getDisplayName()).isEqualTo("PPK User 1 KSC 2");
|
||||
assertThat(report.getRow("USER-1-3").getDisplayName()).isEqualTo("PPK User 1 KSC 3");
|
||||
|
@ -69,13 +69,13 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
|
|||
WorkbasketReport report = MONITOR_SERVICE.createWorkbasketReportBuilder().buildReport();
|
||||
|
||||
assertThat(report).isNotNull();
|
||||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
assertThat(report.rowSize()).isEqualTo(5);
|
||||
|
||||
assertThat(report.getRow("USER-1-1").getTotalValue()).isEqualTo(20);
|
||||
assertThat(report.getRow("USER-1-2").getTotalValue()).isEqualTo(20);
|
||||
assertThat(report.getRow("USER-1-3").getTotalValue()).isEqualTo(10);
|
||||
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(54);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -110,15 +110,15 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
|
|||
.buildReport();
|
||||
|
||||
assertThat(report).isNotNull();
|
||||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
assertThat(report.rowSize()).isEqualTo(5);
|
||||
|
||||
assertThat(report.getRow("USER-1-1").getTotalValue()).isEqualTo(20);
|
||||
assertThat(report.getRow("USER-1-2").getTotalValue()).isEqualTo(20);
|
||||
assertThat(report.getRow("USER-1-3").getTotalValue()).isEqualTo(10);
|
||||
|
||||
int[] sumRow = report.getSumRow().getCells();
|
||||
assertThat(sumRow).isEqualTo(new int[] {10, 9, 11, 0, 4, 0, 7, 4, 5});
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
|
||||
assertThat(sumRow).isEqualTo(new int[] {10, 9, 11, 0, 4, 0, 8, 7, 5});
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(54);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
@ -147,7 +147,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
|
|||
.buildReport();
|
||||
|
||||
assertThat(report).isNotNull();
|
||||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
assertThat(report.rowSize()).isEqualTo(5);
|
||||
|
||||
int[] row1 = report.getRow("USER-1-1").getCells();
|
||||
assertThat(row1).isEqualTo(new int[] {13, 3, 1, 1, 2});
|
||||
|
@ -172,7 +172,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
|
|||
.buildReport(TaskTimestamp.PLANNED);
|
||||
|
||||
assertThat(report).isNotNull();
|
||||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
assertThat(report.rowSize()).isEqualTo(5);
|
||||
int[] row1 = report.getRow("USER-1-1").getCells();
|
||||
assertThat(row1).isEqualTo(new int[] {0, 2, 18, 0, 0});
|
||||
|
||||
|
@ -195,7 +195,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
|
|||
.buildReport();
|
||||
|
||||
assertThat(report).isNotNull();
|
||||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
assertThat(report.rowSize()).isEqualTo(5);
|
||||
|
||||
int[] row1 = report.getRow("USER-1-1").getCells();
|
||||
assertThat(row1).isEqualTo(new int[] {16, 0, 1, 0, 3});
|
||||
|
@ -243,7 +243,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
|
|||
.buildReport();
|
||||
|
||||
assertThat(report).isNotNull();
|
||||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
assertThat(report.rowSize()).isEqualTo(4);
|
||||
|
||||
int[] row1 = report.getRow("USER-1-1").getCells();
|
||||
assertThat(row1).isEqualTo(new int[] {13, 3, 1, 1, 0});
|
||||
|
@ -270,7 +270,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
|
|||
.buildReport();
|
||||
|
||||
assertThat(report).isNotNull();
|
||||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
assertThat(report.rowSize()).isEqualTo(4);
|
||||
|
||||
int[] row1 = report.getRow("USER-1-1").getCells();
|
||||
assertThat(row1).isEqualTo(new int[] {3, 1, 1, 1, 2});
|
||||
|
@ -297,7 +297,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
|
|||
.buildReport();
|
||||
|
||||
assertThat(report).isNotNull();
|
||||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
assertThat(report.rowSize()).isEqualTo(4);
|
||||
|
||||
int[] row1 = report.getRow("USER-1-1").getCells();
|
||||
assertThat(row1).isEqualTo(new int[] {8, 1, 0, 1, 2});
|
||||
|
@ -350,7 +350,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
|
|||
.buildReport();
|
||||
|
||||
assertThat(report).isNotNull();
|
||||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
assertThat(report.rowSize()).isEqualTo(5);
|
||||
|
||||
int[] row1 = report.getRow("USER-1-1").getCells();
|
||||
assertThat(row1).isEqualTo(new int[] {7, 2, 0, 0, 1});
|
||||
|
@ -409,7 +409,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
|
|||
.buildReport();
|
||||
|
||||
assertThat(report).isNotNull();
|
||||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
assertThat(report.rowSize()).isEqualTo(5);
|
||||
|
||||
int[] row1 = report.getRow("USER-1-1").getCells();
|
||||
assertThat(row1).isEqualTo(new int[] {3, 3, 0, 1, 1});
|
||||
|
@ -434,7 +434,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
|
|||
.buildReport(TaskTimestamp.PLANNED);
|
||||
|
||||
assertThat(report).isNotNull();
|
||||
assertThat(report.rowSize()).isEqualTo(3);
|
||||
assertThat(report.rowSize()).isEqualTo(5);
|
||||
|
||||
assertThat(report.getRow("USER-1-1").getTotalValue()).isEqualTo(20);
|
||||
assertThat(report.getRow("USER-1-2").getTotalValue()).isEqualTo(20);
|
||||
|
@ -442,7 +442,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(report.getRow("USER-1-1").getCells()[2]).isEqualTo(2);
|
||||
assertThat(report.getRow("USER-1-2").getCells()[1]).isEqualTo(1);
|
||||
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
|
||||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(54);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
|
|
|
@ -112,7 +112,7 @@ class UpdateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
@WithAccessId(user = "user-1-1")
|
||||
@Test
|
||||
void should_UpdatePrimaryObjectReferenceOfTask_When_ObjectreferenceSystemAndSystemInstanceIsNull()
|
||||
void should_UpdatePrimaryObjectReferenceOfTask_When_ObjectReferenceSystemAndSystemInstanceIsNull()
|
||||
throws Exception {
|
||||
|
||||
Task task = taskService.getTask("TKI:000000000000000000000000000000000000");
|
||||
|
|
|
@ -56,6 +56,8 @@ public final class RestEndpoints {
|
|||
|
||||
// monitor endpoints
|
||||
public static final String URL_MONITOR_WORKBASKET_REPORT = API_V1 + "monitor/workbasket-report";
|
||||
public static final String URL_MONITOR_WORKBASKET_PRIORITY_REPORT =
|
||||
API_V1 + "monitor/workbasket-priority-report";
|
||||
public static final String URL_MONITOR_CLASSIFICATION_CATEGORY_REPORT =
|
||||
API_V1 + "monitor/classification-category-report";
|
||||
public static final String URL_MONITOR_CLASSIFICATION_REPORT =
|
||||
|
|
|
@ -21,11 +21,14 @@ import pro.taskana.monitor.api.reports.ClassificationCategoryReport;
|
|||
import pro.taskana.monitor.api.reports.ClassificationReport;
|
||||
import pro.taskana.monitor.api.reports.TaskCustomFieldValueReport;
|
||||
import pro.taskana.monitor.api.reports.TimestampReport;
|
||||
import pro.taskana.monitor.api.reports.WorkbasketPriorityReport;
|
||||
import pro.taskana.monitor.api.reports.WorkbasketReport;
|
||||
import pro.taskana.monitor.api.reports.header.PriorityColumnHeader;
|
||||
import pro.taskana.monitor.rest.assembler.ReportRepresentationModelAssembler;
|
||||
import pro.taskana.monitor.rest.models.ReportRepresentationModel;
|
||||
import pro.taskana.task.api.TaskCustomField;
|
||||
import pro.taskana.task.api.TaskState;
|
||||
import pro.taskana.workbasket.api.WorkbasketType;
|
||||
|
||||
/** Controller for all monitoring endpoints. */
|
||||
@RestController
|
||||
|
@ -78,6 +81,55 @@ public class MonitorController {
|
|||
return ResponseEntity.status(HttpStatus.OK).body(report);
|
||||
}
|
||||
|
||||
/**
|
||||
* This endpoint generates a Workbasket Report by priority. This Report currently
|
||||
*
|
||||
* <p>Each Row represents a Workbasket.
|
||||
*
|
||||
* <p>Each Column Header represents a priority range. <br>
|
||||
* <br>
|
||||
*
|
||||
* <table>
|
||||
* <caption><b>Default ranges</b></caption>
|
||||
* <tr>
|
||||
* <td> high </td> <td>priority > 500</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td> medium </td> <td> 250 ≥ priority ≤ 500</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td> low </td> <td> priority < 250</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
*
|
||||
* @title Compute a Workbasket Report
|
||||
* @param workbasketTypes determine the {@linkplain WorkbasketType}s to include in the report
|
||||
* @return the computed Report
|
||||
* @throws NotAuthorizedException if the current user is not authorized to compute the Report
|
||||
* @throws InvalidArgumentException if topicWorkbaskets or useDefaultValues are false
|
||||
*/
|
||||
@GetMapping(path = RestEndpoints.URL_MONITOR_WORKBASKET_PRIORITY_REPORT)
|
||||
@Transactional(readOnly = true, rollbackFor = Exception.class)
|
||||
public ResponseEntity<ReportRepresentationModel> computePriorityWorkbasketReport(
|
||||
@RequestParam(name = "workbasket-types", required = false) WorkbasketType[] workbasketTypes)
|
||||
throws NotAuthorizedException, InvalidArgumentException {
|
||||
|
||||
WorkbasketPriorityReport.Builder builder =
|
||||
monitorService
|
||||
.createWorkbasketPriorityReportBuilder()
|
||||
.withColumnHeaders(
|
||||
Arrays.asList(
|
||||
new PriorityColumnHeader(Integer.MIN_VALUE, 249),
|
||||
new PriorityColumnHeader(250, 500),
|
||||
new PriorityColumnHeader(501, Integer.MAX_VALUE)))
|
||||
.workbasketTypeIn(workbasketTypes);
|
||||
|
||||
ReportRepresentationModel report =
|
||||
reportRepresentationModelAssembler.toModel(builder.buildReport(), workbasketTypes);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(report);
|
||||
}
|
||||
|
||||
/**
|
||||
* This endpoint generates a Classification Category Report
|
||||
*
|
||||
|
|
|
@ -23,6 +23,7 @@ import pro.taskana.monitor.api.reports.Report;
|
|||
import pro.taskana.monitor.api.reports.TaskCustomFieldValueReport;
|
||||
import pro.taskana.monitor.api.reports.TaskStatusReport;
|
||||
import pro.taskana.monitor.api.reports.TimestampReport;
|
||||
import pro.taskana.monitor.api.reports.WorkbasketPriorityReport;
|
||||
import pro.taskana.monitor.api.reports.WorkbasketReport;
|
||||
import pro.taskana.monitor.api.reports.header.ColumnHeader;
|
||||
import pro.taskana.monitor.api.reports.item.QueryItem;
|
||||
|
@ -35,6 +36,7 @@ import pro.taskana.monitor.rest.models.ReportRepresentationModel;
|
|||
import pro.taskana.monitor.rest.models.ReportRepresentationModel.RowRepresentationModel;
|
||||
import pro.taskana.task.api.TaskCustomField;
|
||||
import pro.taskana.task.api.TaskState;
|
||||
import pro.taskana.workbasket.api.WorkbasketType;
|
||||
|
||||
/** Transforms any {@link Report} into its {@link ReportRepresentationModel}. */
|
||||
@Component
|
||||
|
@ -55,6 +57,17 @@ public class ReportRepresentationModelAssembler {
|
|||
return resource;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public ReportRepresentationModel toModel(
|
||||
@NonNull WorkbasketPriorityReport report, @NonNull WorkbasketType[] workbasketTypes)
|
||||
throws NotAuthorizedException, InvalidArgumentException {
|
||||
ReportRepresentationModel resource = toReportResource(report);
|
||||
resource.add(
|
||||
linkTo(methodOn(MonitorController.class).computePriorityWorkbasketReport(workbasketTypes))
|
||||
.withSelfRel());
|
||||
return resource;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public ReportRepresentationModel toModel(
|
||||
@NonNull ClassificationCategoryReport report,
|
||||
|
|
|
@ -104,4 +104,27 @@ class MonitorControllerIntTest {
|
|||
.extracting(RowRepresentationModel::getCells)
|
||||
.containsExactly(new int[] {0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0});
|
||||
}
|
||||
|
||||
@Test
|
||||
void should_ComputeReport_When_QueryingForAWorkbasketPriorityReport() {
|
||||
String url =
|
||||
restHelper.toUrl(RestEndpoints.URL_MONITOR_WORKBASKET_PRIORITY_REPORT)
|
||||
+ "?workbasket-types=TOPIC,GROUP";
|
||||
HttpEntity<?> auth = new HttpEntity<>(RestHelper.generateHeadersForUser("monitor"));
|
||||
|
||||
ResponseEntity<ReportRepresentationModel> response =
|
||||
TEMPLATE.exchange(
|
||||
url,
|
||||
HttpMethod.GET,
|
||||
auth,
|
||||
ParameterizedTypeReference.forType(ReportRepresentationModel.class));
|
||||
|
||||
ReportRepresentationModel report = response.getBody();
|
||||
|
||||
assertThat(report).isNotNull();
|
||||
|
||||
assertThat(report.getSumRow())
|
||||
.extracting(RowRepresentationModel::getCells)
|
||||
.containsExactly(new int[] {23, 0, 0});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue