diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/CategoryReportBuilderImpl.java b/lib/taskana-core/src/main/java/pro/taskana/impl/CategoryReportBuilderImpl.java index 8f00aae74..283e6776c 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/CategoryReportBuilderImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/CategoryReportBuilderImpl.java @@ -12,7 +12,6 @@ import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.impl.report.header.TimeIntervalColumnHeader; import pro.taskana.impl.report.item.MonitorQueryItem; import pro.taskana.impl.report.preprocessor.DaysToWorkingDaysPreProcessor; -import pro.taskana.impl.report.structure.Report; import pro.taskana.mappings.TaskMonitorMapper; import pro.taskana.report.CategoryReport; @@ -58,10 +57,4 @@ public class CategoryReportBuilderImpl LOGGER.debug("exit from buildReport()."); } } - - @Override - public Report buildPlannedDateBasedReport() - throws NotAuthorizedException, InvalidArgumentException { - throw new java.lang.UnsupportedOperationException("Not supported yet."); - } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/ClassificationReportBuilderImpl.java b/lib/taskana-core/src/main/java/pro/taskana/impl/ClassificationReportBuilderImpl.java index d2f77acef..0a13e94d1 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/ClassificationReportBuilderImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/ClassificationReportBuilderImpl.java @@ -1,7 +1,10 @@ package pro.taskana.impl; +import java.util.List; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; + import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaRole; import pro.taskana.exceptions.InvalidArgumentException; @@ -13,9 +16,6 @@ import pro.taskana.impl.report.preprocessor.DaysToWorkingDaysPreProcessor; import pro.taskana.mappings.TaskMonitorMapper; import pro.taskana.report.ClassificationReport; import pro.taskana.report.ClassificationReport.DetailedClassificationReport; -import pro.taskana.report.Report; - -import java.util.List; /** * The implementation of ClassificationReportBuilder. @@ -48,10 +48,10 @@ public class ClassificationReportBuilderImpl this.taskanaEngine.openConnection(); ClassificationReport report = new ClassificationReport(this.columnHeaders); List monitorQueryItems = this.taskMonitorMapper.getTaskCountOfClassifications( - this.workbasketIds, this.states, this.categories, this.domains, this.classificationIds, - this.excludedClassificationIds, this.customAttributeFilter); + this.workbasketIds, this.states, this.categories, this.domains, this.classificationIds, + this.excludedClassificationIds, this.customAttributeFilter); report.addItems(monitorQueryItems, - new DaysToWorkingDaysPreProcessor<>(this.columnHeaders, this.inWorkingDays)); + new DaysToWorkingDaysPreProcessor<>(this.columnHeaders, this.inWorkingDays)); return report; } finally { this.taskanaEngine.returnConnection(); @@ -67,11 +67,11 @@ public class ClassificationReportBuilderImpl this.taskanaEngine.openConnection(); DetailedClassificationReport report = new DetailedClassificationReport(this.columnHeaders); List detailedMonitorQueryItems = this.taskMonitorMapper - .getTaskCountOfDetailedClassifications(this.workbasketIds, this.states, this.categories, this.domains, - this.classificationIds, this.excludedClassificationIds, this.customAttributeFilter); + .getTaskCountOfDetailedClassifications(this.workbasketIds, this.states, this.categories, this.domains, + this.classificationIds, this.excludedClassificationIds, this.customAttributeFilter); report.addItems(detailedMonitorQueryItems, - new DaysToWorkingDaysPreProcessor<>(this.columnHeaders, this.inWorkingDays)); + new DaysToWorkingDaysPreProcessor<>(this.columnHeaders, this.inWorkingDays)); return report; } finally { @@ -79,9 +79,4 @@ public class ClassificationReportBuilderImpl LOGGER.debug("exit from buildDetailedReport()."); } } - - @Override - public Report buildPlannedDateBasedReport() throws NotAuthorizedException, InvalidArgumentException { - throw new java.lang.UnsupportedOperationException("Not supported yet."); - } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/CustomFieldValueReportBuilderImpl.java b/lib/taskana-core/src/main/java/pro/taskana/impl/CustomFieldValueReportBuilderImpl.java index 855f20f58..f0b819dbd 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/CustomFieldValueReportBuilderImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/CustomFieldValueReportBuilderImpl.java @@ -13,7 +13,6 @@ import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.impl.report.header.TimeIntervalColumnHeader; import pro.taskana.impl.report.item.MonitorQueryItem; import pro.taskana.impl.report.preprocessor.DaysToWorkingDaysPreProcessor; -import pro.taskana.impl.report.structure.Report; import pro.taskana.mappings.TaskMonitorMapper; import pro.taskana.report.CustomFieldValueReport; @@ -66,11 +65,4 @@ public class CustomFieldValueReportBuilderImpl LOGGER.debug("exit from buildReport()."); } } - - @Override - public Report buildPlannedDateBasedReport() - throws NotAuthorizedException, InvalidArgumentException { - throw new java.lang.UnsupportedOperationException("Not supported yet."); - } - } diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/TaskStatusReportBuilderImpl.java b/lib/taskana-core/src/main/java/pro/taskana/impl/TaskStatusReportBuilderImpl.java index 595de6d44..292d64ea8 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/TaskStatusReportBuilderImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/TaskStatusReportBuilderImpl.java @@ -8,11 +8,8 @@ import org.slf4j.LoggerFactory; import pro.taskana.TaskState; import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaRole; -import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.NotAuthorizedException; -import pro.taskana.impl.report.header.TaskStatusColumnHeader; import pro.taskana.impl.report.item.TaskQueryItem; -import pro.taskana.impl.report.structure.Report; import pro.taskana.mappings.TaskMonitorMapper; import pro.taskana.report.TaskStatusReport; @@ -59,11 +56,4 @@ public class TaskStatusReportBuilderImpl implements TaskStatusReport.Builder { LOGGER.debug("exit from buildReport()."); } } - - @Override - public Report buildPlannedDateBasedReport() - throws NotAuthorizedException, InvalidArgumentException { - throw new java.lang.UnsupportedOperationException("Not supported yet."); - } - } diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/header/TimeIntervalColumnHeader.java b/lib/taskana-core/src/main/java/pro/taskana/impl/report/header/TimeIntervalColumnHeader.java index b64ea0bfa..1622de410 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/header/TimeIntervalColumnHeader.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/report/header/TimeIntervalColumnHeader.java @@ -89,6 +89,12 @@ public class TimeIntervalColumnHeader implements ColumnHeader { return "<" + this.getUpperAgeLimit(); } else if (this.getUpperAgeLimit() == Integer.MAX_VALUE) { return ">" + this.getLowerAgeLimit(); + } else if (this.getLowerAgeLimit() == -1) { + return "-1 day"; + } else if (this.getLowerAgeLimit() == 1) { + return "+1 day"; + } else if (this.getLowerAgeLimit() == 0) { + return "today"; } else if (this.getLowerAgeLimit() == this.getUpperAgeLimit()) { return this.getUpperAgeLimit() + ""; } else if (this.getLowerAgeLimit() != this.getUpperAgeLimit()) { diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/structure/Report.java b/lib/taskana-core/src/main/java/pro/taskana/impl/report/structure/Report.java index fdfb7aaa5..9bcc12d34 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/structure/Report.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/report/structure/Report.java @@ -105,6 +105,5 @@ public abstract class Report> { Report buildReport() throws NotAuthorizedException, InvalidArgumentException; - Report buildPlannedDateBasedReport() throws NotAuthorizedException, InvalidArgumentException; } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/mappings/TaskMonitorMapper.java b/lib/taskana-core/src/main/java/pro/taskana/mappings/TaskMonitorMapper.java index 2ba9f2991..4006643c8 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/mappings/TaskMonitorMapper.java +++ b/lib/taskana-core/src/main/java/pro/taskana/mappings/TaskMonitorMapper.java @@ -10,13 +10,13 @@ import org.apache.ibatis.annotations.Select; import pro.taskana.CustomField; import pro.taskana.TaskState; -import pro.taskana.report.Timestamp; import pro.taskana.impl.SelectedItem; import pro.taskana.impl.report.CombinedClassificationFilter; -import pro.taskana.impl.report.item.TimestampQueryItem; import pro.taskana.impl.report.item.DetailedMonitorQueryItem; import pro.taskana.impl.report.item.MonitorQueryItem; import pro.taskana.impl.report.item.TaskQueryItem; +import pro.taskana.impl.report.item.TimestampQueryItem; +import pro.taskana.report.Timestamp; /** * This class is the mybatis mapping of task monitoring. @@ -24,417 +24,412 @@ import pro.taskana.impl.report.item.TaskQueryItem; public interface TaskMonitorMapper { @Select("") + + "SELECT B.WORKBASKET_KEY, B.AGE_IN_DAYS, COUNT(B.AGE_IN_DAYS) AS NUMBER_OF_TASKS FROM (" + + "SELECT T.WORKBASKET_KEY, (DAYS(T.DUE) - DAYS(CURRENT_TIMESTAMP)) as AGE_IN_DAYS " + + "SELECT T.WORKBASKET_KEY, DATEDIFF('DAY', CURRENT_TIMESTAMP, T.DUE) as AGE_IN_DAYS " + + "SELECT T.WORKBASKET_KEY, DATE_PART('DAY', T.DUE - CURRENT_TIMESTAMP) as AGE_IN_DAYS " + + "FROM TASK AS T LEFT JOIN ATTACHMENT AS A ON T.ID = A.TASK_ID " + + "" + + "" + + "T.WORKBASKET_ID IN (#{workbasketId}) " + + "" + + "" + + "AND T.STATE IN (#{state}) " + + "" + + "" + + "AND T.CLASSIFICATION_CATEGORY IN (#{category}) " + + "" + + "" + + "AND T.DOMAIN IN (#{domain}) " + + "" + + "" + + "AND CLASSIFICATION_ID IN (#{classificationId}) " + + "" + + "" + + "AND CLASSIFICATION_ID NOT IN (#{excludedClassificationId}) " + + "" + + "" + + "AND ((${key} = '${customAttributeFilter.get(key)}')) " + + "" + + "" + + "AND " + + "T.CLASSIFICATION_ID = #{item.taskClassificationId}" + + "" + + "AND A.CLASSIFICATION_ID = #{item.attachmentClassificationId}" + + "" + + "" + + "" + + "AND T.DUE IS NOT NULL " + + "" + + ") AS B " + + "GROUP BY B.WORKBASKET_KEY, B.AGE_IN_DAYS" + + "") @Results({ - @Result(column = "WORKBASKET_KEY", property = "key"), - @Result(column = "AGE_IN_DAYS", property = "ageInDays"), - @Result(column = "NUMBER_OF_TASKS", property = "numberOfTasks")}) + @Result(column = "WORKBASKET_KEY", property = "key"), + @Result(column = "AGE_IN_DAYS", property = "ageInDays"), + @Result(column = "NUMBER_OF_TASKS", property = "numberOfTasks")}) List getTaskCountOfWorkbaskets(@Param("workbasketIds") List workbasketIds, - @Param("states") List states, - @Param("categories") List categories, - @Param("domains") List domains, - @Param("classificationIds") List classificationIds, - @Param("excludedClassificationIds") List excludedClassificationIds, - @Param("customAttributeFilter") Map customAttributeFilter, - @Param("combinedClassificationFilter") List combinedClassificationFilter); + @Param("states") List states, + @Param("categories") List categories, + @Param("domains") List domains, + @Param("classificationIds") List classificationIds, + @Param("excludedClassificationIds") List excludedClassificationIds, + @Param("customAttributeFilter") Map customAttributeFilter, + @Param("combinedClassificationFilter") List combinedClassificationFilter); @Select("") + + "SELECT B.WORKBASKET_KEY, B.AGE_IN_DAYS, COUNT(B.AGE_IN_DAYS) AS NUMBER_OF_TASKS FROM (" + + "SELECT T.WORKBASKET_KEY, (DAYS(T.PLANNED) - DAYS(CURRENT_TIMESTAMP)) as AGE_IN_DAYS " + + "SELECT T.WORKBASKET_KEY, DATEDIFF('DAY', CURRENT_TIMESTAMP, T.PLANNED) as AGE_IN_DAYS " + + "SELECT T.WORKBASKET_KEY, DATE_PART('DAY', T.PLANNED - CURRENT_TIMESTAMP) as AGE_IN_DAYS " + + "FROM TASK AS T LEFT JOIN ATTACHMENT AS A ON T.ID = A.TASK_ID " + + "" + + "" + + "T.WORKBASKET_ID IN (#{workbasketId}) " + + "" + + "" + + "AND T.STATE IN (#{state}) " + + "" + + "" + + "AND T.CLASSIFICATION_CATEGORY IN (#{category}) " + + "" + + "" + + "AND T.DOMAIN IN (#{domain}) " + + "" + + "" + + "AND CLASSIFICATION_ID IN (#{classificationId}) " + + "" + + "" + + "AND CLASSIFICATION_ID NOT IN (#{excludedClassificationId}) " + + "" + + "" + + "AND ((${key} = '${customAttributeFilter.get(key)}')) " + + "" + + "" + + "AND " + + "T.CLASSIFICATION_ID = #{item.taskClassificationId}" + + "" + + "AND A.CLASSIFICATION_ID = #{item.attachmentClassificationId}" + + "" + + "" + + "" + + "AND T.PLANNED IS NOT NULL " + + "" + + ") AS B " + + "GROUP BY B.WORKBASKET_KEY, B.AGE_IN_DAYS" + + "") @Results({ - @Result(column = "WORKBASKET_KEY", property = "key"), - @Result(column = "AGE_IN_DAYS", property = "ageInDays"), - @Result(column = "NUMBER_OF_TASKS", property = "numberOfTasks")}) - List getTaskCountOfWorkbasketsBasedOnPlannedDate(@Param("workbasketIds") List workbasketIds, - @Param("states") List states, - @Param("categories") List categories, - @Param("domains") List domains, - @Param("classificationIds") List classificationIds, - @Param("excludedClassificationIds") List excludedClassificationIds, - @Param("customAttributeFilter") Map customAttributeFilter, - @Param("combinedClassificationFilter") List combinedClassificationFilter); + @Result(column = "WORKBASKET_KEY", property = "key"), + @Result(column = "AGE_IN_DAYS", property = "ageInDays"), + @Result(column = "NUMBER_OF_TASKS", property = "numberOfTasks")}) + List getTaskCountOfWorkbasketsBasedOnPlannedDate( + @Param("workbasketIds") List workbasketIds, + @Param("states") List states, + @Param("categories") List categories, + @Param("domains") List domains, + @Param("classificationIds") List classificationIds, + @Param("excludedClassificationIds") List excludedClassificationIds, + @Param("customAttributeFilter") Map customAttributeFilter, + @Param("combinedClassificationFilter") List combinedClassificationFilter); @Select("") + + "SELECT B.CLASSIFICATION_CATEGORY, B.AGE_IN_DAYS, COUNT(B.AGE_IN_DAYS) AS NUMBER_OF_TASKS FROM (" + + "SELECT CLASSIFICATION_CATEGORY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP)) as AGE_IN_DAYS " + + "SELECT CLASSIFICATION_CATEGORY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) as AGE_IN_DAYS " + + "SELECT CLASSIFICATION_CATEGORY, DATE_PART('DAY', DUE - CURRENT_TIMESTAMP) as AGE_IN_DAYS " + + "FROM TASK " + + "" + + "" + + "WORKBASKET_ID IN (#{workbasketId}) " + + "" + + "" + + "AND STATE IN (#{state}) " + + "" + + "" + + "AND CLASSIFICATION_CATEGORY IN (#{category}) " + + "" + + "" + + "AND DOMAIN IN (#{domain}) " + + "" + + "" + + "AND CLASSIFICATION_ID IN (#{classificationId}) " + + "" + + "" + + "AND CLASSIFICATION_ID NOT IN (#{excludedClassificationId}) " + + "" + + "" + + "AND ((${key} = '${customAttributeFilter.get(key)}')) " + + "" + + "AND DUE IS NOT NULL " + + "" + + ") AS B " + + "GROUP BY B.CLASSIFICATION_CATEGORY, B.AGE_IN_DAYS " + + "") @Results({ - @Result(column = "CLASSIFICATION_CATEGORY", property = "key"), - @Result(column = "AGE_IN_DAYS", property = "ageInDays"), - @Result(column = "NUMBER_OF_TASKS", property = "numberOfTasks")}) + @Result(column = "CLASSIFICATION_CATEGORY", property = "key"), + @Result(column = "AGE_IN_DAYS", property = "ageInDays"), + @Result(column = "NUMBER_OF_TASKS", property = "numberOfTasks")}) List getTaskCountOfCategories(@Param("workbasketIds") List workbasketIds, - @Param("states") List states, - @Param("categories") List categories, - @Param("domains") List domains, - @Param("classificationIds") List classificationIds, - @Param("excludedClassificationIds") List excludedClassificationIds, - @Param("customAttributeFilter") Map customAttributeFilter); + @Param("states") List states, + @Param("categories") List categories, + @Param("domains") List domains, + @Param("classificationIds") List classificationIds, + @Param("excludedClassificationIds") List excludedClassificationIds, + @Param("customAttributeFilter") Map customAttributeFilter); @Select("") + + "SELECT B.CLASSIFICATION_KEY, B.AGE_IN_DAYS, COUNT(B.AGE_IN_DAYS) AS NUMBER_OF_TASKS FROM (" + + "SELECT CLASSIFICATION_KEY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP)) as AGE_IN_DAYS " + + "SELECT CLASSIFICATION_KEY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) as AGE_IN_DAYS " + + "SELECT CLASSIFICATION_KEY, DATE_PART('DAY', DUE - CURRENT_TIMESTAMP) as AGE_IN_DAYS " + + "FROM TASK " + + "" + + "" + + "WORKBASKET_ID IN (#{workbasketId}) " + + "" + + "" + + "AND STATE IN (#{state}) " + + "" + + "" + + "AND CLASSIFICATION_CATEGORY IN (#{category}) " + + "" + + "" + + "AND DOMAIN IN (#{domain}) " + + "" + + "" + + "AND CLASSIFICATION_ID IN (#{classificationId}) " + + "" + + "" + + "AND CLASSIFICATION_ID NOT IN (#{excludedClassificationId}) " + + "" + + "" + + "AND ((${key} = '${customAttributeFilter.get(key)}')) " + + "" + + "AND DUE IS NOT NULL " + + "" + + ") AS B " + + "GROUP BY B.CLASSIFICATION_KEY, B.AGE_IN_DAYS " + + "") @Results({ - @Result(column = "CLASSIFICATION_KEY", property = "key"), - @Result(column = "AGE_IN_DAYS", property = "ageInDays"), - @Result(column = "NUMBER_OF_TASKS", property = "numberOfTasks")}) + @Result(column = "CLASSIFICATION_KEY", property = "key"), + @Result(column = "AGE_IN_DAYS", property = "ageInDays"), + @Result(column = "NUMBER_OF_TASKS", property = "numberOfTasks")}) List getTaskCountOfClassifications(@Param("workbasketIds") List workbasketIds, - @Param("states") List states, - @Param("categories") List categories, - @Param("domains") List domains, - @Param("classificationIds") List classificationIds, - @Param("excludedClassificationIds") List excludedClassificationIds, - @Param("customAttributeFilter") Map customAttributeFilter); + @Param("states") List states, + @Param("categories") List categories, + @Param("domains") List domains, + @Param("classificationIds") List classificationIds, + @Param("excludedClassificationIds") List excludedClassificationIds, + @Param("customAttributeFilter") Map customAttributeFilter); @Select("") + + "SELECT B.TASK_CLASSIFICATION_KEY, B.ATTACHMENT_CLASSIFICATION_KEY, B.AGE_IN_DAYS, COUNT(B.AGE_IN_DAYS) AS NUMBER_OF_TASKS FROM (" + + "SELECT T.CLASSIFICATION_KEY as TASK_CLASSIFICATION_KEY, A.CLASSIFICATION_KEY as ATTACHMENT_CLASSIFICATION_KEY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP)) as AGE_IN_DAYS " + + "SELECT T.CLASSIFICATION_KEY as TASK_CLASSIFICATION_KEY, A.CLASSIFICATION_KEY as ATTACHMENT_CLASSIFICATION_KEY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) as AGE_IN_DAYS " + + "SELECT T.CLASSIFICATION_KEY as TASK_CLASSIFICATION_KEY, A.CLASSIFICATION_KEY as ATTACHMENT_CLASSIFICATION_KEY, DATE_PART('DAY', DUE - CURRENT_TIMESTAMP) as AGE_IN_DAYS " + + "FROM TASK AS T LEFT JOIN ATTACHMENT AS A ON T.ID = A.TASK_ID " + + "" + + "" + + "T.WORKBASKET_ID IN (#{workbasketId}) " + + "" + + "" + + "AND STATE IN (#{state}) " + + "" + + "" + + "AND CLASSIFICATION_CATEGORY IN (#{category}) " + + "" + + "" + + "AND DOMAIN IN (#{domain}) " + + "" + + "" + + "AND CLASSIFICATION_ID IN (#{classificationId}) " + + "" + + "" + + "AND CLASSIFICATION_ID NOT IN (#{excludedClassificationId}) " + + "" + + "" + + "AND ((${key} = '${customAttributeFilter.get(key)}')) " + + "" + + "AND DUE IS NOT NULL " + + "" + + ") AS B " + + "GROUP BY B.TASK_CLASSIFICATION_KEY, B.ATTACHMENT_CLASSIFICATION_KEY, B.AGE_IN_DAYS " + + "") @Results({ - @Result(column = "TASK_CLASSIFICATION_KEY", property = "key"), - @Result(column = "ATTACHMENT_CLASSIFICATION_KEY", property = "attachmentKey"), - @Result(column = "AGE_IN_DAYS", property = "ageInDays"), - @Result(column = "NUMBER_OF_TASKS", property = "numberOfTasks")}) + @Result(column = "TASK_CLASSIFICATION_KEY", property = "key"), + @Result(column = "ATTACHMENT_CLASSIFICATION_KEY", property = "attachmentKey"), + @Result(column = "AGE_IN_DAYS", property = "ageInDays"), + @Result(column = "NUMBER_OF_TASKS", property = "numberOfTasks")}) List getTaskCountOfDetailedClassifications( - @Param("workbasketIds") List workbasketIds, - @Param("states") List states, - @Param("categories") List categories, - @Param("domains") List domains, - @Param("classificationIds") List classificationIds, - @Param("excludedClassificationIds") List excludedClassificationIds, - @Param("customAttributeFilter") Map customAttributeFilter); + @Param("workbasketIds") List workbasketIds, + @Param("states") List states, + @Param("categories") List categories, + @Param("domains") List domains, + @Param("classificationIds") List classificationIds, + @Param("excludedClassificationIds") List excludedClassificationIds, + @Param("customAttributeFilter") Map customAttributeFilter); @Select("") + + "SELECT B.CUSTOM_FIELD, B.AGE_IN_DAYS, COUNT(B.AGE_IN_DAYS) AS NUMBER_OF_TASKS FROM (" + + "SELECT ${customField} as CUSTOM_FIELD, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP)) as AGE_IN_DAYS " + + "SELECT ${customField} as CUSTOM_FIELD, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) as AGE_IN_DAYS " + + "SELECT ${customField} as CUSTOM_FIELD, DATE_PART('DAY', DUE - CURRENT_TIMESTAMP) as AGE_IN_DAYS " + + "FROM TASK " + + "" + + "" + + "WORKBASKET_ID IN (#{workbasketId}) " + + "" + + "" + + "AND STATE IN (#{state}) " + + "" + + "" + + "AND CLASSIFICATION_CATEGORY IN (#{category}) " + + "" + + "" + + "AND DOMAIN IN (#{domain}) " + + "" + + "" + + "AND CLASSIFICATION_ID IN (#{classificationId}) " + + "" + + "" + + "AND CLASSIFICATION_ID NOT IN (#{excludedClassificationId}) " + + "" + + "" + + "AND ((${key} = '${customAttributeFilter.get(key)}')) " + + "" + + "AND DUE IS NOT NULL " + + "" + + ") AS B " + + "GROUP BY B.CUSTOM_FIELD, B.AGE_IN_DAYS " + + "") @Results({ - @Result(column = "CUSTOM_FIELD", property = "key"), - @Result(column = "AGE_IN_DAYS", property = "ageInDays"), - @Result(column = "NUMBER_OF_TASKS", property = "numberOfTasks")}) + @Result(column = "CUSTOM_FIELD", property = "key"), + @Result(column = "AGE_IN_DAYS", property = "ageInDays"), + @Result(column = "NUMBER_OF_TASKS", property = "numberOfTasks")}) List getTaskCountOfCustomFieldValues( - @Param("customField") CustomField customField, - @Param("workbasketIds") List workbasketIds, - @Param("states") List states, - @Param("categories") List categories, - @Param("domains") List domains, - @Param("classificationIds") List classificationIds, - @Param("excludedClassificationIds") List excludedClassificationIds, - @Param("customAttributeFilter") Map customAttributeFilter); + @Param("customField") CustomField customField, + @Param("workbasketIds") List workbasketIds, + @Param("states") List states, + @Param("categories") List categories, + @Param("domains") List domains, + @Param("classificationIds") List classificationIds, + @Param("excludedClassificationIds") List excludedClassificationIds, + @Param("customAttributeFilter") Map customAttributeFilter); @Select("") + + "SELECT T.ID FROM TASK T " + + "" + + "LEFT JOIN ATTACHMENT A ON T.ID = A.TASK_ID " + + "" + + "" + + "" + + "T.WORKBASKET_ID IN (#{workbasketId}) " + + "" + + "" + + "AND T.STATE IN (#{state}) " + + "" + + "" + + "AND T.CLASSIFICATION_CATEGORY IN (#{category}) " + + "" + + "" + + "AND DOMAIN IN (#{domain}) " + + "" + + "" + + "AND T.CLASSIFICATION_ID IN (#{classificationId}) " + + "" + + "" + + "AND T.CLASSIFICATION_ID NOT IN (#{excludedClassificationId}) " + + "" + + "" + + "AND ((${key} = '${customAttributeFilter.get(key)}')) " + + "" + + "AND T.DUE IS NOT NULL AND ( " + + "" + + "#{selectedItem.key} = T.${groupedBy} AND " + + "" + + "A.CLASSIFICATION_KEY = #{selectedItem.subKey} AND " + + "" + + "" + + "#{selectedItem.upperAgeLimit} >= (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP)) AND " + + "#{selectedItem.lowerAgeLimit} <= (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP)) " + + " " + + "" + + "#{selectedItem.upperAgeLimit} >= DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) AND " + + "#{selectedItem.lowerAgeLimit} <= DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) " + + " " + + "" + + "#{selectedItem.upperAgeLimit} >= DATE_PART('day', DUE - CURRENT_TIMESTAMP ) AND " + + "#{selectedItem.lowerAgeLimit} <= DATE_PART('day', DUE - CURRENT_TIMESTAMP ) " + + " " + + ") " + + "" + + "with UR " + + "") List getTaskIdsForSelectedItems(@Param("workbasketIds") List workbasketIds, - @Param("states") List states, - @Param("categories") List categories, - @Param("domains") List domains, - @Param("classificationIds") List classificationIds, - @Param("excludedClassificationIds") List excludedClassificationIds, - @Param("customAttributeFilter") Map customAttributeFilter, - @Param("groupedBy") String groupedBy, @Param("selectedItems") List selectedItems, - @Param("joinWithAttachments") boolean joinWithAttachments); + @Param("states") List states, + @Param("categories") List categories, + @Param("domains") List domains, + @Param("classificationIds") List classificationIds, + @Param("excludedClassificationIds") List excludedClassificationIds, + @Param("customAttributeFilter") Map customAttributeFilter, + @Param("groupedBy") String groupedBy, @Param("selectedItems") List selectedItems, + @Param("joinWithAttachments") boolean joinWithAttachments); @Select("") + + "SELECT DOMAIN, STATE, COUNT(STATE) as COUNT " + + "FROM TASK " + + "" + + "" + + "DOMAIN IN (#{domain}) " + + "" + + "" + + "AND STATE IN (#{state}) " + + "" + + "" + + "GROUP BY DOMAIN, STATE" + + "") @Results({ - @Result(column = "DOMAIN", property = "domain"), - @Result(column = "STATE", property = "state"), - @Result(column = "COUNT", property = "count"), + @Result(column = "DOMAIN", property = "domain"), + @Result(column = "STATE", property = "state"), + @Result(column = "COUNT", property = "count"), }) List getTasksCountByState(@Param("domains") List domains, - @Param("states") List states); + @Param("states") List states); @Select("") + + "SELECT DISTINCT ${customField} " + + "FROM TASK " + + "" + + "" + + "WORKBASKET_ID IN (#{workbasketId}) " + + "" + + "" + + "AND STATE IN (#{state}) " + + "" + + "" + + "AND CLASSIFICATION_CATEGORY IN (#{category}) " + + "" + + "" + + "AND DOMAIN IN (#{domain}) " + + "" + + "" + + "AND CLASSIFICATION_ID IN (#{classificationId}) " + + "" + + "" + + "AND CLASSIFICATION_ID NOT IN (#{excludedClassificationId}) " + + "" + + "" + + "AND ((${key} = '${customAttributeFilter.get(key)}')) " + + "" + + "" + + "") List getCustomAttributeValuesForReport(@Param("workbasketIds") List workbasketIds, - @Param("states") List states, - @Param("categories") List categories, @Param("domains") List domains, - @Param("classificationIds") List classificationIds, - @Param("excludedClassificationIds") List excludedClassificationIds, - @Param("customAttributeFilter") Map customAttributeFilter, - @Param("customField") CustomField customField); + @Param("states") List states, + @Param("categories") List categories, @Param("domains") List domains, + @Param("classificationIds") List classificationIds, + @Param("excludedClassificationIds") List excludedClassificationIds, + @Param("customAttributeFilter") Map customAttributeFilter, + @Param("customField") CustomField customField); @Select("