TSK-1582: Additional statistical data from monitoring component
This commit is contained in:
parent
5dbc722d06
commit
fe0082e00b
|
@ -43,9 +43,9 @@ INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000011', 'ETI:0000000
|
|||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000012', 'ETI:000000000000000000000000000000000012', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(-14) , 'Task12', 'teamlead-2', 'Some description.', 'Some custom Note', 1 , 'READY' , 'EXTERN' , 'L50000' , 'CLI:000000000000000000000000000000000005', 'WBI:000000000000000000000000000000000003', 'USER-1-3' , '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_12' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000013', 'ETI:000000000000000000000000000000000013', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(-14) , 'Task13', 'teamlead-1', 'Some description.', 'Some custom Note', 1 , 'READY' , 'EXTERN' , 'L10000' , 'CLI:000000000000000000000000000000000001', 'WBI:000000000000000000000000000000000001', 'USER-1-1' , 'DOMAIN_A', '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_13' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000014', 'ETI:000000000000000000000000000000000014', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(-14) , 'Task14', 'teamlead-2', 'Some description.', 'Some custom Note', 1 , 'READY' , 'EXTERN' , 'L20000' , 'CLI:000000000000000000000000000000000002', '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_14' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000015', 'ETI:000000000000000000000000000000000015', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(-14) , 'Task15', 'teamlead-2', 'Some description.', 'Some custom Note', 1 , 'READY' , 'EXTERN' , 'L20000' , 'CLI:000000000000000000000000000000000002', 'WBI:000000000000000000000000000000000001', 'USER-1-1' , 'DOMAIN_A', '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_15' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000016', 'ETI:000000000000000000000000000000000016', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(-14) , 'Task16', 'teamlead-2', 'Some description.', 'Some custom Note', 1 , 'READY' , 'EXTERN' , 'L10000' , 'CLI:000000000000000000000000000000000001', 'WBI:000000000000000000000000000000000001', 'USER-1-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_16' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000017', 'ETI:000000000000000000000000000000000017', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(-14) , 'Task17', 'teamlead-2', 'Some description.', 'Some custom Note', 1 , 'READY' , 'AUTOMATIC' , 'L30000' , 'CLI:000000000000000000000000000000000003', '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_17' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000015', 'ETI:000000000000000000000000000000000015', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(-14) , 'Task15', 'teamlead-2', 'Some description.', 'Some custom Note', 6 , 'READY' , 'EXTERN' , 'L20000' , 'CLI:000000000000000000000000000000000002', 'WBI:000000000000000000000000000000000001', 'USER-1-1' , 'DOMAIN_A', '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_15' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000016', 'ETI:000000000000000000000000000000000016', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(-14) , 'Task16', 'teamlead-2', 'Some description.', 'Some custom Note', 7 , 'READY' , 'EXTERN' , 'L10000' , 'CLI:000000000000000000000000000000000001', 'WBI:000000000000000000000000000000000001', 'USER-1-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_16' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000017', 'ETI:000000000000000000000000000000000017', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(-14) , 'Task17', 'teamlead-2', 'Some description.', 'Some custom Note', 8 , 'READY' , 'AUTOMATIC' , 'L30000' , 'CLI:000000000000000000000000000000000003', '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_17' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000018', 'ETI:000000000000000000000000000000000018', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(-14) , 'Task18', 'teamlead-2', 'Some description.', 'Some custom Note', 1 , 'READY' , 'EXTERN' , 'L50000' , 'CLI:000000000000000000000000000000000005', 'WBI:000000000000000000000000000000000001', 'USER-1-1' , 'DOMAIN_B', '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_18' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000019', 'ETI:000000000000000000000000000000000019', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(-14) , 'Task19', 'teamlead-2', 'Some description.', 'Some custom Note', 1 , 'READY' , 'EXTERN' , 'L10000' , 'CLI:000000000000000000000000000000000001', '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_19' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000020', 'ETI:000000000000000000000000000000000020', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(-7) , 'Task20', 'teamlead-2', 'Some description.', 'Some custom Note', 1 , 'READY' , 'EXTERN' , 'L50000' , 'CLI:000000000000000000000000000000000005', 'WBI:000000000000000000000000000000000001', 'USER-1-1' , 'DOMAIN_A', '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_20' );
|
||||
|
@ -72,8 +72,8 @@ INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000040', 'ETI:0000000
|
|||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000041', 'ETI:000000000000000000000000000000000041', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(7) , 'Task41', 'teamlead-1', 'Some description.', 'Some custom Note', 1 , 'READY' , 'EXTERN' , 'L50000' , 'CLI:000000000000000000000000000000000005', 'WBI:000000000000000000000000000000000002', 'USER-1-2' , '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' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000042', 'ETI:000000000000000000000000000000000042', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(14) , 'Task42', 'teamlead-1', 'Some description.', 'Some custom Note', 1 , 'CLAIMED', 'EXTERN' , 'L50000' , 'CLI:000000000000000000000000000000000005', 'WBI:000000000000000000000000000000000003', 'USER-1-3' , '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' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000043', 'ETI:000000000000000000000000000000000043', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(14) , 'Task43', 'teamlead-2', 'Some description.', 'Some custom Note', 1 , 'CLAIMED', 'EXTERN' , 'L50000' , 'CLI:000000000000000000000000000000000005', 'WBI:000000000000000000000000000000000003', 'USER-1-3' , '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' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000044', 'ETI:000000000000000000000000000000000044', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(14) , 'Task44', 'teamlead-2', 'Some description.', 'Some custom Note', 1 , 'CLAIMED', 'AUTOMATIC' , 'L30000' , 'CLI:000000000000000000000000000000000003', 'WBI:000000000000000000000000000000000001', 'USER-1-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' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000045', 'ETI:000000000000000000000000000000000045', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(14) , 'Task45', 'teamlead-2', 'Some description.', 'Some custom Note', 1 , 'CLAIMED', 'AUTOMATIC' , 'L30000' , 'CLI:000000000000000000000000000000000003', 'WBI:000000000000000000000000000000000003', 'USER-1-3' , 'DOMAIN_B', '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_45' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000044', 'ETI:000000000000000000000000000000000044', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(14) , 'Task44', 'teamlead-2', 'Some description.', 'Some custom Note', 9 , 'CLAIMED', 'AUTOMATIC' , 'L30000' , 'CLI:000000000000000000000000000000000003', 'WBI:000000000000000000000000000000000001', 'USER-1-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' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000045', 'ETI:000000000000000000000000000000000045', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(14) , 'Task45', 'teamlead-2', 'Some description.', 'Some custom Note', 9 , 'CLAIMED', 'AUTOMATIC' , 'L30000' , 'CLI:000000000000000000000000000000000003', 'WBI:000000000000000000000000000000000003', 'USER-1-3' , 'DOMAIN_B', '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_45' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000046', 'ETI:000000000000000000000000000000000046', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(21) , 'Task46', 'teamlead-1', 'Some description.', 'Some custom Note', 1 , 'CLAIMED', 'AUTOMATIC' , 'L30000' , 'CLI:000000000000000000000000000000000003', 'WBI:000000000000000000000000000000000003', 'USER-1-3' , 'DOMAIN_B', '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_46' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000047', 'ETI:000000000000000000000000000000000047', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(210) , 'Task47', 'teamlead-1', 'Some description.', 'Some custom Note', 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_47' );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000048', 'ETI:000000000000000000000000000000000048', RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(0) , RELATIVE_DATE(210) , 'Task48', 'teamlead-2', 'Some description.', 'Some custom Note', 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' );
|
||||
|
|
|
@ -39,6 +39,15 @@ public class TaskStatusReport extends Report<TaskQueryItem, TaskStatusColumnHead
|
|||
*/
|
||||
Builder stateIn(List<TaskState> states);
|
||||
|
||||
/**
|
||||
* Adds a priority Integer to the builder. The created report contains only Tasks with a
|
||||
* priority greater or equal than this provided Integer.
|
||||
*
|
||||
* @param priority an Integer for the minimum priority
|
||||
* @return the Builder
|
||||
*/
|
||||
Builder priorityMinimum(Integer priority);
|
||||
|
||||
/**
|
||||
* Adds a list of domains to the builder. The created report contains only tasks with a domain
|
||||
* in this list.
|
||||
|
|
|
@ -363,6 +363,9 @@ public interface MonitorMapper {
|
|||
+ "<if test='workbasketIds != null'>"
|
||||
+ "AND WORKBASKET_ID IN (<foreach collection='workbasketIds' item='workbasketId' separator=','>#{workbasketId}</foreach>) "
|
||||
+ "</if>"
|
||||
+ "<if test='priorityMinimum != null'>"
|
||||
+ "AND priority >= #{priorityMinimum} "
|
||||
+ "</if>"
|
||||
+ "</where>"
|
||||
+ "GROUP BY WORKBASKET_KEY, STATE"
|
||||
+ "</script>")
|
||||
|
@ -372,7 +375,8 @@ public interface MonitorMapper {
|
|||
List<TaskQueryItem> getTasksCountByState(
|
||||
@Param("domains") List<String> domains,
|
||||
@Param("states") List<TaskState> states,
|
||||
@Param("workbasketIds") List<String> workbasketIds);
|
||||
@Param("workbasketIds") List<String> workbasketIds,
|
||||
@Param("priorityMinimum") Integer priorityMinimum);
|
||||
|
||||
@Select(
|
||||
"<script>"
|
||||
|
|
|
@ -27,6 +27,7 @@ public class TaskStatusReportBuilderImpl implements TaskStatusReport.Builder {
|
|||
private List<String> domains;
|
||||
private List<TaskState> states;
|
||||
private List<String> workbasketIds;
|
||||
private Integer priorityMinimum;
|
||||
|
||||
public TaskStatusReportBuilderImpl(
|
||||
InternalTaskanaEngine taskanaEngine, MonitorMapper monitorMapper) {
|
||||
|
@ -42,17 +43,16 @@ public class TaskStatusReportBuilderImpl implements TaskStatusReport.Builder {
|
|||
try {
|
||||
this.taskanaEngine.openConnection();
|
||||
List<TaskQueryItem> tasks =
|
||||
this.monitorMapper.getTasksCountByState(this.domains, this.states, this.workbasketIds);
|
||||
this.monitorMapper.getTasksCountByState(
|
||||
this.domains, this.states, this.workbasketIds, this.priorityMinimum);
|
||||
TaskStatusReport report = new TaskStatusReport(this.states);
|
||||
report.addItems(tasks);
|
||||
Map<String, String> displayMap =
|
||||
taskanaEngine.runAsAdmin(
|
||||
() ->
|
||||
workbasketService
|
||||
.createWorkbasketQuery()
|
||||
workbasketService.createWorkbasketQuery()
|
||||
.keyIn(report.getRows().keySet().toArray(new String[0]))
|
||||
.domainIn(domains != null ? domains.toArray(new String[0]) : null)
|
||||
.list()
|
||||
.domainIn(domains != null ? domains.toArray(new String[0]) : null).list()
|
||||
.stream()
|
||||
.collect(
|
||||
Collectors.toMap(
|
||||
|
@ -71,6 +71,12 @@ public class TaskStatusReportBuilderImpl implements TaskStatusReport.Builder {
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskStatusReportBuilderImpl priorityMinimum(Integer priorityMinimum) {
|
||||
this.priorityMinimum = priorityMinimum;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskStatusReportBuilderImpl domainIn(List<String> domains) {
|
||||
this.domains = domains;
|
||||
|
|
|
@ -190,6 +190,26 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(summaryNumbers[4]).isEqualTo(3); // number of terminated tasks
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
@Test
|
||||
void should_FilterTasksByMinimumPriority_When_BuilderIsFilteredWithMinimumPriority()
|
||||
throws Exception {
|
||||
|
||||
TaskStatusReport report =
|
||||
MONITOR_SERVICE.createTaskStatusReportBuilder().priorityMinimum(5).buildReport();
|
||||
|
||||
assertThat(report).isNotNull();
|
||||
assertThat(report.rowSize()).isEqualTo(2);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
@Test
|
||||
void should_FilterTasksByWorkbasket_When_BuilderIsFilteredWithWorkbasketIds() throws Exception {
|
||||
|
|
|
@ -53,7 +53,10 @@ public class MonitorController {
|
|||
* State.
|
||||
*
|
||||
* @param domains Filter the report values by domains.
|
||||
* @param states Filter the report values by task states.
|
||||
* @param states Filter the report values by Task states.
|
||||
* @param workbasketIds Filter the report values by Workbasket Ids.
|
||||
* @param priorityMinimum Filter the report values by a minimum priority.
|
||||
*
|
||||
* @return the computed TaskStatusReport
|
||||
* @throws NotAuthorizedException if the current user is not authorized to compute the report
|
||||
* @title Get a Task Status Report
|
||||
|
@ -62,7 +65,9 @@ public class MonitorController {
|
|||
@Transactional(readOnly = true, rollbackFor = Exception.class)
|
||||
public ResponseEntity<ReportRepresentationModel> getTaskStatusReport(
|
||||
@RequestParam(required = false) List<String> domains,
|
||||
@RequestParam(required = false) List<TaskState> states)
|
||||
@RequestParam(required = false) List<TaskState> states,
|
||||
@RequestParam(name = "workbasket-ids", required = false) List<String> workbasketIds,
|
||||
@RequestParam(name = "priority-minimum", required = false) Integer priorityMinimum)
|
||||
throws NotAuthorizedException {
|
||||
LOGGER.debug("Entry to getTasksStatusReport(), states to include {}", states);
|
||||
ResponseEntity<ReportRepresentationModel> response =
|
||||
|
@ -72,9 +77,13 @@ public class MonitorController {
|
|||
.createTaskStatusReportBuilder()
|
||||
.stateIn(states)
|
||||
.domainIn(domains)
|
||||
.workbasketIdsIn(workbasketIds)
|
||||
.priorityMinimum(priorityMinimum)
|
||||
.buildReport(),
|
||||
domains,
|
||||
states));
|
||||
states,
|
||||
workbasketIds,
|
||||
priorityMinimum));
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Exit from getTasksStatusReport(), returning {}", response);
|
||||
}
|
||||
|
|
|
@ -39,13 +39,16 @@ public class ReportRepresentationModelAssembler {
|
|||
public ReportRepresentationModel toModel(
|
||||
@NonNull TaskStatusReport report,
|
||||
@NonNull List<String> domains,
|
||||
@NonNull List<TaskState> states)
|
||||
@NonNull List<TaskState> states,
|
||||
@NonNull List<String> workbasketIds,
|
||||
@NonNull Integer priorityMinimum)
|
||||
throws NotAuthorizedException {
|
||||
ReportRepresentationModel resource = toReportResource(report);
|
||||
resource.add(
|
||||
linkTo(methodOn(MonitorController.class).getTaskStatusReport(domains, states))
|
||||
.withSelfRel()
|
||||
.expand());
|
||||
linkTo(
|
||||
methodOn(MonitorController.class)
|
||||
.getTaskStatusReport(domains, states, workbasketIds, priorityMinimum))
|
||||
.withSelfRel());
|
||||
return resource;
|
||||
}
|
||||
|
||||
|
@ -56,8 +59,7 @@ public class ReportRepresentationModelAssembler {
|
|||
ReportRepresentationModel resource = toReportResource(report);
|
||||
resource.add(
|
||||
linkTo(methodOn(MonitorController.class).getClassificationReport(taskTimestamp))
|
||||
.withSelfRel()
|
||||
.expand());
|
||||
.withSelfRel());
|
||||
return resource;
|
||||
}
|
||||
|
||||
|
@ -70,8 +72,7 @@ public class ReportRepresentationModelAssembler {
|
|||
ReportRepresentationModel resource = toReportResource(report);
|
||||
resource.add(
|
||||
linkTo(methodOn(MonitorController.class).getWorkbasketReport(states, taskTimestamp))
|
||||
.withSelfRel()
|
||||
.expand());
|
||||
.withSelfRel());
|
||||
return resource;
|
||||
}
|
||||
|
||||
|
@ -84,8 +85,7 @@ public class ReportRepresentationModelAssembler {
|
|||
linkTo(
|
||||
methodOn(MonitorController.class)
|
||||
.getTasksWorkbasketPlannedDateReport(daysInPast, states))
|
||||
.withSelfRel()
|
||||
.expand());
|
||||
.withSelfRel());
|
||||
return resource;
|
||||
}
|
||||
|
||||
|
@ -93,8 +93,7 @@ public class ReportRepresentationModelAssembler {
|
|||
public ReportRepresentationModel toModel(@NonNull TimestampReport report)
|
||||
throws NotAuthorizedException, InvalidArgumentException {
|
||||
ReportRepresentationModel resource = toReportResource(report);
|
||||
resource.add(
|
||||
linkTo(methodOn(MonitorController.class).getTimestampReport()).withSelfRel().expand());
|
||||
resource.add(linkTo(methodOn(MonitorController.class).getTimestampReport()).withSelfRel());
|
||||
return resource;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package pro.taskana.monitor.rest.models;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.time.Instant;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
@ -13,13 +14,12 @@ public class ReportRepresentationModel extends RepresentationModel<ReportReprese
|
|||
|
||||
/** Object holding meta info on the report. */
|
||||
private final MetaInformation meta;
|
||||
|
||||
/** Array holding the rows of the report. */
|
||||
private final List<RowRepresentationModel> rows;
|
||||
|
||||
/** Array holding the sums in the columns over all rows. */
|
||||
private final List<RowRepresentationModel> sumRow;
|
||||
|
||||
@ConstructorProperties({"meta", "rows", "sumRow"})
|
||||
public ReportRepresentationModel(
|
||||
MetaInformation meta,
|
||||
List<RowRepresentationModel> rows,
|
||||
|
@ -55,6 +55,7 @@ public class ReportRepresentationModel extends RepresentationModel<ReportReprese
|
|||
/** Boolean identifying if the given row should be initially displayed or not. */
|
||||
private final boolean display;
|
||||
|
||||
@ConstructorProperties({"cells", "total", "depth", "desc", "display"})
|
||||
public RowRepresentationModel(
|
||||
int[] cells, int total, int depth, String[] desc, boolean display) {
|
||||
this.cells = cells;
|
||||
|
@ -114,6 +115,7 @@ public class ReportRepresentationModel extends RepresentationModel<ReportReprese
|
|||
/** Description for the sum column. */
|
||||
private final String sumRowDesc;
|
||||
|
||||
@ConstructorProperties({"name", "date", "header", "rowDesc", "sumRowDesc"})
|
||||
public MetaInformation(
|
||||
String name, Instant date, String[] header, String[] rowDesc, String sumRowDesc) {
|
||||
this.name = name;
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
package pro.taskana.monitor.rest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static pro.taskana.common.test.rest.RestHelper.TEMPLATE;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.hateoas.IanaLinkRelations;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import pro.taskana.common.rest.RestEndpoints;
|
||||
import pro.taskana.common.test.rest.RestHelper;
|
||||
import pro.taskana.common.test.rest.TaskanaSpringBootTest;
|
||||
import pro.taskana.monitor.rest.models.ReportRepresentationModel;
|
||||
|
||||
/** Test MonitorController. */
|
||||
@TaskanaSpringBootTest
|
||||
class MonitorControllerIntTest {
|
||||
|
||||
static RestTemplate template = RestHelper.TEMPLATE;
|
||||
@Autowired RestHelper restHelper;
|
||||
|
||||
@Test
|
||||
void
|
||||
should_ReturnAllOpenTasksByState_When_QueryingForSpecificWorkbasketAndReadyAndClaimedState() {
|
||||
|
||||
HttpEntity<String> request = new HttpEntity<>(restHelper.getHeadersAdmin());
|
||||
ResponseEntity<ReportRepresentationModel> response =
|
||||
TEMPLATE.exchange(
|
||||
restHelper.toUrl(RestEndpoints.URL_MONITOR_TASKS_STATUS_REPORT)
|
||||
+ "?workbasket-ids=WBI:100000000000000000000000000000000007&states=READY,CLAIMED",
|
||||
HttpMethod.GET,
|
||||
request,
|
||||
ParameterizedTypeReference.forType(ReportRepresentationModel.class));
|
||||
assertThat(response.getBody()).isNotNull();
|
||||
assertThat((response.getBody()).getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||
|
||||
int totalOpenTasks = response.getBody().getSumRow().get(0).getTotal();
|
||||
assertThat(totalOpenTasks).isEqualTo(15);
|
||||
|
||||
int[] tasksPerState = response.getBody().getSumRow().get(0).getCells();
|
||||
// should be 2 READY, 13 CLAIMED
|
||||
int[] expectedTasksPerState = new int[] {2, 13};
|
||||
assertThat(tasksPerState).isEqualTo(expectedTasksPerState);
|
||||
}
|
||||
|
||||
@Test
|
||||
void should_ReturnAllOpenTasksByState_When_QueryingForSpecificWbAndStateReadyAndMinimumPrio() {
|
||||
|
||||
HttpEntity<String> request = new HttpEntity<>(restHelper.getHeadersAdmin());
|
||||
ResponseEntity<ReportRepresentationModel> response =
|
||||
TEMPLATE.exchange(
|
||||
restHelper.toUrl(RestEndpoints.URL_MONITOR_TASKS_STATUS_REPORT)
|
||||
+ "?workbasket-ids=WBI:100000000000000000000000000000000007"
|
||||
+ "&states=READY&priority-minimum=1",
|
||||
HttpMethod.GET,
|
||||
request,
|
||||
ParameterizedTypeReference.forType(ReportRepresentationModel.class));
|
||||
assertThat(response.getBody()).isNotNull();
|
||||
assertThat((response.getBody()).getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||
|
||||
int[] tasksInStateReady = response.getBody().getSumRow().get(0).getCells();
|
||||
// should be 2 READY
|
||||
int[] expectedTasksPerState = new int[] {2};
|
||||
assertThat(tasksInStateReady).isEqualTo(expectedTasksPerState);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue