diff --git a/lib/taskana-core/src/main/java/pro/taskana/CustomField.java b/lib/taskana-core/src/main/java/pro/taskana/CustomField.java index 153a2bd15..82e7f9481 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/CustomField.java +++ b/lib/taskana-core/src/main/java/pro/taskana/CustomField.java @@ -13,5 +13,11 @@ public enum CustomField { CUSTOM_7, CUSTOM_8, CUSTOM_9, - CUSTOM_10 + CUSTOM_10, + CUSTOM_11, + CUSTOM_12, + CUSTOM_13, + CUSTOM_14, + CUSTOM_15, + CUSTOM_16 } 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 10a0e7ed1..5c2424ede 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/TaskMonitorService.java +++ b/lib/taskana-core/src/main/java/pro/taskana/TaskMonitorService.java @@ -18,6 +18,10 @@ import pro.taskana.impl.report.impl.WorkbasketLevelReport; */ public interface TaskMonitorService { + String DIMENSION_CLASSIFICATION_CATEGORY = "CLASSIFICATION_CATEGORY"; + String DIMENSION_CLASSIFICATION_KEY = "CLASSIFICATION_KEY"; + String DIMENSION_WORKBASKET_KEY = "WORKBASKET_KEY"; + /** * Returns a {@link WorkbasketLevelReport} grouped by workbaskets. The report contains the total numbers of tasks of * the respective workbasket as well as the total number of all tasks. If no filter is required, the respective @@ -128,46 +132,6 @@ 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 @@ -623,45 +587,10 @@ public interface TaskMonitorService { * 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 selectedItems - * a list of {@link SelectedItem}s that are selected from the report whose task ids should be determined. - * @return the list of task ids - * @throws InvalidArgumentException - * thrown if columnHeaders is null or if selectedItems is empty or null - */ - List getTaskIdsOfCategoryReportLineItems(List workbasketIds, List states, - List categories, List domains, CustomField customField, List customFieldValues, - List columnHeaders, List selectedItems) - 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 classificationKeys + * a list of task classification key to filter. To omit this filter, use null for this parameter + * @param excludedClassificationKeys + * a list of task classification key to exclude. 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 @@ -680,14 +609,18 @@ public interface TaskMonitorService { * working days * @param selectedItems * a list of {@link SelectedItem}s that are selected from the report whose task ids should be determined. + * @param dimension + * defines the meaning of the key in the {@link SelectedItem}s. * @return the list of task ids * @throws InvalidArgumentException * thrown if columnHeaders is null or if selectedItems is empty or null */ - List getTaskIdsOfCategoryReportLineItems(List workbasketIds, List states, - List categories, List domains, CustomField customField, List customFieldValues, - List columnHeaders, boolean inWorkingDays, - List selectedItems) throws InvalidArgumentException; + List getTaskIdsForSelectedItems(List workbasketIds, List states, List categories, + List domains, List classificationKeys, + List excludedClassificationKeys, CustomField customField, List customFieldValues, + List columnHeaders, boolean inWorkingDays, List selectedItems, + String dimension) + throws InvalidArgumentException; /** * Returns a list of distinct custom attribute values for the selection from the entire task pool. diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/SelectedItem.java b/lib/taskana-core/src/main/java/pro/taskana/impl/SelectedItem.java index 92a84d97f..0fcd96ead 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/SelectedItem.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/SelectedItem.java @@ -7,6 +7,7 @@ package pro.taskana.impl; public class SelectedItem { private String key; + private String subKey; private int upperAgeLimit; private int lowerAgeLimit; @@ -18,6 +19,14 @@ public class SelectedItem { this.key = key; } + public String getSubKey() { + return subKey; + } + + public void setSubKey(String subKey) { + this.subKey = subKey; + } + public int getUpperAgeLimit() { return upperAgeLimit; } @@ -36,7 +45,8 @@ public class SelectedItem { @Override public String toString() { - return "Key: " + this.key + ", Limits: (" + this.lowerAgeLimit + "," + this.getUpperAgeLimit() + ")"; + return "Key: " + this.key + ", SubKey: " + this.subKey + ", Limits: (" + this.lowerAgeLimit + "," + + this.getUpperAgeLimit() + ")"; } } 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 c2ea8a973..a3185674d 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 @@ -288,60 +288,6 @@ public class TaskMonitorServiceImpl implements TaskMonitorService { } } - @Override - public List getTaskIdsOfCategoryReportLineItems(List workbasketIds, List states, - List categories, List domains, CustomField customField, List customFieldValues, - List columnHeaders, List selectedItems) - throws InvalidArgumentException { - return getTaskIdsOfCategoryReportLineItems(workbasketIds, states, categories, domains, customField, - customFieldValues, columnHeaders, true, selectedItems); - } - - @Override - public List getTaskIdsOfCategoryReportLineItems(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 getTaskIdsOfCategoryReportLineItems(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.getTaskIdsOfCategoriesBySelectedItems(workbasketIds, states, - // categories, domains, customField, customFieldValues, selectedItems); - - List taskIds = taskMonitorMapper.getTaskIdsForSelectedItems(workbasketIds, states, - categories, domains, customField, customFieldValues, "CLASSIFICATION_CATEGORY", selectedItems); - - return taskIds; - - } finally { - taskanaEngineImpl.returnConnection(); - LOGGER.debug("exit from getTaskIdsOfCategoryReportLineItems()."); - } - } - @Override public List getCustomAttributeValuesForReport(List workbasketIds, List states, List categories, List domains, List classificationIds, @@ -376,27 +322,34 @@ 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 { + public List getTaskIdsForSelectedItems(List workbasketIds, List states, + List categories, List domains, List classificationIds, + List excludedClassificationIds, CustomField customField, List customFieldValues, + List columnHeaders, boolean inWorkingDays, + List selectedItems, String dimension) throws InvalidArgumentException { if (LOGGER.isDebugEnabled()) { - LOGGER.debug("entry to getTaskIdsOfWorkbasketLevelReportLineItems(workbasketIds = {}, states = {}, " + LOGGER.debug("entry to getTaskIdsForSelectedItems(workbasketIds = {}, states = {}, " + "categories = {}, domains = {}, customField = {}, customFieldValues = {}, " - + "columnHeaders = {}, inWorkingDays = {}, selectedItems = {})", + + "columnHeaders = {}, inWorkingDays = {}, selectedItems = {}, dimension = {})", LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states), - LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), customField, + LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), + LoggerUtils.listToString(classificationIds), LoggerUtils.listToString(excludedClassificationIds), + customField, LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(columnHeaders), - inWorkingDays, LoggerUtils.listToString(selectedItems)); + inWorkingDays, LoggerUtils.listToString(selectedItems), dimension); } try { taskanaEngineImpl.openConnection(); if (columnHeaders == null) { - throw new InvalidArgumentException("ReportLineItemDefinitions can´t be used as NULL-Parameter"); + throw new InvalidArgumentException("ColumnHeader must not be null."); } if (selectedItems == null || selectedItems.size() == 0) { throw new InvalidArgumentException( - "SelectedItems can´t be used as NULL-Parameter and should not be empty"); + "SelectedItems must not be null or empty."); + } + boolean joinWithAttachments = subKeyIsSet(selectedItems); + if (joinWithAttachments && !TaskMonitorService.DIMENSION_CLASSIFICATION_KEY.equals(dimension)) { + throw new InvalidArgumentException("SubKeys are supported for dimension CLASSIFICATION_KEY only."); } configureDaysToWorkingDaysConverter(); @@ -405,18 +358,15 @@ public class TaskMonitorServiceImpl implements TaskMonitorService { 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); + categories, domains, classificationIds, excludedClassificationIds, customField, customFieldValues, + dimension, selectedItems, joinWithAttachments); return taskIds; } finally { taskanaEngineImpl.returnConnection(); - LOGGER.debug("exit from getTaskIdsOfWorkbasketLevelReportLineItems()."); + LOGGER.debug("exit from getTaskIdsForSelectedItems()."); } } @@ -464,4 +414,13 @@ public class TaskMonitorServiceImpl implements TaskMonitorService { this.taskanaEngineImpl.getConfiguration().isGermanPublicHolidaysEnabled()); } + private boolean subKeyIsSet(List selectedItems) { + for (SelectedItem selectedItem : selectedItems) { + if (selectedItem.getSubKey() != null && !selectedItem.getSubKey().isEmpty()) { + return true; + } + } + return false; + } + } 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 3679138d6..b9253f6d9 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 @@ -208,26 +208,38 @@ public interface TaskMonitorMapper { @Param("customFieldValues") List customFieldValues); @Select("