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 e665b54f3..9d037b131 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/TaskMonitorService.java +++ b/lib/taskana-core/src/main/java/pro/taskana/TaskMonitorService.java @@ -8,6 +8,7 @@ import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.impl.SelectedItem; import pro.taskana.impl.report.impl.CategoryReport; import pro.taskana.impl.report.impl.ClassificationReport; +import pro.taskana.impl.report.impl.CombinedClassificationFilter; import pro.taskana.impl.report.impl.CustomFieldValueReport; import pro.taskana.impl.report.impl.DetailedClassificationReport; import pro.taskana.impl.report.impl.TaskStatusReport; @@ -43,6 +44,11 @@ public interface TaskMonitorService { * @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 combinedClassificationFilter + * a list of pairs of a classificationId for a task and a classificationId for the corresponding + * attachment that is used to filter by the classification of the attachment. To filter by the + * classification of the task, the classificationId of the attachment should be null. To omit this + * filter, use null for this parameter * @return the report * @throws InvalidArgumentException * thrown if DaysToWorkingDaysConverter is initialized with null @@ -50,7 +56,8 @@ public interface TaskMonitorService { * if the current user is not member of role MONITOR */ WorkbasketLevelReport getWorkbasketLevelReport(List workbasketIds, List states, - List categories, List domains, CustomField customField, List customFieldValues) + List categories, List domains, CustomField customField, List customFieldValues, + List combinedClassificationFilter) throws InvalidArgumentException, NotAuthorizedException; /** @@ -77,6 +84,11 @@ public interface TaskMonitorService { * @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 combinedClassificationFilter + * a list of pairs of a classificationId for a task and a classificationId for the corresponding + * attachment that is used to filter by the classification of the attachment. To filter by the + * classification of the task, the classificationId of the attachment should be null. 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 @@ -92,16 +104,17 @@ public interface TaskMonitorService { */ WorkbasketLevelReport getWorkbasketLevelReport(List workbasketIds, List states, List categories, List domains, CustomField customField, List customFieldValues, - List columnHeaders) throws InvalidArgumentException, NotAuthorizedException; + List combinedClassificationFilter, List columnHeaders) + throws InvalidArgumentException, NotAuthorizedException; /** - * Returns a {@link WorkbasketLevelReport} grouped by workbaskets. For each workbasket the report contains the total - * number of tasks and the number of tasks of the respective cluster that are specified by the - * {@link TimeIntervalColumnHeader}s. It can be specified whether the age of the tasks is counted in days or in - * working days. Furthermore the report contains a sum line that contains the total numbers of the different - * clusters and the total number of all tasks. 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. + * Returns a {@link WorkbasketLevelReport} for specific classifications grouped by workbaskets. For each workbasket + * the report contains the total number of tasks and the number of tasks of the respective cluster that are + * specified by the {@link TimeIntervalColumnHeader}s. It can be specified whether the age of the tasks is counted + * in days or in working days. Furthermore the report contains a sum line that contains the total numbers of the + * different clusters and the total number of all tasks. 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 @@ -118,6 +131,11 @@ public interface TaskMonitorService { * @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 combinedClassificationFilter + * a list of pairs of a classificationId for a task and a classificationId for the corresponding + * attachment that is used to filter by the classification of the attachment. To filter by the + * classification of the task, the classificationId of the attachment should be null. 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 @@ -136,8 +154,8 @@ public interface TaskMonitorService { */ WorkbasketLevelReport getWorkbasketLevelReport(List workbasketIds, List states, List categories, List domains, CustomField customField, List customFieldValues, - List columnHeaders, boolean inWorkingDays) - throws InvalidArgumentException, NotAuthorizedException; + List combinedClassificationFilter, List columnHeaders, + boolean inWorkingDays) throws InvalidArgumentException, NotAuthorizedException; /** * Returns a {@link CategoryReport} grouped by categories. The report contains the total numbers of tasks of the 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 d48241162..cf4f0e776 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 @@ -16,6 +16,7 @@ import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.impl.report.impl.CategoryReport; import pro.taskana.impl.report.impl.ClassificationReport; +import pro.taskana.impl.report.impl.CombinedClassificationFilter; import pro.taskana.impl.report.impl.CustomFieldValueReport; import pro.taskana.impl.report.impl.DaysToWorkingDaysPreProcessor; import pro.taskana.impl.report.impl.DetailedClassificationReport; @@ -45,31 +46,34 @@ public class TaskMonitorServiceImpl implements TaskMonitorService { @Override public WorkbasketLevelReport getWorkbasketLevelReport(List workbasketIds, List states, - List categories, List domains, CustomField customField, List customFieldValues) + List categories, List domains, CustomField customField, List customFieldValues, + List combinedClassificationFilter) throws InvalidArgumentException, NotAuthorizedException { return getWorkbasketLevelReport(workbasketIds, states, categories, domains, customField, customFieldValues, - Collections.emptyList(), false); + combinedClassificationFilter, Collections.emptyList(), false); } @Override public WorkbasketLevelReport getWorkbasketLevelReport(List workbasketIds, List states, List categories, List domains, CustomField customField, List customFieldValues, - List columnHeaders) throws InvalidArgumentException, NotAuthorizedException { + List combinedClassificationFilter, List columnHeaders) + throws InvalidArgumentException, NotAuthorizedException { return getWorkbasketLevelReport(workbasketIds, states, categories, domains, customField, customFieldValues, - columnHeaders, true); + combinedClassificationFilter, columnHeaders, true); } @Override public WorkbasketLevelReport getWorkbasketLevelReport(List workbasketIds, List states, List categories, List domains, CustomField customField, List customFieldValues, - List columnHeaders, boolean inWorkingDays) - throws InvalidArgumentException, NotAuthorizedException { + List combinedClassificationFilter, List columnHeaders, + boolean inWorkingDays) throws InvalidArgumentException, NotAuthorizedException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("entry to getWorkbasketLevelReport(workbasketIds = {}, states = {}, categories = {}, " - + "domains = {}, customField = {}, customFieldValues = {}, columnHeaders = {}, " - + "inWorkingDays = {})", LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states), - LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), customField, - LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(columnHeaders), + + "domains = {}, customField = {}, customFieldValues = {}, combinedClassificationFilter = {}, " + + "columnHeaders = {}, inWorkingDays = {})", LoggerUtils.listToString(workbasketIds), + LoggerUtils.listToString(states), LoggerUtils.listToString(categories), + LoggerUtils.listToString(domains), customField, LoggerUtils.listToString(customFieldValues), + LoggerUtils.listToString(combinedClassificationFilter), LoggerUtils.listToString(columnHeaders), inWorkingDays); } taskanaEngineImpl.checkRoleMembership(TaskanaRole.MONITOR); @@ -80,7 +84,8 @@ public class TaskMonitorServiceImpl implements TaskMonitorService { WorkbasketLevelReport report = new WorkbasketLevelReport(columnHeaders); List monitorQueryItems = taskMonitorMapper.getTaskCountOfWorkbaskets( - workbasketIds, states, categories, domains, customField, customFieldValues); + workbasketIds, states, categories, domains, customField, customFieldValues, + combinedClassificationFilter); report.addItems(monitorQueryItems, new DaysToWorkingDaysPreProcessor<>(columnHeaders, inWorkingDays)); diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/CombinedClassificationFilter.java b/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/CombinedClassificationFilter.java new file mode 100644 index 000000000..a406e5b9e --- /dev/null +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/CombinedClassificationFilter.java @@ -0,0 +1,43 @@ +package pro.taskana.impl.report.impl; + +/** + * The CombinedClassificationFilter is a pair of a classificationId for a task and a classificationId for the + * corresponding attachment that is used to filter the {@link WorkbasketLevelReport} by the classification of the + * attachment. To filter by the classification of the task, the classificationId of the attachment should be null. + */ +public class CombinedClassificationFilter { + + private String taskClassificationId; + private String attachmentClassificationId; + + public CombinedClassificationFilter(String taskClassificationId) { + this.taskClassificationId = taskClassificationId; + } + + public CombinedClassificationFilter(String taskClassificationId, String attachmentClassificationId) { + this.taskClassificationId = taskClassificationId; + this.attachmentClassificationId = attachmentClassificationId; + } + + public String getTaskClassificationId() { + return this.taskClassificationId; + } + + public void setTaskClassificationId(String taskClassificationId) { + this.taskClassificationId = taskClassificationId; + } + + public String getAttachmentClassificationId() { + return this.attachmentClassificationId; + } + + public void setAttachmentClassificationId(String attachmentClassificationId) { + this.attachmentClassificationId = attachmentClassificationId; + } + + @Override + public String toString() { + return "(" + this.taskClassificationId + "," + this.attachmentClassificationId + ")"; + } + +} 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 102850e91..899777e68 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 @@ -11,6 +11,7 @@ import org.apache.ibatis.annotations.Select; import pro.taskana.CustomField; import pro.taskana.TaskState; import pro.taskana.impl.SelectedItem; +import pro.taskana.impl.report.impl.CombinedClassificationFilter; import pro.taskana.impl.report.impl.DetailedMonitorQueryItem; import pro.taskana.impl.report.impl.MonitorQueryItem; import pro.taskana.impl.report.impl.TaskQueryItem; @@ -21,31 +22,39 @@ import pro.taskana.impl.report.impl.TaskQueryItem; public interface TaskMonitorMapper { @Select("") @Results({ @@ -57,7 +66,8 @@ public interface TaskMonitorMapper { @Param("categories") List categories, @Param("domains") List domains, @Param("customField") CustomField customField, - @Param("customFieldValues") List customFieldValues); + @Param("customFieldValues") List customFieldValues, + @Param("combinedClassificationFilter") List combinedClassificationFilter); @Select("