diff --git a/lib/taskana-core/src/main/java/pro/taskana/TaskMonitorService.java b/lib/taskana-core/src/main/java/pro/taskana/TaskMonitorService.java index 4c93886dd..10a0e7ed1 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/TaskMonitorService.java +++ b/lib/taskana-core/src/main/java/pro/taskana/TaskMonitorService.java @@ -128,6 +128,46 @@ public interface TaskMonitorService { List columnHeaders, boolean inWorkingDays) throws InvalidArgumentException; + /** + * Returns a list of all task ids in the selected items of a {@link pro.taskana.impl.report.Report}. By default the + * age of the tasks is counted in working days. The tasks of the report are filtered by workbaskets, states, + * categories, domains and values of a custom field. If no filter is required, the respective parameter should be + * null. Tasks with Timestamp DUE = null are not considered. + * + * @param workbasketIds + * a list of workbasket ids objects to filter by workbaskets. To omit this filter, use null for this + * parameter + * @param states + * a list of states objects to filter by states. To omit this filter, use null for this parameter + * @param categories + * a list of categories to filter by categories. To omit this filter, use null for this parameter + * @param domains + * a list of domains to filter by domains. To omit this filter, use null for this parameter + * @param customField + * a custom field to filter by the values of the custom field. To omit this filter, use null for this + * parameter + * @param customFieldValues + * a list of custom field values to filter by the values of the custom field. To omit this filter, use + * null for this parameter + * @param columnHeaders + * a list of columnHeaders that specify the subdivision into different cluster of due dates. Days in past + * are represented as negative values and days in the future are represented as positive values. To avoid + * tasks are counted multiple times or not be listed in the report, these columnHeaders should not + * overlap and should not have gaps. If the ReportLineDefinition should represent a single day, + * lowerLimit and upperLimit have to be equal. The outer cluster of a report should have open ends. These + * open ends are represented with Integer.MIN_VALUE and Integer.MAX_VALUE. + * @param inWorkingDays + * a boolean parameter that specifies whether the age of the tasks should be counted in days or in + * working days + * @return the report + * @throws InvalidArgumentException + * thrown if DaysToWorkingDaysConverter is initialized with null + */ + List getTaskIdsOfWorkbasketLevelReportLineItems(List workbasketIds, List states, + List categories, List domains, CustomField customField, List customFieldValues, + List columnHeaders, boolean inWorkingDays, List selectedItems) + throws InvalidArgumentException; + /** * Returns a {@link CategoryReport} grouped by categories. The report contains the total numbers of tasks of the * respective category as well as the total number of all tasks. The tasks of the report are filtered by diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/TaskMonitorServiceImpl.java b/lib/taskana-core/src/main/java/pro/taskana/impl/TaskMonitorServiceImpl.java index 521588ae1..c2ea8a973 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/TaskMonitorServiceImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/TaskMonitorServiceImpl.java @@ -328,8 +328,11 @@ public class TaskMonitorServiceImpl implements TaskMonitorService { selectedItems = convertWorkingDaysToDays(selectedItems, columnHeaders); } - List taskIds = taskMonitorMapper.getTaskIdsOfCategoriesBySelectedItems(workbasketIds, states, - categories, domains, customField, customFieldValues, selectedItems); + // List taskIds = taskMonitorMapper.getTaskIdsOfCategoriesBySelectedItems(workbasketIds, states, + // categories, domains, customField, customFieldValues, selectedItems); + + List taskIds = taskMonitorMapper.getTaskIdsForSelectedItems(workbasketIds, states, + categories, domains, customField, customFieldValues, "CLASSIFICATION_CATEGORY", selectedItems); return taskIds; @@ -372,6 +375,51 @@ public class TaskMonitorServiceImpl implements TaskMonitorService { } } + @Override + public List getTaskIdsOfWorkbasketLevelReportLineItems(List workbasketIds, List states, + List categories, List domains, CustomField customField, List customFieldValues, + List columnHeaders, boolean inWorkingDays, List selectedItems) + throws InvalidArgumentException { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("entry to getTaskIdsOfWorkbasketLevelReportLineItems(workbasketIds = {}, states = {}, " + + "categories = {}, domains = {}, customField = {}, customFieldValues = {}, " + + "columnHeaders = {}, inWorkingDays = {}, selectedItems = {})", + LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states), + LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), customField, + LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(columnHeaders), + inWorkingDays, LoggerUtils.listToString(selectedItems)); + } + try { + taskanaEngineImpl.openConnection(); + if (columnHeaders == null) { + throw new InvalidArgumentException("ReportLineItemDefinitions can´t be used as NULL-Parameter"); + } + if (selectedItems == null || selectedItems.size() == 0) { + throw new InvalidArgumentException( + "SelectedItems can´t be used as NULL-Parameter and should not be empty"); + } + + configureDaysToWorkingDaysConverter(); + + if (inWorkingDays) { + selectedItems = convertWorkingDaysToDays(selectedItems, columnHeaders); + } + + // List taskIds = taskMonitorMapper.getTaskIdsOfWorkbasketLevelBySelectedItems(workbasketIds, + // states, + // categories, domains, customField, customFieldValues, selectedItems); + + List taskIds = taskMonitorMapper.getTaskIdsForSelectedItems(workbasketIds, states, + categories, domains, customField, customFieldValues, "WORKBASKET_KEY", selectedItems); + + return taskIds; + + } finally { + taskanaEngineImpl.returnConnection(); + LOGGER.debug("exit from getTaskIdsOfWorkbasketLevelReportLineItems()."); + } + } + @Override public TaskStatusReport getTaskStatusReport() { return getTaskStatusReport(null, null); @@ -415,4 +463,5 @@ public class TaskMonitorServiceImpl implements TaskMonitorService { DaysToWorkingDaysConverter.setGermanPublicHolidaysEnabled( this.taskanaEngineImpl.getConfiguration().isGermanPublicHolidaysEnabled()); } + } 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 dfe9cdfec..3679138d6 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 @@ -227,7 +227,7 @@ public interface TaskMonitorMapper { + "" + "AND DUE IS NOT NULL AND ( " + "" - + "#{selectedItem.key} = CLASSIFICATION_CATEGORY AND " + + "#{selectedItem.key} = ${groupedBy} AND " + "" + "#{selectedItem.upperAgeLimit} >= (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP)) AND " + "#{selectedItem.lowerAgeLimit} <= (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP)) " @@ -240,13 +240,11 @@ public interface TaskMonitorMapper { + "" + "with UR " + "") - List getTaskIdsOfCategoriesBySelectedItems(@Param("workbasketIds") List workbasketIds, + List getTaskIdsForSelectedItems(@Param("workbasketIds") List workbasketIds, @Param("states") List states, - @Param("categories") List categories, - @Param("domains") List domains, - @Param("customField") CustomField customField, - @Param("customFieldValues") List customFieldValues, - @Param("selectedItems") List selectedItems); + @Param("categories") List categories, @Param("domains") List domains, + @Param("customField") CustomField customField, @Param("customFieldValues") List customFieldValues, + @Param("groupedBy") String groupedBy, @Param("selectedItems") List selectedItems); @Select("