From db70a89435afde17561c89c83579abc026e1b780 Mon Sep 17 00:00:00 2001 From: Mustapha Zorgati <15628173+mustaphazorgati@users.noreply.github.com> Date: Wed, 5 Sep 2018 13:17:37 +0200 Subject: [PATCH] TSK-697: refactored Report structure --- .../taskana/ClassificationReportBuilder.java | 161 -------------- .../CustomFieldValueReportBuilder.java | 149 ------------- .../java/pro/taskana/TaskMonitorService.java | 38 ++-- .../pro/taskana/TaskStatusReportBuilder.java | 41 ---- .../pro/taskana/WorkbasketReportBuilder.java | 157 -------------- .../impl/CategoryReportBuilderImpl.java | 70 ++----- .../impl/ClassificationReportBuilderImpl.java | 74 ++----- .../CustomFieldValueReportBuilderImpl.java | 74 ++----- .../impl/DaysToWorkingDaysConverter.java | 64 +++--- .../taskana/impl/TaskMonitorServiceImpl.java | 21 +- .../pro/taskana/impl/TaskServiceImpl.java | 2 +- .../impl/TaskStatusReportBuilderImpl.java | 9 +- ...ava => TimeIntervalReportBuilderImpl.java} | 198 ++++++++---------- .../impl/WorkbasketReportBuilderImpl.java | 91 ++------ .../CombinedClassificationFilter.java | 4 +- .../DaysToWorkingDaysPreProcessor.java | 4 +- .../{impl => }/DetailedMonitorQueryItem.java | 2 +- .../report/{impl => }/DetailedReportRow.java | 4 +- .../report/{impl => }/MonitorQueryItem.java | 4 +- .../impl/report/{impl => }/TaskQueryItem.java | 4 +- .../{impl => }/TaskStatusColumnHeader.java | 4 +- .../{impl => }/TimeIntervalColumnHeader.java | 4 +- .../impl/report/impl/CategoryReport.java | 16 -- .../report/impl/ClassificationReport.java | 17 -- .../report/impl/CustomFieldValueReport.java | 15 -- .../impl/DetailedClassificationReport.java | 28 --- .../impl/report/impl/TaskStatusReport.java | 25 --- .../impl/report/impl/WorkbasketReport.java | 16 -- .../taskana/mappings/TaskMonitorMapper.java | 8 +- .../pro/taskana/report/CategoryReport.java | 32 +++ .../taskana/report/ClassificationReport.java | 67 ++++++ .../report/CustomFieldValueReport.java | 33 +++ .../taskana/{impl => }/report/QueryItem.java | 2 +- .../report/QueryItemPreprocessor.java | 2 +- .../pro/taskana/{impl => }/report/Report.java | 17 +- .../{impl => }/report/ReportColumnHeader.java | 2 +- .../taskana/{impl => }/report/ReportRow.java | 2 +- .../pro/taskana/report/TaskStatusReport.java | 52 +++++ .../TimeIntervalReportBuilder.java} | 74 +++---- .../pro/taskana/report/WorkbasketReport.java | 46 ++++ .../UpdateClassificationAccTest.java | 2 +- .../GetTaskIdsOfCategoryReportAccTest.java | 2 +- ...tTaskIdsOfClassificationReportAccTest.java | 2 +- ...askIdsOfCustomFieldValueReportAccTest.java | 2 +- .../GetTaskIdsOfWorkbasketReportAccTest.java | 2 +- .../ProvideCategoryReportAccTest.java | 4 +- .../ProvideClassificationReportAccTest.java | 4 +- .../ProvideCustomFieldValueReportAccTest.java | 7 +- ...deDetailedClassificationReportAccTest.java | 10 +- .../ProvideTaskStatusReportAccTest.java | 19 +- .../ProvideWorkbasketReportAccTest.java | 9 +- .../acceptance/task/CreateTaskAccTest.java | 2 +- .../task/UpdateTaskAttachmentsAccTest.java | 2 +- .../impl/CategoryReportBuilderImplTest.java | 12 +- .../ClassificationReportBuilderImplTest.java | 20 +- ...CustomFieldValueReportBuilderImplTest.java | 6 +- .../impl/DaysToWorkingDaysConverterTest.java | 2 +- .../impl/TaskStatusReportBuilderImplTest.java | 9 +- .../impl/WorkbasketReportBuilderImplTest.java | 16 +- .../pro/taskana/rest/MonitorController.java | 4 +- .../taskana/rest/resource/ReportResource.java | 4 +- .../resource/assembler/ReportAssembler.java | 13 +- 62 files changed, 590 insertions(+), 1196 deletions(-) delete mode 100644 lib/taskana-core/src/main/java/pro/taskana/ClassificationReportBuilder.java delete mode 100644 lib/taskana-core/src/main/java/pro/taskana/CustomFieldValueReportBuilder.java delete mode 100644 lib/taskana-core/src/main/java/pro/taskana/TaskStatusReportBuilder.java delete mode 100644 lib/taskana-core/src/main/java/pro/taskana/WorkbasketReportBuilder.java rename lib/taskana-core/src/main/java/pro/taskana/impl/{ReportBuilder.java => TimeIntervalReportBuilderImpl.java} (56%) rename lib/taskana-core/src/main/java/pro/taskana/impl/report/{impl => }/CombinedClassificationFilter.java (88%) rename lib/taskana-core/src/main/java/pro/taskana/impl/report/{impl => }/DaysToWorkingDaysPreProcessor.java (90%) rename lib/taskana-core/src/main/java/pro/taskana/impl/report/{impl => }/DetailedMonitorQueryItem.java (92%) rename lib/taskana-core/src/main/java/pro/taskana/impl/report/{impl => }/DetailedReportRow.java (95%) rename lib/taskana-core/src/main/java/pro/taskana/impl/report/{impl => }/MonitorQueryItem.java (89%) rename lib/taskana-core/src/main/java/pro/taskana/impl/report/{impl => }/TaskQueryItem.java (89%) rename lib/taskana-core/src/main/java/pro/taskana/impl/report/{impl => }/TaskStatusColumnHeader.java (87%) rename lib/taskana-core/src/main/java/pro/taskana/impl/report/{impl => }/TimeIntervalColumnHeader.java (94%) delete mode 100644 lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/CategoryReport.java delete mode 100644 lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/ClassificationReport.java delete mode 100644 lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/CustomFieldValueReport.java delete mode 100644 lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/DetailedClassificationReport.java delete mode 100644 lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/TaskStatusReport.java delete mode 100644 lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/WorkbasketReport.java create mode 100644 lib/taskana-core/src/main/java/pro/taskana/report/CategoryReport.java create mode 100644 lib/taskana-core/src/main/java/pro/taskana/report/ClassificationReport.java create mode 100644 lib/taskana-core/src/main/java/pro/taskana/report/CustomFieldValueReport.java rename lib/taskana-core/src/main/java/pro/taskana/{impl => }/report/QueryItem.java (90%) rename lib/taskana-core/src/main/java/pro/taskana/{impl => }/report/QueryItemPreprocessor.java (92%) rename lib/taskana-core/src/main/java/pro/taskana/{impl => }/report/Report.java (81%) rename lib/taskana-core/src/main/java/pro/taskana/{impl => }/report/ReportColumnHeader.java (91%) rename lib/taskana-core/src/main/java/pro/taskana/{impl => }/report/ReportRow.java (96%) create mode 100644 lib/taskana-core/src/main/java/pro/taskana/report/TaskStatusReport.java rename lib/taskana-core/src/main/java/pro/taskana/{CategoryReportBuilder.java => report/TimeIntervalReportBuilder.java} (54%) create mode 100644 lib/taskana-core/src/main/java/pro/taskana/report/WorkbasketReport.java diff --git a/lib/taskana-core/src/main/java/pro/taskana/ClassificationReportBuilder.java b/lib/taskana-core/src/main/java/pro/taskana/ClassificationReportBuilder.java deleted file mode 100644 index 7cef00ccb..000000000 --- a/lib/taskana-core/src/main/java/pro/taskana/ClassificationReportBuilder.java +++ /dev/null @@ -1,161 +0,0 @@ -package pro.taskana; - -import java.util.List; -import java.util.Map; - -import pro.taskana.exceptions.InvalidArgumentException; -import pro.taskana.exceptions.NotAuthorizedException; -import pro.taskana.impl.SelectedItem; -import pro.taskana.impl.report.impl.ClassificationReport; -import pro.taskana.impl.report.impl.DetailedClassificationReport; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; - -/** - * The ClassificationReportBuilder is used to build a {@link ClassificationReport} or a - * {@link DetailedClassificationReport}. Furthermore the taskIds and values of an entered custom field of these reports - * can be listed. A ClassificationReport contains the total numbers of tasks of the respective classification as well as - * the total number of all tasks. A ReportLine of a DetailedClassificationReport contains an additional list of - * ReportLines for the classifications of the attachments of the tasks. The tasks of the report can be filtered by - * workbaskets, states, categories, domains, classifications and values of a custom field. Classifications can also be - * excluded from the report. If the {@link TimeIntervalColumnHeader}s are set, the report contains also the number of - * tasks of the respective cluster. The age of the tasks can be counted in days or in working days. Tasks with Timestamp - * DUE = null are not considered. - */ -public interface ClassificationReportBuilder { - - /** - * Adds a list {@link TimeIntervalColumnHeader}s to the builder to subdivide the report into clusters. - * - * @param columnHeaders - * the column headers the report should consist of. - * @return the ClassificationReportBuilder - */ - ClassificationReportBuilder withColumnHeaders(List columnHeaders); - - /** - * If this filter is used, the days of the report are counted in working days. - * - * @return the ClassificationReportBuilder - */ - ClassificationReportBuilder inWorkingDays(); - - /** - * Adds a list of workbasket ids to the builder. The created report contains only tasks with a workbasket id in this - * list. - * - * @param workbasketIds - * a list of workbasket ids - * @return the ClassificationReportBuilder - */ - ClassificationReportBuilder workbasketIdIn(List workbasketIds); - - /** - * Adds a list of states to the builder. The created report contains only tasks with a state in this list. - * - * @param states - * a list of states - * @return the ClassificationReportBuilder - */ - ClassificationReportBuilder stateIn(List states); - - /** - * Adds a list of categories to the builder. The created report contains only tasks with a category in this list. - * - * @param categories - * a list of categories - * @return the ClassificationReportBuilder - */ - ClassificationReportBuilder categoryIn(List categories); - - /** - * Adds a list of classificationIds to the builder. The created report contains only tasks with a classificationId - * in this list. - * - * @param classificationIds - * a list of classificationIds - * @return the ClassificationReportBuilder - */ - ClassificationReportBuilder classificationIdIn(List classificationIds); - - /** - * Adds a list of excludedClassificationIds to the builder. The created report contains only tasks with a - * classificationId NOT in this list. - * - * @param excludedClassificationIds - * a list of excludedClassificationIds - * @return the ClassificationReportBuilder - */ - ClassificationReportBuilder excludedClassificationIdIn(List excludedClassificationIds); - - /** - * Adds a list of domains to the builder. The created report contains only tasks with a domain in this list. - * - * @param domains - * a list of domains - * @return the ClassificationReportBuilder - */ - ClassificationReportBuilder domainIn(List domains); - - /** - * Adds a map of custom attributes and custom attribute values to the builder. The created report contains only - * tasks with a custom attribute value in this list. - * - * @param customAttributeFilter - * a map of custom attributes and custom attribute value - * @return the ClassificationReportBuilder - */ - ClassificationReportBuilder customAttributeFilterIn(Map customAttributeFilter); - - /** - * Returns a {@link ClassificationReport} containing all tasks after applying the filters. If the column headers are - * set the report is subdivided into clusters. - * - * @throws InvalidArgumentException - * if the column headers are not initialized - * @throws NotAuthorizedException - * if the user has no rights to access the monitor - * @return the ClassificationReport - */ - ClassificationReport buildReport() throws InvalidArgumentException, NotAuthorizedException; - - /** - * Returns a {@link DetailedClassificationReport} containing all tasks after applying the filters. If the column - * headers are set the report is subdivided into clusters. Its - * {@link pro.taskana.impl.report.impl.DetailedReportRow}s contain an additional list of - * {@link pro.taskana.impl.report.ReportRow}s for the classifications of the attachments of the tasks. - * - * @throws InvalidArgumentException - * if the column headers are not initialized - * @throws NotAuthorizedException - * if the user has no rights to access the monitor - * @return the DetailedClassificationReport - */ - DetailedClassificationReport buildDetailedReport() throws InvalidArgumentException, NotAuthorizedException; - - /** - * Returns a list of all taskIds of the report that are in the list of selected items. - * - * @param selectedItems - * a list of selectedItems - * @throws InvalidArgumentException - * if the column headers are not initialized - * @throws NotAuthorizedException - * if the user has no rights to access the monitor - * @return the list of all taskIds - */ - List listTaskIdsForSelectedItems(List selectedItems) - throws NotAuthorizedException, InvalidArgumentException; - - /** - * Returns a list of all values of an entered custom field that are in the report. - * - * @param customField - * the customField whose values should appear in the list - * @throws NotAuthorizedException - * if the user has no rights to access the monitor - * @return the list of all custom attribute values - */ - List listCustomAttributeValuesForCustomAttributeName(CustomField customField) - throws NotAuthorizedException; - -} diff --git a/lib/taskana-core/src/main/java/pro/taskana/CustomFieldValueReportBuilder.java b/lib/taskana-core/src/main/java/pro/taskana/CustomFieldValueReportBuilder.java deleted file mode 100644 index 72fd18a03..000000000 --- a/lib/taskana-core/src/main/java/pro/taskana/CustomFieldValueReportBuilder.java +++ /dev/null @@ -1,149 +0,0 @@ -package pro.taskana; - -import java.util.List; -import java.util.Map; - -import pro.taskana.exceptions.InvalidArgumentException; -import pro.taskana.exceptions.NotAuthorizedException; -import pro.taskana.impl.SelectedItem; -import pro.taskana.impl.report.impl.CustomFieldValueReport; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; - -/** - * The CustomFieldValueReportBuilder is used to build a {@link CustomFieldValueReport} and list the values of a entered - * custom field. A CustomFieldValueReport contains the total numbers of tasks of the respective custom field as well as - * the total number of all tasks. The tasks of the report can be filtered by workbaskets, states, categories, domains, - * classifications and values of a custom field. Classifications can also be excluded from the report. If the - * {@link TimeIntervalColumnHeader}s are set, the report contains also the number of tasks of the respective cluster. - * The age of the tasks can be counted in days or in working days. Tasks with Timestamp DUE = null are not considered. - */ -public interface CustomFieldValueReportBuilder { - - /** - * Adds a list {@link TimeIntervalColumnHeader}s to the builder to subdivide the report into clusters. - * - * @param columnHeaders - * the column headers the report should consist of. - * @return the CustomFieldValueReportBuilder - */ - CustomFieldValueReportBuilder withColumnHeaders(List columnHeaders); - - /** - * If this filter is used, the days of the report are counted in working days. - * - * @return the CustomFieldValueReportBuilder - */ - CustomFieldValueReportBuilder inWorkingDays(); - - /** - * Adds a list of workbasket ids to the builder. The created report contains only tasks with a workbasket id in this - * list. - * - * @param workbasketIds - * a list of workbasket ids - * @return the CustomFieldValueReportBuilder - */ - CustomFieldValueReportBuilder workbasketIdIn(List workbasketIds); - - /** - * Adds a list of states to the builder. The created report contains only tasks with a state in this list. - * - * @param states - * a list of states - * @return the CustomFieldValueReportBuilder - */ - CustomFieldValueReportBuilder stateIn(List states); - - /** - * Adds a list of categories to the builder. The created report contains only tasks with a category in this list. - * - * @param categories - * a list of categories - * @return the CustomFieldValueReportBuilder - */ - CustomFieldValueReportBuilder categoryIn(List categories); - - /** - * Adds a list of classificationIds to the builder. The created report contains only tasks with a classificationId - * in this list. - * - * @param classificationIds - * a list of classificationIds - * @return the CustomFieldValueReportBuilder - */ - CustomFieldValueReportBuilder classificationIdIn(List classificationIds); - - /** - * Adds a list of excludedClassificationIds to the builder. The created report contains only tasks with a - * classificationId NOT in this list. - * - * @param excludedClassificationIds - * a list of excludedClassificationIds - * @return the CustomFieldValueReportBuilder - */ - CustomFieldValueReportBuilder excludedClassificationIdIn(List excludedClassificationIds); - - /** - * Adds a list of domains to the builder. The created report contains only tasks with a domain in this list. - * - * @param domains - * a list of domains - * @return the CustomFieldValueReportBuilder - */ - CustomFieldValueReportBuilder domainIn(List domains); - - /** - * Adds a map of custom attributes and custom attribute values to the builder. The created report contains only - * tasks with a custom attribute value in this list. - * - * @param customAttributeFilter - * a map of custom attributes and custom attribute value - * @return the CustomFieldValueReportBuilder - */ - CustomFieldValueReportBuilder customAttributeFilterIn(Map customAttributeFilter); - - /** - * Returns a {@link CustomFieldValueReportBuilder} containing all tasks after applying the filters. If the column - * headers are set the report is subdivided into clusters. - * - * @throws InvalidArgumentException - * if the column headers are not initialized - * @throws NotAuthorizedException - * if the user has no rights to access the monitor - * @return the CustomFieldValueReportBuilder - */ - CustomFieldValueReport buildReport() throws InvalidArgumentException, NotAuthorizedException; - - /** - * Returns a list of all taskIds of the report that are in the list of selected items. - * - * @param selectedItems - * a list of selectedItems - * @throws InvalidArgumentException - * if the column headers are not initialized - * @throws NotAuthorizedException - * if the user has no rights to access the monitor - * @return the list of all taskIds - */ - List listTaskIdsForSelectedItems(List selectedItems) - throws NotAuthorizedException, InvalidArgumentException; - - /** - * Returns a list of all values of an entered custom field that are in the report. - * - * @param customField - * the customField whose values should appear in the list - * @throws NotAuthorizedException - * if the user has no rights to access the monitor - * @return the list of all custom attribute values - */ - List listCustomAttributeValuesForCustomAttributeName(CustomField customField) - throws NotAuthorizedException; - - /** - * Gets the customField property of the CustomFieldValueReportBuilder. - * - * @return the customField property - */ - CustomField getCustomField(); -} 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 10a2748a9..528206d6d 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/TaskMonitorService.java +++ b/lib/taskana-core/src/main/java/pro/taskana/TaskMonitorService.java @@ -1,8 +1,10 @@ package pro.taskana; -import pro.taskana.impl.CustomFieldValueReportBuilderImpl; -import pro.taskana.impl.TaskStatusReportBuilderImpl; -import pro.taskana.impl.WorkbasketReportBuilderImpl; +import pro.taskana.report.CategoryReport; +import pro.taskana.report.ClassificationReport; +import pro.taskana.report.CustomFieldValueReport; +import pro.taskana.report.TaskStatusReport; +import pro.taskana.report.WorkbasketReport; /** * The Task Monitor Service manages operations on tasks regarding the monitoring. @@ -10,44 +12,44 @@ import pro.taskana.impl.WorkbasketReportBuilderImpl; public interface TaskMonitorService { /** - * Provides a {@link WorkbasketReportBuilderImpl} for creating a WorkbasketReport, list the task ids of this report + * Provides a {@link WorkbasketReport.Builder} for creating a {@link WorkbasketReport}, list the task ids of this report * and list the values of an entered custom attribute. * - * @return a {@link WorkbasketReportBuilderImpl} + * @return a {@link WorkbasketReport.Builder} */ - WorkbasketReportBuilderImpl createWorkbasketReportBuilder(); + WorkbasketReport.Builder createWorkbasketReportBuilder(); /** - * Provides a {@link CategoryReportBuilder} for creating a CategoryReport, list the task ids of this report and list + * Provides a {@link CategoryReport.Builder} for creating a {@link CategoryReport}, list the task ids of this report and list * the values of an entered custom attribute. * - * @return a {@link CategoryReportBuilder} + * @return a {@link CategoryReport.Builder} */ - CategoryReportBuilder createCategoryReportBuilder(); + CategoryReport.Builder createCategoryReportBuilder(); /** - * Provides a {@link ClassificationReportBuilder} for creating a ClassificationReport or a + * Provides a {@link ClassificationReport.Builder} for creating a {@link ClassificationReport} or a * DetailedClassificationReport, list the task ids of these reports and list the values of an entered custom * attribute. * - * @return a {@link ClassificationReportBuilder} + * @return a {@link ClassificationReport.Builder} */ - ClassificationReportBuilder createClassificationReportBuilder(); + ClassificationReport.Builder createClassificationReportBuilder(); /** - * Provides a {@link CustomFieldValueReportBuilderImpl} for creating a CustomFieldValueReport and list the values of + * Provides a {@link CustomFieldValueReport.Builder} for creating a {@link CustomFieldValueReport} and list the values of * an entered custom attribute. * * @param customField * the customField whose values should appear in the report - * @return a {@link CustomFieldValueReportBuilderImpl} + * @return a {@link CustomFieldValueReport.Builder} */ - CustomFieldValueReportBuilderImpl createCustomFieldValueReportBuilder(CustomField customField); + CustomFieldValueReport.Builder createCustomFieldValueReportBuilder(CustomField customField); /** - * Provides a {@link TaskStatusReportBuilderImpl} for creating a TaskStatusReport. + * Provides a {@link TaskStatusReport.Builder} for creating a {@link TaskStatusReport}. * - * @return a {@link TaskStatusReportBuilderImpl} + * @return a {@link TaskStatusReport.Builder} */ - TaskStatusReportBuilderImpl createTaskStatusReportBuilder(); + TaskStatusReport.Builder createTaskStatusReportBuilder(); } diff --git a/lib/taskana-core/src/main/java/pro/taskana/TaskStatusReportBuilder.java b/lib/taskana-core/src/main/java/pro/taskana/TaskStatusReportBuilder.java deleted file mode 100644 index dfc9445c5..000000000 --- a/lib/taskana-core/src/main/java/pro/taskana/TaskStatusReportBuilder.java +++ /dev/null @@ -1,41 +0,0 @@ -package pro.taskana; - -import java.util.List; - -import pro.taskana.exceptions.NotAuthorizedException; -import pro.taskana.impl.report.impl.TaskStatusReport; - -/** - * The TaskStatusReportBuilder is used to build a {@link TaskStatusReport}. A TaskStatusReport contains the total number - * of tasks, clustered in their task status. Furthermore the report contains a sum line that contains the total numbers - * of the different clusters and the total number of all tasks. - */ -public interface TaskStatusReportBuilder { - - /** - * Adds a list of states to the builder. The created report contains only tasks with a state in this list. - * - * @param states - * a list of states - * @return the TaskStatusReportBuilder - */ - TaskStatusReportBuilder stateIn(List states); - - /** - * Adds a list of domains to the builder. The created report contains only tasks with a domain in this list. - * - * @param domains - * a list of domains - * @return the TaskStatusReportBuilder - */ - TaskStatusReportBuilder domainIn(List domains); - - /** - * Returns a {@link TaskStatusReport} containing all tasks after applying the filters. - * - * @throws NotAuthorizedException - * if the user has no rights to access the monitor - * @return the TaskStatusReport - */ - TaskStatusReport buildReport() throws NotAuthorizedException; -} diff --git a/lib/taskana-core/src/main/java/pro/taskana/WorkbasketReportBuilder.java b/lib/taskana-core/src/main/java/pro/taskana/WorkbasketReportBuilder.java deleted file mode 100644 index c021a4d86..000000000 --- a/lib/taskana-core/src/main/java/pro/taskana/WorkbasketReportBuilder.java +++ /dev/null @@ -1,157 +0,0 @@ -package pro.taskana; - -import java.util.List; -import java.util.Map; - -import pro.taskana.exceptions.InvalidArgumentException; -import pro.taskana.exceptions.NotAuthorizedException; -import pro.taskana.impl.SelectedItem; -import pro.taskana.impl.WorkbasketReportBuilderImpl; -import pro.taskana.impl.report.impl.CombinedClassificationFilter; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; -import pro.taskana.impl.report.impl.WorkbasketReport; - -/** - * The WorkbasketReportBuilder is used to build a {@link WorkbasketReport}, list the taskIds of a WorkbasketReport and - * list the values of a entered custom field. A WorkbasketReport contains the total numbers of tasks of the respective - * workbasket as well as the total number of all tasks. The tasks of the report can be filtered by workbaskets, states, - * categories, domains, classifications and values of a custom field. Classifications can also be excluded from the - * report. It is also possible to filter by the classifications of the attachments by using the - * {@link CombinedClassificationFilter}. If the {@link TimeIntervalColumnHeader}s are set, the report contains also the - * number of tasks of the respective cluster. The age of the tasks can be counted in days or in working days. Tasks with - * Timestamp DUE = null are not considered. - */ -public interface WorkbasketReportBuilder { - - /** - * Adds a list {@link TimeIntervalColumnHeader}s to the builder to subdivide the report into clusters. - * - * @param columnHeaders - * the column headers the report should consist of. - * @return the WorkbasketReportBuilder - */ - WorkbasketReportBuilder withColumnHeaders(List columnHeaders); - - /** - * If this filter is used, the days of the report are counted in working days. - * - * @return the WorkbasketReportBuilder - */ - WorkbasketReportBuilder inWorkingDays(); - - /** - * Adds a list of workbasket ids to the builder. The created report contains only tasks with a workbasket id in this - * list. - * - * @param workbasketIds - * a list of workbasket ids - * @return the WorkbasketReportBuilder - */ - WorkbasketReportBuilder workbasketIdIn(List workbasketIds); - - /** - * Adds a list of states to the builder. The created report contains only tasks with a state in this list. - * - * @param states - * a list of states - * @return the WorkbasketReportBuilder - */ - WorkbasketReportBuilder stateIn(List states); - - /** - * Adds a list of categories to the builder. The created report contains only tasks with a category in this list. - * - * @param categories - * a list of categories - * @return the WorkbasketReportBuilder - */ - WorkbasketReportBuilder categoryIn(List categories); - - /** - * Adds a list of classificationIds to the builder. The created report contains only tasks with a classificationId - * in this list. - * - * @param classificationIds - * a list of classificationIds - * @return the WorkbasketReportBuilder - */ - WorkbasketReportBuilder classificationIdIn(List classificationIds); - - /** - * Adds a list of excludedClassificationIds to the builder. The created report contains only tasks with a - * classificationId NOT in this list. - * - * @param excludedClassificationIds - * a list of excludedClassificationIds - * @return the WorkbasketReportBuilder - */ - WorkbasketReportBuilder excludedClassificationIdIn(List excludedClassificationIds); - - /** - * Adds a list of domains to the builder. The created report contains only tasks with a domain in this list. - * - * @param domains - * a list of domains - * @return the WorkbasketReportBuilder - */ - WorkbasketReportBuilder domainIn(List domains); - - /** - * Adds a map of custom attributes and custom attribute values to the builder. The created report contains only - * tasks with a custom attribute value in this list. - * - * @param customAttributeFilter - * a map of custom attributes and custom attribute value - * @return the WorkbasketReportBuilder - */ - WorkbasketReportBuilder customAttributeFilterIn(Map customAttributeFilter); - - /** - * Adds a list of {@link CombinedClassificationFilter} to the builder. The created report contains only tasks with a - * pair of a classificationId for a task and a classificationId for the corresponding attachment in this list. - * - * @param combinedClassificationFilter - * a list of combinedClassificationFilter - * @return the WorkbasketReportBuilder - */ - WorkbasketReportBuilderImpl combinedClassificationFilterIn( - List combinedClassificationFilter); - - /** - * Returns a {@link WorkbasketReport} containing all tasks after applying the filters. If the column headers are set - * the report is subdivided into clusters. - * - * @throws InvalidArgumentException - * if the column headers are not initialized - * @throws NotAuthorizedException - * if the user has no rights to access the monitor - * @return the WorkbasketReport - */ - WorkbasketReport buildReport() throws InvalidArgumentException, NotAuthorizedException; - - /** - * Returns a list of all taskIds of the report that are in the list of selected items. - * - * @param selectedItems - * a list of selectedItems - * @throws InvalidArgumentException - * if the column headers are not initialized - * @throws NotAuthorizedException - * if the user has no rights to access the monitor - * @return the list of all taskIds - */ - List listTaskIdsForSelectedItems(List selectedItems) - throws NotAuthorizedException, InvalidArgumentException; - - /** - * Returns a list of all values of an entered custom field that are in the report. - * - * @param customField - * the customField whose values should appear in the list - * @throws NotAuthorizedException - * if the user has no rights to access the monitor - * @return the list of all custom attribute values - */ - List listCustomAttributeValuesForCustomAttributeName(CustomField customField) - throws NotAuthorizedException; -} 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 789b73757..eecb60492 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 @@ -1,87 +1,41 @@ package pro.taskana.impl; import java.util.List; -import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import pro.taskana.CategoryReportBuilder; -import pro.taskana.CustomField; -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.impl.CategoryReport; -import pro.taskana.impl.report.impl.DaysToWorkingDaysPreProcessor; -import pro.taskana.impl.report.impl.MonitorQueryItem; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.DaysToWorkingDaysPreProcessor; +import pro.taskana.impl.report.MonitorQueryItem; +import pro.taskana.impl.report.TimeIntervalColumnHeader; import pro.taskana.mappings.TaskMonitorMapper; +import pro.taskana.report.CategoryReport; /** * The implementation of CategoryReportBuilder. */ -public class CategoryReportBuilderImpl extends ReportBuilder implements CategoryReportBuilder { +public class CategoryReportBuilderImpl + extends TimeIntervalReportBuilderImpl + implements CategoryReport.Builder { - private static final Logger LOGGER = LoggerFactory.getLogger(CategoryReportBuilder.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CategoryReport.Builder.class); - public CategoryReportBuilderImpl(TaskanaEngine taskanaEngine, TaskMonitorMapper taskMonitorMapper) { + CategoryReportBuilderImpl(TaskanaEngine taskanaEngine, TaskMonitorMapper taskMonitorMapper) { super(taskanaEngine, taskMonitorMapper); } @Override - public CategoryReportBuilder withColumnHeaders(List columnHeaders) { - this.columnHeaders = columnHeaders; + protected CategoryReport.Builder _this() { return this; } @Override - public CategoryReportBuilder inWorkingDays() { - this.inWorkingDays = true; - return this; - } - - @Override - public CategoryReportBuilder workbasketIdIn(List workbasketIds) { - this.workbasketIds = workbasketIds; - return this; - } - - @Override - public CategoryReportBuilder stateIn(List states) { - this.states = states; - return this; - } - - @Override - public CategoryReportBuilder categoryIn(List categories) { - this.categories = categories; - return this; - } - - @Override - public CategoryReportBuilder classificationIdIn(List classificationIds) { - this.classificationIds = classificationIds; - return this; - } - - @Override - public CategoryReportBuilder excludedClassificationIdIn(List excludedClassificationIds) { - this.excludedClassificationIds = excludedClassificationIds; - return this; - } - - @Override - public CategoryReportBuilder domainIn(List domains) { - this.domains = domains; - return this; - } - - @Override - public CategoryReportBuilder customAttributeFilterIn(Map customAttributeFilter) { - this.customAttributeFilter = customAttributeFilter; - return this; + protected String determineDimension() { + return "CLASSIFICATION_CATEGORY"; } @Override 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 2664b8cc0..da3832b56 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,89 +1,43 @@ package pro.taskana.impl; import java.util.List; -import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import pro.taskana.ClassificationReportBuilder; -import pro.taskana.CustomField; -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.impl.ClassificationReport; -import pro.taskana.impl.report.impl.DaysToWorkingDaysPreProcessor; -import pro.taskana.impl.report.impl.DetailedClassificationReport; -import pro.taskana.impl.report.impl.DetailedMonitorQueryItem; -import pro.taskana.impl.report.impl.MonitorQueryItem; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.DaysToWorkingDaysPreProcessor; +import pro.taskana.impl.report.DetailedMonitorQueryItem; +import pro.taskana.impl.report.MonitorQueryItem; +import pro.taskana.impl.report.TimeIntervalColumnHeader; import pro.taskana.mappings.TaskMonitorMapper; +import pro.taskana.report.ClassificationReport; +import pro.taskana.report.ClassificationReport.DetailedClassificationReport; /** * The implementation of ClassificationReportBuilder. */ -public class ClassificationReportBuilderImpl extends ReportBuilder implements ClassificationReportBuilder { +public class ClassificationReportBuilderImpl + extends TimeIntervalReportBuilderImpl + implements ClassificationReport.Builder { - private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationReportBuilder.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationReport.Builder.class); - public ClassificationReportBuilderImpl(TaskanaEngine taskanaEngine, TaskMonitorMapper taskMonitorMapper) { + ClassificationReportBuilderImpl(TaskanaEngine taskanaEngine, TaskMonitorMapper taskMonitorMapper) { super(taskanaEngine, taskMonitorMapper); } @Override - public ClassificationReportBuilder withColumnHeaders(List columnHeaders) { - this.columnHeaders = columnHeaders; + protected ClassificationReport.Builder _this() { return this; } @Override - public ClassificationReportBuilder inWorkingDays() { - this.inWorkingDays = true; - return this; - } - - @Override - public ClassificationReportBuilder workbasketIdIn(List workbasketIds) { - this.workbasketIds = workbasketIds; - return this; - } - - @Override - public ClassificationReportBuilder stateIn(List states) { - this.states = states; - return this; - } - - @Override - public ClassificationReportBuilder categoryIn(List categories) { - this.categories = categories; - return this; - } - - @Override - public ClassificationReportBuilder domainIn(List domains) { - this.domains = domains; - return this; - } - - @Override - public ClassificationReportBuilder customAttributeFilterIn(Map customAttributeFilter) { - this.customAttributeFilter = customAttributeFilter; - return this; - } - - @Override - public ClassificationReportBuilder classificationIdIn(List classificationIds) { - this.classificationIds = classificationIds; - return this; - } - - @Override - public ClassificationReportBuilder excludedClassificationIdIn(List excludedClassificationIds) { - this.excludedClassificationIds = excludedClassificationIds; - return this; + protected String determineDimension() { + return "CLASSIFICATION_KEY"; } @Override 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 52df85673..a4e33fe55 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 @@ -1,91 +1,46 @@ package pro.taskana.impl; import java.util.List; -import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import pro.taskana.CustomField; -import pro.taskana.CustomFieldValueReportBuilder; -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.impl.CustomFieldValueReport; -import pro.taskana.impl.report.impl.DaysToWorkingDaysPreProcessor; -import pro.taskana.impl.report.impl.MonitorQueryItem; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.DaysToWorkingDaysPreProcessor; +import pro.taskana.impl.report.MonitorQueryItem; +import pro.taskana.impl.report.TimeIntervalColumnHeader; import pro.taskana.mappings.TaskMonitorMapper; +import pro.taskana.report.CustomFieldValueReport; /** * The implementation of CustomFieldValueReportBuilder. */ -public class CustomFieldValueReportBuilderImpl extends ReportBuilder implements CustomFieldValueReportBuilder { +public class CustomFieldValueReportBuilderImpl + extends TimeIntervalReportBuilderImpl + implements CustomFieldValueReport.Builder { private static final Logger LOGGER = LoggerFactory.getLogger(CustomFieldValueReportBuilderImpl.class); - public CustomField customField; + private CustomField customField; - public CustomFieldValueReportBuilderImpl(TaskanaEngine taskanaEngine, TaskMonitorMapper taskMonitorMapper, + CustomFieldValueReportBuilderImpl(TaskanaEngine taskanaEngine, TaskMonitorMapper taskMonitorMapper, CustomField customField) { super(taskanaEngine, taskMonitorMapper); this.customField = customField; } @Override - public CustomFieldValueReportBuilderImpl withColumnHeaders(List columnHeaders) { - this.columnHeaders = columnHeaders; + protected CustomFieldValueReport.Builder _this() { return this; } @Override - public CustomFieldValueReportBuilderImpl inWorkingDays() { - this.inWorkingDays = true; - return this; - } - - @Override - public CustomFieldValueReportBuilderImpl workbasketIdIn(List workbasketIds) { - this.workbasketIds = workbasketIds; - return this; - } - - @Override - public CustomFieldValueReportBuilderImpl stateIn(List states) { - this.states = states; - return this; - } - - @Override - public CustomFieldValueReportBuilderImpl categoryIn(List categories) { - this.categories = categories; - return this; - } - - @Override - public CustomFieldValueReportBuilderImpl domainIn(List domains) { - this.domains = domains; - return this; - } - - @Override - public CustomFieldValueReportBuilderImpl classificationIdIn(List classificationIds) { - this.classificationIds = classificationIds; - return this; - } - - @Override - public CustomFieldValueReportBuilderImpl excludedClassificationIdIn(List excludedClassificationIds) { - this.excludedClassificationIds = excludedClassificationIds; - return this; - } - - @Override - public CustomFieldValueReportBuilderImpl customAttributeFilterIn(Map customAttributeFilter) { - this.customAttributeFilter = customAttributeFilter; - return this; + protected String determineDimension() { + return customField.name(); } @Override @@ -111,9 +66,4 @@ public class CustomFieldValueReportBuilderImpl extends ReportBuilder implements } } - @Override - public CustomField getCustomField() { - return customField; - } - } diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/DaysToWorkingDaysConverter.java b/lib/taskana-core/src/main/java/pro/taskana/impl/DaysToWorkingDaysConverter.java index cf5d91771..a412f0242 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/DaysToWorkingDaysConverter.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/DaysToWorkingDaysConverter.java @@ -12,8 +12,8 @@ import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; import pro.taskana.exceptions.InvalidArgumentException; +import pro.taskana.impl.report.TimeIntervalColumnHeader; import pro.taskana.impl.util.LoggerUtils; /** @@ -34,7 +34,7 @@ public final class DaysToWorkingDaysConverter { private static boolean germanHolidaysEnabled; private static List customHolidays; - private DaysToWorkingDaysConverter(List columnHeaders, + private DaysToWorkingDaysConverter(List columnHeaders, Instant referenceDate) { easterSunday = getEasterSunday(LocalDateTime.ofInstant(referenceDate, ZoneId.systemDefault()).getYear()); dateCreated = referenceDate; @@ -52,7 +52,7 @@ public final class DaysToWorkingDaysConverter { * @throws InvalidArgumentException * thrown if columnHeaders is null */ - public static DaysToWorkingDaysConverter initialize(List columnHeaders) + public static DaysToWorkingDaysConverter initialize(List columnHeaders) throws InvalidArgumentException { return initialize(columnHeaders, Instant.now()); } @@ -69,7 +69,7 @@ public final class DaysToWorkingDaysConverter { * @throws InvalidArgumentException * thrown if columnHeaders or referenceDate is null */ - public static DaysToWorkingDaysConverter initialize(List columnHeaders, + public static DaysToWorkingDaysConverter initialize(List columnHeaders, Instant referenceDate) throws InvalidArgumentException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Initialize DaysToWorkingDaysConverter with columnHeaders: {}", @@ -95,6 +95,30 @@ public final class DaysToWorkingDaysConverter { return instance; } + private static int getSmallestUpperLimit(List columnHeaders) { + int smallestUpperLimit = 0; + for (TimeIntervalColumnHeader columnHeader : columnHeaders) { + if (columnHeader.getUpperAgeLimit() < smallestUpperLimit) { + smallestUpperLimit = columnHeader.getUpperAgeLimit(); + } + } + return smallestUpperLimit; + } + + private static int getLargestLowerLimit(List columnHeaders) { + int greatestLowerLimit = 0; + for (TimeIntervalColumnHeader columnHeader : columnHeaders) { + if (columnHeader.getUpperAgeLimit() > greatestLowerLimit) { + greatestLowerLimit = columnHeader.getLowerAgeLimit(); + } + } + return greatestLowerLimit; + } + + public static void setGermanPublicHolidaysEnabled(boolean germanPublicHolidaysEnabled) { + germanHolidaysEnabled = germanPublicHolidaysEnabled; + } + /** * Converts an integer, that represents the age in days, to the age in working days by using the table that was * created by initialization. If the age in days is beyond the limits of the table, the integer will be returned @@ -189,7 +213,7 @@ public final class DaysToWorkingDaysConverter { } private ArrayList generateNegativeDaysToWorkingDays( - List columnHeaders, Instant referenceDate) { + List columnHeaders, Instant referenceDate) { int minUpperLimit = getSmallestUpperLimit(columnHeaders); ArrayList daysToWorkingDays = new ArrayList<>(); daysToWorkingDays.add(0); @@ -206,7 +230,7 @@ public final class DaysToWorkingDaysConverter { } private ArrayList generatePositiveDaysToWorkingDays( - List columnHeaders, Instant referenceDate) { + List columnHeaders, Instant referenceDate) { int maxLowerLimit = getLargestLowerLimit(columnHeaders); ArrayList daysToWorkingDays = new ArrayList<>(); daysToWorkingDays.add(0); @@ -223,26 +247,6 @@ public final class DaysToWorkingDaysConverter { return daysToWorkingDays; } - private static int getSmallestUpperLimit(List columnHeaders) { - int smallestUpperLimit = 0; - for (TimeIntervalColumnHeader columnHeader : columnHeaders) { - if (columnHeader.getUpperAgeLimit() < smallestUpperLimit) { - smallestUpperLimit = columnHeader.getUpperAgeLimit(); - } - } - return smallestUpperLimit; - } - - private static int getLargestLowerLimit(List columnHeaders) { - int greatestLowerLimit = 0; - for (TimeIntervalColumnHeader columnHeader : columnHeaders) { - if (columnHeader.getUpperAgeLimit() > greatestLowerLimit) { - greatestLowerLimit = columnHeader.getLowerAgeLimit(); - } - } - return greatestLowerLimit; - } - private boolean isWorkingDay(int day, Instant referenceDate) { LocalDateTime dateTime = LocalDateTime.ofInstant(referenceDate, ZoneId.systemDefault()).plusDays(day); if (dateTime.getDayOfWeek().equals(DayOfWeek.SATURDAY) @@ -310,16 +314,12 @@ public final class DaysToWorkingDaysConverter { return LocalDate.of(year, 3, 22).plusDays(d + e); } - public static void setCustomHolidays(List holidays) { - customHolidays = holidays; - } - public List getCustomHolidays() { return customHolidays; } - public static void setGermanPublicHolidaysEnabled(boolean germanPublicHolidaysEnabled) { - germanHolidaysEnabled = germanPublicHolidaysEnabled; + public static void setCustomHolidays(List holidays) { + customHolidays = holidays; } public boolean isGermanPublicHolidayEnabled() { 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 7a1a767e5..9c779e559 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 @@ -1,21 +1,20 @@ package pro.taskana.impl; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import pro.taskana.CategoryReportBuilder; -import pro.taskana.ClassificationReportBuilder; import pro.taskana.CustomField; import pro.taskana.TaskMonitorService; import pro.taskana.TaskanaEngine; import pro.taskana.mappings.TaskMonitorMapper; +import pro.taskana.report.CategoryReport; +import pro.taskana.report.ClassificationReport; +import pro.taskana.report.CustomFieldValueReport; +import pro.taskana.report.TaskStatusReport; +import pro.taskana.report.WorkbasketReport; /** * This is the implementation of TaskMonitorService. */ public class TaskMonitorServiceImpl implements TaskMonitorService { - private static final Logger LOGGER = LoggerFactory.getLogger(TaskMonitorServiceImpl.class); private TaskanaEngineImpl taskanaEngineImpl; private TaskMonitorMapper taskMonitorMapper; @@ -26,27 +25,27 @@ public class TaskMonitorServiceImpl implements TaskMonitorService { } @Override - public WorkbasketReportBuilderImpl createWorkbasketReportBuilder() { + public WorkbasketReport.Builder createWorkbasketReportBuilder() { return new WorkbasketReportBuilderImpl(taskanaEngineImpl, taskMonitorMapper); } @Override - public CategoryReportBuilder createCategoryReportBuilder() { + public CategoryReport.Builder createCategoryReportBuilder() { return new CategoryReportBuilderImpl(taskanaEngineImpl, taskMonitorMapper); } @Override - public ClassificationReportBuilder createClassificationReportBuilder() { + public ClassificationReport.Builder createClassificationReportBuilder() { return new ClassificationReportBuilderImpl(taskanaEngineImpl, taskMonitorMapper); } @Override - public CustomFieldValueReportBuilderImpl createCustomFieldValueReportBuilder(CustomField customField) { + public CustomFieldValueReport.Builder createCustomFieldValueReportBuilder(CustomField customField) { return new CustomFieldValueReportBuilderImpl(taskanaEngineImpl, taskMonitorMapper, customField); } @Override - public TaskStatusReportBuilderImpl createTaskStatusReportBuilder() { + public TaskStatusReport.Builder createTaskStatusReportBuilder() { return new TaskStatusReportBuilderImpl(taskanaEngineImpl, taskMonitorMapper); } diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/TaskServiceImpl.java b/lib/taskana-core/src/main/java/pro/taskana/impl/TaskServiceImpl.java index 27ae28945..0e05534fc 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/TaskServiceImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/TaskServiceImpl.java @@ -44,7 +44,7 @@ import pro.taskana.exceptions.TaskAlreadyExistException; import pro.taskana.exceptions.TaskNotFoundException; import pro.taskana.exceptions.TaskanaException; import pro.taskana.exceptions.WorkbasketNotFoundException; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.TimeIntervalColumnHeader; import pro.taskana.impl.util.IdGenerator; import pro.taskana.impl.util.LoggerUtils; import pro.taskana.mappings.AttachmentMapper; 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 d7a6c4c02..901bbd9aa 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 @@ -6,18 +6,17 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import pro.taskana.TaskState; -import pro.taskana.TaskStatusReportBuilder; import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaRole; import pro.taskana.exceptions.NotAuthorizedException; -import pro.taskana.impl.report.impl.TaskQueryItem; -import pro.taskana.impl.report.impl.TaskStatusReport; +import pro.taskana.impl.report.TaskQueryItem; import pro.taskana.mappings.TaskMonitorMapper; +import pro.taskana.report.TaskStatusReport; /** * The implementation of TaskStatusReportBuilder. */ -public class TaskStatusReportBuilderImpl implements TaskStatusReportBuilder { +public class TaskStatusReportBuilderImpl implements TaskStatusReport.Builder { private static final Logger LOGGER = LoggerFactory.getLogger(TaskStatusReportBuilderImpl.class); private TaskanaEngineImpl taskanaEngine; @@ -25,7 +24,7 @@ public class TaskStatusReportBuilderImpl implements TaskStatusReportBuilder { private List domains; private List states; - public TaskStatusReportBuilderImpl(TaskanaEngine taskanaEngine, TaskMonitorMapper taskMonitorMapper) { + TaskStatusReportBuilderImpl(TaskanaEngine taskanaEngine, TaskMonitorMapper taskMonitorMapper) { this.taskanaEngine = (TaskanaEngineImpl) taskanaEngine; this.taskMonitorMapper = taskMonitorMapper; } diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/ReportBuilder.java b/lib/taskana-core/src/main/java/pro/taskana/impl/TimeIntervalReportBuilderImpl.java similarity index 56% rename from lib/taskana-core/src/main/java/pro/taskana/impl/ReportBuilder.java rename to lib/taskana-core/src/main/java/pro/taskana/impl/TimeIntervalReportBuilderImpl.java index 516c9dfc5..ef94a0b1b 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/ReportBuilder.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/TimeIntervalReportBuilderImpl.java @@ -1,42 +1,37 @@ package pro.taskana.impl; -import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import pro.taskana.CategoryReportBuilder; -import pro.taskana.ClassificationReportBuilder; import pro.taskana.CustomField; -import pro.taskana.CustomFieldValueReportBuilder; 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.exceptions.SystemException; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.TimeIntervalColumnHeader; import pro.taskana.impl.util.LoggerUtils; import pro.taskana.mappings.TaskMonitorMapper; +import pro.taskana.report.ClassificationReport; +import pro.taskana.report.TimeIntervalReportBuilder; /** - * The super class of the different report builders. + * Implementation of {@link TimeIntervalReportBuilder}. + * @param the true Builder behind this Interface + * @param the column header */ -public abstract class ReportBuilder { +abstract class TimeIntervalReportBuilderImpl + implements TimeIntervalReportBuilder { - private static final Logger LOGGER = LoggerFactory.getLogger(ReportBuilder.class); - - private static final String DIMENSION_CLASSIFICATION_CATEGORY = "CLASSIFICATION_CATEGORY"; - private static final String DIMENSION_CLASSIFICATION_KEY = "CLASSIFICATION_KEY"; - private static final String DIMENSION_WORKBASKET_KEY = "WORKBASKET_KEY"; + private static final Logger LOGGER = LoggerFactory.getLogger(TimeIntervalReportBuilder.class); protected TaskanaEngineImpl taskanaEngine; protected TaskMonitorMapper taskMonitorMapper; - protected List columnHeaders; + protected List columnHeaders; protected boolean inWorkingDays; protected List workbasketIds; protected List states; @@ -46,73 +41,87 @@ public abstract class ReportBuilder { protected List excludedClassificationIds; protected Map customAttributeFilter; - public ReportBuilder(TaskanaEngine taskanaEngine, TaskMonitorMapper taskMonitorMapper) { + TimeIntervalReportBuilderImpl(TaskanaEngine taskanaEngine, TaskMonitorMapper taskMonitorMapper) { this.taskanaEngine = (TaskanaEngineImpl) taskanaEngine; this.taskMonitorMapper = taskMonitorMapper; this.columnHeaders = Collections.emptyList(); configureDaysToWorkingDaysConverter(); } - public List getColumnHeaders() { - if (columnHeaders == null) { - columnHeaders = new ArrayList<>(); + protected abstract B _this(); + + @Override + public B withColumnHeaders(List columnHeaders) { + this.columnHeaders = columnHeaders; + return _this(); + } + + @Override + public B inWorkingDays() { + this.inWorkingDays = true; + return _this(); + } + + @Override + public B workbasketIdIn(List workbasketIds) { + this.workbasketIds = workbasketIds; + return _this(); + } + + @Override + public B stateIn(List states) { + this.states = states; + return _this(); + } + + @Override + public B categoryIn(List categories) { + this.categories = categories; + return _this(); + } + + @Override + public B classificationIdIn(List classificationIds) { + this.classificationIds = classificationIds; + return _this(); + } + + @Override + public B excludedClassificationIdIn(List excludedClassificationIds) { + this.excludedClassificationIds = excludedClassificationIds; + return _this(); + } + + @Override + public B domainIn(List domains) { + this.domains = domains; + return _this(); + } + + @Override + public B customAttributeFilterIn(Map customAttributeFilter) { + this.customAttributeFilter = customAttributeFilter; + return _this(); + } + + @Override + public List listCustomAttributeValuesForCustomAttributeName(CustomField customField) + throws NotAuthorizedException { + LOGGER.debug("entry to listCustomAttributeValuesForCustomAttributeName(customField = {}), this = {}", + customField, this); + this.taskanaEngine.checkRoleMembership(TaskanaRole.MONITOR); + try { + this.taskanaEngine.openConnection(); + return taskMonitorMapper.getCustomAttributeValuesForReport(this.workbasketIds, + this.states, this.categories, this.domains, this.classificationIds, this.excludedClassificationIds, + this.customAttributeFilter, customField); + } finally { + this.taskanaEngine.returnConnection(); + LOGGER.debug("exit from listCustomAttributeValuesForCustomAttributeName()."); } - return this.columnHeaders; - } - - public boolean isInWorkingDays() { - return this.inWorkingDays; - } - - public List getWorkbasketIdIn() { - if (workbasketIds == null) { - workbasketIds = new ArrayList<>(); - } - return this.workbasketIds; - } - - public List getStateIn() { - if (states == null) { - states = new ArrayList<>(); - } - return this.states; - } - - public List getCategoryIn() { - if (categories == null) { - categories = new ArrayList<>(); - } - return this.categories; - } - - public List getDomainIn() { - if (domains == null) { - domains = new ArrayList<>(); - } - return this.domains; - } - - public List getClassificationIdsIn() { - if (classificationIds == null) { - classificationIds = new ArrayList<>(); - } - return this.classificationIds; - } - - public List getExcludedClassificationIdsIn() { - if (excludedClassificationIds == null) { - excludedClassificationIds = new ArrayList<>(); - } - return this.excludedClassificationIds; - } - - public Map getCustomAttributeFilter() { - if (customAttributeFilter == null) { - customAttributeFilter = new HashMap<>(); - } - return this.customAttributeFilter; } + @Override public List listTaskIdsForSelectedItems(List selectedItems) throws NotAuthorizedException, InvalidArgumentException { LOGGER.debug("entry to listTaskIdsForSelectedItems(selectedItems = {}), this = {}", @@ -127,55 +136,23 @@ public abstract class ReportBuilder { throw new InvalidArgumentException("SelectedItems must not be null or empty."); } boolean joinWithAttachments = subKeyIsSet(selectedItems); - if (!(this instanceof ClassificationReportBuilder) && joinWithAttachments) { + if (!(this instanceof ClassificationReport.Builder) && joinWithAttachments) { throw new InvalidArgumentException("SubKeys are supported for ClassificationReport only."); } String dimension = determineDimension(); if (this.inWorkingDays) { selectedItems = convertWorkingDaysToDays(selectedItems, this.columnHeaders); } - List taskIds = this.taskMonitorMapper.getTaskIdsForSelectedItems(this.workbasketIds, + return this.taskMonitorMapper.getTaskIdsForSelectedItems(this.workbasketIds, this.states, this.categories, this.domains, this.classificationIds, this.excludedClassificationIds, this.customAttributeFilter, dimension, selectedItems, joinWithAttachments); - return taskIds; } finally { this.taskanaEngine.returnConnection(); LOGGER.debug("exit from listTaskIdsForSelectedItems()."); } } - private String determineDimension() { - String dimension = null; - if (this instanceof CategoryReportBuilder) { - dimension = DIMENSION_CLASSIFICATION_CATEGORY; - } else if (this instanceof WorkbasketReportBuilderImpl) { - dimension = DIMENSION_WORKBASKET_KEY; - } else if (this instanceof ClassificationReportBuilder) { - dimension = DIMENSION_CLASSIFICATION_KEY; - } else if (this instanceof CustomFieldValueReportBuilder) { - dimension = ((CustomFieldValueReportBuilder) this).getCustomField().toString(); - } else { - throw new SystemException("Internal error. listTaskIdsForSelectedItems() does not support " + this); - } - return dimension; - } - - public List listCustomAttributeValuesForCustomAttributeName(CustomField customField) - throws NotAuthorizedException { - LOGGER.debug("entry to listCustomAttributeValuesForCustomAttributeName(customField = {}), this = {}", - customField, this); - this.taskanaEngine.checkRoleMembership(TaskanaRole.MONITOR); - try { - this.taskanaEngine.openConnection(); - List customAttributeValues = taskMonitorMapper.getCustomAttributeValuesForReport(this.workbasketIds, - this.states, this.categories, this.domains, this.classificationIds, this.excludedClassificationIds, - this.customAttributeFilter, customField); - return customAttributeValues; - } finally { - this.taskanaEngine.returnConnection(); - LOGGER.debug("exit from listCustomAttributeValuesForCustomAttributeName()."); - } - } + protected abstract String determineDimension(); private void configureDaysToWorkingDaysConverter() { DaysToWorkingDaysConverter.setCustomHolidays(this.taskanaEngine.getConfiguration().getCustomHolidays()); @@ -184,7 +161,7 @@ public abstract class ReportBuilder { } private List convertWorkingDaysToDays(List selectedItems, - List columnHeaders) throws InvalidArgumentException { + List columnHeaders) throws InvalidArgumentException { DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter.initialize(columnHeaders); for (SelectedItem selectedItem : selectedItems) { selectedItem @@ -195,7 +172,7 @@ public abstract class ReportBuilder { return selectedItems; } - protected boolean subKeyIsSet(List selectedItems) { + private boolean subKeyIsSet(List selectedItems) { for (SelectedItem selectedItem : selectedItems) { if (selectedItem.getSubKey() != null && !selectedItem.getSubKey().isEmpty()) { return true; @@ -205,3 +182,4 @@ public abstract class ReportBuilder { } } + diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/WorkbasketReportBuilderImpl.java b/lib/taskana-core/src/main/java/pro/taskana/impl/WorkbasketReportBuilderImpl.java index f2e301f97..3c392e304 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/WorkbasketReportBuilderImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/WorkbasketReportBuilderImpl.java @@ -1,104 +1,43 @@ package pro.taskana.impl; -import java.util.ArrayList; import java.util.List; -import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import pro.taskana.CustomField; -import pro.taskana.TaskState; import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaRole; -import pro.taskana.WorkbasketReportBuilder; import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.NotAuthorizedException; -import pro.taskana.impl.report.impl.CombinedClassificationFilter; -import pro.taskana.impl.report.impl.DaysToWorkingDaysPreProcessor; -import pro.taskana.impl.report.impl.MonitorQueryItem; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; -import pro.taskana.impl.report.impl.WorkbasketReport; +import pro.taskana.impl.report.CombinedClassificationFilter; +import pro.taskana.impl.report.DaysToWorkingDaysPreProcessor; +import pro.taskana.impl.report.MonitorQueryItem; +import pro.taskana.impl.report.TimeIntervalColumnHeader; import pro.taskana.mappings.TaskMonitorMapper; +import pro.taskana.report.WorkbasketReport; /** * The implementation of WorkbasketReportBuilder. */ -public class WorkbasketReportBuilderImpl extends ReportBuilder implements WorkbasketReportBuilder { +public class WorkbasketReportBuilderImpl + extends TimeIntervalReportBuilderImpl + implements WorkbasketReport.Builder { private static final Logger LOGGER = LoggerFactory.getLogger(WorkbasketReportBuilderImpl.class); private List combinedClassificationFilter; - public WorkbasketReportBuilderImpl(TaskanaEngine taskanaEngine, TaskMonitorMapper taskMonitorMapper) { + WorkbasketReportBuilderImpl(TaskanaEngine taskanaEngine, TaskMonitorMapper taskMonitorMapper) { super(taskanaEngine, taskMonitorMapper); } @Override - public WorkbasketReportBuilderImpl withColumnHeaders(List columnHeaders) { - this.columnHeaders = columnHeaders; + protected WorkbasketReport.Builder _this() { return this; } @Override - public WorkbasketReportBuilderImpl inWorkingDays() { - this.inWorkingDays = true; - return this; - } - - @Override - public WorkbasketReportBuilderImpl workbasketIdIn(List workbasketIds) { - this.workbasketIds = workbasketIds; - return this; - } - - @Override - public WorkbasketReportBuilderImpl stateIn(List states) { - this.states = states; - return this; - } - - @Override - public WorkbasketReportBuilderImpl categoryIn(List categories) { - this.categories = categories; - return this; - } - - @Override - public WorkbasketReportBuilderImpl domainIn(List domains) { - this.domains = domains; - return this; - } - - @Override - public WorkbasketReportBuilderImpl classificationIdIn(List classificationIds) { - this.classificationIds = classificationIds; - return this; - } - - @Override - public WorkbasketReportBuilderImpl excludedClassificationIdIn(List excludedClassificationIds) { - this.excludedClassificationIds = excludedClassificationIds; - return this; - } - - @Override - public WorkbasketReportBuilderImpl customAttributeFilterIn(Map customAttributeFilter) { - this.customAttributeFilter = customAttributeFilter; - return this; - } - - @Override - public WorkbasketReportBuilderImpl combinedClassificationFilterIn( - List combinedClassificationFilter) { - this.combinedClassificationFilter = combinedClassificationFilter; - return this; - } - - public List getCombinedClassificationFilterIn() { - if (combinedClassificationFilter == null) { - combinedClassificationFilter = new ArrayList<>(); - } - return this.combinedClassificationFilter; + protected String determineDimension() { + return "WORKBASKET_KEY"; } @Override @@ -120,4 +59,10 @@ public class WorkbasketReportBuilderImpl extends ReportBuilder implements Workba } } + @Override + public WorkbasketReport.Builder combinedClassificationFilterIn( + List combinedClassificationFilter) { + this.combinedClassificationFilter = combinedClassificationFilter; + return this; + } } 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/CombinedClassificationFilter.java similarity index 88% rename from lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/CombinedClassificationFilter.java rename to lib/taskana-core/src/main/java/pro/taskana/impl/report/CombinedClassificationFilter.java index 4852560d1..817f32164 100644 --- 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/CombinedClassificationFilter.java @@ -1,8 +1,8 @@ -package pro.taskana.impl.report.impl; +package pro.taskana.impl.report; /** * 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 WorkbasketReport} by the classification of the attachment. + * corresponding attachment that is used to filter the {@link pro.taskana.report.WorkbasketReport} 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 { diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/DaysToWorkingDaysPreProcessor.java b/lib/taskana-core/src/main/java/pro/taskana/impl/report/DaysToWorkingDaysPreProcessor.java similarity index 90% rename from lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/DaysToWorkingDaysPreProcessor.java rename to lib/taskana-core/src/main/java/pro/taskana/impl/report/DaysToWorkingDaysPreProcessor.java index cb5879eac..dab3706fe 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/DaysToWorkingDaysPreProcessor.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/report/DaysToWorkingDaysPreProcessor.java @@ -1,10 +1,10 @@ -package pro.taskana.impl.report.impl; +package pro.taskana.impl.report; import java.util.List; import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.impl.DaysToWorkingDaysConverter; -import pro.taskana.impl.report.QueryItemPreprocessor; +import pro.taskana.report.QueryItemPreprocessor; /** * Uses {@link DaysToWorkingDaysConverter} to convert an <Item>s age to working days. diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/DetailedMonitorQueryItem.java b/lib/taskana-core/src/main/java/pro/taskana/impl/report/DetailedMonitorQueryItem.java similarity index 92% rename from lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/DetailedMonitorQueryItem.java rename to lib/taskana-core/src/main/java/pro/taskana/impl/report/DetailedMonitorQueryItem.java index 570dfc970..aec3c9825 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/DetailedMonitorQueryItem.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/report/DetailedMonitorQueryItem.java @@ -1,4 +1,4 @@ -package pro.taskana.impl.report.impl; +package pro.taskana.impl.report; /** * The DetailedMonitorQueryItem extends the {@link MonitorQueryItem}. diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/DetailedReportRow.java b/lib/taskana-core/src/main/java/pro/taskana/impl/report/DetailedReportRow.java similarity index 95% rename from lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/DetailedReportRow.java rename to lib/taskana-core/src/main/java/pro/taskana/impl/report/DetailedReportRow.java index 872a1388b..990ae8f3a 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/DetailedReportRow.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/report/DetailedReportRow.java @@ -1,9 +1,9 @@ -package pro.taskana.impl.report.impl; +package pro.taskana.impl.report; import java.util.LinkedHashMap; import java.util.Map; -import pro.taskana.impl.report.ReportRow; +import pro.taskana.report.ReportRow; /** * The DetailedReportRow extends the {@link ReportRow}. diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/MonitorQueryItem.java b/lib/taskana-core/src/main/java/pro/taskana/impl/report/MonitorQueryItem.java similarity index 89% rename from lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/MonitorQueryItem.java rename to lib/taskana-core/src/main/java/pro/taskana/impl/report/MonitorQueryItem.java index 0ec54303b..89fc85389 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/MonitorQueryItem.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/report/MonitorQueryItem.java @@ -1,6 +1,6 @@ -package pro.taskana.impl.report.impl; +package pro.taskana.impl.report; -import pro.taskana.impl.report.QueryItem; +import pro.taskana.report.QueryItem; /** * The MonitorQueryItem entity contains the number of tasks for a key (e.g. workbasketKey) and age in days. diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/TaskQueryItem.java b/lib/taskana-core/src/main/java/pro/taskana/impl/report/TaskQueryItem.java similarity index 89% rename from lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/TaskQueryItem.java rename to lib/taskana-core/src/main/java/pro/taskana/impl/report/TaskQueryItem.java index 31acc6078..105fcdcde 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/TaskQueryItem.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/report/TaskQueryItem.java @@ -1,7 +1,7 @@ -package pro.taskana.impl.report.impl; +package pro.taskana.impl.report; import pro.taskana.TaskState; -import pro.taskana.impl.report.QueryItem; +import pro.taskana.report.QueryItem; /** * The TaskQueryItem entity contains the number of tasks for a domain which have a specific state. diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/TaskStatusColumnHeader.java b/lib/taskana-core/src/main/java/pro/taskana/impl/report/TaskStatusColumnHeader.java similarity index 87% rename from lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/TaskStatusColumnHeader.java rename to lib/taskana-core/src/main/java/pro/taskana/impl/report/TaskStatusColumnHeader.java index 73a8964dc..7bb5eb920 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/TaskStatusColumnHeader.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/report/TaskStatusColumnHeader.java @@ -1,7 +1,7 @@ -package pro.taskana.impl.report.impl; +package pro.taskana.impl.report; import pro.taskana.TaskState; -import pro.taskana.impl.report.ReportColumnHeader; +import pro.taskana.report.ReportColumnHeader; /** * The TaskStatusColumnHeader represents a column for each {@link TaskState}. diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/TimeIntervalColumnHeader.java b/lib/taskana-core/src/main/java/pro/taskana/impl/report/TimeIntervalColumnHeader.java similarity index 94% rename from lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/TimeIntervalColumnHeader.java rename to lib/taskana-core/src/main/java/pro/taskana/impl/report/TimeIntervalColumnHeader.java index 40eea4135..ece6fec4e 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/TimeIntervalColumnHeader.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/report/TimeIntervalColumnHeader.java @@ -1,6 +1,6 @@ -package pro.taskana.impl.report.impl; +package pro.taskana.impl.report; -import pro.taskana.impl.report.ReportColumnHeader; +import pro.taskana.report.ReportColumnHeader; /** * A TimeIntervalColumnHeader has a lower and an upper age limit which subdivide the count of tasks into different diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/CategoryReport.java b/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/CategoryReport.java deleted file mode 100644 index 58d8999c4..000000000 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/CategoryReport.java +++ /dev/null @@ -1,16 +0,0 @@ -package pro.taskana.impl.report.impl; - -import java.util.List; - -import pro.taskana.impl.report.Report; - -/** - * TODO. - */ -public class CategoryReport extends Report { - - public CategoryReport(List timeIntervalColumnHeaders) { - super(timeIntervalColumnHeaders, "CLASSIFICATION CATEGORIES"); - } - -} diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/ClassificationReport.java b/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/ClassificationReport.java deleted file mode 100644 index 8a52255d8..000000000 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/ClassificationReport.java +++ /dev/null @@ -1,17 +0,0 @@ -package pro.taskana.impl.report.impl; - -import java.util.List; - -import pro.taskana.impl.report.Report; - -/** - * The ClassificationReport extends the Report. The {@link pro.taskana.impl.report.ReportRow}s of the ClassificationReport are grouped by - * classifications. - */ -public class ClassificationReport extends Report { - - public ClassificationReport(List timeIntervalColumnHeaders) { - super(timeIntervalColumnHeaders, "CLASSIFICATION KEYS"); - } - -} diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/CustomFieldValueReport.java b/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/CustomFieldValueReport.java deleted file mode 100644 index fdbd27b5b..000000000 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/CustomFieldValueReport.java +++ /dev/null @@ -1,15 +0,0 @@ -package pro.taskana.impl.report.impl; - -import java.util.List; - -import pro.taskana.impl.report.Report; - -/** - * TODO. - */ -public class CustomFieldValueReport extends Report { - - public CustomFieldValueReport(List timeIntervalColumnHeaders) { - super(timeIntervalColumnHeaders, "CUSTOM FIELDS"); - } -} diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/DetailedClassificationReport.java b/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/DetailedClassificationReport.java deleted file mode 100644 index 1274295c7..000000000 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/DetailedClassificationReport.java +++ /dev/null @@ -1,28 +0,0 @@ -package pro.taskana.impl.report.impl; - -import java.util.List; - -import pro.taskana.impl.report.Report; - -/** - * The DetailedClassificationReport is a functional extension of the {@link ClassificationReport}. - * Its {@link DetailedReportRow}s contain an additional list of {@link pro.taskana.impl.report.ReportRow}s - * for the classifications of the attachments of the tasks. - */ -public class DetailedClassificationReport extends Report { - - public DetailedClassificationReport(List workbasketLevelReportColumnHeaders) { - super(workbasketLevelReportColumnHeaders, "TASK CLASSIFICATION KEYS"); - } - - @Override - protected DetailedReportRow createReportRow(int columnSize) { - return new DetailedReportRow(columnSize); - } - - @Override - public DetailedReportRow getRow(String key) { - return (DetailedReportRow) super.getRow(key); - } - -} diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/TaskStatusReport.java b/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/TaskStatusReport.java deleted file mode 100644 index b13fc5b19..000000000 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/TaskStatusReport.java +++ /dev/null @@ -1,25 +0,0 @@ -package pro.taskana.impl.report.impl; - -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import pro.taskana.TaskState; -import pro.taskana.impl.report.Report; - -/** - * The TaskStatusReport displays the amount of tasks, differentiated by their state and grouped by domain. - */ -public class TaskStatusReport extends Report { - - public TaskStatusReport() { - this(null); - } - - public TaskStatusReport(List filter) { - super((filter != null ? filter.stream() : Arrays.stream(TaskState.values())) - .map(TaskStatusColumnHeader::new) - .collect(Collectors.toList()), "DOMAINS"); - } - -} diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/WorkbasketReport.java b/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/WorkbasketReport.java deleted file mode 100644 index 458c901cb..000000000 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/impl/WorkbasketReport.java +++ /dev/null @@ -1,16 +0,0 @@ -package pro.taskana.impl.report.impl; - -import java.util.List; - -import pro.taskana.impl.report.Report; - -/** - * TODO. - */ -public class WorkbasketReport extends Report { - - public WorkbasketReport(List timeIntervalColumnHeaders) { - super(timeIntervalColumnHeaders, "WORKBASKET KEYS"); - } - -} 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 80887b28a..d96124a02 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,10 +11,10 @@ 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; +import pro.taskana.impl.report.CombinedClassificationFilter; +import pro.taskana.impl.report.DetailedMonitorQueryItem; +import pro.taskana.impl.report.MonitorQueryItem; +import pro.taskana.impl.report.TaskQueryItem; /** * This class is the mybatis mapping of task monitoring. diff --git a/lib/taskana-core/src/main/java/pro/taskana/report/CategoryReport.java b/lib/taskana-core/src/main/java/pro/taskana/report/CategoryReport.java new file mode 100644 index 000000000..fdad47064 --- /dev/null +++ b/lib/taskana-core/src/main/java/pro/taskana/report/CategoryReport.java @@ -0,0 +1,32 @@ +package pro.taskana.report; + +import java.util.List; + +import pro.taskana.exceptions.InvalidArgumentException; +import pro.taskana.exceptions.NotAuthorizedException; +import pro.taskana.impl.report.MonitorQueryItem; +import pro.taskana.impl.report.TimeIntervalColumnHeader; + +/** + * A CategoryReport contains the total numbers of tasks of the respective category as well as the total number of + * all tasks. The tasks of the report can be filtered by workbaskets, states, categories, domains, classifications + * and values of a custom field. Classifications can also be excluded from the report. + * If the {@link TimeIntervalColumnHeader}s are set, the report contains also the number of tasks of the + * respective cluster. The age of the tasks can be counted in days or in working days. Tasks with Timestamp DUE = null + * are not considered. + */ +public class CategoryReport extends Report { + + public CategoryReport(List timeIntervalColumnHeaders) { + super(timeIntervalColumnHeaders, "CLASSIFICATION CATEGORIES"); + } + + /** + * Builder for {@link CategoryReport}. + */ + public interface Builder extends TimeIntervalReportBuilder { + + @Override + CategoryReport buildReport() throws NotAuthorizedException, InvalidArgumentException; + } +} diff --git a/lib/taskana-core/src/main/java/pro/taskana/report/ClassificationReport.java b/lib/taskana-core/src/main/java/pro/taskana/report/ClassificationReport.java new file mode 100644 index 000000000..66461bc4a --- /dev/null +++ b/lib/taskana-core/src/main/java/pro/taskana/report/ClassificationReport.java @@ -0,0 +1,67 @@ +package pro.taskana.report; + +import java.util.List; + +import pro.taskana.exceptions.InvalidArgumentException; +import pro.taskana.exceptions.NotAuthorizedException; +import pro.taskana.impl.report.DetailedMonitorQueryItem; +import pro.taskana.impl.report.DetailedReportRow; +import pro.taskana.impl.report.MonitorQueryItem; +import pro.taskana.impl.report.TimeIntervalColumnHeader; + +/** + * The ClassificationReport extends the Report. The {@link ReportRow}s of the ClassificationReport are grouped by + * classifications. + */ +public class ClassificationReport extends Report { + + public ClassificationReport(List timeIntervalColumnHeaders) { + super(timeIntervalColumnHeaders, "CLASSIFICATION KEYS"); + } + + /** + * Builder for {@link ClassificationReport}. + */ + public interface Builder extends TimeIntervalReportBuilder { + + @Override + ClassificationReport buildReport() throws NotAuthorizedException, InvalidArgumentException; + + /** + * Returns a {@link DetailedClassificationReport} containing all tasks after applying the filters. If the column + * headers are set the report is subdivided into clusters. Its + * {@link pro.taskana.impl.report.DetailedReportRow}s contain an additional list of + * {@link ReportRow}s for the classifications of the attachments of the tasks. + * + * @throws InvalidArgumentException + * if the column headers are not initialized + * @throws NotAuthorizedException + * if the user has no rights to access the monitor + * @return the DetailedClassificationReport + */ + DetailedClassificationReport buildDetailedReport() throws InvalidArgumentException, NotAuthorizedException; + } + + /** + * The DetailedClassificationReport is a functional extension of the {@link ClassificationReport}. + * Its {@link DetailedReportRow}s contain an additional list of {@link ReportRow}s + * for the classifications of the attachments of the tasks. + */ + public static class DetailedClassificationReport extends Report { + + public DetailedClassificationReport(List workbasketLevelReportColumnHeaders) { + super(workbasketLevelReportColumnHeaders, "TASK CLASSIFICATION KEYS"); + } + + @Override + protected DetailedReportRow createReportRow(int columnSize) { + return new DetailedReportRow(columnSize); + } + + @Override + public DetailedReportRow getRow(String key) { + return (DetailedReportRow) super.getRow(key); + } + + } +} diff --git a/lib/taskana-core/src/main/java/pro/taskana/report/CustomFieldValueReport.java b/lib/taskana-core/src/main/java/pro/taskana/report/CustomFieldValueReport.java new file mode 100644 index 000000000..8bfaa2582 --- /dev/null +++ b/lib/taskana-core/src/main/java/pro/taskana/report/CustomFieldValueReport.java @@ -0,0 +1,33 @@ + +package pro.taskana.report; + +import java.util.List; + +import pro.taskana.exceptions.InvalidArgumentException; +import pro.taskana.exceptions.NotAuthorizedException; +import pro.taskana.impl.report.MonitorQueryItem; +import pro.taskana.impl.report.TimeIntervalColumnHeader; + +/** + * A CustomFieldValueReport contains the total numbers of tasks of the respective custom field as well as + * the total number of all tasks. The tasks of the report can be filtered by workbaskets, states, categories, domains, + * classifications and values of a custom field. Classifications can also be excluded from the report. If the + * {@link TimeIntervalColumnHeader}s are set, the report contains also the number of tasks of the respective cluster. + * The age of the tasks can be counted in days or in working days. Tasks with Timestamp DUE = null are not considered. + */ +public class CustomFieldValueReport extends Report { + + public CustomFieldValueReport(List timeIntervalColumnHeaders) { + super(timeIntervalColumnHeaders, "CUSTOM FIELDS"); + } + + /** + * Builder for {@link CustomFieldValueReport}. + */ + public interface Builder extends TimeIntervalReportBuilder { + + @Override + CustomFieldValueReport buildReport() throws NotAuthorizedException, InvalidArgumentException; + } +} + diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/QueryItem.java b/lib/taskana-core/src/main/java/pro/taskana/report/QueryItem.java similarity index 90% rename from lib/taskana-core/src/main/java/pro/taskana/impl/report/QueryItem.java rename to lib/taskana-core/src/main/java/pro/taskana/report/QueryItem.java index 8082908c3..738667012 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/QueryItem.java +++ b/lib/taskana-core/src/main/java/pro/taskana/report/QueryItem.java @@ -1,4 +1,4 @@ -package pro.taskana.impl.report; +package pro.taskana.report; /** * A QueryItem is en entity on which a {@link Report} is based on. diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/QueryItemPreprocessor.java b/lib/taskana-core/src/main/java/pro/taskana/report/QueryItemPreprocessor.java similarity index 92% rename from lib/taskana-core/src/main/java/pro/taskana/impl/report/QueryItemPreprocessor.java rename to lib/taskana-core/src/main/java/pro/taskana/report/QueryItemPreprocessor.java index b4bfbc42d..477dc8f8f 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/QueryItemPreprocessor.java +++ b/lib/taskana-core/src/main/java/pro/taskana/report/QueryItemPreprocessor.java @@ -1,4 +1,4 @@ -package pro.taskana.impl.report; +package pro.taskana.report; /** * The QueryItemPreprocessor is used when adding {@link QueryItem}s into a {@link Report}. It defines a processing diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/Report.java b/lib/taskana-core/src/main/java/pro/taskana/report/Report.java similarity index 81% rename from lib/taskana-core/src/main/java/pro/taskana/impl/report/Report.java rename to lib/taskana-core/src/main/java/pro/taskana/report/Report.java index f0f8ebc62..ef05ad600 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/Report.java +++ b/lib/taskana-core/src/main/java/pro/taskana/report/Report.java @@ -1,4 +1,4 @@ -package pro.taskana.impl.report; +package pro.taskana.report; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -6,6 +6,9 @@ import java.util.List; import java.util.Map; import java.util.Set; +import pro.taskana.exceptions.InvalidArgumentException; +import pro.taskana.exceptions.NotAuthorizedException; + /** * A Report represents a an abstract table that consists of {@link ReportRow}s and a list of <ColumnHeader>s. * Since a report does not specify <Item> and <ColumnHeader> it does not contain functional logic. @@ -22,7 +25,7 @@ public abstract class Report sumRow; private String rowDesc; - public Report(List columnHeaders, String rowDesc) { + protected Report(List columnHeaders, String rowDesc) { this.rowDesc = rowDesc; sumRow = new ReportRow<>(columnHeaders.size()); this.columnHeaders.addAll(columnHeaders); @@ -84,4 +87,14 @@ public abstract class Report createReportRow(int columnSize) { return new ReportRow<>(columnSize); } + + /** + * Builder for {@link Report}. + * @param {@link QueryItem} whose value is relevant for this report. + * @param {@link ReportColumnHeader} which can determine if an <Item> belongs into that column or not. + */ + public interface Builder> { + + Report buildReport() throws NotAuthorizedException, InvalidArgumentException; + } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/ReportColumnHeader.java b/lib/taskana-core/src/main/java/pro/taskana/report/ReportColumnHeader.java similarity index 91% rename from lib/taskana-core/src/main/java/pro/taskana/impl/report/ReportColumnHeader.java rename to lib/taskana-core/src/main/java/pro/taskana/report/ReportColumnHeader.java index 8f1dfc066..45f280a11 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/ReportColumnHeader.java +++ b/lib/taskana-core/src/main/java/pro/taskana/report/ReportColumnHeader.java @@ -1,4 +1,4 @@ -package pro.taskana.impl.report; +package pro.taskana.report; /** * A ReportColumnHeader is an element of a {@link Report}. diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/report/ReportRow.java b/lib/taskana-core/src/main/java/pro/taskana/report/ReportRow.java similarity index 96% rename from lib/taskana-core/src/main/java/pro/taskana/impl/report/ReportRow.java rename to lib/taskana-core/src/main/java/pro/taskana/report/ReportRow.java index a499238d1..bc8059bb8 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/report/ReportRow.java +++ b/lib/taskana-core/src/main/java/pro/taskana/report/ReportRow.java @@ -1,4 +1,4 @@ -package pro.taskana.impl.report; +package pro.taskana.report; /** * A ReportRow represents a row in a {@link Report}. diff --git a/lib/taskana-core/src/main/java/pro/taskana/report/TaskStatusReport.java b/lib/taskana-core/src/main/java/pro/taskana/report/TaskStatusReport.java new file mode 100644 index 000000000..c9a630f72 --- /dev/null +++ b/lib/taskana-core/src/main/java/pro/taskana/report/TaskStatusReport.java @@ -0,0 +1,52 @@ +package pro.taskana.report; + +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import pro.taskana.TaskState; +import pro.taskana.exceptions.InvalidArgumentException; +import pro.taskana.exceptions.NotAuthorizedException; +import pro.taskana.impl.report.TaskQueryItem; +import pro.taskana.impl.report.TaskStatusColumnHeader; + +/** + * A TaskStatusReport contains the total number of tasks, clustered in their task status. + * Furthermore the report contains a sum line that contains the total numbers + * of the different clusters and the total number of all tasks. + */ +public class TaskStatusReport extends Report { + + public TaskStatusReport(List filter) { + super((filter != null ? filter.stream() : Stream.of(TaskState.values())) + .map(TaskStatusColumnHeader::new) + .collect(Collectors.toList()), "DOMAINS"); + } + + /** + * Builder for {@link TaskStatusReport}. + */ + public interface Builder extends Report.Builder { + + /** + * Adds a list of states to the builder. The created report contains only tasks with a state in this list. + * + * @param states + * a list of states + * @return the Builder + */ + Builder stateIn(List states); + + /** + * Adds a list of domains to the builder. The created report contains only tasks with a domain in this list. + * + * @param domains + * a list of domains + * @return the Builder + */ + Builder domainIn(List domains); + + @Override + TaskStatusReport buildReport() throws NotAuthorizedException, InvalidArgumentException; + } +} diff --git a/lib/taskana-core/src/main/java/pro/taskana/CategoryReportBuilder.java b/lib/taskana-core/src/main/java/pro/taskana/report/TimeIntervalReportBuilder.java similarity index 54% rename from lib/taskana-core/src/main/java/pro/taskana/CategoryReportBuilder.java rename to lib/taskana-core/src/main/java/pro/taskana/report/TimeIntervalReportBuilder.java index a4f81cc59..2b939a52f 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/CategoryReportBuilder.java +++ b/lib/taskana-core/src/main/java/pro/taskana/report/TimeIntervalReportBuilder.java @@ -1,68 +1,67 @@ -package pro.taskana; +package pro.taskana.report; import java.util.List; import java.util.Map; +import pro.taskana.CustomField; +import pro.taskana.TaskState; import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.impl.SelectedItem; -import pro.taskana.impl.report.impl.CategoryReport; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.MonitorQueryItem; +import pro.taskana.impl.report.TimeIntervalColumnHeader; /** - * The CategoryReportBuilder is used to build a {@link CategoryReport}, list the taskIds of a CategoryReport and list - * the values of an entered custom field. A CategoryReport contains the total numbers of tasks of the respective - * category as well as the total number of all tasks. The tasks of the report can be filtered by workbaskets, states, - * categories, domains, classifications and values of a custom field. Classifications can also be excluded from the - * report. If the {@link TimeIntervalColumnHeader}s are set, the report contains also the number of tasks of the - * respective cluster. The age of the tasks can be counted in days or in working days. Tasks with Timestamp DUE = null - * are not considered. + * "Super" Interface for all TimeIntervalReportBuilders. + * @param the true Builder behind this Interface. + * @param the column Header */ -public interface CategoryReportBuilder { +public interface TimeIntervalReportBuilder + extends Report.Builder { /** * Adds a list {@link TimeIntervalColumnHeader}s to the builder to subdivide the report into clusters. * * @param columnHeaders * the column headers the report should consist of. - * @return the CategoryReportBuilder + * @return the TimeIntervalReportBuilder */ - CategoryReportBuilder withColumnHeaders(List columnHeaders); + B withColumnHeaders(List columnHeaders); /** * If this filter is used, the days of the report are counted in working days. * - * @return the CategoryReportBuilder + * @return the TimeIntervalReportBuilder */ - CategoryReportBuilder inWorkingDays(); + B inWorkingDays(); /** - * Adds a list of workbasketIds to the builder. The created report contains only tasks with a workbasketId in this + * Adds a list of workbasket ids to the builder. The created report contains only tasks with a workbasket id in this * list. * * @param workbasketIds - * a list of workbasketIds - * @return the CategoryReportBuilder + * a list of workbasket ids + * @return the TimeIntervalReportBuilder */ - CategoryReportBuilder workbasketIdIn(List workbasketIds); + B workbasketIdIn(List workbasketIds); /** * Adds a list of states to the builder. The created report contains only tasks with a state in this list. * * @param states * a list of states - * @return the CategoryReportBuilder + * @return the TimeIntervalReportBuilder */ - CategoryReportBuilder stateIn(List states); + B stateIn(List states); /** * Adds a list of categories to the builder. The created report contains only tasks with a category in this list. * * @param categories * a list of categories - * @return the CategoryReportBuilder + * @return the TimeIntervalReportBuilder */ - CategoryReportBuilder categoryIn(List categories); + B categoryIn(List categories); /** * Adds a list of classificationIds to the builder. The created report contains only tasks with a classificationId @@ -70,9 +69,9 @@ public interface CategoryReportBuilder { * * @param classificationIds * a list of classificationIds - * @return the CategoryReportBuilder + * @return the TimeIntervalReportBuilder */ - CategoryReportBuilder classificationIdIn(List classificationIds); + B classificationIdIn(List classificationIds); /** * Adds a list of excludedClassificationIds to the builder. The created report contains only tasks with a @@ -80,18 +79,18 @@ public interface CategoryReportBuilder { * * @param excludedClassificationIds * a list of excludedClassificationIds - * @return the CategoryReportBuilder + * @return the TimeIntervalReportBuilder */ - CategoryReportBuilder excludedClassificationIdIn(List excludedClassificationIds); + B excludedClassificationIdIn(List excludedClassificationIds); /** * Adds a list of domains to the builder. The created report contains only tasks with a domain in this list. * * @param domains * a list of domains - * @return the CategoryReportBuilder + * @return the TimeIntervalReportBuilder */ - CategoryReportBuilder domainIn(List domains); + B domainIn(List domains); /** * Adds a map of custom attributes and custom attribute values to the builder. The created report contains only @@ -99,21 +98,9 @@ public interface CategoryReportBuilder { * * @param customAttributeFilter * a map of custom attributes and custom attribute value - * @return the CategoryReportBuilder + * @return the TimeIntervalReportBuilder */ - CategoryReportBuilder customAttributeFilterIn(Map customAttributeFilter); - - /** - * Returns a {@link CategoryReport} containing all tasks after applying the filters. If the column headers are set - * the report is subdivided into clusters. - * - * @throws InvalidArgumentException - * if the column headers are not initialized - * @throws NotAuthorizedException - * if the user has no rights to access the monitor - * @return the CategoryReport - */ - CategoryReport buildReport() throws InvalidArgumentException, NotAuthorizedException; + B customAttributeFilterIn(Map customAttributeFilter); /** * Returns a list of all taskIds of the report that are in the list of selected items. @@ -140,4 +127,5 @@ public interface CategoryReportBuilder { */ List listCustomAttributeValuesForCustomAttributeName(CustomField customField) throws NotAuthorizedException; + } diff --git a/lib/taskana-core/src/main/java/pro/taskana/report/WorkbasketReport.java b/lib/taskana-core/src/main/java/pro/taskana/report/WorkbasketReport.java new file mode 100644 index 000000000..d21d8f02f --- /dev/null +++ b/lib/taskana-core/src/main/java/pro/taskana/report/WorkbasketReport.java @@ -0,0 +1,46 @@ +package pro.taskana.report; + +import java.util.List; + +import pro.taskana.exceptions.InvalidArgumentException; +import pro.taskana.exceptions.NotAuthorizedException; +import pro.taskana.impl.report.CombinedClassificationFilter; +import pro.taskana.impl.report.MonitorQueryItem; +import pro.taskana.impl.report.TimeIntervalColumnHeader; + +/** + * A WorkbasketReport contains the total numbers of tasks of the respective workbasket as well as the + * total number of all tasks. The tasks of the report can be filtered by workbaskets, states, + * categories, domains, classifications and values of a custom field. Classifications can also be excluded from the + * report. It is also possible to filter by the classifications of the attachments by using the + * {@link CombinedClassificationFilter}. If the {@link TimeIntervalColumnHeader}s are set, the report contains also the + * number of tasks of the respective cluster. The age of the tasks can be counted in days or in working days. Tasks with + * Timestamp DUE = null are not considered. + */ + +public class WorkbasketReport extends Report { + + public WorkbasketReport(List timeIntervalColumnHeaders) { + super(timeIntervalColumnHeaders, "WORKBASKET KEYS"); + } + + /** + * Builder for {@link WorkbasketReport}. + */ + public interface Builder extends TimeIntervalReportBuilder { + + @Override + WorkbasketReport buildReport() throws NotAuthorizedException, InvalidArgumentException; + + /** + * Adds a list of {@link CombinedClassificationFilter} to the builder. The created report contains only tasks with a + * pair of a classificationId for a task and a classificationId for the corresponding attachment in this list. + * + * @param combinedClassificationFilter + * a list of combinedClassificationFilter + * @return the WorkbasketReportBuilder + */ + WorkbasketReport.Builder combinedClassificationFilterIn( + List combinedClassificationFilter); + } +} diff --git a/lib/taskana-core/src/test/java/acceptance/classification/UpdateClassificationAccTest.java b/lib/taskana-core/src/test/java/acceptance/classification/UpdateClassificationAccTest.java index 9324f0ac5..1b51e2c14 100644 --- a/lib/taskana-core/src/test/java/acceptance/classification/UpdateClassificationAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/classification/UpdateClassificationAccTest.java @@ -29,7 +29,7 @@ import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.TaskNotFoundException; import pro.taskana.impl.DaysToWorkingDaysConverter; import pro.taskana.impl.TaskImpl; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.TimeIntervalColumnHeader; import pro.taskana.jobs.JobRunner; import pro.taskana.security.JAASRunner; import pro.taskana.security.WithAccessId; diff --git a/lib/taskana-core/src/test/java/acceptance/monitoring/GetTaskIdsOfCategoryReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/monitoring/GetTaskIdsOfCategoryReportAccTest.java index a06682593..551fdbfd6 100644 --- a/lib/taskana-core/src/test/java/acceptance/monitoring/GetTaskIdsOfCategoryReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/monitoring/GetTaskIdsOfCategoryReportAccTest.java @@ -31,7 +31,7 @@ import pro.taskana.impl.SelectedItem; import pro.taskana.impl.TaskanaEngineImpl; import pro.taskana.impl.configuration.DBCleaner; import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.TimeIntervalColumnHeader; import pro.taskana.security.JAASRunner; import pro.taskana.security.WithAccessId; diff --git a/lib/taskana-core/src/test/java/acceptance/monitoring/GetTaskIdsOfClassificationReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/monitoring/GetTaskIdsOfClassificationReportAccTest.java index 54e753bc3..780451547 100644 --- a/lib/taskana-core/src/test/java/acceptance/monitoring/GetTaskIdsOfClassificationReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/monitoring/GetTaskIdsOfClassificationReportAccTest.java @@ -25,7 +25,7 @@ import pro.taskana.impl.SelectedItem; import pro.taskana.impl.TaskanaEngineImpl; import pro.taskana.impl.configuration.DBCleaner; import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.TimeIntervalColumnHeader; import pro.taskana.security.JAASRunner; import pro.taskana.security.WithAccessId; diff --git a/lib/taskana-core/src/test/java/acceptance/monitoring/GetTaskIdsOfCustomFieldValueReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/monitoring/GetTaskIdsOfCustomFieldValueReportAccTest.java index edf995451..4c90f02db 100644 --- a/lib/taskana-core/src/test/java/acceptance/monitoring/GetTaskIdsOfCustomFieldValueReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/monitoring/GetTaskIdsOfCustomFieldValueReportAccTest.java @@ -31,7 +31,7 @@ import pro.taskana.impl.SelectedItem; import pro.taskana.impl.TaskanaEngineImpl; import pro.taskana.impl.configuration.DBCleaner; import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.TimeIntervalColumnHeader; import pro.taskana.security.JAASRunner; import pro.taskana.security.WithAccessId; diff --git a/lib/taskana-core/src/test/java/acceptance/monitoring/GetTaskIdsOfWorkbasketReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/monitoring/GetTaskIdsOfWorkbasketReportAccTest.java index e832ab11a..bb0fd4cad 100644 --- a/lib/taskana-core/src/test/java/acceptance/monitoring/GetTaskIdsOfWorkbasketReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/monitoring/GetTaskIdsOfWorkbasketReportAccTest.java @@ -26,7 +26,7 @@ import pro.taskana.impl.SelectedItem; import pro.taskana.impl.TaskanaEngineImpl; import pro.taskana.impl.configuration.DBCleaner; import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.TimeIntervalColumnHeader; import pro.taskana.security.JAASRunner; import pro.taskana.security.WithAccessId; diff --git a/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideCategoryReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideCategoryReportAccTest.java index fe632b91d..1fd1c35e2 100644 --- a/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideCategoryReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideCategoryReportAccTest.java @@ -34,8 +34,8 @@ import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.impl.TaskanaEngineImpl; import pro.taskana.impl.configuration.DBCleaner; import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; -import pro.taskana.impl.report.impl.CategoryReport; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.TimeIntervalColumnHeader; +import pro.taskana.report.CategoryReport; import pro.taskana.security.JAASRunner; import pro.taskana.security.WithAccessId; diff --git a/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideClassificationReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideClassificationReportAccTest.java index 6396341fb..a0aa825e8 100644 --- a/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideClassificationReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideClassificationReportAccTest.java @@ -34,8 +34,8 @@ import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.impl.TaskanaEngineImpl; import pro.taskana.impl.configuration.DBCleaner; import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; -import pro.taskana.impl.report.impl.ClassificationReport; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.TimeIntervalColumnHeader; +import pro.taskana.report.ClassificationReport; import pro.taskana.security.JAASRunner; import pro.taskana.security.WithAccessId; diff --git a/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideCustomFieldValueReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideCustomFieldValueReportAccTest.java index 6e92a523b..e7f9793eb 100644 --- a/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideCustomFieldValueReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideCustomFieldValueReportAccTest.java @@ -32,8 +32,8 @@ import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.impl.configuration.DBCleaner; import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; -import pro.taskana.impl.report.impl.CustomFieldValueReport; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.TimeIntervalColumnHeader; +import pro.taskana.report.CustomFieldValueReport; import pro.taskana.security.JAASRunner; import pro.taskana.security.WithAccessId; @@ -57,7 +57,8 @@ public class ProvideCustomFieldValueReportAccTest { DBCleaner cleaner = new DBCleaner(); cleaner.clearDb(dataSource, true); dataSource = TaskanaEngineConfigurationTest.getDataSource(); - taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false, TaskanaEngineConfigurationTest.getSchemaName()); + taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false, + TaskanaEngineConfigurationTest.getSchemaName()); taskanaEngineConfiguration.setGermanPublicHolidaysEnabled(false); taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine(); taskanaEngine.setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT); diff --git a/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideDetailedClassificationReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideDetailedClassificationReportAccTest.java index 4048d9ab0..110b047e7 100644 --- a/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideDetailedClassificationReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideDetailedClassificationReportAccTest.java @@ -33,11 +33,11 @@ import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.impl.TaskanaEngineImpl; import pro.taskana.impl.configuration.DBCleaner; import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; -import pro.taskana.impl.report.ReportRow; -import pro.taskana.impl.report.impl.DetailedClassificationReport; -import pro.taskana.impl.report.impl.DetailedMonitorQueryItem; -import pro.taskana.impl.report.impl.DetailedReportRow; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.DetailedMonitorQueryItem; +import pro.taskana.impl.report.DetailedReportRow; +import pro.taskana.impl.report.TimeIntervalColumnHeader; +import pro.taskana.report.ClassificationReport.DetailedClassificationReport; +import pro.taskana.report.ReportRow; import pro.taskana.security.JAASRunner; import pro.taskana.security.WithAccessId; diff --git a/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideTaskStatusReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideTaskStatusReportAccTest.java index a0536f631..2a072e8f9 100644 --- a/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideTaskStatusReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideTaskStatusReportAccTest.java @@ -23,13 +23,14 @@ import pro.taskana.TaskState; import pro.taskana.TaskanaEngine; import pro.taskana.configuration.TaskanaEngineConfiguration; import pro.taskana.database.TestDataGenerator; +import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.impl.configuration.DBCleaner; import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; -import pro.taskana.impl.report.ReportRow; -import pro.taskana.impl.report.impl.TaskQueryItem; -import pro.taskana.impl.report.impl.TaskStatusColumnHeader; -import pro.taskana.impl.report.impl.TaskStatusReport; +import pro.taskana.impl.report.TaskQueryItem; +import pro.taskana.impl.report.TaskStatusColumnHeader; +import pro.taskana.report.ReportRow; +import pro.taskana.report.TaskStatusReport; import pro.taskana.security.JAASRunner; import pro.taskana.security.WithAccessId; @@ -64,7 +65,7 @@ public class ProvideTaskStatusReportAccTest { } @Test(expected = NotAuthorizedException.class) - public void testRoleCheck() throws NotAuthorizedException { + public void testRoleCheck() throws NotAuthorizedException, InvalidArgumentException { TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); taskMonitorService.createTaskStatusReportBuilder().buildReport(); } @@ -72,7 +73,7 @@ public class ProvideTaskStatusReportAccTest { @WithAccessId( userName = "monitor") @Test - public void testCompleteTaskStatusReport() throws NotAuthorizedException { + public void testCompleteTaskStatusReport() throws NotAuthorizedException, InvalidArgumentException { // given TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); // when @@ -104,7 +105,7 @@ public class ProvideTaskStatusReportAccTest { @WithAccessId( userName = "admin") @Test - public void testCompleteTaskStatusReportAsAdmin() throws NotAuthorizedException { + public void testCompleteTaskStatusReportAsAdmin() throws NotAuthorizedException, InvalidArgumentException { TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); taskMonitorService.createTaskStatusReportBuilder().buildReport(); } @@ -112,7 +113,7 @@ public class ProvideTaskStatusReportAccTest { @WithAccessId( userName = "monitor") @Test - public void testCompleteTaskStatusReportWithDomainFilter() throws NotAuthorizedException { + public void testCompleteTaskStatusReportWithDomainFilter() throws NotAuthorizedException, InvalidArgumentException { // given TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); // when @@ -143,7 +144,7 @@ public class ProvideTaskStatusReportAccTest { @WithAccessId( userName = "monitor") @Test - public void testCompleteTaskStatusReportWithStateFilter() throws NotAuthorizedException { + public void testCompleteTaskStatusReportWithStateFilter() throws NotAuthorizedException, InvalidArgumentException { // given TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); // when diff --git a/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideWorkbasketReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideWorkbasketReportAccTest.java index 3514f298e..510eff5eb 100644 --- a/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideWorkbasketReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/monitoring/ProvideWorkbasketReportAccTest.java @@ -33,9 +33,9 @@ import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.impl.configuration.DBCleaner; import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; -import pro.taskana.impl.report.impl.CombinedClassificationFilter; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; -import pro.taskana.impl.report.impl.WorkbasketReport; +import pro.taskana.impl.report.CombinedClassificationFilter; +import pro.taskana.impl.report.TimeIntervalColumnHeader; +import pro.taskana.report.WorkbasketReport; import pro.taskana.security.JAASRunner; import pro.taskana.security.WithAccessId; @@ -59,7 +59,8 @@ public class ProvideWorkbasketReportAccTest { DBCleaner cleaner = new DBCleaner(); cleaner.clearDb(dataSource, true); dataSource = TaskanaEngineConfigurationTest.getDataSource(); - taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false, TaskanaEngineConfigurationTest.getSchemaName()); + taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false, + TaskanaEngineConfigurationTest.getSchemaName()); taskanaEngineConfiguration.setGermanPublicHolidaysEnabled(false); taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine(); taskanaEngine.setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT); diff --git a/lib/taskana-core/src/test/java/acceptance/task/CreateTaskAccTest.java b/lib/taskana-core/src/test/java/acceptance/task/CreateTaskAccTest.java index 86e9747a9..6b69493da 100644 --- a/lib/taskana-core/src/test/java/acceptance/task/CreateTaskAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/task/CreateTaskAccTest.java @@ -33,7 +33,7 @@ import pro.taskana.exceptions.WorkbasketNotFoundException; import pro.taskana.impl.DaysToWorkingDaysConverter; import pro.taskana.impl.TaskanaEngineImpl; import pro.taskana.impl.TaskanaEngineProxyForTest; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.TimeIntervalColumnHeader; import pro.taskana.mappings.AttachmentMapper; import pro.taskana.mappings.TaskTestMapper; import pro.taskana.security.CurrentUserContext; diff --git a/lib/taskana-core/src/test/java/acceptance/task/UpdateTaskAttachmentsAccTest.java b/lib/taskana-core/src/test/java/acceptance/task/UpdateTaskAttachmentsAccTest.java index bd51d8c53..29f13599d 100644 --- a/lib/taskana-core/src/test/java/acceptance/task/UpdateTaskAttachmentsAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/task/UpdateTaskAttachmentsAccTest.java @@ -34,7 +34,7 @@ import pro.taskana.exceptions.WorkbasketNotFoundException; import pro.taskana.impl.AttachmentImpl; import pro.taskana.impl.DaysToWorkingDaysConverter; import pro.taskana.impl.TaskImpl; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.TimeIntervalColumnHeader; import pro.taskana.security.CurrentUserContext; import pro.taskana.security.JAASRunner; import pro.taskana.security.WithAccessId; diff --git a/lib/taskana-core/src/test/java/pro/taskana/impl/CategoryReportBuilderImplTest.java b/lib/taskana-core/src/test/java/pro/taskana/impl/CategoryReportBuilderImplTest.java index 9e0545ca6..022d73bc7 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/impl/CategoryReportBuilderImplTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/impl/CategoryReportBuilderImplTest.java @@ -31,10 +31,10 @@ import pro.taskana.TaskState; import pro.taskana.configuration.TaskanaEngineConfiguration; import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.NotAuthorizedException; -import pro.taskana.impl.report.impl.CategoryReport; -import pro.taskana.impl.report.impl.MonitorQueryItem; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.MonitorQueryItem; +import pro.taskana.impl.report.TimeIntervalColumnHeader; import pro.taskana.mappings.TaskMonitorMapper; +import pro.taskana.report.CategoryReport; /** * Unit Test for CategoryBuilderImpl. @@ -213,7 +213,7 @@ public class CategoryReportBuilderImplTest { SelectedItem selectedItem = new SelectedItem(); List selectedItems = Collections.singletonList(selectedItem); List result = cut.createCategoryReportBuilder() - .listTaskIdsForSelectedItems(selectedItems); + .listTaskIdsForSelectedItems(selectedItems); assertNotNull(result); } @@ -270,8 +270,8 @@ public class CategoryReportBuilderImplTest { @Test public void testListCustomAttributeValuesForCustomAttributeNameIsEmptyResult() throws NotAuthorizedException { List result = cut.createCategoryReportBuilder() - .workbasketIdIn(Arrays.asList("DieGibtsSicherNed")) - .listCustomAttributeValuesForCustomAttributeName(CustomField.CUSTOM_1); + .workbasketIdIn(Arrays.asList("DieGibtsSicherNed")) + .listCustomAttributeValuesForCustomAttributeName(CustomField.CUSTOM_1); assertNotNull(result); } } diff --git a/lib/taskana-core/src/test/java/pro/taskana/impl/ClassificationReportBuilderImplTest.java b/lib/taskana-core/src/test/java/pro/taskana/impl/ClassificationReportBuilderImplTest.java index 3e0864fd6..6420de3c7 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/impl/ClassificationReportBuilderImplTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/impl/ClassificationReportBuilderImplTest.java @@ -31,13 +31,13 @@ import pro.taskana.TaskState; import pro.taskana.configuration.TaskanaEngineConfiguration; import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.NotAuthorizedException; -import pro.taskana.impl.report.impl.ClassificationReport; -import pro.taskana.impl.report.impl.DetailedClassificationReport; -import pro.taskana.impl.report.impl.DetailedMonitorQueryItem; -import pro.taskana.impl.report.impl.DetailedReportRow; -import pro.taskana.impl.report.impl.MonitorQueryItem; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.DetailedMonitorQueryItem; +import pro.taskana.impl.report.DetailedReportRow; +import pro.taskana.impl.report.MonitorQueryItem; +import pro.taskana.impl.report.TimeIntervalColumnHeader; import pro.taskana.mappings.TaskMonitorMapper; +import pro.taskana.report.ClassificationReport; +import pro.taskana.report.ClassificationReport.DetailedClassificationReport; /** * Unit Test for ClassificationReportBuilderImpl. @@ -324,8 +324,8 @@ public class ClassificationReportBuilderImplTest { selectedItem.setKey("GIBTSNED"); List selectedItems = Collections.singletonList(selectedItem); List result = cut.createClassificationReportBuilder() - .workbasketIdIn(Arrays.asList("DieGibtsEhNed")) - .listTaskIdsForSelectedItems(selectedItems); + .workbasketIdIn(Arrays.asList("DieGibtsEhNed")) + .listTaskIdsForSelectedItems(selectedItems); assertNotNull(result); } @@ -383,8 +383,8 @@ public class ClassificationReportBuilderImplTest { public void testListCustomAttributeValuesForCustomAttributeNameIsEmptyResult() throws NotAuthorizedException { List result = cut.createClassificationReportBuilder() - .workbasketIdIn(Arrays.asList("DieGibtsGarantiertNed")) - .listCustomAttributeValuesForCustomAttributeName(CustomField.CUSTOM_10); + .workbasketIdIn(Arrays.asList("DieGibtsGarantiertNed")) + .listCustomAttributeValuesForCustomAttributeName(CustomField.CUSTOM_10); assertNotNull(result); } diff --git a/lib/taskana-core/src/test/java/pro/taskana/impl/CustomFieldValueReportBuilderImplTest.java b/lib/taskana-core/src/test/java/pro/taskana/impl/CustomFieldValueReportBuilderImplTest.java index 8b4457821..4515f7abd 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/impl/CustomFieldValueReportBuilderImplTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/impl/CustomFieldValueReportBuilderImplTest.java @@ -30,10 +30,10 @@ import pro.taskana.TaskState; import pro.taskana.configuration.TaskanaEngineConfiguration; import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.NotAuthorizedException; -import pro.taskana.impl.report.impl.CustomFieldValueReport; -import pro.taskana.impl.report.impl.MonitorQueryItem; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.MonitorQueryItem; +import pro.taskana.impl.report.TimeIntervalColumnHeader; import pro.taskana.mappings.TaskMonitorMapper; +import pro.taskana.report.CustomFieldValueReport; /** * Unit Test for CustomFieldValueReportBuilderImpl. diff --git a/lib/taskana-core/src/test/java/pro/taskana/impl/DaysToWorkingDaysConverterTest.java b/lib/taskana-core/src/test/java/pro/taskana/impl/DaysToWorkingDaysConverterTest.java index 3e82cad58..312ffa8c3 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/impl/DaysToWorkingDaysConverterTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/impl/DaysToWorkingDaysConverterTest.java @@ -15,7 +15,7 @@ import org.junit.BeforeClass; import org.junit.Test; import pro.taskana.exceptions.InvalidArgumentException; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; +import pro.taskana.impl.report.TimeIntervalColumnHeader; /** * Test for the DaysToWorkingDaysConverter. diff --git a/lib/taskana-core/src/test/java/pro/taskana/impl/TaskStatusReportBuilderImplTest.java b/lib/taskana-core/src/test/java/pro/taskana/impl/TaskStatusReportBuilderImplTest.java index a2fa36d92..36702412a 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/impl/TaskStatusReportBuilderImplTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/impl/TaskStatusReportBuilderImplTest.java @@ -23,10 +23,11 @@ import org.mockito.junit.MockitoJUnitRunner; import pro.taskana.TaskState; import pro.taskana.configuration.TaskanaEngineConfiguration; +import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.NotAuthorizedException; -import pro.taskana.impl.report.impl.TaskQueryItem; -import pro.taskana.impl.report.impl.TaskStatusReport; +import pro.taskana.impl.report.TaskQueryItem; import pro.taskana.mappings.TaskMonitorMapper; +import pro.taskana.report.TaskStatusReport; /** * Unit Test for TaskStatusReportBuilderImpl. @@ -54,7 +55,7 @@ public class TaskStatusReportBuilderImplTest { } @Test - public void testGetTaskStateReportWithoutFilters() throws NotAuthorizedException { + public void testGetTaskStateReportWithoutFilters() throws NotAuthorizedException, InvalidArgumentException { // given TaskQueryItem queryItem1 = new TaskQueryItem(); queryItem1.setCount(50); @@ -85,7 +86,7 @@ public class TaskStatusReportBuilderImplTest { } @Test - public void testGetTotalNumberOfTaskStateReport() throws NotAuthorizedException { + public void testGetTotalNumberOfTaskStateReport() throws NotAuthorizedException, InvalidArgumentException { // given TaskQueryItem queryItem1 = new TaskQueryItem(); queryItem1.setCount(50); diff --git a/lib/taskana-core/src/test/java/pro/taskana/impl/WorkbasketReportBuilderImplTest.java b/lib/taskana-core/src/test/java/pro/taskana/impl/WorkbasketReportBuilderImplTest.java index 8a7cbcb28..1563cf185 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/impl/WorkbasketReportBuilderImplTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/impl/WorkbasketReportBuilderImplTest.java @@ -31,11 +31,11 @@ import pro.taskana.TaskState; import pro.taskana.configuration.TaskanaEngineConfiguration; import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.NotAuthorizedException; -import pro.taskana.impl.report.impl.CombinedClassificationFilter; -import pro.taskana.impl.report.impl.MonitorQueryItem; -import pro.taskana.impl.report.impl.TimeIntervalColumnHeader; -import pro.taskana.impl.report.impl.WorkbasketReport; +import pro.taskana.impl.report.CombinedClassificationFilter; +import pro.taskana.impl.report.MonitorQueryItem; +import pro.taskana.impl.report.TimeIntervalColumnHeader; import pro.taskana.mappings.TaskMonitorMapper; +import pro.taskana.report.WorkbasketReport; /** * Unit Test for WorkbasketReportBuilderImpl. @@ -227,8 +227,8 @@ public class WorkbasketReportBuilderImplTest { throws NotAuthorizedException, InvalidArgumentException { List selectedItems = new ArrayList<>(); List result = cut.createWorkbasketReportBuilder() - .workbasketIdIn(Arrays.asList("DieGibtsGarantiertNed")) - .listTaskIdsForSelectedItems(selectedItems); + .workbasketIdIn(Arrays.asList("DieGibtsGarantiertNed")) + .listTaskIdsForSelectedItems(selectedItems); assertNotNull(result); } @@ -286,8 +286,8 @@ public class WorkbasketReportBuilderImplTest { public void testListCustomAttributeValuesForCustomAttributeNameIsEmptyResult() throws NotAuthorizedException { List result = cut.createWorkbasketReportBuilder() - .workbasketIdIn(Arrays.asList("GibtsSicherNed")) - .listCustomAttributeValuesForCustomAttributeName(CustomField.CUSTOM_14); + .workbasketIdIn(Arrays.asList("GibtsSicherNed")) + .listCustomAttributeValuesForCustomAttributeName(CustomField.CUSTOM_14); assertNotNull(result); } } diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/MonitorController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/MonitorController.java index 9ac757a6e..8e65f9c93 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/MonitorController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/MonitorController.java @@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RestController; import pro.taskana.TaskMonitorService; import pro.taskana.TaskState; +import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.rest.resource.ReportResource; import pro.taskana.rest.resource.assembler.ReportAssembler; @@ -71,7 +72,8 @@ public class MonitorController { @GetMapping(path = "/taskStatusReport") @Transactional(readOnly = true, rollbackFor = Exception.class) public ResponseEntity getTaskStatusReport(@RequestParam(required = false) List domains, - @RequestParam(required = false) List states) throws NotAuthorizedException { + @RequestParam(required = false) List states) throws NotAuthorizedException, + InvalidArgumentException { // return ResponseEntity.status(HttpStatus.OK) // .body(reportAssembler.toResource(taskMonitorService.getTaskStatusReport(domains, states), domains, states)); return ResponseEntity.status(HttpStatus.OK) diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/resource/ReportResource.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/resource/ReportResource.java index 4d54f085a..6be98ec10 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/resource/ReportResource.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/resource/ReportResource.java @@ -5,7 +5,7 @@ import java.util.Map; import org.springframework.hateoas.ResourceSupport; /** - * Resource class for {@link pro.taskana.impl.report.Report}. + * Resource class for {@link pro.taskana.report.Report}. */ public class ReportResource extends ResourceSupport { @@ -74,7 +74,7 @@ public class ReportResource extends ResourceSupport { } /** - * Resource class for {@link pro.taskana.impl.report.ReportRow}. + * Resource class for {@link pro.taskana.report.ReportRow}. */ public static class RowResource { diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/resource/assembler/ReportAssembler.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/resource/assembler/ReportAssembler.java index c1a40ae66..c5c905257 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/resource/assembler/ReportAssembler.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/resource/assembler/ReportAssembler.java @@ -12,12 +12,13 @@ import java.util.stream.Collectors; import org.springframework.stereotype.Component; import pro.taskana.TaskState; +import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.NotAuthorizedException; -import pro.taskana.impl.report.QueryItem; -import pro.taskana.impl.report.Report; -import pro.taskana.impl.report.ReportColumnHeader; -import pro.taskana.impl.report.ReportRow; -import pro.taskana.impl.report.impl.TaskStatusReport; +import pro.taskana.report.QueryItem; +import pro.taskana.report.Report; +import pro.taskana.report.ReportColumnHeader; +import pro.taskana.report.ReportRow; +import pro.taskana.report.TaskStatusReport; import pro.taskana.rest.MonitorController; import pro.taskana.rest.resource.ReportResource; @@ -28,7 +29,7 @@ import pro.taskana.rest.resource.ReportResource; public class ReportAssembler { public ReportResource toResource(TaskStatusReport report, List domains, List states) - throws NotAuthorizedException { + throws NotAuthorizedException, InvalidArgumentException { ReportResource resource = toResource(report); resource.add( linkTo(methodOn(MonitorController.class).getTaskStatusReport(domains, states))