TSK-1378: now support combinedClassificationfilter in WorkbasketReport#listCustomAttributeValuesForCustomAttributeName
This commit is contained in:
parent
51a2410afc
commit
0a5ec9e701
|
@ -381,28 +381,39 @@ public interface MonitorMapper {
|
|||
@Select(
|
||||
"<script>"
|
||||
+ "SELECT DISTINCT ${customField} "
|
||||
+ "FROM TASK "
|
||||
+ "FROM TASK T"
|
||||
+ "<if test=\"combinedClassificationFilter != null\">"
|
||||
+ "LEFT JOIN ATTACHMENT A ON T.ID = A.TASK_ID "
|
||||
+ "</if>"
|
||||
+ "<where>"
|
||||
+ "<if test='workbasketIds != null'>"
|
||||
+ "WORKBASKET_ID IN (<foreach collection='workbasketIds' item='workbasketId' separator=','>#{workbasketId}</foreach>) "
|
||||
+ "T.WORKBASKET_ID IN (<foreach collection='workbasketIds' item='workbasketId' separator=','>#{workbasketId}</foreach>) "
|
||||
+ "</if>"
|
||||
+ "<if test='states != null'>"
|
||||
+ "AND STATE IN (<foreach collection='states' item='state' separator=','>#{state}</foreach>) "
|
||||
+ "AND T.STATE IN (<foreach collection='states' item='state' separator=','>#{state}</foreach>) "
|
||||
+ "</if>"
|
||||
+ "<if test='classificationCategories != null'>"
|
||||
+ "AND CLASSIFICATION_CATEGORY IN (<foreach collection='classificationCategories' item='category' separator=','>#{category}</foreach>) "
|
||||
+ "AND T.CLASSIFICATION_CATEGORY IN (<foreach collection='classificationCategories' item='category' separator=','>#{category}</foreach>) "
|
||||
+ "</if>"
|
||||
+ "<if test='domains != null'>"
|
||||
+ "AND DOMAIN IN (<foreach collection='domains' item='domain' separator=','>#{domain}</foreach>) "
|
||||
+ "AND T.DOMAIN IN (<foreach collection='domains' item='domain' separator=','>#{domain}</foreach>) "
|
||||
+ "</if>"
|
||||
+ "<if test='classificationIds != null'>"
|
||||
+ "AND CLASSIFICATION_ID IN (<foreach collection='classificationIds' item='classificationId' separator=','>#{classificationId}</foreach>) "
|
||||
+ "AND T.CLASSIFICATION_ID IN (<foreach collection='classificationIds' item='classificationId' separator=','>#{classificationId}</foreach>) "
|
||||
+ "</if>"
|
||||
+ "<if test='excludedClassificationIds != null'>"
|
||||
+ "AND CLASSIFICATION_ID NOT IN (<foreach collection='excludedClassificationIds' item='excludedClassificationId' separator=','>#{excludedClassificationId}</foreach>) "
|
||||
+ "AND T.CLASSIFICATION_ID NOT IN (<foreach collection='excludedClassificationIds' item='excludedClassificationId' separator=','>#{excludedClassificationId}</foreach>) "
|
||||
+ "</if>"
|
||||
+ "<if test='customAttributeFilter != null'>"
|
||||
+ "AND (<foreach collection='customAttributeFilter.keys' item='key' separator=' AND '>(${key} = '${customAttributeFilter.get(key)}')</foreach>) "
|
||||
+ "AND (<foreach collection='customAttributeFilter.keys' item='key' separator=' AND '>(T.${key} = '${customAttributeFilter.get(key)}')</foreach>) "
|
||||
+ "</if>"
|
||||
+ "<if test=\"combinedClassificationFilter != null\">"
|
||||
+ "AND <foreach collection='combinedClassificationFilter' item='item' separator='OR'> "
|
||||
+ "T.CLASSIFICATION_ID = #{item.taskClassificationId} "
|
||||
+ "<if test=\"item.attachmentClassificationId != null\">"
|
||||
+ "AND A.CLASSIFICATION_ID = #{item.attachmentClassificationId} "
|
||||
+ "</if>"
|
||||
+ "</foreach>"
|
||||
+ "</if>"
|
||||
+ "</where>"
|
||||
+ "</script>")
|
||||
|
@ -414,6 +425,8 @@ public interface MonitorMapper {
|
|||
@Param("classificationIds") List<String> classificationIds,
|
||||
@Param("excludedClassificationIds") List<String> excludedClassificationIds,
|
||||
@Param("customAttributeFilter") Map<TaskCustomField, String> customAttributeFilter,
|
||||
@Param("combinedClassificationFilter")
|
||||
List<CombinedClassificationFilter> combinedClassificationFilter,
|
||||
@Param("customField") TaskCustomField taskCustomField);
|
||||
|
||||
@Select(
|
||||
|
|
|
@ -182,6 +182,7 @@ abstract class TimeIntervalReportBuilderImpl<
|
|||
this.classificationIds,
|
||||
this.excludedClassificationIds,
|
||||
this.customAttributeFilter,
|
||||
getCombinedClassificationFilter(),
|
||||
taskCustomField);
|
||||
} finally {
|
||||
this.taskanaEngine.returnConnection();
|
||||
|
|
|
@ -393,6 +393,29 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
|
|||
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "monitor")
|
||||
@Test
|
||||
void should_ReturnCustomFieldValues_When_CombinedClassificationFilterIsApplied()
|
||||
throws Exception {
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
|
||||
List<CombinedClassificationFilter> combinedClassificationFilters =
|
||||
Collections.singletonList(
|
||||
new CombinedClassificationFilter(
|
||||
"CLI:000000000000000000000000000000000001",
|
||||
"CLI:000000000000000000000000000000000006"));
|
||||
|
||||
List<String> customValues =
|
||||
MONITOR_SERVICE
|
||||
.createWorkbasketReportBuilder()
|
||||
.withColumnHeaders(columnHeaders)
|
||||
.combinedClassificationFilterIn(combinedClassificationFilters)
|
||||
.listCustomAttributeValuesForCustomAttributeName(TaskCustomField.CUSTOM_1);
|
||||
|
||||
assertThat(customValues)
|
||||
.containsExactlyInAnyOrder(
|
||||
"Geschaeftsstelle A", "Geschaeftsstelle B", "Geschaeftsstelle C");
|
||||
}
|
||||
|
||||
private List<TimeIntervalColumnHeader> getListOfColumnHeaders() {
|
||||
List<TimeIntervalColumnHeader> columnHeaders = new ArrayList<>();
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(Integer.MIN_VALUE, -11));
|
||||
|
|
|
@ -276,6 +276,7 @@ class ClassificationClassificationCategoryReportBuilderImplTest {
|
|||
classificationIds,
|
||||
excludedClassificationIds,
|
||||
customAttributeFilter,
|
||||
null,
|
||||
TaskCustomField.CUSTOM_1))
|
||||
.thenReturn(expectedResult);
|
||||
|
||||
|
@ -296,7 +297,8 @@ class ClassificationClassificationCategoryReportBuilderImplTest {
|
|||
verify(taskanaEngineMock).checkRoleMembership(any());
|
||||
verify(taskanaEngineMock).getWorkingDaysToDaysConverter();
|
||||
verify(monitorMapperMock)
|
||||
.getCustomAttributeValuesForReport(any(), any(), any(), any(), any(), any(), any(), any());
|
||||
.getCustomAttributeValuesForReport(
|
||||
any(), any(), any(), any(), any(), any(), any(), any(), any());
|
||||
verify(internalTaskanaEngineMock).returnConnection();
|
||||
verifyNoMoreInteractions(
|
||||
internalTaskanaEngineMock,
|
||||
|
|
|
@ -446,6 +446,7 @@ class ClassificationReportBuilderImplTest {
|
|||
classificationIds,
|
||||
excludedClassificationIds,
|
||||
customAttributeFilter,
|
||||
null,
|
||||
TaskCustomField.CUSTOM_1))
|
||||
.thenReturn(expectedResult);
|
||||
|
||||
|
@ -467,7 +468,8 @@ class ClassificationReportBuilderImplTest {
|
|||
verify(internalTaskanaEngineMock, times(3)).getEngine();
|
||||
|
||||
verify(monitorMapperMock)
|
||||
.getCustomAttributeValuesForReport(any(), any(), any(), any(), any(), any(), any(), any());
|
||||
.getCustomAttributeValuesForReport(
|
||||
any(), any(), any(), any(), any(), any(), any(), any(), any());
|
||||
verify(internalTaskanaEngineMock).returnConnection();
|
||||
verify(taskanaEngineMock).getClassificationService();
|
||||
verifyNoMoreInteractions(mocks);
|
||||
|
|
|
@ -195,6 +195,7 @@ class TaskCustomFieldValueReportBuilderImplTest {
|
|||
classificationIds,
|
||||
excludedClassificationIds,
|
||||
customAttributeFilter,
|
||||
null,
|
||||
TaskCustomField.CUSTOM_1))
|
||||
.thenReturn(expectedResult);
|
||||
|
||||
|
@ -215,7 +216,8 @@ class TaskCustomFieldValueReportBuilderImplTest {
|
|||
verify(taskanaEngineMock).getWorkingDaysToDaysConverter();
|
||||
verify(internalTaskanaEngineMock, times(2)).getEngine();
|
||||
verify(monitorMapperMock)
|
||||
.getCustomAttributeValuesForReport(any(), any(), any(), any(), any(), any(), any(), any());
|
||||
.getCustomAttributeValuesForReport(
|
||||
any(), any(), any(), any(), any(), any(), any(), any(), any());
|
||||
verify(internalTaskanaEngineMock).returnConnection();
|
||||
verifyNoMoreInteractions(
|
||||
internalTaskanaEngineMock,
|
||||
|
|
|
@ -295,6 +295,7 @@ class WorkbasketReportBuilderImplTest {
|
|||
classificationIds,
|
||||
excludedClassificationIds,
|
||||
customAttributeFilter,
|
||||
null,
|
||||
TaskCustomField.CUSTOM_1))
|
||||
.thenReturn(expectedResult);
|
||||
|
||||
|
@ -315,7 +316,8 @@ class WorkbasketReportBuilderImplTest {
|
|||
verify(taskanaEngineMock).getWorkingDaysToDaysConverter();
|
||||
verify(internalTaskanaEngineMock, times(3)).getEngine();
|
||||
verify(monitorMapperMock)
|
||||
.getCustomAttributeValuesForReport(any(), any(), any(), any(), any(), any(), any(), any());
|
||||
.getCustomAttributeValuesForReport(
|
||||
any(), any(), any(), any(), any(), any(), any(), any(), any());
|
||||
verify(internalTaskanaEngineMock).returnConnection();
|
||||
verify(taskanaEngineMock).getWorkbasketService();
|
||||
verifyNoMoreInteractions(internalTaskanaEngineMock, taskanaEngineMock, monitorMapperMock);
|
||||
|
|
Loading…
Reference in New Issue