TSK-269: Add custom property filter to reports and use null parameter to

disable a filter in TaskMonitorService
This commit is contained in:
Konstantin Kläger 2018-03-02 11:17:24 +01:00 committed by Holger Hagen
parent 1809c95265
commit dd241cc9a5
10 changed files with 1577 additions and 606 deletions

View File

@ -16,40 +16,55 @@ public interface TaskMonitorService {
/** /**
* Returns a {@link Report} grouped by workbaskets. The report contains the total numbers of tasks of the respective * Returns a {@link Report} grouped by workbaskets. The report contains the total numbers of tasks of the respective
* workbasket as well as the total number of all tasks. The tasks of the report are filtered by workbaskets, states, * workbasket as well as the total number of all tasks. If no filter is required, the respective parameter should be
* categories and domains. Task with Timestamp DUE = null are not considered. * null. The tasks of the report are filtered by workbaskets, states, categories, domains and values of a custom
* field. Tasks with Timestamp DUE = null are not considered.
* *
* @param workbasketIds * @param workbasketIds
* a list of workbasket ids to filter by workbaskets * a list of workbasket ids to filter by workbaskets. To omit this filter, use null for this parameter
* @param states * @param states
* a list of states to filter by states * a list of states to filter by states. To omit this filter, use null for this parameter
* @param categories * @param categories
* a list of categories to filter by categories * a list of categories to filter by categories. To omit this filter, use null for this parameter
* @param domains * @param domains
* a list of domains to filter by domains * a list of domains to filter by domains. To omit this filter, use null for this parameter
* @param customField
* a custom field to filter by the values of the custom field. To omit this filter, use null for this
* parameter
* @param customFieldValues
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
* null for this parameter
* @return the report * @return the report
* @throws InvalidArgumentException * @throws InvalidArgumentException
* thrown if workbasketIds, states, categories or domains is null * thrown if DaysToWorkingDaysConverter is initialized with null
*/ */
Report getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states, List<String> categories, Report getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
List<String> domains) throws InvalidArgumentException; List<String> domains, CustomField customField, List<String> customFieldValues) throws InvalidArgumentException;
/** /**
* Returns a {@link Report} grouped by workbaskets. For each workbasket the report contains the total number of * Returns a {@link Report} grouped by workbaskets. For each workbasket the report contains the total number of
* tasks and the number of tasks of the respective cluster that are specified by the * tasks and the number of tasks of the respective cluster that are specified by the
* {@link ReportLineItemDefinition}s. By default the age of the tasks is counted in working days. Furthermore the * {@link ReportLineItemDefinition}s. By default the age of the tasks is counted in working days. Furthermore the
* Report contains a sum line that contains the total numbers of the different clusters and the total number of all * Report contains a sum line that contains the total numbers of the different clusters and the total number of all
* tasks in this report. The tasks of the report are filtered by workbaskets, states, categories and domains. Task * tasks in this report. The tasks of the report are filtered by workbaskets, states, categories, domains and values
* with Timestamp DUE = null are not considered. * of a custom field. If no filter is required, the respective parameter should be null. Tasks with Timestamp DUE =
* null are not considered.
* *
* @param workbasketIds * @param workbasketIds
* a list of workbasket ids objects to filter by workbaskets * a list of workbasket ids objects to filter by workbaskets. To omit this filter, use null for this
* parameter
* @param states * @param states
* a list of states objects to filter by states * a list of states objects to filter by states. To omit this filter, use null for this parameter
* @param categories * @param categories
* a list of categories to filter by categories * a list of categories to filter by categories. To omit this filter, use null for this parameter
* @param domains * @param domains
* a list of domains to filter by domains * a list of domains to filter by domains. To omit this filter, use null for this parameter
* @param customField
* a custom field to filter by the values of the custom field. To omit this filter, use null for this
* parameter
* @param customFieldValues
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
* null for this parameter
* @param reportLineItemDefinitions * @param reportLineItemDefinitions
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates. * a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
* Days in past are represented as negative values and days in the future are represented as positive * Days in past are represented as negative values and days in the future are represented as positive
@ -60,11 +75,11 @@ public interface TaskMonitorService {
* Integer.MAX_VALUE. * Integer.MAX_VALUE.
* @return the report * @return the report
* @throws InvalidArgumentException * @throws InvalidArgumentException
* thrown if workbasketIds, states, categories or domains is null * thrown if DaysToWorkingDaysConverter is initialized with null
*/ */
Report getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states, Report getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains, List<ReportLineItemDefinition> reportLineItemDefinitions) List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
throws InvalidArgumentException; List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException;
/** /**
* Returns a {@link Report} grouped by workbaskets. For each workbasket the report contains the total number of * Returns a {@link Report} grouped by workbaskets. For each workbasket the report contains the total number of
@ -72,16 +87,24 @@ public interface TaskMonitorService {
* {@link ReportLineItemDefinition}s. It can be specified whether the age of the tasks is counted in days or in * {@link ReportLineItemDefinition}s. It can be specified whether the age of the tasks is counted in days or in
* working days. Furthermore the report contains a sum line that contains the total numbers of the different * working days. Furthermore the report contains a sum line that contains the total numbers of the different
* clusters and the total number of all tasks. The tasks of the report are filtered by workbaskets, states, * clusters and the total number of all tasks. The tasks of the report are filtered by workbaskets, states,
* categories and domains. Task with Timestamp DUE = null are not considered. * categories, domains and values of a custom field. If no filter is required, the respective parameter should be
* null. Tasks with Timestamp DUE = null are not considered.
* *
* @param workbasketIds * @param workbasketIds
* a list of workbasket ids objects to filter by workbaskets * a list of workbasket ids objects to filter by workbaskets. To omit this filter, use null for this
* parameter
* @param states * @param states
* a list of states objects to filter by states * a list of states objects to filter by states. To omit this filter, use null for this parameter
* @param categories * @param categories
* a list of categories to filter by categories * a list of categories to filter by categories. To omit this filter, use null for this parameter
* @param domains * @param domains
* a list of domains to filter by domains * a list of domains to filter by domains. To omit this filter, use null for this parameter
* @param customField
* a custom field to filter by the values of the custom field. To omit this filter, use null for this
* parameter
* @param customFieldValues
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
* null for this parameter
* @param reportLineItemDefinitions * @param reportLineItemDefinitions
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates. * a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
* Days in past are represented as negative values and days in the future are represented as positive * Days in past are represented as negative values and days in the future are represented as positive
@ -95,48 +118,63 @@ public interface TaskMonitorService {
* working days * working days
* @return the report * @return the report
* @throws InvalidArgumentException * @throws InvalidArgumentException
* thrown if workbasketIds, states, categories or domains is null * thrown if DaysToWorkingDaysConverter is initialized with null
*/ */
Report getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states, Report getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains, List<ReportLineItemDefinition> reportLineItemDefinitions, List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
boolean inWorkingDays) throws InvalidArgumentException; List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
throws InvalidArgumentException;
/** /**
* Returns a {@link Report} grouped by categories. The report contains the total numbers of tasks of the respective * Returns a {@link Report} grouped by categories. The report contains the total numbers of tasks of the respective
* category as well as the total number of all tasks. The tasks of the report are filtered by workbaskets, states, * category as well as the total number of all tasks. The tasks of the report are filtered by workbaskets, states,
* categories and domains. Task with Timestamp DUE = null are not considered. * categories, domains and values of a custom field and values of a custom field. If no filter is required, the
* respective parameter should be null. Tasks with Timestamp DUE = null are not considered.
* *
* @param workbasketIds * @param workbasketIds
* a list of workbasket ids to filter by workbaskets * a list of workbasket ids to filter by workbaskets. To omit this filter, use null for this parameter
* @param states * @param states
* a list of states to filter by states * a list of states to filter by states. To omit this filter, use null for this parameter
* @param categories * @param categories
* a list of categories to filter by categories * a list of categories to filter by categories. To omit this filter, use null for this parameter
* @param domains * @param domains
* a list of domains to filter by domains * a list of domains to filter by domains. To omit this filter, use null for this parameter
* @param customField
* a custom field to filter by the values of the custom field. To omit this filter, use null for this
* parameter
* @param customFieldValues
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
* null for this parameter
* @return the report * @return the report
* @throws InvalidArgumentException * @throws InvalidArgumentException
* thrown if workbasketIds, states, categories or domains is null * thrown if DaysToWorkingDaysConverter is initialized with null
*/ */
Report getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories, Report getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
List<String> domains) throws InvalidArgumentException; List<String> domains, CustomField customField, List<String> customFieldValues) throws InvalidArgumentException;
/** /**
* Returns a {@link Report} grouped by categories. For each category the report contains the total number of tasks * Returns a {@link Report} grouped by categories. For each category the report contains the total number of tasks
* and the number of tasks of the respective cluster that are specified by the {@link ReportLineItemDefinition}s. By * and the number of tasks of the respective cluster that are specified by the {@link ReportLineItemDefinition}s. By
* default the age of the tasks is counted in working days. Furthermore the Report contains a sum line that contains * default the age of the tasks is counted in working days. Furthermore the Report contains a sum line that contains
* the total numbers of the different clusters and the total number of all tasks in this report. The tasks of the * the total numbers of the different clusters and the total number of all tasks in this report. The tasks of the
* report are filtered by workbaskets, states, categories and domains. Task with Timestamp DUE = null are not * report are filtered by workbaskets, states, categories, domains and values of a custom field. If no filter is
* considered. * required, the respective parameter should be null. Tasks with Timestamp DUE = null are not considered.
* *
* @param workbasketIds * @param workbasketIds
* a list of workbasket ids objects to filter by workbaskets * a list of workbasket ids objects to filter by workbaskets. To omit this filter, use null for this
* parameter
* @param states * @param states
* a list of states objects to filter by states * a list of states objects to filter by states. To omit this filter, use null for this parameter
* @param categories * @param categories
* a list of categories to filter by categories * a list of categories to filter by categories. To omit this filter, use null for this parameter
* @param domains * @param domains
* a list of domains to filter by domains * a list of domains to filter by domains. To omit this filter, use null for this parameter
* @param customField
* a custom field to filter by the values of the custom field. To omit this filter, use null for this
* parameter
* @param customFieldValues
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
* null for this parameter
* @param reportLineItemDefinitions * @param reportLineItemDefinitions
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates. * a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
* Days in past are represented as negative values and days in the future are represented as positive * Days in past are represented as negative values and days in the future are represented as positive
@ -147,27 +185,36 @@ public interface TaskMonitorService {
* Integer.MAX_VALUE. * Integer.MAX_VALUE.
* @return the report * @return the report
* @throws InvalidArgumentException * @throws InvalidArgumentException
* thrown if workbasketIds, states, categories or domains is null * thrown if DaysToWorkingDaysConverter is initialized with null
*/ */
Report getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories, Report getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
List<String> domains, List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException; List<String> domains, CustomField customField, List<String> customFieldValues,
List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException;
/** /**
* Returns a {@link Report} grouped by categories. For each category the report contains the total number of tasks * Returns a {@link Report} grouped by categories. For each category the report contains the total number of tasks
* and the number of tasks of the respective cluster that are specified by the {@link ReportLineItemDefinition}s. It * and the number of tasks of the respective cluster that are specified by the {@link ReportLineItemDefinition}s. It
* can be specified whether the age of the tasks is counted in days or in working days. Furthermore the report * can be specified whether the age of the tasks is counted in days or in working days. Furthermore the report
* contains a sum line that contains the total numbers of the different clusters and the total number of all tasks. * contains a sum line that contains the total numbers of the different clusters and the total number of all tasks.
* The tasks of the report are filtered by workbaskets, states, categories and domains. Task with Timestamp DUE = * The tasks of the report are filtered by workbaskets, states, categories, domains and values of a custom field. If
* null are not considered. * no filter is required, the respective parameter should be null. Tasks with Timestamp DUE = null are not
* considered.
* *
* @param workbasketIds * @param workbasketIds
* a list of workbasket ids objects to filter by workbaskets * a list of workbasket ids objects to filter by workbaskets. To omit this filter, use null for this
* parameter
* @param states * @param states
* a list of states objects to filter by states * a list of states objects to filter by states. To omit this filter, use null for this parameter
* @param categories * @param categories
* a list of categories to filter by categories * a list of categories to filter by categories. To omit this filter, use null for this parameter
* @param domains * @param domains
* a list of domains to filter by domains * a list of domains to filter by domains. To omit this filter, use null for this parameter
* @param customField
* a custom field to filter by the values of the custom field. To omit this filter, use null for this
* parameter
* @param customFieldValues
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
* null for this parameter
* @param reportLineItemDefinitions * @param reportLineItemDefinitions
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates. * a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
* Days in past are represented as negative values and days in the future are represented as positive * Days in past are represented as negative values and days in the future are represented as positive
@ -181,48 +228,65 @@ public interface TaskMonitorService {
* working days * working days
* @return the report * @return the report
* @throws InvalidArgumentException * @throws InvalidArgumentException
* thrown if workbasketIds, states, categories or domains is null * thrown if DaysToWorkingDaysConverter is initialized with null
*/ */
Report getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories, Report getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
List<String> domains, List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays) List<String> domains, CustomField customField, List<String> customFieldValues,
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
throws InvalidArgumentException; throws InvalidArgumentException;
/** /**
* Returns a {@link Classification} grouped by classifications. The report contains the total numbers of tasks of * Returns a {@link Classification} grouped by classifications. The report contains the total numbers of tasks of
* the respective classification as well as the total number of all tasks. The tasks of the report are filtered by * the respective classification as well as the total number of all tasks. The tasks of the report are filtered by
* workbaskets, states, categories and domains. Task with Timestamp DUE = null are not considered. * workbaskets, states, categories, domains and values of a custom field. If no filter is required, the respective
* parameter should be null. Tasks with Timestamp DUE = null are not considered.
* *
* @param workbasketIds * @param workbasketIds
* a list of workbasket ids to filter by workbaskets * a list of workbasket ids to filter by workbaskets. To omit this filter, use null for this parameter
* @param states * @param states
* a list of states to filter by states * a list of states to filter by states. To omit this filter, use null for this parameter
* @param categories * @param categories
* a list of categories to filter by categories * a list of categories to filter by categories. To omit this filter, use null for this parameter
* @param domains * @param domains
* a list of domains to filter by domains * a list of domains to filter by domains. To omit this filter, use null for this parameter
* @param customField
* a custom field to filter by the values of the custom field. To omit this filter, use null for this
* parameter
* @param customFieldValues
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
* null for this parameter
* @return the ClassificationReport * @return the ClassificationReport
* @throws InvalidArgumentException * @throws InvalidArgumentException
* thrown if workbasketIds, states, categories or domains is null * thrown if DaysToWorkingDaysConverter is initialized with null
*/ */
ClassificationReport getClassificationReport(List<String> workbasketIds, List<TaskState> states, ClassificationReport getClassificationReport(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains) throws InvalidArgumentException; List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues)
throws InvalidArgumentException;
/** /**
* Returns a {@link Classification} grouped by classifications. For each classification the report contains the * Returns a {@link Classification} grouped by classifications. For each classification the report contains the
* total number of tasks and the number of tasks of the respective cluster that are specified by the * total number of tasks and the number of tasks of the respective cluster that are specified by the
* {@link ReportLineItemDefinition}s. By default the age of the tasks is counted in working days. Furthermore the * {@link ReportLineItemDefinition}s. By default the age of the tasks is counted in working days. Furthermore the
* Report contains a sum line that contains the total numbers of the different clusters and the total number of all * Report contains a sum line that contains the total numbers of the different clusters and the total number of all
* tasks in this report. The tasks of the report are filtered by workbaskets, states, categories and domains. Task * tasks in this report. The tasks of the report are filtered by workbaskets, states, categories, domains and values
* with Timestamp DUE = null are not considered. * of a custom field. If no filter is required, the respective parameter should be null. Tasks with Timestamp DUE =
* null are not considered.
* *
* @param workbasketIds * @param workbasketIds
* a list of workbasket ids objects to filter by workbaskets * a list of workbasket ids objects to filter by workbaskets. To omit this filter, use null for this
* parameter
* @param states * @param states
* a list of states objects to filter by states * a list of states objects to filter by states. To omit this filter, use null for this parameter
* @param categories * @param categories
* a list of categories to filter by categories * a list of categories to filter by categories. To omit this filter, use null for this parameter
* @param domains * @param domains
* a list of domains to filter by domains * a list of domains to filter by domains. To omit this filter, use null for this parameter
* @param customField
* a custom field to filter by the values of the custom field. To omit this filter, use null for this
* parameter
* @param customFieldValues
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
* null for this parameter
* @param reportLineItemDefinitions * @param reportLineItemDefinitions
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates. * a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
* Days in past are represented as negative values and days in the future are represented as positive * Days in past are represented as negative values and days in the future are represented as positive
@ -233,11 +297,11 @@ public interface TaskMonitorService {
* Integer.MAX_VALUE. * Integer.MAX_VALUE.
* @return the ClassificationReport * @return the ClassificationReport
* @throws InvalidArgumentException * @throws InvalidArgumentException
* thrown if workbasketIds, states, categories or domains is null * thrown if DaysToWorkingDaysConverter is initialized with null
*/ */
ClassificationReport getClassificationReport(List<String> workbasketIds, List<TaskState> states, ClassificationReport getClassificationReport(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains, List<ReportLineItemDefinition> reportLineItemDefinitions) List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
throws InvalidArgumentException; List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException;
/** /**
* Returns a {@link ClassificationReport} grouped by classification. For each classification the report contains the * Returns a {@link ClassificationReport} grouped by classification. For each classification the report contains the
@ -245,16 +309,24 @@ public interface TaskMonitorService {
* {@link ReportLineItemDefinition}s. It can be specified whether the age of the tasks is counted in days or in * {@link ReportLineItemDefinition}s. It can be specified whether the age of the tasks is counted in days or in
* working days. Furthermore the report contains a sum line that contains the total numbers of the different * working days. Furthermore the report contains a sum line that contains the total numbers of the different
* clusters and the total number of all tasks. The tasks of the report are filtered by workbaskets, states, * clusters and the total number of all tasks. The tasks of the report are filtered by workbaskets, states,
* categories and domains. Task with Timestamp DUE = null are not considered. * categories, domains and values of a custom field. If no filter is required, the respective parameter should be
* null. Tasks with Timestamp DUE = null are not considered.
* *
* @param workbasketIds * @param workbasketIds
* a list of workbasket ids objects to filter by workbaskets * a list of workbasket ids objects to filter by workbaskets. To omit this filter, use null for this
* parameter
* @param states * @param states
* a list of states objects to filter by states * a list of states objects to filter by states. To omit this filter, use null for this parameter
* @param categories * @param categories
* a list of categories to filter by categories * a list of categories to filter by categories. To omit this filter, use null for this parameter
* @param domains * @param domains
* a list of domains to filter by domains * a list of domains to filter by domains. To omit this filter, use null for this parameter
* @param customField
* a custom field to filter by the values of the custom field. To omit this filter, use null for this
* parameter
* @param customFieldValues
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
* null for this parameter
* @param reportLineItemDefinitions * @param reportLineItemDefinitions
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates. * a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
* Days in past are represented as negative values and days in the future are represented as positive * Days in past are represented as negative values and days in the future are represented as positive
@ -268,32 +340,41 @@ public interface TaskMonitorService {
* working days * working days
* @return the ClassificationReport * @return the ClassificationReport
* @throws InvalidArgumentException * @throws InvalidArgumentException
* thrown if workbasketIds, states, categories or domains is null * thrown if DaysToWorkingDaysConverter is initialized with null
*/ */
ClassificationReport getClassificationReport(List<String> workbasketIds, List<TaskState> states, ClassificationReport getClassificationReport(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains, List<ReportLineItemDefinition> reportLineItemDefinitions, List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
boolean inWorkingDays) throws InvalidArgumentException; List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
throws InvalidArgumentException;
/** /**
* Returns a {@link DetailedClassificationReport}. The report contains the total numbers of tasks of the respective * Returns a {@link DetailedClassificationReport}. The report contains the total numbers of tasks of the respective
* classification as well as the total number of all tasks. Each ReportLine contains an additional list of * classification as well as the total number of all tasks. Each ReportLine contains an additional list of
* ReportLines for the classifications of the attachments of the tasks. The tasks of the report are filtered by * ReportLines for the classifications of the attachments of the tasks. The tasks of the report are filtered by
* workbaskets, states, categories and domains. Task with Timestamp DUE = null are not considered. * workbaskets, states, categories, domains and values of a custom field. If no filter is required, the respective
* parameter should be null. Tasks with Timestamp DUE = null are not considered.
* *
* @param workbasketIds * @param workbasketIds
* a list of workbasket ids to filter by workbaskets * a list of workbasket ids to filter by workbaskets. To omit this filter, use null for this parameter
* @param states * @param states
* a list of states to filter by states * a list of states to filter by states. To omit this filter, use null for this parameter
* @param categories * @param categories
* a list of categories to filter by categories * a list of categories to filter by categories. To omit this filter, use null for this parameter
* @param domains * @param domains
* a list of domains to filter by domains * a list of domains to filter by domains. To omit this filter, use null for this parameter
* @param customField
* a custom field to filter by the values of the custom field. To omit this filter, use null for this
* parameter
* @param customFieldValues
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
* null for this parameter
* @return the DetailedClassificationReport * @return the DetailedClassificationReport
* @throws InvalidArgumentException * @throws InvalidArgumentException
* thrown if workbasketIds, states, categories or domains is null * thrown if DaysToWorkingDaysConverter is initialized with null
*/ */
DetailedClassificationReport getDetailedClassificationReport(List<String> workbasketIds, List<TaskState> states, DetailedClassificationReport getDetailedClassificationReport(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains) throws InvalidArgumentException; List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues)
throws InvalidArgumentException;
/** /**
* Returns a {@link DetailedClassificationReport}. For each classification the report contains the total number of * Returns a {@link DetailedClassificationReport}. For each classification the report contains the total number of
@ -301,17 +382,25 @@ public interface TaskMonitorService {
* {@link ReportLineItemDefinition}s. By default the age of the tasks is counted in working days. Each ReportLine * {@link ReportLineItemDefinition}s. By default the age of the tasks is counted in working days. Each ReportLine
* contains an additional list of ReportLines for the classifications of the attachments of the tasks. Furthermore * contains an additional list of ReportLines for the classifications of the attachments of the tasks. Furthermore
* the Report contains a sum line that contains the total numbers of the different clusters and the total number of * the Report contains a sum line that contains the total numbers of the different clusters and the total number of
* all tasks in this report. The tasks of the report are filtered by workbaskets, states, categories and domains. * all tasks in this report. The tasks of the report are filtered by workbaskets, states, categories, domains and
* Task with Timestamp DUE = null are not considered. * values of a custom field. If no filter is required, the respective parameter should be null. Tasks with Timestamp
* DUE = null are not considered.
* *
* @param workbasketIds * @param workbasketIds
* a list of workbasket ids objects to filter by workbaskets * a list of workbasket ids objects to filter by workbaskets. To omit this filter, use null for this
* parameter
* @param states * @param states
* a list of states objects to filter by states * a list of states objects to filter by states. To omit this filter, use null for this parameter
* @param categories * @param categories
* a list of categories to filter by categories * a list of categories to filter by categories. To omit this filter, use null for this parameter
* @param domains * @param domains
* a list of domains to filter by domains * a list of domains to filter by domains. To omit this filter, use null for this parameter
* @param customField
* a custom field to filter by the values of the custom field. To omit this filter, use null for this
* parameter
* @param customFieldValues
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
* null for this parameter
* @param reportLineItemDefinitions * @param reportLineItemDefinitions
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates. * a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
* Days in past are represented as negative values and days in the future are represented as positive * Days in past are represented as negative values and days in the future are represented as positive
@ -322,11 +411,11 @@ public interface TaskMonitorService {
* Integer.MAX_VALUE. * Integer.MAX_VALUE.
* @return the DetailedClassificationReport * @return the DetailedClassificationReport
* @throws InvalidArgumentException * @throws InvalidArgumentException
* thrown if workbasketIds, states, categories or domains is null * thrown if DaysToWorkingDaysConverter is initialized with null
*/ */
DetailedClassificationReport getDetailedClassificationReport(List<String> workbasketIds, List<TaskState> states, DetailedClassificationReport getDetailedClassificationReport(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains, List<ReportLineItemDefinition> reportLineItemDefinitions) List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
throws InvalidArgumentException; List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException;
/** /**
* Returns a {@link DetailedClassificationReport}. For each classification the report contains the total number of * Returns a {@link DetailedClassificationReport}. For each classification the report contains the total number of
@ -335,16 +424,24 @@ public interface TaskMonitorService {
* working days. Each ReportLine contains an additional list of ReportLines for the classifications of the * working days. Each ReportLine contains an additional list of ReportLines for the classifications of the
* attachments of the tasks. Furthermore the report contains a sum line that contains the total numbers of the * attachments of the tasks. Furthermore the report contains a sum line that contains the total numbers of the
* different clusters and the total number of all tasks. The tasks of the report are filtered by workbaskets, * different clusters and the total number of all tasks. The tasks of the report are filtered by workbaskets,
* states, categories and domains. Task with Timestamp DUE = null are not considered. * states, categories, domains and values of a custom field. If no filter is required, the respective parameter
* should be null. Tasks with Timestamp DUE = null are not considered.
* *
* @param workbasketIds * @param workbasketIds
* a list of workbasket ids objects to filter by workbaskets * a list of workbasket ids objects to filter by workbaskets. To omit this filter, use null for this
* parameter
* @param states * @param states
* a list of states objects to filter by states * a list of states objects to filter by states. To omit this filter, use null for this parameter
* @param categories * @param categories
* a list of categories to filter by categories * a list of categories to filter by categories. To omit this filter, use null for this parameter
* @param domains * @param domains
* a list of domains to filter by domains * a list of domains to filter by domains. To omit this filter, use null for this parameter
* @param customField
* a custom field to filter by the values of the custom field. To omit this filter, use null for this
* parameter
* @param customFieldValues
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
* null for this parameter
* @param reportLineItemDefinitions * @param reportLineItemDefinitions
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates. * a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
* Days in past are represented as negative values and days in the future are represented as positive * Days in past are represented as negative values and days in the future are represented as positive
@ -358,52 +455,62 @@ public interface TaskMonitorService {
* working days * working days
* @return the DetailedClassificationReport * @return the DetailedClassificationReport
* @throws InvalidArgumentException * @throws InvalidArgumentException
* thrown if workbasketIds, states, categories or domains is null * thrown if DaysToWorkingDaysConverter is initialized with null
*/ */
DetailedClassificationReport getDetailedClassificationReport(List<String> workbasketIds, List<TaskState> states, DetailedClassificationReport getDetailedClassificationReport(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains, List<ReportLineItemDefinition> reportLineItemDefinitions, List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
boolean inWorkingDays) throws InvalidArgumentException; List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
throws InvalidArgumentException;
/** /**
* Returns a {@link Report} grouped by the value of a certain {@link CustomField}. The report contains the total * Returns a {@link Report} grouped by the value of a certain {@link CustomField}. The report 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 * numbers of tasks of the respective custom field as well as the total number of all tasks. The tasks of the report
* are filtered by workbaskets, states, categories and domains. Task with Timestamp DUE = null are not considered. * are filtered by workbaskets, states, categories, domains and values of a custom field. If no filter is required,
* the respective parameter should be null. Tasks with Timestamp DUE = null are not considered.
* *
* @param workbasketIds * @param workbasketIds
* a list of workbasket ids to filter by workbaskets * a list of workbasket ids to filter by workbaskets. To omit this filter, use null for this parameter
* @param states * @param states
* a list of states to filter by states * a list of states to filter by states. To omit this filter, use null for this parameter
* @param categories * @param categories
* a list of categories to filter by categories * a list of categories to filter by categories. To omit this filter, use null for this parameter
* @param domains * @param domains
* a list of domains to filter by domains * a list of domains to filter by domains. To omit this filter, use null for this parameter
* @param customField * @param customField
* a custom field whose values should be listed in the report * a custom field to filter by the values of the custom field
* @param customFieldValues
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
* null for this parameter
* @return the report * @return the report
* @throws InvalidArgumentException * @throws InvalidArgumentException
* thrown if workbasketIds, states, categories, domains or customField is null * thrown if customField is null
*/ */
Report getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states, List<String> categories, Report getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
List<String> domains, CustomField customField) throws InvalidArgumentException; List<String> domains, CustomField customField, List<String> customFieldValues) throws InvalidArgumentException;
/** /**
* Returns a {@link Report} grouped by the value of a certain {@link CustomField}. For each value of the custom * Returns a {@link Report} grouped by the value of a certain {@link CustomField}. For each value of the custom
* field the report contains the total number of tasks and the number of tasks of the respective cluster that are * field the report contains the total number of tasks and the number of tasks of the respective cluster that are
* specified by the {@link ReportLineItemDefinition}s. By default the age of the tasks is counted in working days. * specified by the {@link ReportLineItemDefinition}s. By default the age of the tasks is counted in working days.
* Furthermore the Report contains a sum line that contains the total numbers of the different clusters and the * Furthermore the Report contains a sum line that contains the total numbers of the different clusters and the
* total number of all tasks in this report. The tasks of the report are filtered by workbaskets, states, categories * total number of all tasks in this report. The tasks of the report are filtered by workbaskets, states,
* and domains. Task with Timestamp DUE = null are not considered. * categories, domains and values of a custom field. If no filter is required, the respective parameter should be
* null. Tasks with Timestamp DUE = null are not considered.
* *
* @param workbasketIds * @param workbasketIds
* a list of workbasket ids objects to filter by workbaskets * a list of workbasket ids objects to filter by workbaskets. To omit this filter, use null for this
* parameter
* @param states * @param states
* a list of states objects to filter by states * a list of states objects to filter by states. To omit this filter, use null for this parameter
* @param categories * @param categories
* a list of categories to filter by categories * a list of categories to filter by categories. To omit this filter, use null for this parameter
* @param domains * @param domains
* a list of domains to filter by domains * a list of domains to filter by domains. To omit this filter, use null for this parameter
* @param customField * @param customField
* a custom field whose values should be listed in the report * a custom field to filter by the values of the custom field
* @param customFieldValues
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
* null for this parameter
* @param reportLineItemDefinitions * @param reportLineItemDefinitions
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates. * a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
* Days in past are represented as negative values and days in the future are represented as positive * Days in past are represented as negative values and days in the future are represented as positive
@ -414,11 +521,11 @@ public interface TaskMonitorService {
* Integer.MAX_VALUE. * Integer.MAX_VALUE.
* @return the report * @return the report
* @throws InvalidArgumentException * @throws InvalidArgumentException
* thrown if workbasketIds, states, categories, domains or customField is null * thrown if customField is null
*/ */
Report getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states, List<String> categories, Report getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
List<String> domains, CustomField customField, List<ReportLineItemDefinition> reportLineItemDefinitions) List<String> domains, CustomField customField, List<String> customFieldValues,
throws InvalidArgumentException; List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException;
/** /**
* Returns a {@link Report} grouped by the value of a certain {@link CustomField}. For each value of the custom * Returns a {@link Report} grouped by the value of a certain {@link CustomField}. For each value of the custom
@ -426,18 +533,23 @@ public interface TaskMonitorService {
* specified by the {@link ReportLineItemDefinition}s. It can be specified whether the age of the tasks is counted * specified by the {@link ReportLineItemDefinition}s. It can be specified whether the age of the tasks is counted
* in days or in working days. Furthermore the report contains a sum line that contains the total numbers of the * in days or in working days. Furthermore the report contains a sum line that contains the total numbers of the
* different clusters and the total number of all tasks. The tasks of the report are filtered by workbaskets, * different clusters and the total number of all tasks. The tasks of the report are filtered by workbaskets,
* states, categories and domains. Task with Timestamp DUE = null are not considered. * states, categories, domains and values of a custom field. If no filter is required, the respective parameter
* should be null. Tasks with Timestamp DUE = null are not considered.
* *
* @param workbasketIds * @param workbasketIds
* a list of workbasket ids objects to filter by workbaskets * a list of workbasket ids objects to filter by workbaskets. To omit this filter, use null for this
* parameter
* @param states * @param states
* a list of states objects to filter by states * a list of states objects to filter by states. To omit this filter, use null for this parameter
* @param categories * @param categories
* a list of categories to filter by categories * a list of categories to filter by categories. To omit this filter, use null for this parameter
* @param domains * @param domains
* a list of domains to filter by domains * a list of domains to filter by domains. To omit this filter, use null for this parameter
* @param customField * @param customField
* a custom field whose values should be listed in the report * a custom field to filter by the values of the custom field
* @param customFieldValues
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
* null for this parameter
* @param reportLineItemDefinitions * @param reportLineItemDefinitions
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates. * a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
* Days in past are represented as negative values and days in the future are represented as positive * Days in past are represented as negative values and days in the future are represented as positive
@ -451,24 +563,34 @@ public interface TaskMonitorService {
* working days * working days
* @return the report * @return the report
* @throws InvalidArgumentException * @throws InvalidArgumentException
* thrown if workbasketIds, states, categories, domains or customField is null * thrown if customField is null
*/ */
Report getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states, List<String> categories, Report getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
List<String> domains, CustomField customField, List<ReportLineItemDefinition> reportLineItemDefinitions, List<String> domains, CustomField customField, List<String> customFieldValues,
boolean inWorkingDays) throws InvalidArgumentException; List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
throws InvalidArgumentException;
/** /**
* Returns a list of all task ids in the selected items of a {@link Report}. By default the age of the tasks is * Returns a list of all task ids in the selected items of a {@link Report}. By default the age of the tasks is
* counted in working days. * counted in working days. The tasks of the report are filtered by workbaskets, states, categories, domains and
* values of a custom field. If no filter is required, the respective parameter should be null. Tasks with Timestamp
* DUE = null are not considered.
* *
* @param workbasketIds * @param workbasketIds
* a list of workbasket ids objects to filter by workbaskets * a list of workbasket ids objects to filter by workbaskets. To omit this filter, use null for this
* parameter
* @param states * @param states
* a list of states objects to filter by states * a list of states objects to filter by states. To omit this filter, use null for this parameter
* @param categories * @param categories
* a list of categories to filter by categories * a list of categories to filter by categories. To omit this filter, use null for this parameter
* @param domains * @param domains
* a list of domains to filter by domains * a list of domains to filter by domains. To omit this filter, use null for this parameter
* @param customField
* a custom field to filter by the values of the custom field. To omit this filter, use null for this
* parameter
* @param customFieldValues
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
* null for this parameter
* @param reportLineItemDefinitions * @param reportLineItemDefinitions
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates. * a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
* Days in past are represented as negative values and days in the future are represented as positive * Days in past are represented as negative values and days in the future are represented as positive
@ -481,25 +603,34 @@ public interface TaskMonitorService {
* a list of {@link SelectedItem}s that are selected from the report whose task ids should be determined. * a list of {@link SelectedItem}s that are selected from the report whose task ids should be determined.
* @return the list of task ids * @return the list of task ids
* @throws InvalidArgumentException * @throws InvalidArgumentException
* thrown if workbasketIds, states, categories, domains or reportLineItemDefinitions is null or if * thrown if reportLineItemDefinitions is null or if selectedItems is empty or null
* selectedItems is empty or null
*/ */
List<String> getTaskIdsOfCategoryReportLineItems(List<String> workbasketIds, List<TaskState> states, List<String> getTaskIdsOfCategoryReportLineItems(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains, List<ReportLineItemDefinition> reportLineItemDefinitions, List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
List<SelectedItem> selectedItems) throws InvalidArgumentException; List<ReportLineItemDefinition> reportLineItemDefinitions, List<SelectedItem> selectedItems)
throws InvalidArgumentException;
/** /**
* Returns a list of all task ids in the selected items of a {@link Report}. By default the age of the tasks is * Returns a list of all task ids in the selected items of a {@link Report}. By default the age of the tasks is
* counted in working days. * counted in working days. The tasks of the report are filtered by workbaskets, states, categories, domains and
* values of a custom field. If no filter is required, the respective parameter should be null. Tasks with Timestamp
* DUE = null are not considered.
* *
* @param workbasketIds * @param workbasketIds
* a list of workbasket ids objects to filter by workbaskets * a list of workbasket ids objects to filter by workbaskets. To omit this filter, use null for this
* parameter
* @param states * @param states
* a list of states objects to filter by states * a list of states objects to filter by states. To omit this filter, use null for this parameter
* @param categories * @param categories
* a list of categories to filter by categories * a list of categories to filter by categories. To omit this filter, use null for this parameter
* @param domains * @param domains
* a list of domains to filter by domains * a list of domains to filter by domains. To omit this filter, use null for this parameter
* @param customField
* a custom field to filter by the values of the custom field. To omit this filter, use null for this
* parameter
* @param customFieldValues
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
* null for this parameter
* @param reportLineItemDefinitions * @param reportLineItemDefinitions
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates. * a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
* Days in past are represented as negative values and days in the future are represented as positive * Days in past are represented as negative values and days in the future are represented as positive
@ -515,11 +646,11 @@ public interface TaskMonitorService {
* a list of {@link SelectedItem}s that are selected from the report whose task ids should be determined. * a list of {@link SelectedItem}s that are selected from the report whose task ids should be determined.
* @return the list of task ids * @return the list of task ids
* @throws InvalidArgumentException * @throws InvalidArgumentException
* thrown if workbasketIds, states, categories, domains or reportLineItemDefinitions is null or if * thrown if reportLineItemDefinitions is null or if selectedItems is empty or null
* selectedItems is empty or null
*/ */
List<String> getTaskIdsOfCategoryReportLineItems(List<String> workbasketIds, List<TaskState> states, List<String> getTaskIdsOfCategoryReportLineItems(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains, List<ReportLineItemDefinition> reportLineItemDefinitions, List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
boolean inWorkingDays, List<SelectedItem> selectedItems) throws InvalidArgumentException; List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays,
List<SelectedItem> selectedItems) throws InvalidArgumentException;
} }

View File

@ -30,49 +30,41 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
@Override @Override
public Report getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states, public Report getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains) throws InvalidArgumentException { List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues)
return getWorkbasketLevelReport(workbasketIds, states, categories, domains, null, false);
}
@Override
public Report getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains, List<ReportLineItemDefinition> reportLineItemDefinitions)
throws InvalidArgumentException { throws InvalidArgumentException {
return getWorkbasketLevelReport(workbasketIds, states, categories, domains, reportLineItemDefinitions, true); return getWorkbasketLevelReport(workbasketIds, states, categories, domains, customField, customFieldValues,
null, false);
} }
@Override @Override
public Report getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states, public Report getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains, List<ReportLineItemDefinition> reportLineItemDefinitions, List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
boolean inWorkingDays) throws InvalidArgumentException { List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException {
return getWorkbasketLevelReport(workbasketIds, states, categories, domains, customField, customFieldValues,
reportLineItemDefinitions, true);
}
@Override
public Report getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
throws InvalidArgumentException {
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to getWorkbasketLevelReport(workbasketIds = {}, states = {}, categories = {}, " LOGGER.debug("entry to getWorkbasketLevelReport(workbasketIds = {}, states = {}, categories = {}, "
+ "domains = {}, reportLineItemDefinitions = {}, inWorkingDays = {})", + "domains = {}, customField = {}, customFieldValues = {}, reportLineItemDefinitions = {}, "
LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states), + "inWorkingDays = {})", LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states),
LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), customField,
LoggerUtils.listToString(reportLineItemDefinitions), inWorkingDays); LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(reportLineItemDefinitions),
inWorkingDays);
} }
try { try {
taskanaEngineImpl.openConnection(); taskanaEngineImpl.openConnection();
if (workbasketIds == null) {
throw new InvalidArgumentException("WorkbasketIds can´t be used as NULL-Parameter");
}
if (states == null) {
throw new InvalidArgumentException("States can´t be used as NULL-Parameter");
}
if (categories == null) {
throw new InvalidArgumentException("Categories can´t be used as NULL-Parameter");
}
if (domains == null) {
throw new InvalidArgumentException("Domains can´t be used as NULL-Parameter");
}
configureDaysToWorkingDaysConverter(); configureDaysToWorkingDaysConverter();
Report report = new Report(); Report report = new Report();
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfWorkbaskets(workbasketIds, List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfWorkbaskets(workbasketIds,
states, categories, domains); states, categories, domains, customField, customFieldValues);
report.addMonitoringQueryItems(monitorQueryItems, reportLineItemDefinitions, inWorkingDays); report.addMonitoringQueryItems(monitorQueryItems, reportLineItemDefinitions, inWorkingDays);
return report; return report;
@ -84,49 +76,41 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
@Override @Override
public Report getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories, public Report getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
List<String> domains) throws InvalidArgumentException { List<String> domains, CustomField customField, List<String> customFieldValues) throws InvalidArgumentException {
return getCategoryReport(workbasketIds, states, categories, domains, null, false); return getCategoryReport(workbasketIds, states, categories, domains, customField, customFieldValues, null,
false);
} }
@Override @Override
public Report getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories, public Report getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
List<String> domains, List<ReportLineItemDefinition> reportLineItemDefinitions) List<String> domains, CustomField customField, List<String> customFieldValues,
List<ReportLineItemDefinition> reportLineItemDefinitions)
throws InvalidArgumentException { throws InvalidArgumentException {
return getCategoryReport(workbasketIds, states, categories, domains, reportLineItemDefinitions, true); return getCategoryReport(workbasketIds, states, categories, domains, customField, customFieldValues,
reportLineItemDefinitions, true);
} }
@Override @Override
public Report getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories, public Report getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
List<String> domains, List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays) List<String> domains, CustomField customField, List<String> customFieldValues,
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
throws InvalidArgumentException { throws InvalidArgumentException {
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to getCategoryReport(workbasketIds = {}, states = {}, categories = {}, " LOGGER.debug("entry to getCategoryReport(workbasketIds = {}, states = {}, categories = {}, "
+ "domains = {},reportLineItemDefinitions = {}, inWorkingDays = {})", + "domains = {}, customField = {}, customFieldValues = {}, reportLineItemDefinitions = {}, "
LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states), + "inWorkingDays = {})", LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states),
LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), customField,
LoggerUtils.listToString(reportLineItemDefinitions), inWorkingDays); LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(reportLineItemDefinitions),
inWorkingDays);
} }
try { try {
taskanaEngineImpl.openConnection(); taskanaEngineImpl.openConnection();
if (workbasketIds == null) {
throw new InvalidArgumentException("WorkbasketIds can´t be used as NULL-Parameter");
}
if (states == null) {
throw new InvalidArgumentException("States can´t be used as NULL-Parameter");
}
if (categories == null) {
throw new InvalidArgumentException("Categories can´t be used as NULL-Parameter");
}
if (domains == null) {
throw new InvalidArgumentException("Domains can´t be used as NULL-Parameter");
}
configureDaysToWorkingDaysConverter(); configureDaysToWorkingDaysConverter();
Report report = new Report(); Report report = new Report();
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfCategories(workbasketIds, states, List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfCategories(workbasketIds, states,
categories, domains); categories, domains, customField, customFieldValues);
report.addMonitoringQueryItems(monitorQueryItems, reportLineItemDefinitions, inWorkingDays); report.addMonitoringQueryItems(monitorQueryItems, reportLineItemDefinitions, inWorkingDays);
return report; return report;
@ -138,49 +122,41 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
@Override @Override
public ClassificationReport getClassificationReport(List<String> workbasketIds, List<TaskState> states, public ClassificationReport getClassificationReport(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains) throws InvalidArgumentException { List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues)
return getClassificationReport(workbasketIds, states, categories, domains, null, false);
}
@Override
public ClassificationReport getClassificationReport(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains, List<ReportLineItemDefinition> reportLineItemDefinitions)
throws InvalidArgumentException { throws InvalidArgumentException {
return getClassificationReport(workbasketIds, states, categories, domains, reportLineItemDefinitions, true); return getClassificationReport(workbasketIds, states, categories, domains, customField, customFieldValues, null,
false);
} }
@Override @Override
public ClassificationReport getClassificationReport(List<String> workbasketIds, List<TaskState> states, public ClassificationReport getClassificationReport(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains, List<ReportLineItemDefinition> reportLineItemDefinitions, List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
boolean inWorkingDays) throws InvalidArgumentException { List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException {
return getClassificationReport(workbasketIds, states, categories, domains, customField, customFieldValues,
reportLineItemDefinitions, true);
}
@Override
public ClassificationReport getClassificationReport(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
throws InvalidArgumentException {
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to getClassificationReport(workbasketIds = {}, states = {}, categories = {}, " LOGGER.debug("entry to getClassificationReport(workbasketIds = {}, states = {}, categories = {}, "
+ "domains = {}, reportLineItemDefinitions = {}, inWorkingDays = {})", + "domains = {}, customField = {}, customFieldValues = {}, reportLineItemDefinitions = {}, "
LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states), + "inWorkingDays = {})", LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states),
LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), customField,
LoggerUtils.listToString(reportLineItemDefinitions), inWorkingDays); LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(reportLineItemDefinitions),
inWorkingDays);
} }
try { try {
taskanaEngineImpl.openConnection(); taskanaEngineImpl.openConnection();
if (workbasketIds == null) {
throw new InvalidArgumentException("WorkbasketIds can´t be used as NULL-Parameter");
}
if (states == null) {
throw new InvalidArgumentException("States can´t be used as NULL-Parameter");
}
if (categories == null) {
throw new InvalidArgumentException("Categories can´t be used as NULL-Parameter");
}
if (domains == null) {
throw new InvalidArgumentException("Domains can´t be used as NULL-Parameter");
}
configureDaysToWorkingDaysConverter(); configureDaysToWorkingDaysConverter();
ClassificationReport report = new ClassificationReport(); ClassificationReport report = new ClassificationReport();
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfClassifications(workbasketIds, List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfClassifications(workbasketIds,
states, categories, domains); states, categories, domains, customField, customFieldValues);
report.addMonitoringQueryItems(monitorQueryItems, reportLineItemDefinitions, inWorkingDays); report.addMonitoringQueryItems(monitorQueryItems, reportLineItemDefinitions, inWorkingDays);
return report; return report;
@ -192,52 +168,44 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
@Override @Override
public DetailedClassificationReport getDetailedClassificationReport(List<String> workbasketIds, public DetailedClassificationReport getDetailedClassificationReport(List<String> workbasketIds,
List<TaskState> states, List<String> categories, List<String> domains) throws InvalidArgumentException { List<TaskState> states, List<String> categories, List<String> domains, CustomField customField,
return getDetailedClassificationReport(workbasketIds, states, categories, domains, null, false); List<String> customFieldValues) throws InvalidArgumentException {
return getDetailedClassificationReport(workbasketIds, states, categories, domains, customField,
customFieldValues, null, false);
} }
@Override @Override
public DetailedClassificationReport getDetailedClassificationReport(List<String> workbasketIds, public DetailedClassificationReport getDetailedClassificationReport(List<String> workbasketIds,
List<TaskState> states, List<String> categories, List<String> domains, List<TaskState> states, List<String> categories, List<String> domains, CustomField customField,
List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException { List<String> customFieldValues, List<ReportLineItemDefinition> reportLineItemDefinitions)
return getDetailedClassificationReport(workbasketIds, states, categories, domains, reportLineItemDefinitions, throws InvalidArgumentException {
true); return getDetailedClassificationReport(workbasketIds, states, categories, domains, customField,
customFieldValues, reportLineItemDefinitions, true);
} }
@Override @Override
public DetailedClassificationReport getDetailedClassificationReport(List<String> workbasketIds, public DetailedClassificationReport getDetailedClassificationReport(List<String> workbasketIds,
List<TaskState> states, List<String> categories, List<String> domains, List<TaskState> states, List<String> categories, List<String> domains, CustomField customField,
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays) List<String> customFieldValues, List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
throws InvalidArgumentException { throws InvalidArgumentException {
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to getDetailedClassificationReport(workbasketIds = {}, states = {}, " LOGGER.debug("entry to getDetailedClassificationReport(workbasketIds = {}, states = {}, "
+ "categories = {}, domains = {}, reportLineItemDefinitions = {}, inWorkingDays = {})", + "categories = {}, domains = {}, customField = {}, customFieldValues = {}, "
LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states), + "reportLineItemDefinitions = {}, inWorkingDays = {})", LoggerUtils.listToString(workbasketIds),
LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), LoggerUtils.listToString(states), LoggerUtils.listToString(categories),
LoggerUtils.listToString(domains), customField, LoggerUtils.listToString(customFieldValues),
LoggerUtils.listToString(reportLineItemDefinitions), inWorkingDays); LoggerUtils.listToString(reportLineItemDefinitions), inWorkingDays);
} }
try { try {
taskanaEngineImpl.openConnection(); taskanaEngineImpl.openConnection();
if (workbasketIds == null) {
throw new InvalidArgumentException("WorkbasketIds can´t be used as NULL-Parameter");
}
if (states == null) {
throw new InvalidArgumentException("States can´t be used as NULL-Parameter");
}
if (categories == null) {
throw new InvalidArgumentException("Categories can´t be used as NULL-Parameter");
}
if (domains == null) {
throw new InvalidArgumentException("Domains can´t be used as NULL-Parameter");
}
configureDaysToWorkingDaysConverter(); configureDaysToWorkingDaysConverter();
DetailedClassificationReport report = new DetailedClassificationReport(); DetailedClassificationReport report = new DetailedClassificationReport();
List<DetailedMonitorQueryItem> detailedMonitorQueryItems = taskMonitorMapper List<DetailedMonitorQueryItem> detailedMonitorQueryItems = taskMonitorMapper
.getTaskCountOfDetailedClassifications(workbasketIds, states, categories, domains); .getTaskCountOfDetailedClassifications(workbasketIds, states, categories, domains, customField,
customFieldValues);
report.addDetailedMonitoringQueryItems(detailedMonitorQueryItems, reportLineItemDefinitions, report.addDetailedMonitoringQueryItems(detailedMonitorQueryItems, reportLineItemDefinitions,
inWorkingDays); inWorkingDays);
return report; return report;
@ -250,45 +218,36 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
@Override @Override
public Report getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states, public Report getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains, CustomField customField) throws InvalidArgumentException { List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues)
return getCustomFieldValueReport(workbasketIds, states, categories, domains, customField, null, false); throws InvalidArgumentException {
return getCustomFieldValueReport(workbasketIds, states, categories, domains, customField, customFieldValues,
null, false);
} }
@Override @Override
public Report getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states, public Report getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains, CustomField customField, List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException { List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException {
return getCustomFieldValueReport(workbasketIds, states, categories, domains, customField, return getCustomFieldValueReport(workbasketIds, states, categories, domains, customField, customFieldValues,
reportLineItemDefinitions, true); reportLineItemDefinitions, true);
} }
@Override @Override
public Report getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states, public Report getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains, CustomField customField, List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays) List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
throws InvalidArgumentException { throws InvalidArgumentException {
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to getCustomFieldValueReport(workbasketIds = {}, states = {}, categories = {}, " LOGGER.debug("entry to getCustomFieldValueReport(workbasketIds = {}, states = {}, categories = {}, "
+ "domains = {}, customField = {}, reportLineItemDefinitions = {}, inWorkingDays = {})", + "domains = {}, customField = {}, customFieldValues = {}, reportLineItemDefinitions = {}, "
LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states), + "inWorkingDays = {})", LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states),
LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), customField, LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), customField,
LoggerUtils.listToString(reportLineItemDefinitions), inWorkingDays); LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(reportLineItemDefinitions),
inWorkingDays);
} }
try { try {
taskanaEngineImpl.openConnection(); taskanaEngineImpl.openConnection();
if (workbasketIds == null) {
throw new InvalidArgumentException("WorkbasketIds can´t be used as NULL-Parameter");
}
if (states == null) {
throw new InvalidArgumentException("States can´t be used as NULL-Parameter");
}
if (categories == null) {
throw new InvalidArgumentException("Categories can´t be used as NULL-Parameter");
}
if (domains == null) {
throw new InvalidArgumentException("Domains can´t be used as NULL-Parameter");
}
if (customField == null) { if (customField == null) {
throw new InvalidArgumentException("CustomField can´t be used as NULL-Parameter"); throw new InvalidArgumentException("CustomField can´t be used as NULL-Parameter");
} }
@ -297,7 +256,7 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
Report report = new Report(); Report report = new Report();
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfCustomFieldValues(workbasketIds, List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfCustomFieldValues(workbasketIds,
states, categories, domains, customField); states, categories, domains, customField, customFieldValues);
report.addMonitoringQueryItems(monitorQueryItems, reportLineItemDefinitions, inWorkingDays); report.addMonitoringQueryItems(monitorQueryItems, reportLineItemDefinitions, inWorkingDays);
return report; return report;
@ -309,39 +268,30 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
@Override @Override
public List<String> getTaskIdsOfCategoryReportLineItems(List<String> workbasketIds, List<TaskState> states, public List<String> getTaskIdsOfCategoryReportLineItems(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains, List<ReportLineItemDefinition> reportLineItemDefinitions, List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
List<SelectedItem> selectedItems) throws InvalidArgumentException { List<ReportLineItemDefinition> reportLineItemDefinitions, List<SelectedItem> selectedItems)
return getTaskIdsOfCategoryReportLineItems(workbasketIds, states, categories, domains, throws InvalidArgumentException {
reportLineItemDefinitions, true, selectedItems); return getTaskIdsOfCategoryReportLineItems(workbasketIds, states, categories, domains, customField,
customFieldValues, reportLineItemDefinitions, true, selectedItems);
} }
@Override @Override
public List<String> getTaskIdsOfCategoryReportLineItems(List<String> workbasketIds, List<TaskState> states, public List<String> getTaskIdsOfCategoryReportLineItems(List<String> workbasketIds, List<TaskState> states,
List<String> categories, List<String> domains, List<ReportLineItemDefinition> reportLineItemDefinitions, List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
boolean inWorkingDays, List<SelectedItem> selectedItems) throws InvalidArgumentException { List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays,
List<SelectedItem> selectedItems) throws InvalidArgumentException {
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug("entry to getTaskIdsOfCategoryReportLineItems(workbasketIds = {}, states = {}, " LOGGER.debug("entry to getTaskIdsOfCategoryReportLineItems(workbasketIds = {}, states = {}, "
+ "categories = {}, domains = {}, reportLineItemDefinitions = {}, inWorkingDays = {}, " + "categories = {}, domains = {}, customField = {}, customFieldValues = {}, "
+ "selectedItems = {})", LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states), + "reportLineItemDefinitions = {}, inWorkingDays = {}, selectedItems = {})",
LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states),
LoggerUtils.listToString(reportLineItemDefinitions), inWorkingDays, LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), customField,
LoggerUtils.listToString(selectedItems)); LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(reportLineItemDefinitions),
inWorkingDays, LoggerUtils.listToString(selectedItems));
} }
try { try {
taskanaEngineImpl.openConnection(); taskanaEngineImpl.openConnection();
if (workbasketIds == null) {
throw new InvalidArgumentException("WorkbasketIds can´t be used as NULL-Parameter");
}
if (states == null) {
throw new InvalidArgumentException("States can´t be used as NULL-Parameter");
}
if (categories == null) {
throw new InvalidArgumentException("Categories can´t be used as NULL-Parameter");
}
if (domains == null) {
throw new InvalidArgumentException("Domains can´t be used as NULL-Parameter");
}
if (reportLineItemDefinitions == null) { if (reportLineItemDefinitions == null) {
throw new InvalidArgumentException("ReportLineItemDefinitions can´t be used as NULL-Parameter"); throw new InvalidArgumentException("ReportLineItemDefinitions can´t be used as NULL-Parameter");
} }
@ -357,7 +307,7 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
} }
List<String> taskIds = taskMonitorMapper.getTaskIdsOfCategoriesBySelectedItems(workbasketIds, states, List<String> taskIds = taskMonitorMapper.getTaskIdsOfCategoriesBySelectedItems(workbasketIds, states,
categories, domains, selectedItems); categories, domains, customField, customFieldValues, selectedItems);
return taskIds; return taskIds;

View File

@ -22,11 +22,24 @@ public interface TaskMonitorMapper {
+ "<if test=\"_databaseId == 'db2'\">SELECT WORKBASKET_KEY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP)) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> " + "<if test=\"_databaseId == 'db2'\">SELECT WORKBASKET_KEY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP)) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> "
+ "<if test=\"_databaseId == 'h2'\">SELECT WORKBASKET_KEY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> " + "<if test=\"_databaseId == 'h2'\">SELECT WORKBASKET_KEY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> "
+ "FROM TASK " + "FROM TASK "
+ "WHERE WORKBASKET_ID IN (<foreach collection='workbasketIds' item='workbasketId' separator=','>#{workbasketId}</foreach>) " + "<where>"
+ "<if test=\"workbasketIds != null\">"
+ "WORKBASKET_ID IN (<foreach collection='workbasketIds' item='workbasketId' separator=','>#{workbasketId}</foreach>) "
+ "</if>"
+ "<if test=\"states != null\">"
+ "AND STATE IN (<foreach collection='states' item='state' separator=','>#{state}</foreach>) " + "AND STATE IN (<foreach collection='states' item='state' separator=','>#{state}</foreach>) "
+ "</if>"
+ "<if test=\"categories != null\">"
+ "AND CLASSIFICATION_CATEGORY IN (<foreach collection='categories' item='category' separator=','>#{category}</foreach>) " + "AND CLASSIFICATION_CATEGORY IN (<foreach collection='categories' item='category' separator=','>#{category}</foreach>) "
+ "</if>"
+ "<if test=\"domains != null\">"
+ "AND DOMAIN IN (<foreach collection='domains' item='domain' separator=','>#{domain}</foreach>) " + "AND DOMAIN IN (<foreach collection='domains' item='domain' separator=','>#{domain}</foreach>) "
+ "</if>"
+ "<if test=\"customField != null and customFieldValues != null\">"
+ "AND ${customField} IN (<foreach collection='customFieldValues' item='customFieldValue' separator=','>#{customFieldValue}</foreach>) "
+ "</if>"
+ "AND DUE IS NOT NULL " + "AND DUE IS NOT NULL "
+ "</where>"
+ "<if test=\"_databaseId == 'db2'\">GROUP BY WORKBASKET_KEY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP))</if> " + "<if test=\"_databaseId == 'db2'\">GROUP BY WORKBASKET_KEY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP))</if> "
+ "<if test=\"_databaseId == 'h2'\">GROUP BY WORKBASKET_KEY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE)</if> " + "<if test=\"_databaseId == 'h2'\">GROUP BY WORKBASKET_KEY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE)</if> "
+ "</script>") + "</script>")
@ -37,17 +50,32 @@ public interface TaskMonitorMapper {
List<MonitorQueryItem> getTaskCountOfWorkbaskets(@Param("workbasketIds") List<String> workbasketIds, List<MonitorQueryItem> getTaskCountOfWorkbaskets(@Param("workbasketIds") List<String> workbasketIds,
@Param("states") List<TaskState> states, @Param("states") List<TaskState> states,
@Param("categories") List<String> categories, @Param("categories") List<String> categories,
@Param("domains") List<String> domains); @Param("domains") List<String> domains,
@Param("customField") CustomField customField,
@Param("customFieldValues") List<String> customFieldValues);
@Select("<script>" @Select("<script>"
+ "<if test=\"_databaseId == 'db2'\">SELECT CLASSIFICATION_CATEGORY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP)) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> " + "<if test=\"_databaseId == 'db2'\">SELECT CLASSIFICATION_CATEGORY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP)) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> "
+ "<if test=\"_databaseId == 'h2'\">SELECT CLASSIFICATION_CATEGORY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> " + "<if test=\"_databaseId == 'h2'\">SELECT CLASSIFICATION_CATEGORY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> "
+ "FROM TASK " + "FROM TASK "
+ "WHERE WORKBASKET_ID IN (<foreach collection='workbasketIds' item='workbasketId' separator=','>#{workbasketId}</foreach>) " + "<where>"
+ "<if test=\"workbasketIds != null\">"
+ "WORKBASKET_ID IN (<foreach collection='workbasketIds' item='workbasketId' separator=','>#{workbasketId}</foreach>) "
+ "</if>"
+ "<if test=\"states != null\">"
+ "AND STATE IN (<foreach collection='states' item='state' separator=','>#{state}</foreach>) " + "AND STATE IN (<foreach collection='states' item='state' separator=','>#{state}</foreach>) "
+ "</if>"
+ "<if test=\"categories != null\">"
+ "AND CLASSIFICATION_CATEGORY IN (<foreach collection='categories' item='category' separator=','>#{category}</foreach>) " + "AND CLASSIFICATION_CATEGORY IN (<foreach collection='categories' item='category' separator=','>#{category}</foreach>) "
+ "</if>"
+ "<if test=\"domains != null\">"
+ "AND DOMAIN IN (<foreach collection='domains' item='domain' separator=','>#{domain}</foreach>) " + "AND DOMAIN IN (<foreach collection='domains' item='domain' separator=','>#{domain}</foreach>) "
+ "</if>"
+ "<if test=\"customField != null and customFieldValues != null\">"
+ "AND ${customField} IN (<foreach collection='customFieldValues' item='customFieldValue' separator=','>#{customFieldValue}</foreach>) "
+ "</if>"
+ "AND DUE IS NOT NULL " + "AND DUE IS NOT NULL "
+ "</where>"
+ "<if test=\"_databaseId == 'db2'\">GROUP BY CLASSIFICATION_CATEGORY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP))</if> " + "<if test=\"_databaseId == 'db2'\">GROUP BY CLASSIFICATION_CATEGORY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP))</if> "
+ "<if test=\"_databaseId == 'h2'\">GROUP BY CLASSIFICATION_CATEGORY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE)</if> " + "<if test=\"_databaseId == 'h2'\">GROUP BY CLASSIFICATION_CATEGORY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE)</if> "
+ "</script>") + "</script>")
@ -58,17 +86,32 @@ public interface TaskMonitorMapper {
List<MonitorQueryItem> getTaskCountOfCategories(@Param("workbasketIds") List<String> workbasketIds, List<MonitorQueryItem> getTaskCountOfCategories(@Param("workbasketIds") List<String> workbasketIds,
@Param("states") List<TaskState> states, @Param("states") List<TaskState> states,
@Param("categories") List<String> categories, @Param("categories") List<String> categories,
@Param("domains") List<String> domains); @Param("domains") List<String> domains,
@Param("customField") CustomField customField,
@Param("customFieldValues") List<String> customFieldValues);
@Select("<script>" @Select("<script>"
+ "<if test=\"_databaseId == 'db2'\">SELECT CLASSIFICATION_KEY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP)) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> " + "<if test=\"_databaseId == 'db2'\">SELECT CLASSIFICATION_KEY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP)) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> "
+ "<if test=\"_databaseId == 'h2'\">SELECT CLASSIFICATION_KEY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> " + "<if test=\"_databaseId == 'h2'\">SELECT CLASSIFICATION_KEY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> "
+ "FROM TASK " + "FROM TASK "
+ "WHERE WORKBASKET_ID IN (<foreach collection='workbasketIds' item='workbasketId' separator=','>#{workbasketId}</foreach>) " + "<where>"
+ "<if test=\"workbasketIds != null\">"
+ "WORKBASKET_ID IN (<foreach collection='workbasketIds' item='workbasketId' separator=','>#{workbasketId}</foreach>) "
+ "</if>"
+ "<if test=\"states != null\">"
+ "AND STATE IN (<foreach collection='states' item='state' separator=','>#{state}</foreach>) " + "AND STATE IN (<foreach collection='states' item='state' separator=','>#{state}</foreach>) "
+ "</if>"
+ "<if test=\"categories != null\">"
+ "AND CLASSIFICATION_CATEGORY IN (<foreach collection='categories' item='category' separator=','>#{category}</foreach>) " + "AND CLASSIFICATION_CATEGORY IN (<foreach collection='categories' item='category' separator=','>#{category}</foreach>) "
+ "</if>"
+ "<if test=\"domains != null\">"
+ "AND DOMAIN IN (<foreach collection='domains' item='domain' separator=','>#{domain}</foreach>) " + "AND DOMAIN IN (<foreach collection='domains' item='domain' separator=','>#{domain}</foreach>) "
+ "</if>"
+ "<if test=\"customField != null and customFieldValues != null\">"
+ "AND ${customField} IN (<foreach collection='customFieldValues' item='customFieldValue' separator=','>#{customFieldValue}</foreach>) "
+ "</if>"
+ "AND DUE IS NOT NULL " + "AND DUE IS NOT NULL "
+ "</where>"
+ "<if test=\"_databaseId == 'db2'\">GROUP BY CLASSIFICATION_KEY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP))</if> " + "<if test=\"_databaseId == 'db2'\">GROUP BY CLASSIFICATION_KEY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP))</if> "
+ "<if test=\"_databaseId == 'h2'\">GROUP BY CLASSIFICATION_KEY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE)</if> " + "<if test=\"_databaseId == 'h2'\">GROUP BY CLASSIFICATION_KEY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE)</if> "
+ "</script>") + "</script>")
@ -79,17 +122,32 @@ public interface TaskMonitorMapper {
List<MonitorQueryItem> getTaskCountOfClassifications(@Param("workbasketIds") List<String> workbasketIds, List<MonitorQueryItem> getTaskCountOfClassifications(@Param("workbasketIds") List<String> workbasketIds,
@Param("states") List<TaskState> states, @Param("states") List<TaskState> states,
@Param("categories") List<String> categories, @Param("categories") List<String> categories,
@Param("domains") List<String> domains); @Param("domains") List<String> domains,
@Param("customField") CustomField customField,
@Param("customFieldValues") List<String> customFieldValues);
@Select("<script>" @Select("<script>"
+ "<if test=\"_databaseId == 'db2'\">SELECT T.CLASSIFICATION_KEY as TASK_CLASSIFICATION_KEY, A.CLASSIFICATION_KEY as ATTACHMENT_CLASSIFICATION_KEY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP)) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> " + "<if test=\"_databaseId == 'db2'\">SELECT T.CLASSIFICATION_KEY as TASK_CLASSIFICATION_KEY, A.CLASSIFICATION_KEY as ATTACHMENT_CLASSIFICATION_KEY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP)) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> "
+ "<if test=\"_databaseId == 'h2'\">SELECT T.CLASSIFICATION_KEY as TASK_CLASSIFICATION_KEY, A.CLASSIFICATION_KEY as ATTACHMENT_CLASSIFICATION_KEY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> " + "<if test=\"_databaseId == 'h2'\">SELECT T.CLASSIFICATION_KEY as TASK_CLASSIFICATION_KEY, A.CLASSIFICATION_KEY as ATTACHMENT_CLASSIFICATION_KEY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> "
+ "FROM TASK AS T LEFT JOIN ATTACHMENT AS A ON T.ID = A.TASK_ID " + "FROM TASK AS T LEFT JOIN ATTACHMENT AS A ON T.ID = A.TASK_ID "
+ "WHERE T.WORKBASKET_ID IN (<foreach collection='workbasketIds' item='workbasketId' separator=','>#{workbasketId}</foreach>) " + "<where>"
+ "<if test=\"workbasketIds != null\">"
+ "T.WORKBASKET_ID IN (<foreach collection='workbasketIds' item='workbasketId' separator=','>#{workbasketId}</foreach>) "
+ "</if>"
+ "<if test=\"states != null\">"
+ "AND STATE IN (<foreach collection='states' item='state' separator=','>#{state}</foreach>) " + "AND STATE IN (<foreach collection='states' item='state' separator=','>#{state}</foreach>) "
+ "</if>"
+ "<if test=\"categories != null\">"
+ "AND CLASSIFICATION_CATEGORY IN (<foreach collection='categories' item='category' separator=','>#{category}</foreach>) " + "AND CLASSIFICATION_CATEGORY IN (<foreach collection='categories' item='category' separator=','>#{category}</foreach>) "
+ "</if>"
+ "<if test=\"domains != null\">"
+ "AND DOMAIN IN (<foreach collection='domains' item='domain' separator=','>#{domain}</foreach>) " + "AND DOMAIN IN (<foreach collection='domains' item='domain' separator=','>#{domain}</foreach>) "
+ "</if>"
+ "<if test=\"customField != null and customFieldValues != null\">"
+ "AND ${customField} IN (<foreach collection='customFieldValues' item='customFieldValue' separator=','>#{customFieldValue}</foreach>) "
+ "</if>"
+ "AND DUE IS NOT NULL " + "AND DUE IS NOT NULL "
+ "</where>"
+ "<if test=\"_databaseId == 'db2'\">GROUP BY T.CLASSIFICATION_KEY, A.CLASSIFICATION_KEY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP))</if> " + "<if test=\"_databaseId == 'db2'\">GROUP BY T.CLASSIFICATION_KEY, A.CLASSIFICATION_KEY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP))</if> "
+ "<if test=\"_databaseId == 'h2'\">GROUP BY T.CLASSIFICATION_KEY, A.CLASSIFICATION_KEY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE)</if> " + "<if test=\"_databaseId == 'h2'\">GROUP BY T.CLASSIFICATION_KEY, A.CLASSIFICATION_KEY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE)</if> "
+ "</script>") + "</script>")
@ -102,18 +160,32 @@ public interface TaskMonitorMapper {
@Param("workbasketIds") List<String> workbasketIds, @Param("workbasketIds") List<String> workbasketIds,
@Param("states") List<TaskState> states, @Param("states") List<TaskState> states,
@Param("categories") List<String> categories, @Param("categories") List<String> categories,
@Param("domains") List<String> domains); @Param("domains") List<String> domains,
@Param("customField") CustomField customField,
@Param("customFieldValues") List<String> customFieldValues);
@Select("<script>" @Select("<script>"
+ "<if test=\"_databaseId == 'db2'\">SELECT ${customField} as CUSTOM_FIELD, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP)) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> " + "<if test=\"_databaseId == 'db2'\">SELECT ${customField} as CUSTOM_FIELD, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP)) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> "
+ "<if test=\"_databaseId == 'h2'\">SELECT ${customField} as CUSTOM_FIELD, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> " + "<if test=\"_databaseId == 'h2'\">SELECT ${customField} as CUSTOM_FIELD, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> "
+ "FROM TASK " + "FROM TASK "
+ "WHERE WORKBASKET_ID IN (<foreach collection='workbasketIds' item='workbasketId' separator=','>#{workbasketId}</foreach>) " + "<where>"
+ "<if test=\"workbasketIds != null\">"
+ "WORKBASKET_ID IN (<foreach collection='workbasketIds' item='workbasketId' separator=','>#{workbasketId}</foreach>) "
+ "</if>"
+ "<if test=\"states != null\">"
+ "AND STATE IN (<foreach collection='states' item='state' separator=','>#{state}</foreach>) " + "AND STATE IN (<foreach collection='states' item='state' separator=','>#{state}</foreach>) "
+ "</if>"
+ "<if test=\"categories != null\">"
+ "AND CLASSIFICATION_CATEGORY IN (<foreach collection='categories' item='category' separator=','>#{category}</foreach>) " + "AND CLASSIFICATION_CATEGORY IN (<foreach collection='categories' item='category' separator=','>#{category}</foreach>) "
+ "</if>"
+ "<if test=\"domains != null\">"
+ "AND DOMAIN IN (<foreach collection='domains' item='domain' separator=','>#{domain}</foreach>) " + "AND DOMAIN IN (<foreach collection='domains' item='domain' separator=','>#{domain}</foreach>) "
+ "</if>"
+ "<if test=\"customField != null and customFieldValues != null\">"
+ "AND ${customField} IN (<foreach collection='customFieldValues' item='customFieldValue' separator=','>#{customFieldValue}</foreach>) "
+ "</if>"
+ "AND DUE IS NOT NULL " + "AND DUE IS NOT NULL "
+ "AND ${customField} IS NOT NULL " + "</where>"
+ "<if test=\"_databaseId == 'db2'\">GROUP BY ${customField}, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP))</if> " + "<if test=\"_databaseId == 'db2'\">GROUP BY ${customField}, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP))</if> "
+ "<if test=\"_databaseId == 'h2'\">GROUP BY ${customField}, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE)</if> " + "<if test=\"_databaseId == 'h2'\">GROUP BY ${customField}, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE)</if> "
+ "</script>") + "</script>")
@ -125,14 +197,27 @@ public interface TaskMonitorMapper {
@Param("states") List<TaskState> states, @Param("states") List<TaskState> states,
@Param("categories") List<String> categories, @Param("categories") List<String> categories,
@Param("domains") List<String> domains, @Param("domains") List<String> domains,
@Param("customField") CustomField customField); @Param("customField") CustomField customField,
@Param("customFieldValues") List<String> customFieldValues);
@Select("<script>" @Select("<script>"
+ "SELECT ID FROM TASK " + "SELECT ID FROM TASK "
+ "WHERE WORKBASKET_ID IN (<foreach collection='workbasketIds' item='workbasketId' separator=','>#{workbasketId}</foreach>) " + "<where>"
+ "<if test=\"workbasketIds != null\">"
+ "WORKBASKET_ID IN (<foreach collection='workbasketIds' item='workbasketId' separator=','>#{workbasketId}</foreach>) "
+ "</if>"
+ "<if test=\"states != null\">"
+ "AND STATE IN (<foreach collection='states' item='state' separator=','>#{state}</foreach>) " + "AND STATE IN (<foreach collection='states' item='state' separator=','>#{state}</foreach>) "
+ "</if>"
+ "<if test=\"categories != null\">"
+ "AND CLASSIFICATION_CATEGORY IN (<foreach collection='categories' item='category' separator=','>#{category}</foreach>) " + "AND CLASSIFICATION_CATEGORY IN (<foreach collection='categories' item='category' separator=','>#{category}</foreach>) "
+ "</if>"
+ "<if test=\"domains != null\">"
+ "AND DOMAIN IN (<foreach collection='domains' item='domain' separator=','>#{domain}</foreach>) " + "AND DOMAIN IN (<foreach collection='domains' item='domain' separator=','>#{domain}</foreach>) "
+ "</if>"
+ "<if test=\"customField != null and customFieldValues != null\">"
+ "AND ${customField} IN (<foreach collection='customFieldValues' item='customFieldValue' separator=','>#{customFieldValue}</foreach>) "
+ "</if>"
+ "AND DUE IS NOT NULL AND ( " + "AND DUE IS NOT NULL AND ( "
+ "<foreach collection='selectedItems' item='selectedItem' separator=' OR '>" + "<foreach collection='selectedItems' item='selectedItem' separator=' OR '>"
+ "#{selectedItem.key} = CLASSIFICATION_CATEGORY AND " + "#{selectedItem.key} = CLASSIFICATION_CATEGORY AND "
@ -144,12 +229,15 @@ public interface TaskMonitorMapper {
+ "#{selectedItem.upperAgeLimit} >= DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) AND " + "#{selectedItem.upperAgeLimit} >= DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) AND "
+ "#{selectedItem.lowerAgeLimit} &lt;= DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) " + "#{selectedItem.lowerAgeLimit} &lt;= DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) "
+ "</if> " + "</if> "
+ "</foreach> ) " + "</foreach>) "
+ "</where>"
+ "</script>") + "</script>")
List<String> getTaskIdsOfCategoriesBySelectedItems(@Param("workbasketIds") List<String> workbasketIds, List<String> getTaskIdsOfCategoriesBySelectedItems(@Param("workbasketIds") List<String> workbasketIds,
@Param("states") List<TaskState> states, @Param("states") List<TaskState> states,
@Param("categories") List<String> categories, @Param("categories") List<String> categories,
@Param("domains") List<String> domains, @Param("domains") List<String> domains,
@Param("customField") CustomField customField,
@Param("customFieldValues") List<String> customFieldValues,
@Param("selectedItems") List<SelectedItem> selectedItems); @Param("selectedItems") List<SelectedItem> selectedItems);
} }

View File

@ -16,6 +16,7 @@ import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import pro.taskana.CustomField;
import pro.taskana.TaskMonitorService; import pro.taskana.TaskMonitorService;
import pro.taskana.TaskState; import pro.taskana.TaskState;
import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaEngine;
@ -30,7 +31,7 @@ import pro.taskana.impl.configuration.DBCleaner;
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest;
/** /**
* Acceptance test for all "category report" scenarios. * Acceptance test for all "get task ids of category report" scenarios.
*/ */
public class GetTaskIdsOfCategoryReportAccTest { public class GetTaskIdsOfCategoryReportAccTest {
@ -60,10 +61,6 @@ public class GetTaskIdsOfCategoryReportAccTest {
public void testGetTaskIdsOfCategoryReport() throws InvalidArgumentException { public void testGetTaskIdsOfCategoryReport() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
List<SelectedItem> selectedItems = new ArrayList<>(); List<SelectedItem> selectedItems = new ArrayList<>();
@ -86,8 +83,8 @@ public class GetTaskIdsOfCategoryReportAccTest {
s3.setUpperAgeLimit(0); s3.setUpperAgeLimit(0);
selectedItems.add(s3); selectedItems.add(s3);
List<String> ids = taskMonitorService.getTaskIdsOfCategoryReportLineItems(workbasketIds, states, categories, List<String> ids = taskMonitorService.getTaskIdsOfCategoryReportLineItems(null, null, null, null, null, null,
domains, reportLineItemDefinitions, selectedItems); reportLineItemDefinitions, selectedItems);
assertEquals(11, ids.size()); assertEquals(11, ids.size());
assertTrue(ids.contains("TKI:000000000000000000000000000000000006")); assertTrue(ids.contains("TKI:000000000000000000000000000000000006"));
@ -103,12 +100,191 @@ public class GetTaskIdsOfCategoryReportAccTest {
assertTrue(ids.contains("TKI:000000000000000000000000000000000032")); assertTrue(ids.contains("TKI:000000000000000000000000000000000032"));
} }
private List<String> generateWorkbasketIds(int amount, int startAt) { @Test
List<String> workbasketIds = new ArrayList<>(); public void testGetTaskIdsOfCategoryReportWithWorkbasketFilter() throws InvalidArgumentException {
for (int i = 0; i < amount; i++) { TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
workbasketIds.add(String.format("WBI:%036d", startAt + i));
} List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
return workbasketIds; List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("EXTERN");
s1.setLowerAgeLimit(-5);
s1.setUpperAgeLimit(-2);
selectedItems.add(s1);
SelectedItem s2 = new SelectedItem();
s2.setKey("AUTOMATIC");
s2.setLowerAgeLimit(Integer.MIN_VALUE);
s2.setUpperAgeLimit(-11);
selectedItems.add(s2);
SelectedItem s3 = new SelectedItem();
s3.setKey("MANUAL");
s3.setLowerAgeLimit(0);
s3.setUpperAgeLimit(0);
selectedItems.add(s3);
List<String> ids = taskMonitorService.getTaskIdsOfCategoryReportLineItems(workbasketIds, null, null, null, null,
null, reportLineItemDefinitions, selectedItems);
assertEquals(4, ids.size());
assertTrue(ids.contains("TKI:000000000000000000000000000000000006"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000020"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000026"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000031"));
}
@Test
public void testGetTaskIdsOfCategoryReportWithStateFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TaskState> states = Arrays.asList(TaskState.READY);
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("EXTERN");
s1.setLowerAgeLimit(-5);
s1.setUpperAgeLimit(-2);
selectedItems.add(s1);
SelectedItem s2 = new SelectedItem();
s2.setKey("AUTOMATIC");
s2.setLowerAgeLimit(Integer.MIN_VALUE);
s2.setUpperAgeLimit(-11);
selectedItems.add(s2);
SelectedItem s3 = new SelectedItem();
s3.setKey("MANUAL");
s3.setLowerAgeLimit(0);
s3.setUpperAgeLimit(0);
selectedItems.add(s3);
List<String> ids = taskMonitorService.getTaskIdsOfCategoryReportLineItems(null, states, null, null, null, null,
reportLineItemDefinitions, selectedItems);
assertEquals(11, ids.size());
assertTrue(ids.contains("TKI:000000000000000000000000000000000006"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000020"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000021"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000022"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000023"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000024"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000026"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000027"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000028"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000031"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000032"));
}
@Test
public void testGetTaskIdsOfCategoryReportWithCategoryFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("AUTOMATIC");
s1.setLowerAgeLimit(Integer.MIN_VALUE);
s1.setUpperAgeLimit(-11);
selectedItems.add(s1);
SelectedItem s2 = new SelectedItem();
s2.setKey("MANUAL");
s2.setLowerAgeLimit(0);
s2.setUpperAgeLimit(0);
selectedItems.add(s2);
List<String> ids = taskMonitorService.getTaskIdsOfCategoryReportLineItems(null, null, categories, null, null,
null, reportLineItemDefinitions, selectedItems);
assertEquals(3, ids.size());
assertTrue(ids.contains("TKI:000000000000000000000000000000000006"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000031"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000032"));
}
@Test
public void testGetTaskIdsOfCategoryReportWithDomainFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> domains = Arrays.asList("DOMAIN_A");
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("EXTERN");
s1.setLowerAgeLimit(-5);
s1.setUpperAgeLimit(-2);
selectedItems.add(s1);
SelectedItem s2 = new SelectedItem();
s2.setKey("AUTOMATIC");
s2.setLowerAgeLimit(Integer.MIN_VALUE);
s2.setUpperAgeLimit(-11);
selectedItems.add(s2);
SelectedItem s3 = new SelectedItem();
s3.setKey("MANUAL");
s3.setLowerAgeLimit(0);
s3.setUpperAgeLimit(0);
selectedItems.add(s3);
List<String> ids = taskMonitorService.getTaskIdsOfCategoryReportLineItems(null, null, null, domains, null, null,
reportLineItemDefinitions, selectedItems);
assertEquals(4, ids.size());
assertTrue(ids.contains("TKI:000000000000000000000000000000000020"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000021"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000022"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000028"));
}
@Test
public void testGetTaskIdsOfCategoryReportWithCustomFieldValueFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
CustomField customField = CustomField.CUSTOM_1;
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("EXTERN");
s1.setLowerAgeLimit(-5);
s1.setUpperAgeLimit(-2);
selectedItems.add(s1);
SelectedItem s2 = new SelectedItem();
s2.setKey("AUTOMATIC");
s2.setLowerAgeLimit(Integer.MIN_VALUE);
s2.setUpperAgeLimit(-11);
selectedItems.add(s2);
SelectedItem s3 = new SelectedItem();
s3.setKey("MANUAL");
s3.setLowerAgeLimit(0);
s3.setUpperAgeLimit(0);
selectedItems.add(s3);
List<String> ids = taskMonitorService.getTaskIdsOfCategoryReportLineItems(null, null, null, null, customField,
customFieldValues, reportLineItemDefinitions, selectedItems);
assertEquals(5, ids.size());
assertTrue(ids.contains("TKI:000000000000000000000000000000000020"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000024"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000027"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000031"));
assertTrue(ids.contains("TKI:000000000000000000000000000000000032"));
} }
private List<ReportLineItemDefinition> getListOfReportLineItemDefinitions() { private List<ReportLineItemDefinition> getListOfReportLineItemDefinitions() {

View File

@ -18,6 +18,7 @@ import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import pro.taskana.CustomField;
import pro.taskana.TaskMonitorService; import pro.taskana.TaskMonitorService;
import pro.taskana.TaskState; import pro.taskana.TaskState;
import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaEngine;
@ -64,23 +65,19 @@ public class ProvideCategoryReportAccTest {
public void testGetTotalNumbersOfTasksOfCategoryReport() throws InvalidArgumentException { public void testGetTotalNumbersOfTasksOfCategoryReport() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1); Report report = taskMonitorService.getCategoryReport(null, null, null, null, null, null);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
Report report = taskMonitorService.getCategoryReport(workbasketIds, states, categories, domains);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report)); LOGGER.debug(reportToString(report));
} }
assertNotNull(report); assertNotNull(report);
assertEquals(33, report.getReportLines().get(categories.get(0)).getTotalNumberOfTasks()); assertEquals(33, report.getReportLines().get("EXTERN").getTotalNumberOfTasks());
assertEquals(7, report.getReportLines().get(categories.get(1)).getTotalNumberOfTasks()); assertEquals(7, report.getReportLines().get("AUTOMATIC").getTotalNumberOfTasks());
assertEquals(10, report.getReportLines().get(categories.get(2)).getTotalNumberOfTasks()); assertEquals(10, report.getReportLines().get("MANUAL").getTotalNumberOfTasks());
assertEquals(0, report.getReportLines().get(categories.get(0)).getLineItems().size()); assertEquals(0, report.getReportLines().get("EXTERN").getLineItems().size());
assertEquals(0, report.getReportLines().get(categories.get(1)).getLineItems().size()); assertEquals(0, report.getReportLines().get("AUTOMATIC").getLineItems().size());
assertEquals(0, report.getReportLines().get(categories.get(2)).getLineItems().size()); assertEquals(0, report.getReportLines().get("MANUAL").getLineItems().size());
assertEquals(50, report.getSumLine().getTotalNumberOfTasks()); assertEquals(50, report.getSumLine().getTotalNumberOfTasks());
} }
@ -88,13 +85,9 @@ public class ProvideCategoryReportAccTest {
public void testGetCategoryReportWithReportLineItemDefinitions() throws InvalidArgumentException { public void testGetCategoryReportWithReportLineItemDefinitions() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
Report report = taskMonitorService.getCategoryReport(workbasketIds, states, categories, domains, Report report = taskMonitorService.getCategoryReport(null, null, null, null, null, null,
reportLineItemDefinitions); reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
@ -113,9 +106,9 @@ public class ProvideCategoryReportAccTest {
assertNotNull(report); assertNotNull(report);
assertEquals(33, report.getReportLines().get(categories.get(0)).getTotalNumberOfTasks()); assertEquals(33, report.getReportLines().get("EXTERN").getTotalNumberOfTasks());
assertEquals(7, report.getReportLines().get(categories.get(1)).getTotalNumberOfTasks()); assertEquals(7, report.getReportLines().get("AUTOMATIC").getTotalNumberOfTasks());
assertEquals(10, report.getReportLines().get(categories.get(2)).getTotalNumberOfTasks()); assertEquals(10, report.getReportLines().get("MANUAL").getTotalNumberOfTasks());
assertEquals(10, report.getSumLine().getLineItems().get(0).getNumberOfTasks()); assertEquals(10, report.getSumLine().getLineItems().get(0).getNumberOfTasks());
assertEquals(9, report.getSumLine().getLineItems().get(1).getNumberOfTasks()); assertEquals(9, report.getSumLine().getLineItems().get(1).getNumberOfTasks());
@ -134,13 +127,9 @@ public class ProvideCategoryReportAccTest {
public void testEachItemOfCategoryReport() throws InvalidArgumentException { public void testEachItemOfCategoryReport() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getCategoryReport(workbasketIds, states, categories, domains, Report report = taskMonitorService.getCategoryReport(null, null, null, null, null, null,
reportLineItemDefinitions); reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
@ -173,13 +162,9 @@ public class ProvideCategoryReportAccTest {
public void testEachItemOfCategoryReportNotInWorkingDays() throws InvalidArgumentException { public void testEachItemOfCategoryReportNotInWorkingDays() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getCategoryReport(workbasketIds, states, categories, domains, Report report = taskMonitorService.getCategoryReport(null, null, null, null, null, null,
reportLineItemDefinitions, false); reportLineItemDefinitions, false);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
@ -208,17 +193,86 @@ public class ProvideCategoryReportAccTest {
assertEquals(4, line3.get(4).getNumberOfTasks()); assertEquals(4, line3.get(4).getNumberOfTasks());
} }
@Test
public void testEachItemOfCategoryReportWithWorkbasketFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getCategoryReport(workbasketIds, null, null, null, null, null,
reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
}
List<ReportLineItem> line1 = report.getReportLines().get("EXTERN").getLineItems();
assertEquals(10, line1.get(0).getNumberOfTasks());
assertEquals(2, line1.get(1).getNumberOfTasks());
assertEquals(0, line1.get(2).getNumberOfTasks());
assertEquals(0, line1.get(3).getNumberOfTasks());
assertEquals(0, line1.get(4).getNumberOfTasks());
List<ReportLineItem> line2 = report.getReportLines().get("AUTOMATIC").getLineItems();
assertEquals(2, line2.get(0).getNumberOfTasks());
assertEquals(1, line2.get(1).getNumberOfTasks());
assertEquals(0, line2.get(2).getNumberOfTasks());
assertEquals(1, line2.get(3).getNumberOfTasks());
assertEquals(1, line2.get(4).getNumberOfTasks());
List<ReportLineItem> line3 = report.getReportLines().get("MANUAL").getLineItems();
assertEquals(1, line3.get(0).getNumberOfTasks());
assertEquals(0, line3.get(1).getNumberOfTasks());
assertEquals(1, line3.get(2).getNumberOfTasks());
assertEquals(0, line3.get(3).getNumberOfTasks());
assertEquals(1, line3.get(4).getNumberOfTasks());
}
@Test
public void testEachItemOfCategoryReportWithStateFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TaskState> states = Arrays.asList(TaskState.READY);
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getCategoryReport(null, states, null, null, null, null,
reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
}
List<ReportLineItem> line1 = report.getReportLines().get("EXTERN").getLineItems();
assertEquals(15, line1.get(0).getNumberOfTasks());
assertEquals(8, line1.get(1).getNumberOfTasks());
assertEquals(2, line1.get(2).getNumberOfTasks());
assertEquals(6, line1.get(3).getNumberOfTasks());
assertEquals(0, line1.get(4).getNumberOfTasks());
List<ReportLineItem> line2 = report.getReportLines().get("AUTOMATIC").getLineItems();
assertEquals(2, line2.get(0).getNumberOfTasks());
assertEquals(1, line2.get(1).getNumberOfTasks());
assertEquals(0, line2.get(2).getNumberOfTasks());
assertEquals(1, line2.get(3).getNumberOfTasks());
assertEquals(0, line2.get(4).getNumberOfTasks());
List<ReportLineItem> line3 = report.getReportLines().get("MANUAL").getLineItems();
assertEquals(2, line3.get(0).getNumberOfTasks());
assertEquals(2, line3.get(1).getNumberOfTasks());
assertEquals(2, line3.get(2).getNumberOfTasks());
assertEquals(0, line3.get(3).getNumberOfTasks());
assertEquals(0, line3.get(4).getNumberOfTasks());
}
@Test @Test
public void testEachItemOfCategoryReportWithCategoryFilter() throws InvalidArgumentException { public void testEachItemOfCategoryReportWithCategoryFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL"); List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getCategoryReport(workbasketIds, states, categories, domains, Report report = taskMonitorService.getCategoryReport(null, null, categories, null, null, null,
reportLineItemDefinitions); reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
@ -246,13 +300,10 @@ public class ProvideCategoryReportAccTest {
public void testEachItemOfCategoryReportWithDomainFilter() throws InvalidArgumentException { public void testEachItemOfCategoryReportWithDomainFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A"); List<String> domains = Arrays.asList("DOMAIN_A");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getCategoryReport(workbasketIds, states, categories, domains, Report report = taskMonitorService.getCategoryReport(null, null, null, domains, null, null,
reportLineItemDefinitions); reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
@ -281,12 +332,41 @@ public class ProvideCategoryReportAccTest {
assertEquals(3, line3.get(4).getNumberOfTasks()); assertEquals(3, line3.get(4).getNumberOfTasks());
} }
private List<String> generateWorkbasketIds(int amount, int startAt) { @Test
List<String> workbasketIds = new ArrayList<>(); public void testEachItemOfCategoryReportWithCustomFieldValueFilter() throws InvalidArgumentException {
for (int i = 0; i < amount; i++) { TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
workbasketIds.add(String.format("WBI:%036d", startAt + i));
CustomField customField = CustomField.CUSTOM_1;
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getCategoryReport(null, null, null, null, customField, customFieldValues,
reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
} }
return workbasketIds;
List<ReportLineItem> line1 = report.getReportLines().get("EXTERN").getLineItems();
assertEquals(9, line1.get(0).getNumberOfTasks());
assertEquals(3, line1.get(1).getNumberOfTasks());
assertEquals(1, line1.get(2).getNumberOfTasks());
assertEquals(3, line1.get(3).getNumberOfTasks());
assertEquals(0, line1.get(4).getNumberOfTasks());
List<ReportLineItem> line2 = report.getReportLines().get("AUTOMATIC").getLineItems();
assertEquals(1, line2.get(0).getNumberOfTasks());
assertEquals(0, line2.get(1).getNumberOfTasks());
assertEquals(0, line2.get(2).getNumberOfTasks());
assertEquals(1, line2.get(3).getNumberOfTasks());
assertEquals(1, line2.get(4).getNumberOfTasks());
List<ReportLineItem> line3 = report.getReportLines().get("MANUAL").getLineItems();
assertEquals(1, line3.get(0).getNumberOfTasks());
assertEquals(1, line3.get(1).getNumberOfTasks());
assertEquals(2, line3.get(2).getNumberOfTasks());
assertEquals(0, line3.get(3).getNumberOfTasks());
assertEquals(2, line3.get(4).getNumberOfTasks());
} }
private List<ReportLineItemDefinition> getListOfReportLineItemDefinitions() { private List<ReportLineItemDefinition> getListOfReportLineItemDefinitions() {

View File

@ -18,6 +18,7 @@ import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import pro.taskana.CustomField;
import pro.taskana.TaskMonitorService; import pro.taskana.TaskMonitorService;
import pro.taskana.TaskState; import pro.taskana.TaskState;
import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaEngine;
@ -64,12 +65,7 @@ public class ProvideClassificationReportAccTest {
public void testGetTotalNumbersOfTasksOfClassificationReport() throws InvalidArgumentException { public void testGetTotalNumbersOfTasksOfClassificationReport() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1); Report report = taskMonitorService.getClassificationReport(null, null, null, null, null, null);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
Report report = taskMonitorService.getClassificationReport(workbasketIds, states, categories, domains);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report)); LOGGER.debug(reportToString(report));
@ -93,13 +89,9 @@ public class ProvideClassificationReportAccTest {
public void testGetClassificationReportWithReportLineItemDefinitions() throws InvalidArgumentException { public void testGetClassificationReportWithReportLineItemDefinitions() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
Report report = taskMonitorService.getClassificationReport(workbasketIds, states, categories, domains, Report report = taskMonitorService.getClassificationReport(null, null, null, null, null, null,
reportLineItemDefinitions); reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
@ -141,13 +133,9 @@ public class ProvideClassificationReportAccTest {
public void testEachItemOfClassificationReport() throws InvalidArgumentException { public void testEachItemOfClassificationReport() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getClassificationReport(workbasketIds, states, categories, domains, Report report = taskMonitorService.getClassificationReport(null, null, null, null, null, null,
reportLineItemDefinitions); reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
@ -194,13 +182,9 @@ public class ProvideClassificationReportAccTest {
public void testEachItemOfClassificationReportNotInWorkingDays() throws InvalidArgumentException { public void testEachItemOfClassificationReportNotInWorkingDays() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getClassificationReport(workbasketIds, states, categories, domains, Report report = taskMonitorService.getClassificationReport(null, null, null, null, null, null,
reportLineItemDefinitions, false); reportLineItemDefinitions, false);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
@ -243,17 +227,114 @@ public class ProvideClassificationReportAccTest {
assertEquals(7, line5.get(4).getNumberOfTasks()); assertEquals(7, line5.get(4).getNumberOfTasks());
} }
@Test
public void testEachItemOfClassificationReportWithWorkbasketFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getClassificationReport(workbasketIds, null, null, null, null, null,
reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
}
List<ReportLineItem> line1 = report.getReportLines().get("L10000").getLineItems();
assertEquals(6, line1.get(0).getNumberOfTasks());
assertEquals(0, line1.get(1).getNumberOfTasks());
assertEquals(0, line1.get(2).getNumberOfTasks());
assertEquals(0, line1.get(3).getNumberOfTasks());
assertEquals(0, line1.get(4).getNumberOfTasks());
List<ReportLineItem> line2 = report.getReportLines().get("L20000").getLineItems();
assertEquals(2, line2.get(0).getNumberOfTasks());
assertEquals(0, line2.get(1).getNumberOfTasks());
assertEquals(0, line2.get(2).getNumberOfTasks());
assertEquals(0, line2.get(3).getNumberOfTasks());
assertEquals(0, line2.get(4).getNumberOfTasks());
List<ReportLineItem> line3 = report.getReportLines().get("L30000").getLineItems();
assertEquals(2, line3.get(0).getNumberOfTasks());
assertEquals(1, line3.get(1).getNumberOfTasks());
assertEquals(0, line3.get(2).getNumberOfTasks());
assertEquals(1, line3.get(3).getNumberOfTasks());
assertEquals(1, line3.get(4).getNumberOfTasks());
List<ReportLineItem> line4 = report.getReportLines().get("L40000").getLineItems();
assertEquals(1, line4.get(0).getNumberOfTasks());
assertEquals(0, line4.get(1).getNumberOfTasks());
assertEquals(1, line4.get(2).getNumberOfTasks());
assertEquals(0, line4.get(3).getNumberOfTasks());
assertEquals(1, line4.get(4).getNumberOfTasks());
List<ReportLineItem> line5 = report.getReportLines().get("L50000").getLineItems();
assertEquals(2, line5.get(0).getNumberOfTasks());
assertEquals(2, line5.get(1).getNumberOfTasks());
assertEquals(0, line5.get(2).getNumberOfTasks());
assertEquals(0, line5.get(3).getNumberOfTasks());
assertEquals(0, line5.get(4).getNumberOfTasks());
}
@Test
public void testEachItemOfClassificationReportWithStateFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TaskState> states = Arrays.asList(TaskState.READY);
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getClassificationReport(null, states, null, null, null, null,
reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
}
List<ReportLineItem> line1 = report.getReportLines().get("L10000").getLineItems();
assertEquals(7, line1.get(0).getNumberOfTasks());
assertEquals(2, line1.get(1).getNumberOfTasks());
assertEquals(1, line1.get(2).getNumberOfTasks());
assertEquals(0, line1.get(3).getNumberOfTasks());
assertEquals(0, line1.get(4).getNumberOfTasks());
List<ReportLineItem> line2 = report.getReportLines().get("L20000").getLineItems();
assertEquals(5, line2.get(0).getNumberOfTasks());
assertEquals(3, line2.get(1).getNumberOfTasks());
assertEquals(1, line2.get(2).getNumberOfTasks());
assertEquals(1, line2.get(3).getNumberOfTasks());
assertEquals(0, line2.get(4).getNumberOfTasks());
List<ReportLineItem> line3 = report.getReportLines().get("L30000").getLineItems();
assertEquals(2, line3.get(0).getNumberOfTasks());
assertEquals(1, line3.get(1).getNumberOfTasks());
assertEquals(0, line3.get(2).getNumberOfTasks());
assertEquals(1, line3.get(3).getNumberOfTasks());
assertEquals(0, line3.get(4).getNumberOfTasks());
List<ReportLineItem> line4 = report.getReportLines().get("L40000").getLineItems();
assertEquals(2, line4.get(0).getNumberOfTasks());
assertEquals(2, line4.get(1).getNumberOfTasks());
assertEquals(2, line4.get(2).getNumberOfTasks());
assertEquals(0, line4.get(3).getNumberOfTasks());
assertEquals(0, line4.get(4).getNumberOfTasks());
List<ReportLineItem> line5 = report.getReportLines().get("L50000").getLineItems();
assertEquals(3, line5.get(0).getNumberOfTasks());
assertEquals(3, line5.get(1).getNumberOfTasks());
assertEquals(0, line5.get(2).getNumberOfTasks());
assertEquals(5, line5.get(3).getNumberOfTasks());
assertEquals(0, line5.get(4).getNumberOfTasks());
}
@Test @Test
public void testEachItemOfClassificationReportWithCategoryFilter() throws InvalidArgumentException { public void testEachItemOfClassificationReportWithCategoryFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL"); List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getClassificationReport(workbasketIds, states, categories, domains, Report report = taskMonitorService.getClassificationReport(null, null, categories, null, null, null,
reportLineItemDefinitions); reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
@ -281,13 +362,10 @@ public class ProvideClassificationReportAccTest {
public void testEachItemOfClassificationReportWithDomainFilter() throws InvalidArgumentException { public void testEachItemOfClassificationReportWithDomainFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A"); List<String> domains = Arrays.asList("DOMAIN_A");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getClassificationReport(workbasketIds, states, categories, domains, Report report = taskMonitorService.getClassificationReport(null, null, null, domains, null, null,
reportLineItemDefinitions); reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
@ -330,12 +408,55 @@ public class ProvideClassificationReportAccTest {
assertEquals(0, line5.get(4).getNumberOfTasks()); assertEquals(0, line5.get(4).getNumberOfTasks());
} }
private List<String> generateWorkbasketIds(int amount, int startAt) { @Test
List<String> workbasketIds = new ArrayList<>(); public void testEachItemOfClassificationReportWithCustomFieldValueFilter() throws InvalidArgumentException {
for (int i = 0; i < amount; i++) { TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
workbasketIds.add(String.format("WBI:%036d", startAt + i));
CustomField customField = CustomField.CUSTOM_1;
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getClassificationReport(null, null, null, null, customField,
customFieldValues, reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
} }
return workbasketIds;
List<ReportLineItem> line1 = report.getReportLines().get("L10000").getLineItems();
assertEquals(4, line1.get(0).getNumberOfTasks());
assertEquals(0, line1.get(1).getNumberOfTasks());
assertEquals(0, line1.get(2).getNumberOfTasks());
assertEquals(0, line1.get(3).getNumberOfTasks());
assertEquals(0, line1.get(4).getNumberOfTasks());
List<ReportLineItem> line2 = report.getReportLines().get("L20000").getLineItems();
assertEquals(4, line2.get(0).getNumberOfTasks());
assertEquals(1, line2.get(1).getNumberOfTasks());
assertEquals(1, line2.get(2).getNumberOfTasks());
assertEquals(1, line2.get(3).getNumberOfTasks());
assertEquals(0, line2.get(4).getNumberOfTasks());
List<ReportLineItem> line3 = report.getReportLines().get("L30000").getLineItems();
assertEquals(1, line3.get(0).getNumberOfTasks());
assertEquals(0, line3.get(1).getNumberOfTasks());
assertEquals(0, line3.get(2).getNumberOfTasks());
assertEquals(1, line3.get(3).getNumberOfTasks());
assertEquals(1, line3.get(4).getNumberOfTasks());
List<ReportLineItem> line4 = report.getReportLines().get("L40000").getLineItems();
assertEquals(1, line4.get(0).getNumberOfTasks());
assertEquals(1, line4.get(1).getNumberOfTasks());
assertEquals(2, line4.get(2).getNumberOfTasks());
assertEquals(0, line4.get(3).getNumberOfTasks());
assertEquals(2, line4.get(4).getNumberOfTasks());
List<ReportLineItem> line5 = report.getReportLines().get("L50000").getLineItems();
assertEquals(1, line5.get(0).getNumberOfTasks());
assertEquals(2, line5.get(1).getNumberOfTasks());
assertEquals(0, line5.get(2).getNumberOfTasks());
assertEquals(2, line5.get(3).getNumberOfTasks());
assertEquals(0, line5.get(4).getNumberOfTasks());
} }
private List<ReportLineItemDefinition> getListOfReportLineItemDefinitions() { private List<ReportLineItemDefinition> getListOfReportLineItemDefinitions() {

View File

@ -65,30 +65,21 @@ public class ProvideCustomFieldValueReportAccTest {
public void testGetTotalNumbersOfTasksOfCustomFieldValueReportForCustom1() throws InvalidArgumentException { public void testGetTotalNumbersOfTasksOfCustomFieldValueReportForCustom1() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
CustomField customField = CustomField.CUSTOM_1; CustomField customField = CustomField.CUSTOM_1;
String customFieldValue1 = "Geschaeftsstelle A";
String customFieldValue2 = "Geschaeftsstelle B";
String customFieldValue3 = "Geschaeftsstelle C";
Report report = taskMonitorService.getCustomFieldValueReport(workbasketIds, states, categories, domains, Report report = taskMonitorService.getCustomFieldValueReport(null, null, null, null, customField, null);
customField);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report)); LOGGER.debug(reportToString(report));
} }
assertNotNull(report); assertNotNull(report);
assertEquals(25, report.getReportLines().get(customFieldValue1).getTotalNumberOfTasks()); assertEquals(25, report.getReportLines().get("Geschaeftsstelle A").getTotalNumberOfTasks());
assertEquals(10, report.getReportLines().get(customFieldValue2).getTotalNumberOfTasks()); assertEquals(10, report.getReportLines().get("Geschaeftsstelle B").getTotalNumberOfTasks());
assertEquals(15, report.getReportLines().get(customFieldValue3).getTotalNumberOfTasks()); assertEquals(15, report.getReportLines().get("Geschaeftsstelle C").getTotalNumberOfTasks());
assertEquals(0, report.getReportLines().get(customFieldValue1).getLineItems().size()); assertEquals(0, report.getReportLines().get("Geschaeftsstelle A").getLineItems().size());
assertEquals(0, report.getReportLines().get(customFieldValue2).getLineItems().size()); assertEquals(0, report.getReportLines().get("Geschaeftsstelle B").getLineItems().size());
assertEquals(0, report.getReportLines().get(customFieldValue3).getLineItems().size()); assertEquals(0, report.getReportLines().get("Geschaeftsstelle C").getLineItems().size());
assertEquals(3, report.getReportLines().size()); assertEquals(3, report.getReportLines().size());
assertEquals(50, report.getSumLine().getTotalNumberOfTasks()); assertEquals(50, report.getSumLine().getTotalNumberOfTasks());
} }
@ -97,28 +88,20 @@ public class ProvideCustomFieldValueReportAccTest {
public void testGetTotalNumbersOfTasksOfCustomFieldValueReportForCustom2() throws InvalidArgumentException { public void testGetTotalNumbersOfTasksOfCustomFieldValueReportForCustom2() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
CustomField customField = CustomField.CUSTOM_2; CustomField customField = CustomField.CUSTOM_2;
String customFieldValue1 = "Vollkasko";
String customFieldValue2 = "Teilkasko";
Report report = taskMonitorService.getCustomFieldValueReport(workbasketIds, states, categories, domains, Report report = taskMonitorService.getCustomFieldValueReport(null, null, null, null, customField, null);
customField);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report)); LOGGER.debug(reportToString(report));
} }
assertNotNull(report); assertNotNull(report);
assertEquals(21, report.getReportLines().get(customFieldValue1).getTotalNumberOfTasks()); assertEquals(21, report.getReportLines().get("Vollkasko").getTotalNumberOfTasks());
assertEquals(29, report.getReportLines().get(customFieldValue2).getTotalNumberOfTasks()); assertEquals(29, report.getReportLines().get("Teilkasko").getTotalNumberOfTasks());
assertEquals(0, report.getReportLines().get(customFieldValue1).getLineItems().size()); assertEquals(0, report.getReportLines().get("Vollkasko").getLineItems().size());
assertEquals(0, report.getReportLines().get(customFieldValue2).getLineItems().size()); assertEquals(0, report.getReportLines().get("Teilkasko").getLineItems().size());
assertEquals(2, report.getReportLines().size()); assertEquals(2, report.getReportLines().size());
assertEquals(50, report.getSumLine().getTotalNumberOfTasks()); assertEquals(50, report.getSumLine().getTotalNumberOfTasks());
@ -128,19 +111,11 @@ public class ProvideCustomFieldValueReportAccTest {
public void testGetCustomFieldValueReportWithReportLineItemDefinitions() throws InvalidArgumentException { public void testGetCustomFieldValueReportWithReportLineItemDefinitions() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1); CustomField customField = CustomField.CUSTOM_1;
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
CustomField customField = CustomField.CUSTOM_1; Report report = taskMonitorService.getCustomFieldValueReport(null, null, null, null, customField, null,
String customFieldValue1 = "Geschaeftsstelle A"; reportLineItemDefinitions);
String customFieldValue2 = "Geschaeftsstelle B";
String customFieldValue3 = "Geschaeftsstelle C";
Report report = taskMonitorService.getCustomFieldValueReport(workbasketIds, states, categories, domains,
customField, reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions)); LOGGER.debug(reportToString(report, reportLineItemDefinitions));
@ -148,9 +123,9 @@ public class ProvideCustomFieldValueReportAccTest {
assertNotNull(report); assertNotNull(report);
assertEquals(25, report.getReportLines().get(customFieldValue1).getTotalNumberOfTasks()); assertEquals(25, report.getReportLines().get("Geschaeftsstelle A").getTotalNumberOfTasks());
assertEquals(10, report.getReportLines().get(customFieldValue2).getTotalNumberOfTasks()); assertEquals(10, report.getReportLines().get("Geschaeftsstelle B").getTotalNumberOfTasks());
assertEquals(15, report.getReportLines().get(customFieldValue3).getTotalNumberOfTasks()); assertEquals(15, report.getReportLines().get("Geschaeftsstelle C").getTotalNumberOfTasks());
assertEquals(10, report.getSumLine().getLineItems().get(0).getNumberOfTasks()); assertEquals(10, report.getSumLine().getLineItems().get(0).getNumberOfTasks());
assertEquals(9, report.getSumLine().getLineItems().get(1).getNumberOfTasks()); assertEquals(9, report.getSumLine().getLineItems().get(1).getNumberOfTasks());
@ -170,39 +145,31 @@ public class ProvideCustomFieldValueReportAccTest {
public void testEachItemOfCustomFieldValueReport() throws InvalidArgumentException { public void testEachItemOfCustomFieldValueReport() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1); CustomField customField = CustomField.CUSTOM_1;
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
CustomField customField = CustomField.CUSTOM_1; Report report = taskMonitorService.getCustomFieldValueReport(null, null, null, null, customField, null,
String customFieldValue1 = "Geschaeftsstelle A"; reportLineItemDefinitions);
String customFieldValue2 = "Geschaeftsstelle B";
String customFieldValue3 = "Geschaeftsstelle C";
Report report = taskMonitorService.getCustomFieldValueReport(workbasketIds, states, categories, domains,
customField, reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions)); LOGGER.debug(reportToString(report, reportLineItemDefinitions));
} }
List<ReportLineItem> line1 = report.getReportLines().get(customFieldValue1).getLineItems(); List<ReportLineItem> line1 = report.getReportLines().get("Geschaeftsstelle A").getLineItems();
assertEquals(11, line1.get(0).getNumberOfTasks()); assertEquals(11, line1.get(0).getNumberOfTasks());
assertEquals(4, line1.get(1).getNumberOfTasks()); assertEquals(4, line1.get(1).getNumberOfTasks());
assertEquals(3, line1.get(2).getNumberOfTasks()); assertEquals(3, line1.get(2).getNumberOfTasks());
assertEquals(4, line1.get(3).getNumberOfTasks()); assertEquals(4, line1.get(3).getNumberOfTasks());
assertEquals(3, line1.get(4).getNumberOfTasks()); assertEquals(3, line1.get(4).getNumberOfTasks());
List<ReportLineItem> line2 = report.getReportLines().get(customFieldValue2).getLineItems(); List<ReportLineItem> line2 = report.getReportLines().get("Geschaeftsstelle B").getLineItems();
assertEquals(5, line2.get(0).getNumberOfTasks()); assertEquals(5, line2.get(0).getNumberOfTasks());
assertEquals(3, line2.get(1).getNumberOfTasks()); assertEquals(3, line2.get(1).getNumberOfTasks());
assertEquals(0, line2.get(2).getNumberOfTasks()); assertEquals(0, line2.get(2).getNumberOfTasks());
assertEquals(2, line2.get(3).getNumberOfTasks()); assertEquals(2, line2.get(3).getNumberOfTasks());
assertEquals(0, line2.get(4).getNumberOfTasks()); assertEquals(0, line2.get(4).getNumberOfTasks());
List<ReportLineItem> line3 = report.getReportLines().get(customFieldValue3).getLineItems(); List<ReportLineItem> line3 = report.getReportLines().get("Geschaeftsstelle C").getLineItems();
assertEquals(3, line3.get(0).getNumberOfTasks()); assertEquals(3, line3.get(0).getNumberOfTasks());
assertEquals(4, line3.get(1).getNumberOfTasks()); assertEquals(4, line3.get(1).getNumberOfTasks());
assertEquals(1, line3.get(2).getNumberOfTasks()); assertEquals(1, line3.get(2).getNumberOfTasks());
@ -214,39 +181,31 @@ public class ProvideCustomFieldValueReportAccTest {
public void testEachItemOfCustomFieldValueReportNotInWorkingDays() throws InvalidArgumentException { public void testEachItemOfCustomFieldValueReportNotInWorkingDays() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1); CustomField customField = CustomField.CUSTOM_1;
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
CustomField customField = CustomField.CUSTOM_1; Report report = taskMonitorService.getCustomFieldValueReport(null, null, null, null, customField, null,
String customFieldValue1 = "Geschaeftsstelle A"; reportLineItemDefinitions, false);
String customFieldValue2 = "Geschaeftsstelle B";
String customFieldValue3 = "Geschaeftsstelle C";
Report report = taskMonitorService.getCustomFieldValueReport(workbasketIds, states, categories, domains,
customField, reportLineItemDefinitions, false);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions)); LOGGER.debug(reportToString(report, reportLineItemDefinitions));
} }
List<ReportLineItem> line1 = report.getReportLines().get(customFieldValue1).getLineItems(); List<ReportLineItem> line1 = report.getReportLines().get("Geschaeftsstelle A").getLineItems();
assertEquals(15, line1.get(0).getNumberOfTasks()); assertEquals(15, line1.get(0).getNumberOfTasks());
assertEquals(0, line1.get(1).getNumberOfTasks()); assertEquals(0, line1.get(1).getNumberOfTasks());
assertEquals(3, line1.get(2).getNumberOfTasks()); assertEquals(3, line1.get(2).getNumberOfTasks());
assertEquals(0, line1.get(3).getNumberOfTasks()); assertEquals(0, line1.get(3).getNumberOfTasks());
assertEquals(7, line1.get(4).getNumberOfTasks()); assertEquals(7, line1.get(4).getNumberOfTasks());
List<ReportLineItem> line2 = report.getReportLines().get(customFieldValue2).getLineItems(); List<ReportLineItem> line2 = report.getReportLines().get("Geschaeftsstelle B").getLineItems();
assertEquals(8, line2.get(0).getNumberOfTasks()); assertEquals(8, line2.get(0).getNumberOfTasks());
assertEquals(0, line2.get(1).getNumberOfTasks()); assertEquals(0, line2.get(1).getNumberOfTasks());
assertEquals(0, line2.get(2).getNumberOfTasks()); assertEquals(0, line2.get(2).getNumberOfTasks());
assertEquals(0, line2.get(3).getNumberOfTasks()); assertEquals(0, line2.get(3).getNumberOfTasks());
assertEquals(2, line2.get(4).getNumberOfTasks()); assertEquals(2, line2.get(4).getNumberOfTasks());
List<ReportLineItem> line3 = report.getReportLines().get(customFieldValue3).getLineItems(); List<ReportLineItem> line3 = report.getReportLines().get("Geschaeftsstelle C").getLineItems();
assertEquals(7, line3.get(0).getNumberOfTasks()); assertEquals(7, line3.get(0).getNumberOfTasks());
assertEquals(0, line3.get(1).getNumberOfTasks()); assertEquals(0, line3.get(1).getNumberOfTasks());
assertEquals(1, line3.get(2).getNumberOfTasks()); assertEquals(1, line3.get(2).getNumberOfTasks());
@ -255,42 +214,110 @@ public class ProvideCustomFieldValueReportAccTest {
} }
@Test @Test
public void testEachItemOfCustomFieldValueReportWithCategoryFilter() throws InvalidArgumentException { public void testEachItemOfCustomFieldValueReportWithWorkbasketFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1); List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED); CustomField customField = CustomField.CUSTOM_1;
List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
CustomField customField = CustomField.CUSTOM_1; Report report = taskMonitorService.getCustomFieldValueReport(workbasketIds, null, null, null, customField, null,
String customFieldValue1 = "Geschaeftsstelle A"; reportLineItemDefinitions);
String customFieldValue2 = "Geschaeftsstelle B";
String customFieldValue3 = "Geschaeftsstelle C";
Report report = taskMonitorService.getCustomFieldValueReport(workbasketIds, states, categories, domains,
customField, reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions)); LOGGER.debug(reportToString(report, reportLineItemDefinitions));
} }
List<ReportLineItem> line1 = report.getReportLines().get(customFieldValue1).getLineItems(); List<ReportLineItem> line1 = report.getReportLines().get("Geschaeftsstelle A").getLineItems();
assertEquals(6, line1.get(0).getNumberOfTasks());
assertEquals(1, line1.get(1).getNumberOfTasks());
assertEquals(1, line1.get(2).getNumberOfTasks());
assertEquals(1, line1.get(3).getNumberOfTasks());
assertEquals(1, line1.get(4).getNumberOfTasks());
List<ReportLineItem> line2 = report.getReportLines().get("Geschaeftsstelle B").getLineItems();
assertEquals(4, line2.get(0).getNumberOfTasks());
assertEquals(1, line2.get(1).getNumberOfTasks());
assertEquals(0, line2.get(2).getNumberOfTasks());
assertEquals(0, line2.get(3).getNumberOfTasks());
assertEquals(0, line2.get(4).getNumberOfTasks());
List<ReportLineItem> line3 = report.getReportLines().get("Geschaeftsstelle C").getLineItems();
assertEquals(3, line3.get(0).getNumberOfTasks());
assertEquals(1, line3.get(1).getNumberOfTasks());
assertEquals(0, line3.get(2).getNumberOfTasks());
assertEquals(0, line3.get(3).getNumberOfTasks());
assertEquals(1, line3.get(4).getNumberOfTasks());
}
@Test
public void testEachItemOfCustomFieldValueReportWithStateFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TaskState> states = Arrays.asList(TaskState.READY);
CustomField customField = CustomField.CUSTOM_1;
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getCustomFieldValueReport(null, states, null, null, customField, null,
reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
}
List<ReportLineItem> line1 = report.getReportLines().get("Geschaeftsstelle A").getLineItems();
assertEquals(11, line1.get(0).getNumberOfTasks());
assertEquals(4, line1.get(1).getNumberOfTasks());
assertEquals(3, line1.get(2).getNumberOfTasks());
assertEquals(4, line1.get(3).getNumberOfTasks());
assertEquals(0, line1.get(4).getNumberOfTasks());
List<ReportLineItem> line2 = report.getReportLines().get("Geschaeftsstelle B").getLineItems();
assertEquals(5, line2.get(0).getNumberOfTasks());
assertEquals(3, line2.get(1).getNumberOfTasks());
assertEquals(0, line2.get(2).getNumberOfTasks());
assertEquals(2, line2.get(3).getNumberOfTasks());
assertEquals(0, line2.get(4).getNumberOfTasks());
List<ReportLineItem> line3 = report.getReportLines().get("Geschaeftsstelle C").getLineItems();
assertEquals(3, line3.get(0).getNumberOfTasks());
assertEquals(4, line3.get(1).getNumberOfTasks());
assertEquals(1, line3.get(2).getNumberOfTasks());
assertEquals(1, line3.get(3).getNumberOfTasks());
assertEquals(0, line3.get(4).getNumberOfTasks());
}
@Test
public void testEachItemOfCustomFieldValueReportWithCategoryFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
CustomField customField = CustomField.CUSTOM_1;
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getCustomFieldValueReport(null, null, categories, null, customField, null,
reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
}
List<ReportLineItem> line1 = report.getReportLines().get("Geschaeftsstelle A").getLineItems();
assertEquals(2, line1.get(0).getNumberOfTasks()); assertEquals(2, line1.get(0).getNumberOfTasks());
assertEquals(1, line1.get(1).getNumberOfTasks()); assertEquals(1, line1.get(1).getNumberOfTasks());
assertEquals(2, line1.get(2).getNumberOfTasks()); assertEquals(2, line1.get(2).getNumberOfTasks());
assertEquals(1, line1.get(3).getNumberOfTasks()); assertEquals(1, line1.get(3).getNumberOfTasks());
assertEquals(3, line1.get(4).getNumberOfTasks()); assertEquals(3, line1.get(4).getNumberOfTasks());
List<ReportLineItem> line2 = report.getReportLines().get(customFieldValue2).getLineItems(); List<ReportLineItem> line2 = report.getReportLines().get("Geschaeftsstelle B").getLineItems();
assertEquals(2, line2.get(0).getNumberOfTasks()); assertEquals(2, line2.get(0).getNumberOfTasks());
assertEquals(0, line2.get(1).getNumberOfTasks()); assertEquals(0, line2.get(1).getNumberOfTasks());
assertEquals(0, line2.get(2).getNumberOfTasks()); assertEquals(0, line2.get(2).getNumberOfTasks());
assertEquals(0, line2.get(3).getNumberOfTasks()); assertEquals(0, line2.get(3).getNumberOfTasks());
assertEquals(0, line2.get(4).getNumberOfTasks()); assertEquals(0, line2.get(4).getNumberOfTasks());
List<ReportLineItem> line3 = report.getReportLines().get(customFieldValue3).getLineItems(); List<ReportLineItem> line3 = report.getReportLines().get("Geschaeftsstelle C").getLineItems();
assertEquals(0, line3.get(0).getNumberOfTasks()); assertEquals(0, line3.get(0).getNumberOfTasks());
assertEquals(2, line3.get(1).getNumberOfTasks()); assertEquals(2, line3.get(1).getNumberOfTasks());
assertEquals(0, line3.get(2).getNumberOfTasks()); assertEquals(0, line3.get(2).getNumberOfTasks());
@ -302,39 +329,32 @@ public class ProvideCustomFieldValueReportAccTest {
public void testEachItemOfCustomFieldValueReportWithDomainFilter() throws InvalidArgumentException { public void testEachItemOfCustomFieldValueReportWithDomainFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A"); List<String> domains = Arrays.asList("DOMAIN_A");
CustomField customField = CustomField.CUSTOM_1;
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
CustomField customField = CustomField.CUSTOM_1; Report report = taskMonitorService.getCustomFieldValueReport(null, null, null, domains, customField, null,
String customFieldValue1 = "Geschaeftsstelle A"; reportLineItemDefinitions);
String customFieldValue2 = "Geschaeftsstelle B";
String customFieldValue3 = "Geschaeftsstelle C";
Report report = taskMonitorService.getCustomFieldValueReport(workbasketIds, states, categories, domains,
customField, reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions)); LOGGER.debug(reportToString(report, reportLineItemDefinitions));
} }
List<ReportLineItem> line1 = report.getReportLines().get(customFieldValue1).getLineItems(); List<ReportLineItem> line1 = report.getReportLines().get("Geschaeftsstelle A").getLineItems();
assertEquals(8, line1.get(0).getNumberOfTasks()); assertEquals(8, line1.get(0).getNumberOfTasks());
assertEquals(1, line1.get(1).getNumberOfTasks()); assertEquals(1, line1.get(1).getNumberOfTasks());
assertEquals(1, line1.get(2).getNumberOfTasks()); assertEquals(1, line1.get(2).getNumberOfTasks());
assertEquals(4, line1.get(3).getNumberOfTasks()); assertEquals(4, line1.get(3).getNumberOfTasks());
assertEquals(1, line1.get(4).getNumberOfTasks()); assertEquals(1, line1.get(4).getNumberOfTasks());
List<ReportLineItem> line2 = report.getReportLines().get(customFieldValue2).getLineItems(); List<ReportLineItem> line2 = report.getReportLines().get("Geschaeftsstelle B").getLineItems();
assertEquals(2, line2.get(0).getNumberOfTasks()); assertEquals(2, line2.get(0).getNumberOfTasks());
assertEquals(2, line2.get(1).getNumberOfTasks()); assertEquals(2, line2.get(1).getNumberOfTasks());
assertEquals(0, line2.get(2).getNumberOfTasks()); assertEquals(0, line2.get(2).getNumberOfTasks());
assertEquals(1, line2.get(3).getNumberOfTasks()); assertEquals(1, line2.get(3).getNumberOfTasks());
assertEquals(0, line2.get(4).getNumberOfTasks()); assertEquals(0, line2.get(4).getNumberOfTasks());
List<ReportLineItem> line3 = report.getReportLines().get(customFieldValue3).getLineItems(); List<ReportLineItem> line3 = report.getReportLines().get("Geschaeftsstelle C").getLineItems();
assertEquals(1, line3.get(0).getNumberOfTasks()); assertEquals(1, line3.get(0).getNumberOfTasks());
assertEquals(1, line3.get(1).getNumberOfTasks()); assertEquals(1, line3.get(1).getNumberOfTasks());
assertEquals(1, line3.get(2).getNumberOfTasks()); assertEquals(1, line3.get(2).getNumberOfTasks());
@ -342,12 +362,29 @@ public class ProvideCustomFieldValueReportAccTest {
assertEquals(3, line3.get(4).getNumberOfTasks()); assertEquals(3, line3.get(4).getNumberOfTasks());
} }
private List<String> generateWorkbasketIds(int amount, int startAt) { @Test
List<String> workbasketIds = new ArrayList<>(); public void testEachItemOfCustomFieldValueReportWithCustomFieldValueFilter() throws InvalidArgumentException {
for (int i = 0; i < amount; i++) { TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
workbasketIds.add(String.format("WBI:%036d", startAt + i));
CustomField customField = CustomField.CUSTOM_1;
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getCustomFieldValueReport(null, null, null, null, customField,
customFieldValues, reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
} }
return workbasketIds;
List<ReportLineItem> line1 = report.getReportLines().get("Geschaeftsstelle A").getLineItems();
assertEquals(11, line1.get(0).getNumberOfTasks());
assertEquals(4, line1.get(1).getNumberOfTasks());
assertEquals(3, line1.get(2).getNumberOfTasks());
assertEquals(4, line1.get(3).getNumberOfTasks());
assertEquals(3, line1.get(4).getNumberOfTasks());
assertEquals(1, report.getReportLines().size());
} }
private List<ReportLineItemDefinition> getListOfReportLineItemDefinitions() { private List<ReportLineItemDefinition> getListOfReportLineItemDefinitions() {

View File

@ -18,6 +18,7 @@ import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import pro.taskana.CustomField;
import pro.taskana.TaskMonitorService; import pro.taskana.TaskMonitorService;
import pro.taskana.TaskState; import pro.taskana.TaskState;
import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaEngine;
@ -67,13 +68,8 @@ public class ProvideDetailedClassificationReportAccTest {
public void testGetTotalNumbersOfTasksOfDetailedClassificationReport() throws InvalidArgumentException { public void testGetTotalNumbersOfTasksOfDetailedClassificationReport() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1); DetailedClassificationReport report = taskMonitorService.getDetailedClassificationReport(null, null, null, null,
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED); null, null);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
DetailedClassificationReport report = taskMonitorService.getDetailedClassificationReport(workbasketIds, states,
categories, domains);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report)); LOGGER.debug(reportToString(report));
@ -122,14 +118,10 @@ public class ProvideDetailedClassificationReportAccTest {
public void testGetDetailedClassificationReportWithReportLineItemDefinitions() throws InvalidArgumentException { public void testGetDetailedClassificationReportWithReportLineItemDefinitions() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
DetailedClassificationReport report = taskMonitorService.getDetailedClassificationReport(workbasketIds, states, DetailedClassificationReport report = taskMonitorService.getDetailedClassificationReport(null, null, null, null,
categories, domains, reportLineItemDefinitions); null, null, reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions)); LOGGER.debug(reportToString(report, reportLineItemDefinitions));
@ -159,14 +151,10 @@ public class ProvideDetailedClassificationReportAccTest {
public void testEachItemOfDetailedClassificationReport() throws InvalidArgumentException { public void testEachItemOfDetailedClassificationReport() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
DetailedClassificationReport report = taskMonitorService.getDetailedClassificationReport(workbasketIds, states, DetailedClassificationReport report = taskMonitorService.getDetailedClassificationReport(null, null, null, null,
categories, domains, reportLineItemDefinitions); null, null, reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions)); LOGGER.debug(reportToString(report, reportLineItemDefinitions));
@ -271,18 +259,227 @@ public class ProvideDetailedClassificationReportAccTest {
assertEquals(2, detailedLineNoAttachment5.getLineItems().get(4).getNumberOfTasks()); assertEquals(2, detailedLineNoAttachment5.getLineItems().get(4).getNumberOfTasks());
} }
@Test
public void testEachItemOfDetailedClassificationReportWithWorkbasketFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
DetailedClassificationReport report = taskMonitorService.getDetailedClassificationReport(workbasketIds, null,
null, null, null, null, reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
}
DetailedReportLine line1 = (DetailedReportLine) report.getReportLines().get("L10000");
assertEquals(6, line1.getLineItems().get(0).getNumberOfTasks());
assertEquals(0, line1.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, line1.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, line1.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, line1.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLine1 = line1.getDetailLines().get("L11000");
assertEquals(2, detailedLine1.getLineItems().get(0).getNumberOfTasks());
assertEquals(0, detailedLine1.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, detailedLine1.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, detailedLine1.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLine1.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLineNoAttachment1 = line1.getDetailLines().get("N/A");
assertEquals(4, detailedLineNoAttachment1.getLineItems().get(0).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment1.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment1.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment1.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment1.getLineItems().get(4).getNumberOfTasks());
DetailedReportLine line2 = (DetailedReportLine) report.getReportLines().get("L20000");
assertEquals(2, line2.getLineItems().get(0).getNumberOfTasks());
assertEquals(0, line2.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, line2.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, line2.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, line2.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLine2 = line2.getDetailLines().get("L22000");
assertEquals(1, detailedLine2.getLineItems().get(0).getNumberOfTasks());
assertEquals(0, detailedLine2.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, detailedLine2.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, detailedLine2.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLine2.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLineNoAttachment2 = line2.getDetailLines().get("N/A");
assertEquals(1, detailedLineNoAttachment2.getLineItems().get(0).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment2.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment2.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment2.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment2.getLineItems().get(4).getNumberOfTasks());
DetailedReportLine line3 = (DetailedReportLine) report.getReportLines().get("L30000");
assertEquals(2, line3.getLineItems().get(0).getNumberOfTasks());
assertEquals(1, line3.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, line3.getLineItems().get(2).getNumberOfTasks());
assertEquals(1, line3.getLineItems().get(3).getNumberOfTasks());
assertEquals(1, line3.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLine3a = line3.getDetailLines().get("L33000");
assertEquals(0, detailedLine3a.getLineItems().get(0).getNumberOfTasks());
assertEquals(1, detailedLine3a.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, detailedLine3a.getLineItems().get(2).getNumberOfTasks());
assertEquals(1, detailedLine3a.getLineItems().get(3).getNumberOfTasks());
assertEquals(1, detailedLine3a.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLineNoAttachment3 = line3.getDetailLines().get("N/A");
assertEquals(2, detailedLineNoAttachment3.getLineItems().get(0).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment3.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment3.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment3.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment3.getLineItems().get(4).getNumberOfTasks());
DetailedReportLine line4 = (DetailedReportLine) report.getReportLines().get("L40000");
assertEquals(1, line4.getLineItems().get(0).getNumberOfTasks());
assertEquals(0, line4.getLineItems().get(1).getNumberOfTasks());
assertEquals(1, line4.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, line4.getLineItems().get(3).getNumberOfTasks());
assertEquals(1, line4.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLineNoAttachment4 = line4.getDetailLines().get("N/A");
assertEquals(1, detailedLineNoAttachment4.getLineItems().get(0).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment4.getLineItems().get(1).getNumberOfTasks());
assertEquals(1, detailedLineNoAttachment4.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment4.getLineItems().get(3).getNumberOfTasks());
assertEquals(1, detailedLineNoAttachment4.getLineItems().get(4).getNumberOfTasks());
DetailedReportLine line5 = (DetailedReportLine) report.getReportLines().get("L50000");
assertEquals(2, line5.getLineItems().get(0).getNumberOfTasks());
assertEquals(2, line5.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, line5.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, line5.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, line5.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLineNoAttachment5 = line5.getDetailLines().get("N/A");
assertEquals(2, detailedLineNoAttachment5.getLineItems().get(0).getNumberOfTasks());
assertEquals(2, detailedLineNoAttachment5.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment5.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment5.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment5.getLineItems().get(4).getNumberOfTasks());
}
@Test
public void testEachItemOfDetailedClassificationReportWithStateFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TaskState> states = Arrays.asList(TaskState.READY);
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
DetailedClassificationReport report = taskMonitorService.getDetailedClassificationReport(null, states, null,
null,
null, null, reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
}
DetailedReportLine line1 = (DetailedReportLine) report.getReportLines().get("L10000");
assertEquals(7, line1.getLineItems().get(0).getNumberOfTasks());
assertEquals(2, line1.getLineItems().get(1).getNumberOfTasks());
assertEquals(1, line1.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, line1.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, line1.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLine1 = line1.getDetailLines().get("L11000");
assertEquals(2, detailedLine1.getLineItems().get(0).getNumberOfTasks());
assertEquals(0, detailedLine1.getLineItems().get(1).getNumberOfTasks());
assertEquals(1, detailedLine1.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, detailedLine1.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLine1.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLineNoAttachment1 = line1.getDetailLines().get("N/A");
assertEquals(5, detailedLineNoAttachment1.getLineItems().get(0).getNumberOfTasks());
assertEquals(2, detailedLineNoAttachment1.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment1.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment1.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment1.getLineItems().get(4).getNumberOfTasks());
DetailedReportLine line2 = (DetailedReportLine) report.getReportLines().get("L20000");
assertEquals(5, line2.getLineItems().get(0).getNumberOfTasks());
assertEquals(3, line2.getLineItems().get(1).getNumberOfTasks());
assertEquals(1, line2.getLineItems().get(2).getNumberOfTasks());
assertEquals(1, line2.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, line2.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLine2 = line2.getDetailLines().get("L22000");
assertEquals(1, detailedLine2.getLineItems().get(0).getNumberOfTasks());
assertEquals(1, detailedLine2.getLineItems().get(1).getNumberOfTasks());
assertEquals(1, detailedLine2.getLineItems().get(2).getNumberOfTasks());
assertEquals(1, detailedLine2.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLine2.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLineNoAttachment2 = line2.getDetailLines().get("N/A");
assertEquals(4, detailedLineNoAttachment2.getLineItems().get(0).getNumberOfTasks());
assertEquals(2, detailedLineNoAttachment2.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment2.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment2.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment2.getLineItems().get(4).getNumberOfTasks());
DetailedReportLine line3 = (DetailedReportLine) report.getReportLines().get("L30000");
assertEquals(2, line3.getLineItems().get(0).getNumberOfTasks());
assertEquals(1, line3.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, line3.getLineItems().get(2).getNumberOfTasks());
assertEquals(1, line3.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, line3.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLine3a = line3.getDetailLines().get("L33000");
assertEquals(0, detailedLine3a.getLineItems().get(0).getNumberOfTasks());
assertEquals(1, detailedLine3a.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, detailedLine3a.getLineItems().get(2).getNumberOfTasks());
assertEquals(1, detailedLine3a.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLine3a.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLineNoAttachment3 = line3.getDetailLines().get("N/A");
assertEquals(2, detailedLineNoAttachment3.getLineItems().get(0).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment3.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment3.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment3.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment3.getLineItems().get(4).getNumberOfTasks());
DetailedReportLine line4 = (DetailedReportLine) report.getReportLines().get("L40000");
assertEquals(2, line4.getLineItems().get(0).getNumberOfTasks());
assertEquals(2, line4.getLineItems().get(1).getNumberOfTasks());
assertEquals(2, line4.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, line4.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, line4.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLineNoAttachment4 = line4.getDetailLines().get("N/A");
assertEquals(2, detailedLineNoAttachment4.getLineItems().get(0).getNumberOfTasks());
assertEquals(2, detailedLineNoAttachment4.getLineItems().get(1).getNumberOfTasks());
assertEquals(2, detailedLineNoAttachment4.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment4.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment4.getLineItems().get(4).getNumberOfTasks());
DetailedReportLine line5 = (DetailedReportLine) report.getReportLines().get("L50000");
assertEquals(3, line5.getLineItems().get(0).getNumberOfTasks());
assertEquals(3, line5.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, line5.getLineItems().get(2).getNumberOfTasks());
assertEquals(5, line5.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, line5.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLineNoAttachment5 = line5.getDetailLines().get("N/A");
assertEquals(3, detailedLineNoAttachment5.getLineItems().get(0).getNumberOfTasks());
assertEquals(3, detailedLineNoAttachment5.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment5.getLineItems().get(2).getNumberOfTasks());
assertEquals(5, detailedLineNoAttachment5.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment5.getLineItems().get(4).getNumberOfTasks());
}
@Test @Test
public void testEachItemOfDetailedClassificationReportNotInWorkingDays() throws InvalidArgumentException { public void testEachItemOfDetailedClassificationReportNotInWorkingDays() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
DetailedClassificationReport report = taskMonitorService.getDetailedClassificationReport(workbasketIds, states, DetailedClassificationReport report = taskMonitorService.getDetailedClassificationReport(null, null, null, null,
categories, domains, reportLineItemDefinitions, false); null, null, reportLineItemDefinitions, false);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions)); LOGGER.debug(reportToString(report, reportLineItemDefinitions));
@ -391,14 +588,11 @@ public class ProvideDetailedClassificationReportAccTest {
public void testEachItemOfDetailedClassificationReportWithCategoryFilter() throws InvalidArgumentException { public void testEachItemOfDetailedClassificationReportWithCategoryFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL"); List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
DetailedClassificationReport report = taskMonitorService.getDetailedClassificationReport(workbasketIds, states, DetailedClassificationReport report = taskMonitorService.getDetailedClassificationReport(null, null, categories,
categories, domains, reportLineItemDefinitions); null, null, null, reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions)); LOGGER.debug(reportToString(report, reportLineItemDefinitions));
@ -453,14 +647,11 @@ public class ProvideDetailedClassificationReportAccTest {
public void testEachItemOfDetailedClassificationReportWithDomainFilter() throws InvalidArgumentException { public void testEachItemOfDetailedClassificationReportWithDomainFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A"); List<String> domains = Arrays.asList("DOMAIN_A");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
DetailedClassificationReport report = taskMonitorService.getDetailedClassificationReport(workbasketIds, states, DetailedClassificationReport report = taskMonitorService.getDetailedClassificationReport(null, null, null,
categories, domains, reportLineItemDefinitions); domains, null, null, reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions)); LOGGER.debug(reportToString(report, reportLineItemDefinitions));
@ -558,12 +749,111 @@ public class ProvideDetailedClassificationReportAccTest {
assertEquals(0, detailedLineNoAttachment5.getLineItems().get(4).getNumberOfTasks()); assertEquals(0, detailedLineNoAttachment5.getLineItems().get(4).getNumberOfTasks());
} }
private List<String> generateWorkbasketIds(int amount, int startAt) { @Test
List<String> workbasketIds = new ArrayList<>(); public void testEachItemOfDetailedClassificationReportWithCustomFieldValueFilter() throws InvalidArgumentException {
for (int i = 0; i < amount; i++) { TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
workbasketIds.add(String.format("WBI:%036d", startAt + i));
CustomField customField = CustomField.CUSTOM_1;
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
DetailedClassificationReport report = taskMonitorService.getDetailedClassificationReport(null, null,
null, null, customField, customFieldValues, reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
} }
return workbasketIds;
DetailedReportLine line1 = (DetailedReportLine) report.getReportLines().get("L10000");
assertEquals(4, line1.getLineItems().get(0).getNumberOfTasks());
assertEquals(0, line1.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, line1.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, line1.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, line1.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLine1 = line1.getDetailLines().get("L11000");
assertEquals(1, detailedLine1.getLineItems().get(0).getNumberOfTasks());
assertEquals(0, detailedLine1.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, detailedLine1.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, detailedLine1.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLine1.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLineNoAttachment1 = line1.getDetailLines().get("N/A");
assertEquals(3, detailedLineNoAttachment1.getLineItems().get(0).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment1.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment1.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment1.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment1.getLineItems().get(4).getNumberOfTasks());
DetailedReportLine line2 = (DetailedReportLine) report.getReportLines().get("L20000");
assertEquals(4, line2.getLineItems().get(0).getNumberOfTasks());
assertEquals(1, line2.getLineItems().get(1).getNumberOfTasks());
assertEquals(1, line2.getLineItems().get(2).getNumberOfTasks());
assertEquals(1, line2.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, line2.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLine2 = line2.getDetailLines().get("L22000");
assertEquals(1, detailedLine2.getLineItems().get(0).getNumberOfTasks());
assertEquals(1, detailedLine2.getLineItems().get(1).getNumberOfTasks());
assertEquals(1, detailedLine2.getLineItems().get(2).getNumberOfTasks());
assertEquals(1, detailedLine2.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLine2.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLineNoAttachment2 = line2.getDetailLines().get("N/A");
assertEquals(3, detailedLineNoAttachment2.getLineItems().get(0).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment2.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment2.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment2.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment2.getLineItems().get(4).getNumberOfTasks());
DetailedReportLine line3 = (DetailedReportLine) report.getReportLines().get("L30000");
assertEquals(1, line3.getLineItems().get(0).getNumberOfTasks());
assertEquals(0, line3.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, line3.getLineItems().get(2).getNumberOfTasks());
assertEquals(1, line3.getLineItems().get(3).getNumberOfTasks());
assertEquals(1, line3.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLine3a = line3.getDetailLines().get("L33000");
assertEquals(0, detailedLine3a.getLineItems().get(0).getNumberOfTasks());
assertEquals(0, detailedLine3a.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, detailedLine3a.getLineItems().get(2).getNumberOfTasks());
assertEquals(1, detailedLine3a.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLine3a.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLineNoAttachment3 = line3.getDetailLines().get("N/A");
assertEquals(1, detailedLineNoAttachment3.getLineItems().get(0).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment3.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment3.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment3.getLineItems().get(3).getNumberOfTasks());
assertEquals(1, detailedLineNoAttachment3.getLineItems().get(4).getNumberOfTasks());
DetailedReportLine line4 = (DetailedReportLine) report.getReportLines().get("L40000");
assertEquals(1, line4.getLineItems().get(0).getNumberOfTasks());
assertEquals(1, line4.getLineItems().get(1).getNumberOfTasks());
assertEquals(2, line4.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, line4.getLineItems().get(3).getNumberOfTasks());
assertEquals(2, line4.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLineNoAttachment4 = line4.getDetailLines().get("N/A");
assertEquals(1, detailedLineNoAttachment4.getLineItems().get(0).getNumberOfTasks());
assertEquals(1, detailedLineNoAttachment4.getLineItems().get(1).getNumberOfTasks());
assertEquals(2, detailedLineNoAttachment4.getLineItems().get(2).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment4.getLineItems().get(3).getNumberOfTasks());
assertEquals(2, detailedLineNoAttachment4.getLineItems().get(4).getNumberOfTasks());
DetailedReportLine line5 = (DetailedReportLine) report.getReportLines().get("L50000");
assertEquals(1, line5.getLineItems().get(0).getNumberOfTasks());
assertEquals(2, line5.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, line5.getLineItems().get(2).getNumberOfTasks());
assertEquals(2, line5.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, line5.getLineItems().get(4).getNumberOfTasks());
ReportLine detailedLineNoAttachment5 = line5.getDetailLines().get("N/A");
assertEquals(1, detailedLineNoAttachment5.getLineItems().get(0).getNumberOfTasks());
assertEquals(2, detailedLineNoAttachment5.getLineItems().get(1).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment5.getLineItems().get(2).getNumberOfTasks());
assertEquals(2, detailedLineNoAttachment5.getLineItems().get(3).getNumberOfTasks());
assertEquals(0, detailedLineNoAttachment5.getLineItems().get(4).getNumberOfTasks());
} }
private List<ReportLineItemDefinition> getListOfReportLineItemDefinitions() { private List<ReportLineItemDefinition> getListOfReportLineItemDefinitions() {

View File

@ -18,6 +18,7 @@ import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import pro.taskana.CustomField;
import pro.taskana.TaskMonitorService; import pro.taskana.TaskMonitorService;
import pro.taskana.TaskState; import pro.taskana.TaskState;
import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaEngine;
@ -64,12 +65,7 @@ public class ProvideWorkbasketLevelReportAccTest {
public void testGetTotalNumbersOfTasksOfWorkbasketLevelReport() throws InvalidArgumentException { public void testGetTotalNumbersOfTasksOfWorkbasketLevelReport() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1); Report report = taskMonitorService.getWorkbasketLevelReport(null, null, null, null, null, null);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
Report report = taskMonitorService.getWorkbasketLevelReport(workbasketIds, states, categories, domains);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report)); LOGGER.debug(reportToString(report));
@ -86,13 +82,9 @@ public class ProvideWorkbasketLevelReportAccTest {
public void testGetWorkbasketLevelReportWithReportLineItemDefinitions() throws InvalidArgumentException { public void testGetWorkbasketLevelReportWithReportLineItemDefinitions() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
Report report = taskMonitorService.getWorkbasketLevelReport(workbasketIds, states, categories, domains, Report report = taskMonitorService.getWorkbasketLevelReport(null, null, null, null, null, null,
reportLineItemDefinitions); reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
@ -132,13 +124,9 @@ public class ProvideWorkbasketLevelReportAccTest {
public void testEachItemOfWorkbasketLevelReport() throws InvalidArgumentException { public void testEachItemOfWorkbasketLevelReport() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getWorkbasketLevelReport(workbasketIds, states, categories, domains, Report report = taskMonitorService.getWorkbasketLevelReport(null, null, null, null, null, null,
reportLineItemDefinitions); reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
@ -171,13 +159,9 @@ public class ProvideWorkbasketLevelReportAccTest {
public void testEachItemOfWorkbasketLevelReportNotInWorkingDays() throws InvalidArgumentException { public void testEachItemOfWorkbasketLevelReportNotInWorkingDays() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getWorkbasketLevelReport(workbasketIds, states, categories, domains, Report report = taskMonitorService.getWorkbasketLevelReport(null, null, null, null, null, null,
reportLineItemDefinitions, false); reportLineItemDefinitions, false);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
@ -206,17 +190,74 @@ public class ProvideWorkbasketLevelReportAccTest {
assertEquals(6, line3.get(4).getNumberOfTasks()); assertEquals(6, line3.get(4).getNumberOfTasks());
} }
@Test
public void testEachItemOfWorkbasketLevelReportWithWorkbasketFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getWorkbasketLevelReport(workbasketIds, null, null, null, null, null,
reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
}
List<ReportLineItem> line1 = report.getReportLines().get("USER_1_1").getLineItems();
assertEquals(13, line1.get(0).getNumberOfTasks());
assertEquals(3, line1.get(1).getNumberOfTasks());
assertEquals(1, line1.get(2).getNumberOfTasks());
assertEquals(1, line1.get(3).getNumberOfTasks());
assertEquals(2, line1.get(4).getNumberOfTasks());
assertEquals(1, report.getReportLines().size());
}
@Test
public void testEachItemOfWorkbasketLevelReportWithStateFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TaskState> states = Arrays.asList(TaskState.READY);
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getWorkbasketLevelReport(null, states, null, null, null, null,
reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
}
List<ReportLineItem> line1 = report.getReportLines().get("USER_1_1").getLineItems();
assertEquals(13, line1.get(0).getNumberOfTasks());
assertEquals(3, line1.get(1).getNumberOfTasks());
assertEquals(1, line1.get(2).getNumberOfTasks());
assertEquals(1, line1.get(3).getNumberOfTasks());
assertEquals(0, line1.get(4).getNumberOfTasks());
List<ReportLineItem> line2 = report.getReportLines().get("USER_1_2").getLineItems();
assertEquals(4, line2.get(0).getNumberOfTasks());
assertEquals(6, line2.get(1).getNumberOfTasks());
assertEquals(3, line2.get(2).getNumberOfTasks());
assertEquals(6, line2.get(3).getNumberOfTasks());
assertEquals(0, line2.get(4).getNumberOfTasks());
List<ReportLineItem> line3 = report.getReportLines().get("USER_1_3").getLineItems();
assertEquals(2, line3.get(0).getNumberOfTasks());
assertEquals(2, line3.get(1).getNumberOfTasks());
assertEquals(0, line3.get(2).getNumberOfTasks());
assertEquals(0, line3.get(3).getNumberOfTasks());
assertEquals(0, line3.get(4).getNumberOfTasks());
}
@Test @Test
public void testEachItemOfWorkbasketLevelReportWithCategoryFilter() throws InvalidArgumentException { public void testEachItemOfWorkbasketLevelReportWithCategoryFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL"); List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A", "DOMAIN_B", "DOMAIN_C");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getWorkbasketLevelReport(workbasketIds, states, categories, domains, Report report = taskMonitorService.getWorkbasketLevelReport(null, null, categories, null, null, null,
reportLineItemDefinitions); reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
@ -251,13 +292,10 @@ public class ProvideWorkbasketLevelReportAccTest {
public void testEachItemOfWorkbasketLevelReportWithDomainFilter() throws InvalidArgumentException { public void testEachItemOfWorkbasketLevelReportWithDomainFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds = generateWorkbasketIds(3, 1);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<String> categories = Arrays.asList("EXTERN", "AUTOMATIC", "MANUAL");
List<String> domains = Arrays.asList("DOMAIN_A"); List<String> domains = Arrays.asList("DOMAIN_A");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions(); List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getWorkbasketLevelReport(workbasketIds, states, categories, domains, Report report = taskMonitorService.getWorkbasketLevelReport(null, null, null, domains, null, null,
reportLineItemDefinitions); reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
@ -286,12 +324,41 @@ public class ProvideWorkbasketLevelReportAccTest {
assertEquals(2, line3.get(4).getNumberOfTasks()); assertEquals(2, line3.get(4).getNumberOfTasks());
} }
private List<String> generateWorkbasketIds(int amount, int startAt) { @Test
List<String> workbasketIds = new ArrayList<>(); public void testEachItemOfWorkbasketLevelReportWithCustomFieldValueFilter() throws InvalidArgumentException {
for (int i = 0; i < amount; i++) { TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
workbasketIds.add(String.format("WBI:%036d", startAt + i));
CustomField customField = CustomField.CUSTOM_1;
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getWorkbasketLevelReport(null, null, null, null,
customField, customFieldValues, reportLineItemDefinitions);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
} }
return workbasketIds;
List<ReportLineItem> line1 = report.getReportLines().get("USER_1_1").getLineItems();
assertEquals(6, line1.get(0).getNumberOfTasks());
assertEquals(1, line1.get(1).getNumberOfTasks());
assertEquals(1, line1.get(2).getNumberOfTasks());
assertEquals(1, line1.get(3).getNumberOfTasks());
assertEquals(1, line1.get(4).getNumberOfTasks());
List<ReportLineItem> line2 = report.getReportLines().get("USER_1_2").getLineItems();
assertEquals(3, line2.get(0).getNumberOfTasks());
assertEquals(2, line2.get(1).getNumberOfTasks());
assertEquals(2, line2.get(2).getNumberOfTasks());
assertEquals(3, line2.get(3).getNumberOfTasks());
assertEquals(1, line2.get(4).getNumberOfTasks());
List<ReportLineItem> line3 = report.getReportLines().get("USER_1_3").getLineItems();
assertEquals(2, line3.get(0).getNumberOfTasks());
assertEquals(1, line3.get(1).getNumberOfTasks());
assertEquals(0, line3.get(2).getNumberOfTasks());
assertEquals(0, line3.get(3).getNumberOfTasks());
assertEquals(1, line3.get(4).getNumberOfTasks());
} }
private List<ReportLineItemDefinition> getListOfReportLineItemDefinitions() { private List<ReportLineItemDefinition> getListOfReportLineItemDefinitions() {

View File

@ -21,9 +21,9 @@ import org.mockito.Mockito;
import org.mockito.MockitoAnnotations; import org.mockito.MockitoAnnotations;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.MockitoJUnitRunner;
import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.CustomField; import pro.taskana.CustomField;
import pro.taskana.TaskState; import pro.taskana.TaskState;
import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.mappings.TaskMonitorMapper; import pro.taskana.mappings.TaskMonitorMapper;
@ -61,6 +61,8 @@ public class TaskMonitorServiceImplTest {
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Arrays.asList("EXTERN"); List<String> categories = Arrays.asList("EXTERN");
List<String> domains = Arrays.asList("DOMAIN_A"); List<String> domains = Arrays.asList("DOMAIN_A");
CustomField customField = CustomField.CUSTOM_1;
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
List<MonitorQueryItem> expectedResult = new ArrayList<>(); List<MonitorQueryItem> expectedResult = new ArrayList<>();
MonitorQueryItem monitorQueryItem = new MonitorQueryItem(); MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
@ -68,16 +70,17 @@ public class TaskMonitorServiceImplTest {
monitorQueryItem.setNumberOfTasks(1); monitorQueryItem.setNumberOfTasks(1);
expectedResult.add(monitorQueryItem); expectedResult.add(monitorQueryItem);
doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfWorkbaskets(workbasketIds, states, doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfWorkbaskets(workbasketIds, states,
categories, domains); categories, domains, customField, customFieldValues);
Report actualResult = cut.getWorkbasketLevelReport(workbasketIds, states, categories, domains); Report actualResult = cut.getWorkbasketLevelReport(workbasketIds, states, categories, domains, customField,
customFieldValues);
verify(taskanaEngineImplMock, times(1)).openConnection(); verify(taskanaEngineImplMock, times(1)).openConnection();
verify(taskanaEngineImplMock, times(2)).getConfiguration(); verify(taskanaEngineImplMock, times(2)).getConfiguration();
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled(); verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays(); verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
verify(taskMonitorMapperMock, times(1)).getTaskCountOfWorkbaskets(any(), any(), any(), verify(taskMonitorMapperMock, times(1)).getTaskCountOfWorkbaskets(any(), any(), any(),
any()); any(), any(), any());
verify(taskanaEngineImplMock, times(1)).returnConnection(); verify(taskanaEngineImplMock, times(1)).returnConnection();
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration); verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
@ -93,6 +96,8 @@ public class TaskMonitorServiceImplTest {
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Arrays.asList("EXTERN"); List<String> categories = Arrays.asList("EXTERN");
List<String> domains = Arrays.asList("DOMAIN_A"); List<String> domains = Arrays.asList("DOMAIN_A");
CustomField customField = CustomField.CUSTOM_1;
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
List<ReportLineItemDefinition> reportLineItemDefinitions = Arrays.asList(new ReportLineItemDefinition(), List<ReportLineItemDefinition> reportLineItemDefinitions = Arrays.asList(new ReportLineItemDefinition(),
new ReportLineItemDefinition()); new ReportLineItemDefinition());
@ -103,16 +108,16 @@ public class TaskMonitorServiceImplTest {
monitorQueryItem.setNumberOfTasks(1); monitorQueryItem.setNumberOfTasks(1);
expectedResult.add(monitorQueryItem); expectedResult.add(monitorQueryItem);
doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfWorkbaskets(workbasketIds, states, doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfWorkbaskets(workbasketIds, states,
categories, domains); categories, domains, customField, customFieldValues);
Report actualResult = cut.getWorkbasketLevelReport(workbasketIds, states, categories, domains, Report actualResult = cut.getWorkbasketLevelReport(workbasketIds, states, categories, domains, customField,
reportLineItemDefinitions); customFieldValues, reportLineItemDefinitions);
verify(taskanaEngineImplMock, times(1)).openConnection(); verify(taskanaEngineImplMock, times(1)).openConnection();
verify(taskanaEngineImplMock, times(2)).getConfiguration(); verify(taskanaEngineImplMock, times(2)).getConfiguration();
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled(); verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays(); verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
verify(taskMonitorMapperMock, times(1)).getTaskCountOfWorkbaskets(any(), any(), any(), any()); verify(taskMonitorMapperMock, times(1)).getTaskCountOfWorkbaskets(any(), any(), any(), any(), any(), any());
verify(taskanaEngineImplMock, times(1)).returnConnection(); verify(taskanaEngineImplMock, times(1)).returnConnection();
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration); verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
@ -135,6 +140,8 @@ public class TaskMonitorServiceImplTest {
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Arrays.asList("EXTERN"); List<String> categories = Arrays.asList("EXTERN");
List<String> domains = Arrays.asList("DOMAIN_A"); List<String> domains = Arrays.asList("DOMAIN_A");
CustomField customField = CustomField.CUSTOM_1;
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
List<MonitorQueryItem> expectedResult = new ArrayList<>(); List<MonitorQueryItem> expectedResult = new ArrayList<>();
MonitorQueryItem monitorQueryItem = new MonitorQueryItem(); MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
@ -142,15 +149,16 @@ public class TaskMonitorServiceImplTest {
monitorQueryItem.setNumberOfTasks(1); monitorQueryItem.setNumberOfTasks(1);
expectedResult.add(monitorQueryItem); expectedResult.add(monitorQueryItem);
doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfCategories(workbasketIds, states, categories, doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfCategories(workbasketIds, states, categories,
domains); domains, customField, customFieldValues);
Report actualResult = cut.getCategoryReport(workbasketIds, states, categories, domains); Report actualResult = cut.getCategoryReport(workbasketIds, states, categories, domains, customField,
customFieldValues);
verify(taskanaEngineImplMock, times(1)).openConnection(); verify(taskanaEngineImplMock, times(1)).openConnection();
verify(taskanaEngineImplMock, times(2)).getConfiguration(); verify(taskanaEngineImplMock, times(2)).getConfiguration();
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled(); verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays(); verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
verify(taskMonitorMapperMock, times(1)).getTaskCountOfCategories(any(), any(), any(), any()); verify(taskMonitorMapperMock, times(1)).getTaskCountOfCategories(any(), any(), any(), any(), any(), any());
verify(taskanaEngineImplMock, times(1)).returnConnection(); verify(taskanaEngineImplMock, times(1)).returnConnection();
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration); verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
@ -165,6 +173,8 @@ public class TaskMonitorServiceImplTest {
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Arrays.asList("EXTERN"); List<String> categories = Arrays.asList("EXTERN");
List<String> domains = Arrays.asList("DOMAIN_A"); List<String> domains = Arrays.asList("DOMAIN_A");
CustomField customField = CustomField.CUSTOM_1;
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
List<ReportLineItemDefinition> reportLineItemDefinitions = Arrays.asList(new ReportLineItemDefinition(), List<ReportLineItemDefinition> reportLineItemDefinitions = Arrays.asList(new ReportLineItemDefinition(),
new ReportLineItemDefinition()); new ReportLineItemDefinition());
@ -175,16 +185,16 @@ public class TaskMonitorServiceImplTest {
monitorQueryItem.setNumberOfTasks(1); monitorQueryItem.setNumberOfTasks(1);
expectedResult.add(monitorQueryItem); expectedResult.add(monitorQueryItem);
doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfCategories(workbasketIds, states, categories, doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfCategories(workbasketIds, states, categories,
domains); domains, customField, customFieldValues);
Report actualResult = cut.getCategoryReport(workbasketIds, states, categories, domains, Report actualResult = cut.getCategoryReport(workbasketIds, states, categories, domains, customField,
reportLineItemDefinitions); customFieldValues, reportLineItemDefinitions);
verify(taskanaEngineImplMock, times(1)).openConnection(); verify(taskanaEngineImplMock, times(1)).openConnection();
verify(taskanaEngineImplMock, times(2)).getConfiguration(); verify(taskanaEngineImplMock, times(2)).getConfiguration();
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled(); verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays(); verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
verify(taskMonitorMapperMock, times(1)).getTaskCountOfCategories(any(), any(), any(), any()); verify(taskMonitorMapperMock, times(1)).getTaskCountOfCategories(any(), any(), any(), any(), any(), any());
verify(taskanaEngineImplMock, times(1)).returnConnection(); verify(taskanaEngineImplMock, times(1)).returnConnection();
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration); verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
@ -200,6 +210,8 @@ public class TaskMonitorServiceImplTest {
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Arrays.asList("EXTERN"); List<String> categories = Arrays.asList("EXTERN");
List<String> domains = Arrays.asList("DOMAIN_A"); List<String> domains = Arrays.asList("DOMAIN_A");
CustomField customField = CustomField.CUSTOM_1;
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
List<MonitorQueryItem> expectedResult = new ArrayList<>(); List<MonitorQueryItem> expectedResult = new ArrayList<>();
MonitorQueryItem monitorQueryItem = new MonitorQueryItem(); MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
@ -207,15 +219,16 @@ public class TaskMonitorServiceImplTest {
monitorQueryItem.setNumberOfTasks(1); monitorQueryItem.setNumberOfTasks(1);
expectedResult.add(monitorQueryItem); expectedResult.add(monitorQueryItem);
doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfClassifications(workbasketIds, states, doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfClassifications(workbasketIds, states,
categories, domains); categories, domains, customField, customFieldValues);
ClassificationReport actualResult = cut.getClassificationReport(workbasketIds, states, categories, domains); ClassificationReport actualResult = cut.getClassificationReport(workbasketIds, states, categories, domains,
customField, customFieldValues);
verify(taskanaEngineImplMock, times(1)).openConnection(); verify(taskanaEngineImplMock, times(1)).openConnection();
verify(taskanaEngineImplMock, times(2)).getConfiguration(); verify(taskanaEngineImplMock, times(2)).getConfiguration();
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled(); verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays(); verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
verify(taskMonitorMapperMock, times(1)).getTaskCountOfClassifications(any(), any(), any(), any()); verify(taskMonitorMapperMock, times(1)).getTaskCountOfClassifications(any(), any(), any(), any(), any(), any());
verify(taskanaEngineImplMock, times(1)).returnConnection(); verify(taskanaEngineImplMock, times(1)).returnConnection();
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration); verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
@ -231,6 +244,9 @@ public class TaskMonitorServiceImplTest {
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Arrays.asList("EXTERN"); List<String> categories = Arrays.asList("EXTERN");
List<String> domains = Arrays.asList("DOMAIN_A"); List<String> domains = Arrays.asList("DOMAIN_A");
CustomField customField = CustomField.CUSTOM_1;
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
List<ReportLineItemDefinition> reportLineItemDefinitions = Arrays.asList(new ReportLineItemDefinition(), List<ReportLineItemDefinition> reportLineItemDefinitions = Arrays.asList(new ReportLineItemDefinition(),
new ReportLineItemDefinition()); new ReportLineItemDefinition());
@ -241,16 +257,16 @@ public class TaskMonitorServiceImplTest {
monitorQueryItem.setNumberOfTasks(1); monitorQueryItem.setNumberOfTasks(1);
expectedResult.add(monitorQueryItem); expectedResult.add(monitorQueryItem);
doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfClassifications(workbasketIds, states, doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfClassifications(workbasketIds, states,
categories, domains); categories, domains, customField, customFieldValues);
ClassificationReport actualResult = cut.getClassificationReport(workbasketIds, states, categories, domains, ClassificationReport actualResult = cut.getClassificationReport(workbasketIds, states, categories, domains,
reportLineItemDefinitions); customField, customFieldValues, reportLineItemDefinitions);
verify(taskanaEngineImplMock, times(1)).openConnection(); verify(taskanaEngineImplMock, times(1)).openConnection();
verify(taskanaEngineImplMock, times(2)).getConfiguration(); verify(taskanaEngineImplMock, times(2)).getConfiguration();
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled(); verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays(); verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
verify(taskMonitorMapperMock, times(1)).getTaskCountOfClassifications(any(), any(), any(), any()); verify(taskMonitorMapperMock, times(1)).getTaskCountOfClassifications(any(), any(), any(), any(), any(), any());
verify(taskanaEngineImplMock, times(1)).returnConnection(); verify(taskanaEngineImplMock, times(1)).returnConnection();
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration); verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
@ -271,6 +287,8 @@ public class TaskMonitorServiceImplTest {
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Arrays.asList("EXTERN"); List<String> categories = Arrays.asList("EXTERN");
List<String> domains = Arrays.asList("DOMAIN_A"); List<String> domains = Arrays.asList("DOMAIN_A");
CustomField customField = CustomField.CUSTOM_1;
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
List<DetailedMonitorQueryItem> expectedResult = new ArrayList<>(); List<DetailedMonitorQueryItem> expectedResult = new ArrayList<>();
DetailedMonitorQueryItem detailedMonitorQueryItem = new DetailedMonitorQueryItem(); DetailedMonitorQueryItem detailedMonitorQueryItem = new DetailedMonitorQueryItem();
@ -279,16 +297,17 @@ public class TaskMonitorServiceImplTest {
detailedMonitorQueryItem.setNumberOfTasks(1); detailedMonitorQueryItem.setNumberOfTasks(1);
expectedResult.add(detailedMonitorQueryItem); expectedResult.add(detailedMonitorQueryItem);
doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfDetailedClassifications(workbasketIds, doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfDetailedClassifications(workbasketIds,
states, categories, domains); states, categories, domains, customField, customFieldValues);
DetailedClassificationReport actualResult = cut.getDetailedClassificationReport(workbasketIds, states, DetailedClassificationReport actualResult = cut.getDetailedClassificationReport(workbasketIds, states,
categories, domains); categories, domains, customField, customFieldValues);
verify(taskanaEngineImplMock, times(1)).openConnection(); verify(taskanaEngineImplMock, times(1)).openConnection();
verify(taskanaEngineImplMock, times(2)).getConfiguration(); verify(taskanaEngineImplMock, times(2)).getConfiguration();
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled(); verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays(); verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
verify(taskMonitorMapperMock, times(1)).getTaskCountOfDetailedClassifications(any(), any(), any(), any()); verify(taskMonitorMapperMock, times(1)).getTaskCountOfDetailedClassifications(any(), any(), any(), any(), any(),
any());
verify(taskanaEngineImplMock, times(1)).returnConnection(); verify(taskanaEngineImplMock, times(1)).returnConnection();
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration); verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
@ -306,6 +325,8 @@ public class TaskMonitorServiceImplTest {
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Arrays.asList("EXTERN"); List<String> categories = Arrays.asList("EXTERN");
List<String> domains = Arrays.asList("DOMAIN_A"); List<String> domains = Arrays.asList("DOMAIN_A");
CustomField customField = CustomField.CUSTOM_1;
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
List<ReportLineItemDefinition> reportLineItemDefinitions = Arrays.asList(new ReportLineItemDefinition(), List<ReportLineItemDefinition> reportLineItemDefinitions = Arrays.asList(new ReportLineItemDefinition(),
new ReportLineItemDefinition()); new ReportLineItemDefinition());
@ -317,16 +338,17 @@ public class TaskMonitorServiceImplTest {
detailedMonitorQueryItem.setNumberOfTasks(1); detailedMonitorQueryItem.setNumberOfTasks(1);
expectedResult.add(detailedMonitorQueryItem); expectedResult.add(detailedMonitorQueryItem);
doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfDetailedClassifications(workbasketIds, doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfDetailedClassifications(workbasketIds,
states, categories, domains); states, categories, domains, customField, customFieldValues);
DetailedClassificationReport actualResult = cut.getDetailedClassificationReport(workbasketIds, states, DetailedClassificationReport actualResult = cut.getDetailedClassificationReport(workbasketIds, states,
categories, domains, reportLineItemDefinitions); categories, domains, customField, customFieldValues, reportLineItemDefinitions);
verify(taskanaEngineImplMock, times(1)).openConnection(); verify(taskanaEngineImplMock, times(1)).openConnection();
verify(taskanaEngineImplMock, times(2)).getConfiguration(); verify(taskanaEngineImplMock, times(2)).getConfiguration();
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled(); verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays(); verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
verify(taskMonitorMapperMock, times(1)).getTaskCountOfDetailedClassifications(any(), any(), any(), any()); verify(taskMonitorMapperMock, times(1)).getTaskCountOfDetailedClassifications(any(), any(), any(), any(), any(),
any());
verify(taskanaEngineImplMock, times(1)).returnConnection(); verify(taskanaEngineImplMock, times(1)).returnConnection();
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration); verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
@ -351,6 +373,8 @@ public class TaskMonitorServiceImplTest {
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Arrays.asList("EXTERN"); List<String> categories = Arrays.asList("EXTERN");
List<String> domains = Arrays.asList("DOMAIN_A"); List<String> domains = Arrays.asList("DOMAIN_A");
CustomField customField = CustomField.CUSTOM_1;
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
List<MonitorQueryItem> expectedResult = new ArrayList<>(); List<MonitorQueryItem> expectedResult = new ArrayList<>();
MonitorQueryItem monitorQueryItem = new MonitorQueryItem(); MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
@ -358,16 +382,18 @@ public class TaskMonitorServiceImplTest {
monitorQueryItem.setNumberOfTasks(1); monitorQueryItem.setNumberOfTasks(1);
expectedResult.add(monitorQueryItem); expectedResult.add(monitorQueryItem);
doReturn(expectedResult).when(taskMonitorMapperMock) doReturn(expectedResult).when(taskMonitorMapperMock)
.getTaskCountOfCustomFieldValues(workbasketIds, states, categories, domains, CustomField.CUSTOM_1); .getTaskCountOfCustomFieldValues(workbasketIds, states, categories, domains, customField,
customFieldValues);
Report actualResult = cut.getCustomFieldValueReport(workbasketIds, states, categories, domains, Report actualResult = cut.getCustomFieldValueReport(workbasketIds, states, categories, domains,
CustomField.CUSTOM_1); customField, customFieldValues);
verify(taskanaEngineImplMock, times(1)).openConnection(); verify(taskanaEngineImplMock, times(1)).openConnection();
verify(taskanaEngineImplMock, times(2)).getConfiguration(); verify(taskanaEngineImplMock, times(2)).getConfiguration();
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled(); verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays(); verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
verify(taskMonitorMapperMock, times(1)).getTaskCountOfCustomFieldValues(any(), any(), any(), any(), any()); verify(taskMonitorMapperMock, times(1)).getTaskCountOfCustomFieldValues(any(), any(), any(), any(), any(),
any());
verify(taskanaEngineImplMock, times(1)).returnConnection(); verify(taskanaEngineImplMock, times(1)).returnConnection();
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration); verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
@ -382,6 +408,8 @@ public class TaskMonitorServiceImplTest {
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Arrays.asList("EXTERN"); List<String> categories = Arrays.asList("EXTERN");
List<String> domains = Arrays.asList("DOMAIN_A"); List<String> domains = Arrays.asList("DOMAIN_A");
CustomField customField = CustomField.CUSTOM_1;
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
List<ReportLineItemDefinition> reportLineItemDefinitions = Arrays.asList(new ReportLineItemDefinition(), List<ReportLineItemDefinition> reportLineItemDefinitions = Arrays.asList(new ReportLineItemDefinition(),
new ReportLineItemDefinition()); new ReportLineItemDefinition());
@ -392,17 +420,18 @@ public class TaskMonitorServiceImplTest {
monitorQueryItem.setNumberOfTasks(1); monitorQueryItem.setNumberOfTasks(1);
expectedResult.add(monitorQueryItem); expectedResult.add(monitorQueryItem);
doReturn(expectedResult).when(taskMonitorMapperMock) doReturn(expectedResult).when(taskMonitorMapperMock)
.getTaskCountOfCustomFieldValues(workbasketIds, states, categories, domains, CustomField.CUSTOM_1); .getTaskCountOfCustomFieldValues(workbasketIds, states, categories, domains, customField,
customFieldValues);
Report actualResult = cut.getCustomFieldValueReport(workbasketIds, states, categories, domains, Report actualResult = cut.getCustomFieldValueReport(workbasketIds, states, categories, domains,
CustomField.CUSTOM_1, reportLineItemDefinitions); customField, customFieldValues, reportLineItemDefinitions);
verify(taskanaEngineImplMock, times(1)).openConnection(); verify(taskanaEngineImplMock, times(1)).openConnection();
verify(taskanaEngineImplMock, times(2)).getConfiguration(); verify(taskanaEngineImplMock, times(2)).getConfiguration();
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled(); verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays(); verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
verify(taskMonitorMapperMock, times(1)) verify(taskMonitorMapperMock, times(1))
.getTaskCountOfCustomFieldValues(any(), any(), any(), any(), any()); .getTaskCountOfCustomFieldValues(any(), any(), any(), any(), any(), any());
verify(taskanaEngineImplMock, times(1)).returnConnection(); verify(taskanaEngineImplMock, times(1)).returnConnection();
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration); verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
@ -419,6 +448,8 @@ public class TaskMonitorServiceImplTest {
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Arrays.asList("EXTERN"); List<String> categories = Arrays.asList("EXTERN");
List<String> domains = Arrays.asList("DOMAIN_A"); List<String> domains = Arrays.asList("DOMAIN_A");
CustomField customField = CustomField.CUSTOM_1;
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
List<ReportLineItemDefinition> reportLineItemDefinitions = Arrays.asList(new ReportLineItemDefinition(), List<ReportLineItemDefinition> reportLineItemDefinitions = Arrays.asList(new ReportLineItemDefinition(),
new ReportLineItemDefinition()); new ReportLineItemDefinition());
@ -430,17 +461,17 @@ public class TaskMonitorServiceImplTest {
List<String> expectedResult = Arrays.asList("TKI:000000000000000000000000000000000001"); List<String> expectedResult = Arrays.asList("TKI:000000000000000000000000000000000001");
doReturn(expectedResult).when(taskMonitorMapperMock).getTaskIdsOfCategoriesBySelectedItems(workbasketIds, doReturn(expectedResult).when(taskMonitorMapperMock).getTaskIdsOfCategoriesBySelectedItems(workbasketIds,
states, categories, domains, selectedItems); states, categories, domains, customField, customFieldValues, selectedItems);
List<String> actualResult = cut.getTaskIdsOfCategoryReportLineItems(workbasketIds, states, categories, domains, List<String> actualResult = cut.getTaskIdsOfCategoryReportLineItems(workbasketIds, states, categories, domains,
reportLineItemDefinitions, true, selectedItems); customField, customFieldValues, reportLineItemDefinitions, selectedItems);
verify(taskanaEngineImplMock, times(1)).openConnection(); verify(taskanaEngineImplMock, times(1)).openConnection();
verify(taskanaEngineImplMock, times(2)).getConfiguration(); verify(taskanaEngineImplMock, times(2)).getConfiguration();
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled(); verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays(); verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
verify(taskMonitorMapperMock, times(1)) verify(taskMonitorMapperMock, times(1))
.getTaskIdsOfCategoriesBySelectedItems(any(), any(), any(), any(), any()); .getTaskIdsOfCategoriesBySelectedItems(any(), any(), any(), any(), any(), any(), any());
verify(taskanaEngineImplMock, times(1)).returnConnection(); verify(taskanaEngineImplMock, times(1)).returnConnection();
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration); verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);