TSK-354: replaced all existing reports with new report structure
TSK-354: replaced WorkbasketLevelReport with new report structure TSK-354: replaced DetailedClassificationReport with new report stucture TSK-354: replaced CategoryReport with new report structure TSK-354 replaced ClassificationReport with new report structure TSK-354: replaced CustomFieldValueReport with new report structure TSK-354: cleanup TSK-354: fixed checkstyle
This commit is contained in:
parent
41719b0d76
commit
8e61e8c4dd
|
@ -3,11 +3,13 @@ package pro.taskana;
|
|||
import java.util.List;
|
||||
|
||||
import pro.taskana.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.impl.ClassificationReport;
|
||||
import pro.taskana.impl.DetailedClassificationReport;
|
||||
import pro.taskana.impl.Report;
|
||||
import pro.taskana.impl.ReportLineItemDefinition;
|
||||
import pro.taskana.impl.SelectedItem;
|
||||
import pro.taskana.impl.report.impl.CategoryReport;
|
||||
import pro.taskana.impl.report.impl.ClassificationReport;
|
||||
import pro.taskana.impl.report.impl.CustomFieldValueReport;
|
||||
import pro.taskana.impl.report.impl.DetailedClassificationReport;
|
||||
import pro.taskana.impl.report.impl.TimeIntervalColumnHeader;
|
||||
import pro.taskana.impl.report.impl.WorkbasketLevelReport;
|
||||
|
||||
/**
|
||||
* The Task Monitor Service manages operations on tasks regarding the monitoring.
|
||||
|
@ -15,7 +17,7 @@ import pro.taskana.impl.SelectedItem;
|
|||
public interface TaskMonitorService {
|
||||
|
||||
/**
|
||||
* Returns a {@link Report} grouped by workbaskets. The report contains the total numbers of tasks of the respective
|
||||
* Returns a {@link WorkbasketLevelReport} grouped by workbaskets. The report contains the total numbers of tasks of the respective
|
||||
* workbasket as well as the total number of all tasks. If no filter is required, the respective parameter should be
|
||||
* 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.
|
||||
|
@ -38,13 +40,14 @@ public interface TaskMonitorService {
|
|||
* @throws InvalidArgumentException
|
||||
* thrown if DaysToWorkingDaysConverter is initialized with null
|
||||
*/
|
||||
Report getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
|
||||
List<String> domains, CustomField customField, List<String> customFieldValues) throws InvalidArgumentException;
|
||||
WorkbasketLevelReport getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, 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 WorkbasketLevelReport} grouped by workbaskets. For each workbasket the report contains the total number of
|
||||
* tasks and the number of tasks of the respective cluster that are specified by the
|
||||
* {@link ReportLineItemDefinition}s. By default the age of the tasks is counted in working days. Furthermore the
|
||||
* {@link TimeIntervalColumnHeader}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
|
||||
* tasks in this report. 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 =
|
||||
|
@ -65,11 +68,11 @@ public interface TaskMonitorService {
|
|||
* @param customFieldValues
|
||||
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
|
||||
* null for this parameter
|
||||
* @param reportLineItemDefinitions
|
||||
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
|
||||
* @param columnHeaders
|
||||
* a list of columnHeaders that specify the subdivision into different cluster of due dates.
|
||||
* Days in past are represented as negative values and days in the future are represented as positive
|
||||
* values. To avoid tasks are counted multiple times or not be listed in the report, these
|
||||
* reportLineItemDefinitions should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* columnHeaders should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* should represent a single day, lowerLimit and upperLimit have to be equal. The outer cluster of a
|
||||
* report should have open ends. These open ends are represented with Integer.MIN_VALUE and
|
||||
* Integer.MAX_VALUE.
|
||||
|
@ -77,14 +80,14 @@ public interface TaskMonitorService {
|
|||
* @throws InvalidArgumentException
|
||||
* thrown if DaysToWorkingDaysConverter is initialized with null
|
||||
*/
|
||||
Report getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states,
|
||||
WorkbasketLevelReport getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException;
|
||||
List<TimeIntervalColumnHeader> columnHeaders) throws InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Returns a {@link Report} grouped by workbaskets. For each workbasket the report contains the total number of
|
||||
* Returns a {@link WorkbasketLevelReport} grouped by workbaskets. For each workbasket the report contains the total number of
|
||||
* tasks and the number of tasks of the respective cluster that are specified by the
|
||||
* {@link ReportLineItemDefinition}s. It can be specified whether the age of the tasks is counted in days or in
|
||||
* {@link TimeIntervalColumnHeader}s. It can be specified whether the age of the tasks is counted in days or in
|
||||
* working days. Furthermore the report contains a sum line that contains the total numbers of the different
|
||||
* clusters and the total number of all tasks. The tasks of the report are filtered by workbaskets, states,
|
||||
* categories, domains and values of a custom field. If no filter is required, the respective parameter should be
|
||||
|
@ -105,11 +108,11 @@ public interface TaskMonitorService {
|
|||
* @param customFieldValues
|
||||
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
|
||||
* null for this parameter
|
||||
* @param reportLineItemDefinitions
|
||||
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
|
||||
* @param columnHeaders
|
||||
* a list of columnHeaders that specify the subdivision into different cluster of due dates.
|
||||
* Days in past are represented as negative values and days in the future are represented as positive
|
||||
* values. To avoid tasks are counted multiple times or not be listed in the report, these
|
||||
* reportLineItemDefinitions should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* columnHeaders should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* should represent a single day, lowerLimit and upperLimit have to be equal. The outer cluster of a
|
||||
* report should have open ends. These open ends are represented with Integer.MIN_VALUE and
|
||||
* Integer.MAX_VALUE.
|
||||
|
@ -120,13 +123,13 @@ public interface TaskMonitorService {
|
|||
* @throws InvalidArgumentException
|
||||
* thrown if DaysToWorkingDaysConverter is initialized with null
|
||||
*/
|
||||
Report getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states,
|
||||
WorkbasketLevelReport getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
|
||||
List<TimeIntervalColumnHeader> columnHeaders, 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 CategoryReport} grouped by categories. The report contains the total numbers of tasks of the respective
|
||||
* category as well as the total number of all tasks. The tasks of the report are filtered by workbaskets, states,
|
||||
* 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.
|
||||
|
@ -149,12 +152,12 @@ public interface TaskMonitorService {
|
|||
* @throws InvalidArgumentException
|
||||
* thrown if DaysToWorkingDaysConverter is initialized with null
|
||||
*/
|
||||
Report getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
|
||||
CategoryReport getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
|
||||
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
|
||||
* and the number of tasks of the respective cluster that are specified by the {@link ReportLineItemDefinition}s. By
|
||||
* Returns a {@link CategoryReport} 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 TimeIntervalColumnHeader}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 tasks in this report. The tasks of the
|
||||
* report are filtered by workbaskets, states, categories, domains and values of a custom field. If no filter is
|
||||
|
@ -175,11 +178,11 @@ public interface TaskMonitorService {
|
|||
* @param customFieldValues
|
||||
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
|
||||
* null for this parameter
|
||||
* @param reportLineItemDefinitions
|
||||
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
|
||||
* @param columnHeaders
|
||||
* a list of columnHeaders that specify the subdivision into different cluster of due dates.
|
||||
* Days in past are represented as negative values and days in the future are represented as positive
|
||||
* values. To avoid tasks are counted multiple times or not be listed in the report, these
|
||||
* reportLineItemDefinitions should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* columnHeaders should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* should represent a single day, lowerLimit and upperLimit have to be equal. The outer cluster of a
|
||||
* report should have open ends. These open ends are represented with Integer.MIN_VALUE and
|
||||
* Integer.MAX_VALUE.
|
||||
|
@ -187,13 +190,13 @@ public interface TaskMonitorService {
|
|||
* @throws InvalidArgumentException
|
||||
* thrown if DaysToWorkingDaysConverter is initialized with null
|
||||
*/
|
||||
Report getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
|
||||
CategoryReport getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
|
||||
List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException;
|
||||
List<TimeIntervalColumnHeader> columnHeaders) throws InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* Returns a {@link CategoryReport} 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 TimeIntervalColumnHeader}s. It
|
||||
* can be specified whether the age of the tasks is counted in days or in working days. Furthermore the report
|
||||
* contains a sum line that contains the total numbers of the different clusters and the total number of all tasks.
|
||||
* The tasks of the report are filtered by workbaskets, states, categories, domains and values of a custom field. If
|
||||
|
@ -215,11 +218,11 @@ public interface TaskMonitorService {
|
|||
* @param customFieldValues
|
||||
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
|
||||
* null for this parameter
|
||||
* @param reportLineItemDefinitions
|
||||
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
|
||||
* @param columnHeaders
|
||||
* a list of columnHeaders that specify the subdivision into different cluster of due dates.
|
||||
* Days in past are represented as negative values and days in the future are represented as positive
|
||||
* values. To avoid tasks are counted multiple times or not be listed in the report, these
|
||||
* reportLineItemDefinitions should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* columnHeaders should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* should represent a single day, lowerLimit and upperLimit have to be equal. The outer cluster of a
|
||||
* report should have open ends. These open ends are represented with Integer.MIN_VALUE and
|
||||
* Integer.MAX_VALUE.
|
||||
|
@ -230,13 +233,13 @@ public interface TaskMonitorService {
|
|||
* @throws InvalidArgumentException
|
||||
* thrown if DaysToWorkingDaysConverter is initialized with null
|
||||
*/
|
||||
Report getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
|
||||
CategoryReport getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
|
||||
List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
|
||||
List<TimeIntervalColumnHeader> columnHeaders, boolean inWorkingDays)
|
||||
throws InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Returns a {@link Classification} grouped by classifications. The report contains the total numbers of tasks of
|
||||
* Returns a {@link ClassificationReport} 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
|
||||
* 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.
|
||||
|
@ -264,9 +267,9 @@ public interface TaskMonitorService {
|
|||
throws InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Returns a {@link Classification} grouped by classifications. For each classification the report contains the
|
||||
* Returns a {@link ClassificationReport} 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
|
||||
* {@link ReportLineItemDefinition}s. By default the age of the tasks is counted in working days. Furthermore the
|
||||
* {@link TimeIntervalColumnHeader}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
|
||||
* tasks in this report. 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 =
|
||||
|
@ -287,11 +290,11 @@ public interface TaskMonitorService {
|
|||
* @param customFieldValues
|
||||
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
|
||||
* null for this parameter
|
||||
* @param reportLineItemDefinitions
|
||||
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
|
||||
* @param columnHeaders
|
||||
* a list of columnHeaders that specify the subdivision into different cluster of due dates.
|
||||
* Days in past are represented as negative values and days in the future are represented as positive
|
||||
* values. To avoid tasks are counted multiple times or not be listed in the report, these
|
||||
* reportLineItemDefinitions should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* columnHeaders should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* should represent a single day, lowerLimit and upperLimit have to be equal. The outer cluster of a
|
||||
* report should have open ends. These open ends are represented with Integer.MIN_VALUE and
|
||||
* Integer.MAX_VALUE.
|
||||
|
@ -301,12 +304,12 @@ public interface TaskMonitorService {
|
|||
*/
|
||||
ClassificationReport getClassificationReport(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException;
|
||||
List<TimeIntervalColumnHeader> columnHeaders) throws InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Returns a {@link ClassificationReport} grouped by classification. 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
|
||||
* {@link ReportLineItemDefinition}s. It can be specified whether the age of the tasks is counted in days or in
|
||||
* {@link TimeIntervalColumnHeader}s. It can be specified whether the age of the tasks is counted in days or in
|
||||
* working days. Furthermore the report contains a sum line that contains the total numbers of the different
|
||||
* clusters and the total number of all tasks. The tasks of the report are filtered by workbaskets, states,
|
||||
* categories, domains and values of a custom field. If no filter is required, the respective parameter should be
|
||||
|
@ -327,11 +330,11 @@ public interface TaskMonitorService {
|
|||
* @param customFieldValues
|
||||
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
|
||||
* null for this parameter
|
||||
* @param reportLineItemDefinitions
|
||||
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
|
||||
* @param columnHeaders
|
||||
* a list of columnHeaders that specify the subdivision into different cluster of due dates.
|
||||
* Days in past are represented as negative values and days in the future are represented as positive
|
||||
* values. To avoid tasks are counted multiple times or not be listed in the report, these
|
||||
* reportLineItemDefinitions should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* columnHeaders should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* should represent a single day, lowerLimit and upperLimit have to be equal. The outer cluster of a
|
||||
* report should have open ends. These open ends are represented with Integer.MIN_VALUE and
|
||||
* Integer.MAX_VALUE.
|
||||
|
@ -344,7 +347,7 @@ public interface TaskMonitorService {
|
|||
*/
|
||||
ClassificationReport getClassificationReport(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
|
||||
List<TimeIntervalColumnHeader> columnHeaders, boolean inWorkingDays)
|
||||
throws InvalidArgumentException;
|
||||
|
||||
/**
|
||||
|
@ -379,7 +382,7 @@ public interface TaskMonitorService {
|
|||
/**
|
||||
* Returns a {@link DetailedClassificationReport}. 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
|
||||
* {@link ReportLineItemDefinition}s. By default the age of the tasks is counted in working days. Each ReportLine
|
||||
* {@link TimeIntervalColumnHeader}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
|
||||
* 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, domains and
|
||||
|
@ -401,11 +404,11 @@ public interface TaskMonitorService {
|
|||
* @param customFieldValues
|
||||
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
|
||||
* null for this parameter
|
||||
* @param reportLineItemDefinitions
|
||||
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
|
||||
* @param columnHeaders
|
||||
* a list of columnHeaders that specify the subdivision into different cluster of due dates.
|
||||
* Days in past are represented as negative values and days in the future are represented as positive
|
||||
* values. To avoid tasks are counted multiple times or not be listed in the report, these
|
||||
* reportLineItemDefinitions should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* columnHeaders should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* should represent a single day, lowerLimit and upperLimit have to be equal. The outer cluster of a
|
||||
* report should have open ends. These open ends are represented with Integer.MIN_VALUE and
|
||||
* Integer.MAX_VALUE.
|
||||
|
@ -415,12 +418,12 @@ public interface TaskMonitorService {
|
|||
*/
|
||||
DetailedClassificationReport getDetailedClassificationReport(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException;
|
||||
List<TimeIntervalColumnHeader> columnHeaders) throws InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Returns a {@link DetailedClassificationReport}. 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
|
||||
* {@link ReportLineItemDefinition}s. It can be specified whether the age of the tasks is counted in days or in
|
||||
* {@link TimeIntervalColumnHeader}s. It can be specified whether the age of the tasks is counted in days or in
|
||||
* 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
|
||||
* different clusters and the total number of all tasks. The tasks of the report are filtered by workbaskets,
|
||||
|
@ -442,11 +445,11 @@ public interface TaskMonitorService {
|
|||
* @param customFieldValues
|
||||
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
|
||||
* null for this parameter
|
||||
* @param reportLineItemDefinitions
|
||||
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
|
||||
* @param columnHeaders
|
||||
* a list of columnHeaders that specify the subdivision into different cluster of due dates.
|
||||
* Days in past are represented as negative values and days in the future are represented as positive
|
||||
* values. To avoid tasks are counted multiple times or not be listed in the report, these
|
||||
* reportLineItemDefinitions should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* columnHeaders should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* should represent a single day, lowerLimit and upperLimit have to be equal. The outer cluster of a
|
||||
* report should have open ends. These open ends are represented with Integer.MIN_VALUE and
|
||||
* Integer.MAX_VALUE.
|
||||
|
@ -459,11 +462,11 @@ public interface TaskMonitorService {
|
|||
*/
|
||||
DetailedClassificationReport getDetailedClassificationReport(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
|
||||
List<TimeIntervalColumnHeader> columnHeaders, 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 CustomFieldValueReport} 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
|
||||
* 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.
|
||||
|
@ -485,13 +488,14 @@ public interface TaskMonitorService {
|
|||
* @throws InvalidArgumentException
|
||||
* thrown if customField is null
|
||||
*/
|
||||
Report getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
|
||||
List<String> domains, CustomField customField, List<String> customFieldValues) throws InvalidArgumentException;
|
||||
CustomFieldValueReport getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, 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 CustomFieldValueReport} 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
|
||||
* specified by the {@link ReportLineItemDefinition}s. By default the age of the tasks is counted in working days.
|
||||
* specified by the {@link TimeIntervalColumnHeader}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 tasks in this report. 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
|
||||
|
@ -511,11 +515,11 @@ public interface TaskMonitorService {
|
|||
* @param customFieldValues
|
||||
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
|
||||
* null for this parameter
|
||||
* @param reportLineItemDefinitions
|
||||
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
|
||||
* @param columnHeaders
|
||||
* a list of columnHeaders that specify the subdivision into different cluster of due dates.
|
||||
* Days in past are represented as negative values and days in the future are represented as positive
|
||||
* values. To avoid tasks are counted multiple times or not be listed in the report, these
|
||||
* reportLineItemDefinitions should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* columnHeaders should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* should represent a single day, lowerLimit and upperLimit have to be equal. The outer cluster of a
|
||||
* report should have open ends. These open ends are represented with Integer.MIN_VALUE and
|
||||
* Integer.MAX_VALUE.
|
||||
|
@ -523,14 +527,14 @@ public interface TaskMonitorService {
|
|||
* @throws InvalidArgumentException
|
||||
* thrown if customField is null
|
||||
*/
|
||||
Report getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
|
||||
List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException;
|
||||
CustomFieldValueReport getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<TimeIntervalColumnHeader> columnHeaders) throws InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Returns a {@link Report} grouped by the value of a certain {@link CustomField}. For each value of the custom
|
||||
* Returns a {@link CustomFieldValueReport} 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
|
||||
* specified by the {@link ReportLineItemDefinition}s. It can be specified whether the age of the tasks is counted
|
||||
* specified by the {@link TimeIntervalColumnHeader}s. It can be specified whether the age of the tasks is counted
|
||||
* in days or in working days. Furthermore the report contains a sum line that contains the total numbers of the
|
||||
* different clusters and the total number of all tasks. The tasks of the report are filtered by workbaskets,
|
||||
* states, categories, domains and values of a custom field. If no filter is required, the respective parameter
|
||||
|
@ -550,11 +554,11 @@ public interface TaskMonitorService {
|
|||
* @param customFieldValues
|
||||
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
|
||||
* null for this parameter
|
||||
* @param reportLineItemDefinitions
|
||||
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
|
||||
* @param columnHeaders
|
||||
* a list of columnHeaders that specify the subdivision into different cluster of due dates.
|
||||
* Days in past are represented as negative values and days in the future are represented as positive
|
||||
* values. To avoid tasks are counted multiple times or not be listed in the report, these
|
||||
* reportLineItemDefinitions should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* columnHeaders should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* should represent a single day, lowerLimit and upperLimit have to be equal. The outer cluster of a
|
||||
* report should have open ends. These open ends are represented with Integer.MIN_VALUE and
|
||||
* Integer.MAX_VALUE.
|
||||
|
@ -565,16 +569,17 @@ public interface TaskMonitorService {
|
|||
* @throws InvalidArgumentException
|
||||
* thrown if customField is null
|
||||
*/
|
||||
Report getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
|
||||
CustomFieldValueReport getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories,
|
||||
List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
|
||||
List<TimeIntervalColumnHeader> columnHeaders, 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
|
||||
* 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.
|
||||
* Returns a list of all task ids in the selected items of a {@link pro.taskana.impl.report.Report}.
|
||||
* By default the age of the tasks is counted in working days. The tasks of the report are filtered by workbaskets,
|
||||
* states, categories, domains and values of a custom field. If no filter is required, the respective parameter
|
||||
* should be null. Tasks with Timestamp DUE = null are not considered.
|
||||
*
|
||||
* @param workbasketIds
|
||||
* a list of workbasket ids objects to filter by workbaskets. To omit this filter, use null for this
|
||||
|
@ -591,11 +596,11 @@ public interface TaskMonitorService {
|
|||
* @param customFieldValues
|
||||
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
|
||||
* null for this parameter
|
||||
* @param reportLineItemDefinitions
|
||||
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
|
||||
* @param columnHeaders
|
||||
* a list of columnHeaders that specify the subdivision into different cluster of due dates.
|
||||
* Days in past are represented as negative values and days in the future are represented as positive
|
||||
* values. To avoid tasks are counted multiple times or not be listed in the report, these
|
||||
* reportLineItemDefinitions should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* columnHeaders should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* should represent a single day, lowerLimit and upperLimit have to be equal. The outer cluster of a
|
||||
* report should have open ends. These open ends are represented with Integer.MIN_VALUE and
|
||||
* Integer.MAX_VALUE.
|
||||
|
@ -603,18 +608,18 @@ public interface TaskMonitorService {
|
|||
* a list of {@link SelectedItem}s that are selected from the report whose task ids should be determined.
|
||||
* @return the list of task ids
|
||||
* @throws InvalidArgumentException
|
||||
* thrown if reportLineItemDefinitions is null or if selectedItems is empty or null
|
||||
* thrown if columnHeaders is null or if selectedItems is empty or null
|
||||
*/
|
||||
List<String> getTaskIdsOfCategoryReportLineItems(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions, List<SelectedItem> selectedItems)
|
||||
List<TimeIntervalColumnHeader> columnHeaders, 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
|
||||
* 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.
|
||||
* Returns a list of all task ids in the selected items of a {@link pro.taskana.impl.report.Report}.
|
||||
* By default the age of the tasks is counted in working days. The tasks of the report are filtered by workbaskets,
|
||||
* states, categories, domains and values of a custom field. If no filter is required, the respective parameter
|
||||
* should be null. Tasks with Timestamp DUE = null are not considered.
|
||||
*
|
||||
* @param workbasketIds
|
||||
* a list of workbasket ids objects to filter by workbaskets. To omit this filter, use null for this
|
||||
|
@ -631,11 +636,11 @@ public interface TaskMonitorService {
|
|||
* @param customFieldValues
|
||||
* a list of custom field values to filter by the values of the custom field. To omit this filter, use
|
||||
* null for this parameter
|
||||
* @param reportLineItemDefinitions
|
||||
* a list of reportLineItemDefinitions that specify the subdivision into different cluster of due dates.
|
||||
* @param columnHeaders
|
||||
* a list of columnHeaders that specify the subdivision into different cluster of due dates.
|
||||
* Days in past are represented as negative values and days in the future are represented as positive
|
||||
* values. To avoid tasks are counted multiple times or not be listed in the report, these
|
||||
* reportLineItemDefinitions should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* columnHeaders should not overlap and should not have gaps. If the ReportLineDefinition
|
||||
* should represent a single day, lowerLimit and upperLimit have to be equal. The outer cluster of a
|
||||
* report should have open ends. These open ends are represented with Integer.MIN_VALUE and
|
||||
* Integer.MAX_VALUE.
|
||||
|
@ -646,11 +651,11 @@ public interface TaskMonitorService {
|
|||
* a list of {@link SelectedItem}s that are selected from the report whose task ids should be determined.
|
||||
* @return the list of task ids
|
||||
* @throws InvalidArgumentException
|
||||
* thrown if reportLineItemDefinitions is null or if selectedItems is empty or null
|
||||
* thrown if columnHeaders is null or if selectedItems is empty or null
|
||||
*/
|
||||
List<String> getTaskIdsOfCategoryReportLineItems(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays,
|
||||
List<TimeIntervalColumnHeader> columnHeaders, boolean inWorkingDays,
|
||||
List<SelectedItem> selectedItems) throws InvalidArgumentException;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
package pro.taskana.impl;
|
||||
|
||||
/**
|
||||
* The ClassificationReport extends the Report. The {@link ReportLine}s of the ClassificationReport are grouped by
|
||||
* classifications.
|
||||
*/
|
||||
public class ClassificationReport extends Report {
|
||||
|
||||
public ClassificationReport() {
|
||||
super();
|
||||
}
|
||||
|
||||
}
|
|
@ -12,14 +12,15 @@ import java.util.List;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import pro.taskana.impl.report.impl.TimeIntervalColumnHeader;
|
||||
import pro.taskana.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.impl.util.LoggerUtils;
|
||||
|
||||
/**
|
||||
* The DaysToWorkingDaysConverter provides a method to convert an age in days into an age in working days. Before the
|
||||
* method convertDaysToWorkingDays() can be used, the DaysToWorkingDaysConverter has to be initialized. For a list of
|
||||
* {@link ReportLineItemDefinition}s the converter creates a "table" with integer that represents the age in days from
|
||||
* the largest lower limit until the smallest upper limit of the reportLineItemDefinitions. This table is valid for a
|
||||
* {@link TimeIntervalColumnHeader}s the converter creates a "table" with integer that represents the age in days from
|
||||
* the largest lower limit until the smallest upper limit of the timeIntervalColumnHeaders. This table is valid for a
|
||||
* whole day until the converter is initialized with bigger limits.
|
||||
*/
|
||||
public final class DaysToWorkingDaysConverter {
|
||||
|
@ -33,61 +34,61 @@ public final class DaysToWorkingDaysConverter {
|
|||
private static boolean germanHolidaysEnabled;
|
||||
private static List<LocalDate> customHolidays;
|
||||
|
||||
private DaysToWorkingDaysConverter(List<ReportLineItemDefinition> reportLineItemDefinitions,
|
||||
private DaysToWorkingDaysConverter(List<TimeIntervalColumnHeader> columnHeaders,
|
||||
Instant referenceDate) {
|
||||
easterSunday = getEasterSunday(LocalDateTime.ofInstant(referenceDate, ZoneId.systemDefault()).getYear());
|
||||
dateCreated = referenceDate;
|
||||
positiveDaysToWorkingDays = generatePositiveDaysToWorkingDays(reportLineItemDefinitions, referenceDate);
|
||||
negativeDaysToWorkingDays = generateNegativeDaysToWorkingDays(reportLineItemDefinitions, referenceDate);
|
||||
positiveDaysToWorkingDays = generatePositiveDaysToWorkingDays(columnHeaders, referenceDate);
|
||||
negativeDaysToWorkingDays = generateNegativeDaysToWorkingDays(columnHeaders, referenceDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the DaysToWorkingDaysConverter for a list of {@link ReportLineItemDefinition}s and the current day. A
|
||||
* Initializes the DaysToWorkingDaysConverter for a list of {@link TimeIntervalColumnHeader}s and the current day. A
|
||||
* new table is only created if there are bigger limits or the date has changed.
|
||||
*
|
||||
* @param reportLineItemDefinitions
|
||||
* a list of {@link ReportLineItemDefinition}s that determines the size of the table
|
||||
* @param columnHeaders
|
||||
* a list of {@link TimeIntervalColumnHeader}s that determines the size of the table
|
||||
* @return an instance of the DaysToWorkingDaysConverter
|
||||
* @throws InvalidArgumentException
|
||||
* thrown if reportLineItemDefinitions is null
|
||||
* thrown if columnHeaders is null
|
||||
*/
|
||||
public static DaysToWorkingDaysConverter initialize(List<ReportLineItemDefinition> reportLineItemDefinitions)
|
||||
public static DaysToWorkingDaysConverter initialize(List<TimeIntervalColumnHeader> columnHeaders)
|
||||
throws InvalidArgumentException {
|
||||
return initialize(reportLineItemDefinitions, Instant.now());
|
||||
return initialize(columnHeaders, Instant.now());
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the DaysToWorkingDaysConverter for a list of {@link ReportLineItemDefinition}s and a referenceDate. A
|
||||
* Initializes the DaysToWorkingDaysConverter for a list of {@link TimeIntervalColumnHeader}s and a referenceDate. A
|
||||
* new table is only created if there are bigger limits or the date has changed.
|
||||
*
|
||||
* @param reportLineItemDefinitions
|
||||
* a list of {@link ReportLineItemDefinition}s that determines the size of the table
|
||||
* @param columnHeaders
|
||||
* a list of {@link TimeIntervalColumnHeader}s that determines the size of the table
|
||||
* @param referenceDate
|
||||
* a {@link Instant} that represents the current day of the table
|
||||
* @return an instance of the DaysToWorkingDaysConverter
|
||||
* @throws InvalidArgumentException
|
||||
* thrown if reportLineItemDefinitions or referenceDate is null
|
||||
* thrown if columnHeaders or referenceDate is null
|
||||
*/
|
||||
public static DaysToWorkingDaysConverter initialize(List<ReportLineItemDefinition> reportLineItemDefinitions,
|
||||
public static DaysToWorkingDaysConverter initialize(List<TimeIntervalColumnHeader> columnHeaders,
|
||||
Instant referenceDate) throws InvalidArgumentException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Initialize DaysToWorkingDaysConverter with reportLineItemDefinitions: {}",
|
||||
LoggerUtils.listToString(reportLineItemDefinitions));
|
||||
LOGGER.debug("Initialize DaysToWorkingDaysConverter with columnHeaders: {}",
|
||||
LoggerUtils.listToString(columnHeaders));
|
||||
}
|
||||
if (reportLineItemDefinitions == null) {
|
||||
throw new InvalidArgumentException("ReportLineItemDefinitions can´t be used as NULL-Parameter");
|
||||
if (columnHeaders == null) {
|
||||
throw new InvalidArgumentException("TimeIntervalColumnHeaders can´t be used as NULL-Parameter");
|
||||
}
|
||||
if (referenceDate == null) {
|
||||
throw new InvalidArgumentException("ReferenceDate can´t be used as NULL-Parameter");
|
||||
}
|
||||
int largesLowerLimit = getLargestLowerLimit(reportLineItemDefinitions);
|
||||
int smallestUpperLimit = getSmallestUpperLimit(reportLineItemDefinitions);
|
||||
int largesLowerLimit = getLargestLowerLimit(columnHeaders);
|
||||
int smallestUpperLimit = getSmallestUpperLimit(columnHeaders);
|
||||
if (instance == null
|
||||
|| !positiveDaysToWorkingDays.contains(largesLowerLimit)
|
||||
|| !negativeDaysToWorkingDays.contains(smallestUpperLimit)
|
||||
|| !dateCreated.truncatedTo(ChronoUnit.DAYS).equals(referenceDate.truncatedTo(ChronoUnit.DAYS))) {
|
||||
|
||||
instance = new DaysToWorkingDaysConverter(reportLineItemDefinitions, referenceDate);
|
||||
instance = new DaysToWorkingDaysConverter(columnHeaders, referenceDate);
|
||||
LOGGER.debug("Create new converter for the values from {} until {} for the date: {}.", largesLowerLimit,
|
||||
smallestUpperLimit, dateCreated);
|
||||
}
|
||||
|
@ -188,8 +189,8 @@ public final class DaysToWorkingDaysConverter {
|
|||
}
|
||||
|
||||
private ArrayList<Integer> generateNegativeDaysToWorkingDays(
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions, Instant referenceDate) {
|
||||
int minUpperLimit = getSmallestUpperLimit(reportLineItemDefinitions);
|
||||
List<TimeIntervalColumnHeader> columnHeaders, Instant referenceDate) {
|
||||
int minUpperLimit = getSmallestUpperLimit(columnHeaders);
|
||||
ArrayList<Integer> daysToWorkingDays = new ArrayList<>();
|
||||
daysToWorkingDays.add(0);
|
||||
int day = -1;
|
||||
|
@ -205,8 +206,8 @@ public final class DaysToWorkingDaysConverter {
|
|||
}
|
||||
|
||||
private ArrayList<Integer> generatePositiveDaysToWorkingDays(
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions, Instant referenceDate) {
|
||||
int maxLowerLimit = getLargestLowerLimit(reportLineItemDefinitions);
|
||||
List<TimeIntervalColumnHeader> columnHeaders, Instant referenceDate) {
|
||||
int maxLowerLimit = getLargestLowerLimit(columnHeaders);
|
||||
ArrayList<Integer> daysToWorkingDays = new ArrayList<>();
|
||||
daysToWorkingDays.add(0);
|
||||
|
||||
|
@ -222,21 +223,21 @@ public final class DaysToWorkingDaysConverter {
|
|||
return daysToWorkingDays;
|
||||
}
|
||||
|
||||
private static int getSmallestUpperLimit(List<ReportLineItemDefinition> reportLineItemDefinitions) {
|
||||
private static int getSmallestUpperLimit(List<TimeIntervalColumnHeader> columnHeaders) {
|
||||
int smallestUpperLimit = 0;
|
||||
for (ReportLineItemDefinition reportLineItemDefinition : reportLineItemDefinitions) {
|
||||
if (reportLineItemDefinition.getUpperAgeLimit() < smallestUpperLimit) {
|
||||
smallestUpperLimit = reportLineItemDefinition.getUpperAgeLimit();
|
||||
for (TimeIntervalColumnHeader columnHeader : columnHeaders) {
|
||||
if (columnHeader.getUpperAgeLimit() < smallestUpperLimit) {
|
||||
smallestUpperLimit = columnHeader.getUpperAgeLimit();
|
||||
}
|
||||
}
|
||||
return smallestUpperLimit;
|
||||
}
|
||||
|
||||
private static int getLargestLowerLimit(List<ReportLineItemDefinition> reportLineItemDefinitions) {
|
||||
private static int getLargestLowerLimit(List<TimeIntervalColumnHeader> columnHeaders) {
|
||||
int greatestLowerLimit = 0;
|
||||
for (ReportLineItemDefinition reportLineItemDefinition : reportLineItemDefinitions) {
|
||||
if (reportLineItemDefinition.getUpperAgeLimit() > greatestLowerLimit) {
|
||||
greatestLowerLimit = reportLineItemDefinition.getLowerAgeLimit();
|
||||
for (TimeIntervalColumnHeader columnHeader : columnHeaders) {
|
||||
if (columnHeader.getUpperAgeLimit() > greatestLowerLimit) {
|
||||
greatestLowerLimit = columnHeader.getLowerAgeLimit();
|
||||
}
|
||||
}
|
||||
return greatestLowerLimit;
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
package pro.taskana.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pro.taskana.exceptions.InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* The DetailedClassificationReport extends the {@link ClassificationReport}. In contrast to the ClassificationReport
|
||||
* there are DetailedReportLines instead of ReportLines. That means each ReportLine contains an additional list of
|
||||
* ReportLines for the classifications of the attachments of the tasks. The additional addDetailedMonitoringQueryItems
|
||||
* method allows to add {@link DetailedMonitorQueryItem}s to the DetailedClassificationReport.
|
||||
*/
|
||||
public class DetailedClassificationReport extends ClassificationReport {
|
||||
|
||||
public DetailedClassificationReport() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the information of the {@link DetailedMonitorQueryItem}s to the DetailedClassificationReport.
|
||||
*
|
||||
* @param detailedMonitorQueryItems
|
||||
* a list of {@link DetailedMonitorQueryItem} with the information of the database
|
||||
* @param reportLineItemDefinitions
|
||||
* a list of {@link ReportLineItemDefinition}s that is needed to create the {@link ReportLine}s.
|
||||
* @param inWorkingDays
|
||||
* a boolean parameter that specifies whether the age of the tasks should be counted in days or in
|
||||
* working days.
|
||||
* @throws InvalidArgumentException
|
||||
* thrown if reportLineItemDefinitions is null and inWorkingDays is true
|
||||
*/
|
||||
public void addDetailedMonitoringQueryItems(List<DetailedMonitorQueryItem> detailedMonitorQueryItems,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
|
||||
throws InvalidArgumentException {
|
||||
|
||||
DaysToWorkingDaysConverter instance = null;
|
||||
if (inWorkingDays) {
|
||||
instance = DaysToWorkingDaysConverter.initialize(reportLineItemDefinitions);
|
||||
}
|
||||
|
||||
for (DetailedMonitorQueryItem item : detailedMonitorQueryItems) {
|
||||
if (instance != null) {
|
||||
item.setAgeInDays(instance.convertDaysToWorkingDays(item.getAgeInDays()));
|
||||
}
|
||||
if (!this.reportLines.containsKey(item.getKey())) {
|
||||
DetailedReportLine detailedReportLine = new DetailedReportLine();
|
||||
detailedReportLine.create(reportLineItemDefinitions);
|
||||
this.reportLines.put(item.getKey(), detailedReportLine);
|
||||
}
|
||||
DetailedReportLine detailedReportLine = (DetailedReportLine) this.reportLines.get(item.getKey());
|
||||
detailedReportLine.addNumberOfTasks(item, reportLineItemDefinitions);
|
||||
}
|
||||
this.sumLine = createSumLine(reportLineItemDefinitions);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
package pro.taskana.impl;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The DetailedReportLine extends the {@link ReportLine}. In contrast to the ReportLine there is an additional list of
|
||||
* ReportLines for the classifications of the attachments of the tasks.
|
||||
*/
|
||||
public class DetailedReportLine extends ReportLine {
|
||||
|
||||
private Map<String, ReportLine> detailLines;
|
||||
|
||||
public DetailedReportLine() {
|
||||
super();
|
||||
this.detailLines = new LinkedHashMap<>();
|
||||
}
|
||||
|
||||
public Map<String, ReportLine> getDetailLines() {
|
||||
return detailLines;
|
||||
}
|
||||
|
||||
public void setDetailLines(Map<String, ReportLine> reportLines) {
|
||||
this.detailLines = reportLines;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the number of tasks of the {@link DetailedMonitorQueryItem} to the respective {@link ReportLineItem} of this
|
||||
* {@link DetailedReportLine} and and of the suitable sub line.
|
||||
*
|
||||
* @param item
|
||||
* a {@link DetailedMonitorQueryItem} that contains the number of tasks, the age in days of these tasks
|
||||
* and the Classification key of the corresponding attachment.
|
||||
* @param reportLineItemDefinitions
|
||||
* a list of {@link ReportLineItemDefinition}s that is needed to create a sub line if necessary.
|
||||
*/
|
||||
public void addNumberOfTasks(DetailedMonitorQueryItem item,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions) {
|
||||
super.addNumberOfTasks(item);
|
||||
|
||||
if (item.getAttachmentKey() != null) {
|
||||
if (!this.detailLines.containsKey(item.getAttachmentKey())) {
|
||||
ReportLine reportLine = new ReportLine();
|
||||
reportLine.create(reportLineItemDefinitions);
|
||||
this.detailLines.put(item.getAttachmentKey(), reportLine);
|
||||
}
|
||||
this.detailLines.get(item.getAttachmentKey()).addNumberOfTasks(item);
|
||||
} else {
|
||||
if (!this.detailLines.containsKey("N/A")) {
|
||||
ReportLine reportLine = new ReportLine();
|
||||
reportLine.create(reportLineItemDefinitions);
|
||||
this.detailLines.put("N/A", reportLine);
|
||||
}
|
||||
this.detailLines.get("N/A").addNumberOfTasks(item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,102 +0,0 @@
|
|||
package pro.taskana.impl;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import pro.taskana.exceptions.InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* A Report represents a table that consists of {@link ReportLine} objects. The detailLines are the rows of the table
|
||||
* that contains the total number of all tasks and could be optionally subdivided into different sections. The sumLine
|
||||
* contains the sums of all tasks and if the detailLines are subdivided into different sections the sumLine also
|
||||
* contains the number of tasks of the respective section.
|
||||
*/
|
||||
public class Report {
|
||||
|
||||
protected Map<String, ReportLine> reportLines;
|
||||
protected ReportLine sumLine;
|
||||
|
||||
public Report() {
|
||||
this.reportLines = new LinkedHashMap<String, ReportLine>();
|
||||
}
|
||||
|
||||
public Map<String, ReportLine> getReportLines() {
|
||||
return reportLines;
|
||||
}
|
||||
|
||||
public void setReportLines(Map<String, ReportLine> reportLines) {
|
||||
this.reportLines = reportLines;
|
||||
}
|
||||
|
||||
public ReportLine getSumLine() {
|
||||
return sumLine;
|
||||
}
|
||||
|
||||
public void setSumLine(ReportLine sumLine) {
|
||||
this.sumLine = sumLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the information of the {@link MonitorQueryItem}s to the Report.
|
||||
*
|
||||
* @param monitorQueryItems
|
||||
* a list of {@link MonitorQueryItem} with the information of the database
|
||||
* @param reportLineItemDefinitions
|
||||
* a list of {@link ReportLineItemDefinition}s that is needed to create the {@link ReportLine}s.
|
||||
* @param inWorkingDays
|
||||
* a boolean parameter that specifies whether the age of the tasks should be counted in days or in
|
||||
* working days.
|
||||
* @throws InvalidArgumentException
|
||||
* thrown if reportLineItemDefinitions is null and inWorkingDays is true
|
||||
*/
|
||||
public void addMonitoringQueryItems(List<MonitorQueryItem> monitorQueryItems,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
|
||||
throws InvalidArgumentException {
|
||||
DaysToWorkingDaysConverter instance = null;
|
||||
if (inWorkingDays) {
|
||||
instance = DaysToWorkingDaysConverter.initialize(reportLineItemDefinitions);
|
||||
}
|
||||
|
||||
for (MonitorQueryItem item : monitorQueryItems) {
|
||||
if (instance != null) {
|
||||
item.setAgeInDays(instance.convertDaysToWorkingDays(item.getAgeInDays()));
|
||||
}
|
||||
if (!this.reportLines.containsKey(item.getKey())) {
|
||||
ReportLine reportLine = new ReportLine();
|
||||
reportLine.create(reportLineItemDefinitions);
|
||||
this.reportLines.put(item.getKey(), reportLine);
|
||||
}
|
||||
this.reportLines.get(item.getKey()).addNumberOfTasks(item);
|
||||
}
|
||||
|
||||
this.sumLine = createSumLine(reportLineItemDefinitions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the sum line of this {@link Report}.
|
||||
*
|
||||
* @param reportLineItemDefinitions
|
||||
* a list of {@link ReportLineItemDefinition}s that specify the subdivision into different cluster of
|
||||
* ages.
|
||||
* @return a {@link ReportLine} that contains the sums of the different cluster of this {@link Report}.
|
||||
*/
|
||||
protected ReportLine createSumLine(List<ReportLineItemDefinition> reportLineItemDefinitions) {
|
||||
ReportLine sumLine = new ReportLine();
|
||||
sumLine.create(reportLineItemDefinitions);
|
||||
int totalNumberOfTasks = 0;
|
||||
for (ReportLine reportLine : this.reportLines.values()) {
|
||||
Iterator<ReportLineItem> reportLineItemIterator = reportLine.getLineItems().iterator();
|
||||
Iterator<ReportLineItem> sumLineItemIterator = sumLine.getLineItems().iterator();
|
||||
while (reportLineItemIterator.hasNext() && sumLineItemIterator.hasNext()) {
|
||||
int numberOfTasks = reportLineItemIterator.next().getNumberOfTasks();
|
||||
sumLineItemIterator.next().addNumberOfTasks(numberOfTasks);
|
||||
}
|
||||
totalNumberOfTasks += reportLine.getTotalNumberOfTasks();
|
||||
}
|
||||
sumLine.setTotalNumberOfTasks(totalNumberOfTasks);
|
||||
return sumLine;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
package pro.taskana.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Each ReportLine consists of a list of {@link ReportLineItem} objects and the number of all tasks of this ReportLine.
|
||||
*/
|
||||
public class ReportLine {
|
||||
|
||||
protected List<ReportLineItem> lineItems;
|
||||
protected int totalNumberOfTasks;
|
||||
|
||||
public ReportLine() {
|
||||
this.lineItems = new ArrayList<>();
|
||||
this.totalNumberOfTasks = 0;
|
||||
}
|
||||
|
||||
public List<ReportLineItem> getLineItems() {
|
||||
return lineItems;
|
||||
}
|
||||
|
||||
public void setLineItems(List<ReportLineItem> lineItems) {
|
||||
this.lineItems = lineItems;
|
||||
}
|
||||
|
||||
public int getTotalNumberOfTasks() {
|
||||
return totalNumberOfTasks;
|
||||
}
|
||||
|
||||
public void setTotalNumberOfTasks(int totalNumberOfTasks) {
|
||||
this.totalNumberOfTasks = totalNumberOfTasks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a list of {@link ReportLineItem}s for this {@link ReportLine} by using the list of
|
||||
* {@link ReportLineItemDefinition}s.
|
||||
*
|
||||
* @param reportLineItemDefinitions
|
||||
* a list of {@link ReportLineItemDefinition}s that specify the subdivision into different cluster of
|
||||
* ages.
|
||||
*/
|
||||
public void create(List<ReportLineItemDefinition> reportLineItemDefinitions) {
|
||||
if (reportLineItemDefinitions != null) {
|
||||
for (ReportLineItemDefinition reportLineItemDefinition : reportLineItemDefinitions) {
|
||||
ReportLineItem reportLineItem = new ReportLineItem();
|
||||
reportLineItem.setReportLineItemDefinition(reportLineItemDefinition);
|
||||
this.getLineItems().add(reportLineItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the number of tasks of the {@link MonitorQueryItem} to the respective {@link ReportLineItem}.
|
||||
*
|
||||
* @param item
|
||||
* a {@link MonitorQueryItem} that contains the number of tasks and the age in days of these tasks.
|
||||
*/
|
||||
public void addNumberOfTasks(MonitorQueryItem item) {
|
||||
this.totalNumberOfTasks += item.getNumberOfTasks();
|
||||
for (ReportLineItem reportLineItem : lineItems) {
|
||||
int lowerAgeLimit = reportLineItem.getReportLineItemDefinition().getLowerAgeLimit();
|
||||
int upperAgeLimit = reportLineItem.getReportLineItemDefinition().getUpperAgeLimit();
|
||||
if (lowerAgeLimit <= item.getAgeInDays() && upperAgeLimit >= item.getAgeInDays()) {
|
||||
reportLineItem.addNumberOfTasks(item.getNumberOfTasks());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package pro.taskana.impl;
|
||||
|
||||
/**
|
||||
* Each ReportLineItem consists of a {@link ReportLineItemDefinition} that defines the upper and lower age limits of
|
||||
* this item and a number of tasks of this item.
|
||||
*/
|
||||
public class ReportLineItem {
|
||||
|
||||
private ReportLineItemDefinition reportLineItemDefinition;
|
||||
private int numberOfTasks;
|
||||
|
||||
public ReportLineItem() {
|
||||
this.numberOfTasks = 0;
|
||||
}
|
||||
|
||||
public ReportLineItemDefinition getReportLineItemDefinition() {
|
||||
return reportLineItemDefinition;
|
||||
}
|
||||
|
||||
public void setReportLineItemDefinition(ReportLineItemDefinition reportLineItemDefinition) {
|
||||
this.reportLineItemDefinition = reportLineItemDefinition;
|
||||
}
|
||||
|
||||
public int getNumberOfTasks() {
|
||||
return numberOfTasks;
|
||||
}
|
||||
|
||||
public void setNumberOfTasks(int numberOfTasks) {
|
||||
this.numberOfTasks = numberOfTasks;
|
||||
}
|
||||
|
||||
public void addNumberOfTasks(int numberOfTasks) {
|
||||
this.numberOfTasks += numberOfTasks;
|
||||
}
|
||||
|
||||
}
|
|
@ -11,6 +11,15 @@ import pro.taskana.TaskMonitorService;
|
|||
import pro.taskana.TaskState;
|
||||
import pro.taskana.TaskanaEngine;
|
||||
import pro.taskana.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.impl.report.impl.CategoryReport;
|
||||
import pro.taskana.impl.report.impl.ClassificationReport;
|
||||
import pro.taskana.impl.report.impl.CustomFieldValueReport;
|
||||
import pro.taskana.impl.report.impl.DaysToWorkingDaysPreProcessor;
|
||||
import pro.taskana.impl.report.impl.DetailedClassificationReport;
|
||||
import pro.taskana.impl.report.impl.DetailedMonitorQueryItem;
|
||||
import pro.taskana.impl.report.impl.MonitorQueryItem;
|
||||
import pro.taskana.impl.report.impl.TimeIntervalColumnHeader;
|
||||
import pro.taskana.impl.report.impl.WorkbasketLevelReport;
|
||||
import pro.taskana.impl.util.LoggerUtils;
|
||||
import pro.taskana.mappings.TaskMonitorMapper;
|
||||
|
||||
|
@ -30,32 +39,32 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Report getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states,
|
||||
public WorkbasketLevelReport getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues)
|
||||
throws InvalidArgumentException {
|
||||
return getWorkbasketLevelReport(workbasketIds, states, categories, domains, customField, customFieldValues,
|
||||
null, false);
|
||||
Collections.emptyList(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Report getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states,
|
||||
public WorkbasketLevelReport getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException {
|
||||
List<TimeIntervalColumnHeader> columnHeaders) throws InvalidArgumentException {
|
||||
return getWorkbasketLevelReport(workbasketIds, states, categories, domains, customField, customFieldValues,
|
||||
reportLineItemDefinitions, true);
|
||||
columnHeaders, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Report getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states,
|
||||
public WorkbasketLevelReport getWorkbasketLevelReport(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
|
||||
List<TimeIntervalColumnHeader> columnHeaders, boolean inWorkingDays)
|
||||
throws InvalidArgumentException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("entry to getWorkbasketLevelReport(workbasketIds = {}, states = {}, categories = {}, "
|
||||
+ "domains = {}, customField = {}, customFieldValues = {}, reportLineItemDefinitions = {}, "
|
||||
+ "inWorkingDays = {})", LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states),
|
||||
+ "domains = {}, customField = {}, customFieldValues = {}, columnHeaders = {}, "
|
||||
+ "inWorkingDays = {})", LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states),
|
||||
LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), customField,
|
||||
LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(reportLineItemDefinitions),
|
||||
LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(columnHeaders),
|
||||
inWorkingDays);
|
||||
}
|
||||
try {
|
||||
|
@ -63,10 +72,16 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
|
|||
|
||||
configureDaysToWorkingDaysConverter();
|
||||
|
||||
Report report = new Report();
|
||||
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfWorkbaskets(workbasketIds,
|
||||
states, categories, domains, customField, customFieldValues);
|
||||
report.addMonitoringQueryItems(monitorQueryItems, reportLineItemDefinitions, inWorkingDays);
|
||||
WorkbasketLevelReport report = new WorkbasketLevelReport(columnHeaders);
|
||||
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfWorkbaskets(
|
||||
workbasketIds, states, categories, domains, customField, customFieldValues);
|
||||
|
||||
if (inWorkingDays) {
|
||||
report.addItems(monitorQueryItems, new DaysToWorkingDaysPreProcessor<>(columnHeaders));
|
||||
} else {
|
||||
report.addItems(monitorQueryItems);
|
||||
}
|
||||
|
||||
return report;
|
||||
|
||||
} finally {
|
||||
|
@ -76,32 +91,31 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Report getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
|
||||
public CategoryReport getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
|
||||
List<String> domains, CustomField customField, List<String> customFieldValues) throws InvalidArgumentException {
|
||||
return getCategoryReport(workbasketIds, states, categories, domains, customField, customFieldValues, null,
|
||||
return getCategoryReport(workbasketIds, states, categories, domains, customField, customFieldValues,
|
||||
Collections.emptyList(),
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Report getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
|
||||
public CategoryReport getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
|
||||
List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions)
|
||||
throws InvalidArgumentException {
|
||||
List<TimeIntervalColumnHeader> columnHeaders) throws InvalidArgumentException {
|
||||
return getCategoryReport(workbasketIds, states, categories, domains, customField, customFieldValues,
|
||||
reportLineItemDefinitions, true);
|
||||
columnHeaders, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Report getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
|
||||
public CategoryReport getCategoryReport(List<String> workbasketIds, List<TaskState> states, List<String> categories,
|
||||
List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
|
||||
throws InvalidArgumentException {
|
||||
List<TimeIntervalColumnHeader> columnHeaders, boolean inWorkingDays) throws InvalidArgumentException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("entry to getCategoryReport(workbasketIds = {}, states = {}, categories = {}, "
|
||||
+ "domains = {}, customField = {}, customFieldValues = {}, reportLineItemDefinitions = {}, "
|
||||
+ "inWorkingDays = {})", LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states),
|
||||
+ "domains = {}, customField = {}, customFieldValues = {}, reportLineItemDefinitions = {}, "
|
||||
+ "inWorkingDays = {})", LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states),
|
||||
LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), customField,
|
||||
LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(reportLineItemDefinitions),
|
||||
LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(columnHeaders),
|
||||
inWorkingDays);
|
||||
}
|
||||
try {
|
||||
|
@ -109,10 +123,16 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
|
|||
|
||||
configureDaysToWorkingDaysConverter();
|
||||
|
||||
Report report = new Report();
|
||||
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfCategories(workbasketIds, states,
|
||||
categories, domains, customField, customFieldValues);
|
||||
report.addMonitoringQueryItems(monitorQueryItems, reportLineItemDefinitions, inWorkingDays);
|
||||
CategoryReport report = new CategoryReport(columnHeaders);
|
||||
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfCategories(
|
||||
workbasketIds, states, categories, domains, customField, customFieldValues);
|
||||
|
||||
if (inWorkingDays) {
|
||||
report.addItems(monitorQueryItems, new DaysToWorkingDaysPreProcessor<>(columnHeaders));
|
||||
} else {
|
||||
report.addItems(monitorQueryItems);
|
||||
}
|
||||
|
||||
return report;
|
||||
|
||||
} finally {
|
||||
|
@ -125,29 +145,29 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
|
|||
public ClassificationReport getClassificationReport(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues)
|
||||
throws InvalidArgumentException {
|
||||
return getClassificationReport(workbasketIds, states, categories, domains, customField, customFieldValues, null,
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassificationReport getClassificationReport(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException {
|
||||
return getClassificationReport(workbasketIds, states, categories, domains, customField, customFieldValues,
|
||||
reportLineItemDefinitions, true);
|
||||
Collections.emptyList(), false);
|
||||
}
|
||||
|
||||
@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)
|
||||
List<TimeIntervalColumnHeader> columnHeaders) throws InvalidArgumentException {
|
||||
return getClassificationReport(workbasketIds, states, categories, domains, customField, customFieldValues,
|
||||
columnHeaders, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassificationReport getClassificationReport(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<TimeIntervalColumnHeader> columnHeaders, boolean inWorkingDays)
|
||||
throws InvalidArgumentException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("entry to getClassificationReport(workbasketIds = {}, states = {}, categories = {}, "
|
||||
+ "domains = {}, customField = {}, customFieldValues = {}, reportLineItemDefinitions = {}, "
|
||||
+ "inWorkingDays = {})", LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states),
|
||||
+ "domains = {}, customField = {}, customFieldValues = {}, columnHeaders = {}, "
|
||||
+ "inWorkingDays = {})", LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states),
|
||||
LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), customField,
|
||||
LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(reportLineItemDefinitions),
|
||||
LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(columnHeaders),
|
||||
inWorkingDays);
|
||||
}
|
||||
try {
|
||||
|
@ -155,10 +175,16 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
|
|||
|
||||
configureDaysToWorkingDaysConverter();
|
||||
|
||||
ClassificationReport report = new ClassificationReport();
|
||||
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfClassifications(workbasketIds,
|
||||
states, categories, domains, customField, customFieldValues);
|
||||
report.addMonitoringQueryItems(monitorQueryItems, reportLineItemDefinitions, inWorkingDays);
|
||||
ClassificationReport report = new ClassificationReport(columnHeaders);
|
||||
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfClassifications(
|
||||
workbasketIds, states, categories, domains, customField, customFieldValues);
|
||||
|
||||
if (inWorkingDays) {
|
||||
report.addItems(monitorQueryItems, new DaysToWorkingDaysPreProcessor<>(columnHeaders));
|
||||
} else {
|
||||
report.addItems(monitorQueryItems);
|
||||
}
|
||||
|
||||
return report;
|
||||
|
||||
} finally {
|
||||
|
@ -172,43 +198,48 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
|
|||
List<TaskState> states, List<String> categories, List<String> domains, CustomField customField,
|
||||
List<String> customFieldValues) throws InvalidArgumentException {
|
||||
return getDetailedClassificationReport(workbasketIds, states, categories, domains, customField,
|
||||
customFieldValues, null, false);
|
||||
customFieldValues, Collections.emptyList(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DetailedClassificationReport getDetailedClassificationReport(List<String> workbasketIds,
|
||||
List<TaskState> states, List<String> categories, List<String> domains, CustomField customField,
|
||||
List<String> customFieldValues, List<ReportLineItemDefinition> reportLineItemDefinitions)
|
||||
List<String> customFieldValues, List<TimeIntervalColumnHeader> columnHeaders)
|
||||
throws InvalidArgumentException {
|
||||
return getDetailedClassificationReport(workbasketIds, states, categories, domains, customField,
|
||||
customFieldValues, reportLineItemDefinitions, true);
|
||||
customFieldValues, columnHeaders, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DetailedClassificationReport getDetailedClassificationReport(List<String> workbasketIds,
|
||||
List<TaskState> states, List<String> categories, List<String> domains, CustomField customField,
|
||||
List<String> customFieldValues, List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
|
||||
List<String> customFieldValues, List<TimeIntervalColumnHeader> columnHeaders, boolean inWorkingDays)
|
||||
throws InvalidArgumentException {
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("entry to getDetailedClassificationReport(workbasketIds = {}, states = {}, "
|
||||
+ "categories = {}, domains = {}, customField = {}, customFieldValues = {}, "
|
||||
+ "reportLineItemDefinitions = {}, inWorkingDays = {})", LoggerUtils.listToString(workbasketIds),
|
||||
+ "categories = {}, domains = {}, customField = {}, customFieldValues = {}, "
|
||||
+ "columnHeaders = {}, inWorkingDays = {})", LoggerUtils.listToString(workbasketIds),
|
||||
LoggerUtils.listToString(states), LoggerUtils.listToString(categories),
|
||||
LoggerUtils.listToString(domains), customField, LoggerUtils.listToString(customFieldValues),
|
||||
LoggerUtils.listToString(reportLineItemDefinitions), inWorkingDays);
|
||||
LoggerUtils.listToString(columnHeaders), inWorkingDays);
|
||||
}
|
||||
try {
|
||||
taskanaEngineImpl.openConnection();
|
||||
|
||||
configureDaysToWorkingDaysConverter();
|
||||
|
||||
DetailedClassificationReport report = new DetailedClassificationReport();
|
||||
DetailedClassificationReport report = new DetailedClassificationReport(columnHeaders);
|
||||
List<DetailedMonitorQueryItem> detailedMonitorQueryItems = taskMonitorMapper
|
||||
.getTaskCountOfDetailedClassifications(workbasketIds, states, categories, domains, customField,
|
||||
customFieldValues);
|
||||
report.addDetailedMonitoringQueryItems(detailedMonitorQueryItems, reportLineItemDefinitions,
|
||||
inWorkingDays);
|
||||
|
||||
if (inWorkingDays) {
|
||||
report.addItems(detailedMonitorQueryItems, new DaysToWorkingDaysPreProcessor<>(columnHeaders));
|
||||
} else {
|
||||
report.addItems(detailedMonitorQueryItems);
|
||||
}
|
||||
|
||||
return report;
|
||||
|
||||
} finally {
|
||||
|
@ -218,32 +249,32 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Report getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states,
|
||||
public CustomFieldValueReport getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues)
|
||||
throws InvalidArgumentException {
|
||||
return getCustomFieldValueReport(workbasketIds, states, categories, domains, customField, customFieldValues,
|
||||
null, false);
|
||||
Collections.emptyList(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Report getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states,
|
||||
public CustomFieldValueReport getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException {
|
||||
List<TimeIntervalColumnHeader> columnHeaders) throws InvalidArgumentException {
|
||||
return getCustomFieldValueReport(workbasketIds, states, categories, domains, customField, customFieldValues,
|
||||
reportLineItemDefinitions, true);
|
||||
columnHeaders, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Report getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states,
|
||||
public CustomFieldValueReport getCustomFieldValueReport(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays)
|
||||
List<TimeIntervalColumnHeader> columnHeaders, boolean inWorkingDays)
|
||||
throws InvalidArgumentException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("entry to getCustomFieldValueReport(workbasketIds = {}, states = {}, categories = {}, "
|
||||
+ "domains = {}, customField = {}, customFieldValues = {}, reportLineItemDefinitions = {}, "
|
||||
+ "inWorkingDays = {})", LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states),
|
||||
+ "domains = {}, customField = {}, customFieldValues = {}, columnHeaders = {}, "
|
||||
+ "inWorkingDays = {})", LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states),
|
||||
LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), customField,
|
||||
LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(reportLineItemDefinitions),
|
||||
LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(columnHeaders),
|
||||
inWorkingDays);
|
||||
}
|
||||
try {
|
||||
|
@ -255,10 +286,16 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
|
|||
|
||||
configureDaysToWorkingDaysConverter();
|
||||
|
||||
Report report = new Report();
|
||||
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfCustomFieldValues(workbasketIds,
|
||||
states, categories, domains, customField, customFieldValues);
|
||||
report.addMonitoringQueryItems(monitorQueryItems, reportLineItemDefinitions, inWorkingDays);
|
||||
CustomFieldValueReport report = new CustomFieldValueReport(columnHeaders);
|
||||
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfCustomFieldValues(
|
||||
workbasketIds, states, categories, domains, customField, customFieldValues);
|
||||
|
||||
if (inWorkingDays) {
|
||||
report.addItems(monitorQueryItems, new DaysToWorkingDaysPreProcessor<>(columnHeaders));
|
||||
} else {
|
||||
report.addItems(monitorQueryItems);
|
||||
}
|
||||
|
||||
return report;
|
||||
|
||||
} finally {
|
||||
|
@ -270,30 +307,30 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
|
|||
@Override
|
||||
public List<String> getTaskIdsOfCategoryReportLineItems(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions, List<SelectedItem> selectedItems)
|
||||
List<TimeIntervalColumnHeader> columnHeaders, List<SelectedItem> selectedItems)
|
||||
throws InvalidArgumentException {
|
||||
return getTaskIdsOfCategoryReportLineItems(workbasketIds, states, categories, domains, customField,
|
||||
customFieldValues, reportLineItemDefinitions, true, selectedItems);
|
||||
customFieldValues, columnHeaders, true, selectedItems);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTaskIdsOfCategoryReportLineItems(List<String> workbasketIds, List<TaskState> states,
|
||||
List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays,
|
||||
List<TimeIntervalColumnHeader> columnHeaders, boolean inWorkingDays,
|
||||
List<SelectedItem> selectedItems) throws InvalidArgumentException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("entry to getTaskIdsOfCategoryReportLineItems(workbasketIds = {}, states = {}, "
|
||||
+ "categories = {}, domains = {}, customField = {}, customFieldValues = {}, "
|
||||
+ "reportLineItemDefinitions = {}, inWorkingDays = {}, selectedItems = {})",
|
||||
+ "categories = {}, domains = {}, customField = {}, customFieldValues = {}, "
|
||||
+ "columnHeaders = {}, inWorkingDays = {}, selectedItems = {})",
|
||||
LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states),
|
||||
LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), customField,
|
||||
LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(reportLineItemDefinitions),
|
||||
LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(columnHeaders),
|
||||
inWorkingDays, LoggerUtils.listToString(selectedItems));
|
||||
}
|
||||
try {
|
||||
taskanaEngineImpl.openConnection();
|
||||
|
||||
if (reportLineItemDefinitions == null) {
|
||||
if (columnHeaders == null) {
|
||||
throw new InvalidArgumentException("ReportLineItemDefinitions can´t be used as NULL-Parameter");
|
||||
}
|
||||
if (selectedItems == null || selectedItems.size() == 0) {
|
||||
|
@ -304,7 +341,7 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
|
|||
configureDaysToWorkingDaysConverter();
|
||||
|
||||
if (inWorkingDays) {
|
||||
selectedItems = convertWorkingDaysToDays(selectedItems, reportLineItemDefinitions);
|
||||
selectedItems = convertWorkingDaysToDays(selectedItems, columnHeaders);
|
||||
}
|
||||
|
||||
List<String> taskIds = taskMonitorMapper.getTaskIdsOfCategoriesBySelectedItems(workbasketIds, states,
|
||||
|
@ -319,9 +356,9 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
|
|||
}
|
||||
|
||||
private List<SelectedItem> convertWorkingDaysToDays(List<SelectedItem> selectedItems,
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions) throws InvalidArgumentException {
|
||||
List<TimeIntervalColumnHeader> columnHeaders) throws InvalidArgumentException {
|
||||
|
||||
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter.initialize(reportLineItemDefinitions);
|
||||
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter.initialize(columnHeaders);
|
||||
for (SelectedItem selectedItem : selectedItems) {
|
||||
selectedItem
|
||||
.setLowerAgeLimit(Collections.min(instance.convertWorkingDaysToDays(selectedItem.getLowerAgeLimit())));
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.time.Duration;
|
|||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -42,6 +43,7 @@ import pro.taskana.exceptions.TaskAlreadyExistException;
|
|||
import pro.taskana.exceptions.TaskNotFoundException;
|
||||
import pro.taskana.exceptions.TaskanaException;
|
||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||
import pro.taskana.impl.report.impl.TimeIntervalColumnHeader;
|
||||
import pro.taskana.impl.util.IdGenerator;
|
||||
import pro.taskana.impl.util.LoggerUtils;
|
||||
import pro.taskana.mappings.AttachmentMapper;
|
||||
|
@ -72,7 +74,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
super();
|
||||
try {
|
||||
this.converter = DaysToWorkingDaysConverter
|
||||
.initialize(new ArrayList<>(Arrays.asList(new ReportLineItemDefinition(0))), Instant.now());
|
||||
.initialize(Collections.singletonList(new TimeIntervalColumnHeader(0)), Instant.now());
|
||||
} catch (InvalidArgumentException e) {
|
||||
LOGGER.error("could not initialize DaysToWorkingDaysConverter. Caught exception " + e);
|
||||
throw new SystemException("Internal error. Cannot initialize DaysToWorkingDaysConverter");
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
package pro.taskana.impl.report;
|
||||
|
||||
/**
|
||||
* A QueryItem is en entity on which a {@link Report} is based on.
|
||||
* Its value will be added to the existing cell value during the insertion into a report.
|
||||
* Its key will determine in which {@link ReportRow} the item will be inserted.
|
||||
*/
|
||||
public interface QueryItem {
|
||||
|
||||
String getKey();
|
||||
|
||||
int getValue();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package pro.taskana.impl.report;
|
||||
|
||||
/**
|
||||
* The QueryItemPreprocessor is used when adding {@link QueryItem}s into a {@link Report}. It defines a processing
|
||||
* step which is executed on each {@link QueryItem} before inserting it into the {@link Report}.
|
||||
* @param <Item> Item class which is being pre processed.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface QueryItemPreprocessor<Item extends QueryItem> {
|
||||
|
||||
Item apply(Item item);
|
||||
|
||||
}
|
|
@ -4,45 +4,70 @@ import java.util.ArrayList;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class Report<Item extends QueryItem, Column extends ReportColumnHeader<? super Item>> {
|
||||
/**
|
||||
* A Report represents a an abstract table that consists of {@link ReportRow}s and a list of <ColumnHeader>s.
|
||||
* Since a report does not specify <Item> and <ColumnHeader> it does not contain functional logic.
|
||||
* Due to readability implicit definition of functional logic is prevented and thus prevent
|
||||
* initialization of an abstract Report. In order to create a specific Report a subclass has to be created.
|
||||
*
|
||||
* @param <Item> {@link QueryItem} whose value is relevant for this report.
|
||||
* @param <ColumnHeader> {@link ReportColumnHeader} which can determine if an <Item> belongs into that column or not.
|
||||
*/
|
||||
public abstract class Report<Item extends QueryItem, ColumnHeader extends ReportColumnHeader<? super Item>> {
|
||||
|
||||
protected List<Column> columns = new ArrayList<>(); //this can be done as an array
|
||||
private Map<String, ReportRow<Item>> reportLines = new LinkedHashMap<>();
|
||||
private ReportRow<Item> sumLine;
|
||||
protected List<ColumnHeader> columnHeaders = new ArrayList<>();
|
||||
private Map<String, ReportRow<Item>> reportRows = new LinkedHashMap<>();
|
||||
private ReportRow<Item> sumRow;
|
||||
|
||||
public Report(List<Column> columns) {
|
||||
sumLine = new ReportRow<>(columns.size());
|
||||
this.columns.addAll(columns);
|
||||
public Report(List<ColumnHeader> columnHeaders) {
|
||||
sumRow = new ReportRow<>(columnHeaders.size());
|
||||
this.columnHeaders.addAll(columnHeaders);
|
||||
}
|
||||
|
||||
protected final void addItem(Item item) {
|
||||
ReportRow<Item> row = reportLines.computeIfAbsent(item.getKey(), (s) -> createReportRow(columns.size()));
|
||||
for (int i = 0; i < columns.size(); i++) {
|
||||
if (columns.get(i).fits(item)) {
|
||||
row.addItem(item, i);
|
||||
sumLine.addItem(item, i);
|
||||
public final void addItem(Item item) {
|
||||
ReportRow<Item> row = reportRows.computeIfAbsent(item.getKey(), (s) -> createReportRow(columnHeaders.size()));
|
||||
if (columnHeaders.isEmpty()) {
|
||||
row.updateTotalValue(item);
|
||||
sumRow.updateTotalValue(item);
|
||||
} else {
|
||||
for (int i = 0; i < columnHeaders.size(); i++) {
|
||||
if (columnHeaders.get(i).fits(item)) {
|
||||
row.addItem(item, i);
|
||||
sumRow.addItem(item, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ReportRow<Item> getRow(String key) {
|
||||
return reportLines.get(key);
|
||||
public final void addItems(List<Item> items, QueryItemPreprocessor<Item> preprocessor) {
|
||||
items.stream()
|
||||
.map(preprocessor::apply)
|
||||
.forEach(this::addItem);
|
||||
}
|
||||
|
||||
public void addItems(List<Item> items) {
|
||||
public final void addItems(List<Item> items) {
|
||||
items.forEach(this::addItem);
|
||||
}
|
||||
|
||||
public final ReportRow<Item> getSumLine() {
|
||||
return sumLine;
|
||||
public ReportRow<Item> getRow(String key) {
|
||||
return reportRows.get(key);
|
||||
}
|
||||
|
||||
public Map<String, ReportRow<Item>> getReportLines() {
|
||||
return reportLines;
|
||||
public final ReportRow<Item> getSumRow() {
|
||||
return sumRow;
|
||||
}
|
||||
|
||||
public Set<String> getRowTitles() {
|
||||
return reportRows.keySet();
|
||||
}
|
||||
|
||||
public final int rowSize() {
|
||||
return reportRows.size();
|
||||
}
|
||||
|
||||
protected ReportRow<Item> createReportRow(int columnSize) {
|
||||
return new ReportRow<>(columnSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
package pro.taskana.impl.report;
|
||||
|
||||
/**
|
||||
* A ReportColumnHeader is an element of a {@link Report}.
|
||||
* It determines weather a given <Item> belongs into the representing column.
|
||||
*
|
||||
* @param <Item> {@link QueryItem} on which the {@link Report} is based on.
|
||||
*/
|
||||
public interface ReportColumnHeader<Item extends QueryItem> {
|
||||
|
||||
String displayName();
|
||||
|
||||
boolean fits(Item item);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +1,34 @@
|
|||
package pro.taskana.impl.report;
|
||||
|
||||
/**
|
||||
* A ReportRow represents a row in a {@link Report}.
|
||||
* It contains an array of cells whose index corresponds to the {@link ReportColumnHeader} index in the {@link Report}.
|
||||
*
|
||||
* @param <Item> {@link QueryItem} on which the {@link Report} is based on.
|
||||
*/
|
||||
public class ReportRow<Item extends QueryItem> {
|
||||
|
||||
private final int[] lineItems;
|
||||
private final int[] cells;
|
||||
private int totalValue = 0;
|
||||
|
||||
public ReportRow(int columnCount) {
|
||||
//TODO: do you use an assert / throw an exception?
|
||||
lineItems = new int[columnCount];
|
||||
cells = new int[columnCount];
|
||||
}
|
||||
|
||||
public int[] getLineItems() {
|
||||
return lineItems;
|
||||
public int[] getCells() {
|
||||
return cells;
|
||||
}
|
||||
|
||||
public int getTotalValue() {
|
||||
return totalValue;
|
||||
}
|
||||
|
||||
public void updateTotalValue(Item item) {
|
||||
totalValue += item.getValue();
|
||||
}
|
||||
|
||||
public void addItem(Item item, int index) throws IndexOutOfBoundsException {
|
||||
totalValue += item.getValue();
|
||||
lineItems[index] += item.getValue();
|
||||
cells[index] += item.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package pro.taskana.impl.report.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pro.taskana.impl.report.Report;
|
||||
|
||||
/**
|
||||
* TODO.
|
||||
*/
|
||||
public class CategoryReport extends Report<MonitorQueryItem, TimeIntervalColumnHeader> {
|
||||
|
||||
public CategoryReport(List<TimeIntervalColumnHeader> timeIntervalColumnHeaders) {
|
||||
super(timeIntervalColumnHeaders);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package pro.taskana.impl.report.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pro.taskana.impl.report.Report;
|
||||
|
||||
/**
|
||||
* The ClassificationReport extends the Report. The {@link pro.taskana.impl.report.ReportRow}s of the ClassificationReport are grouped by
|
||||
* classifications.
|
||||
*/
|
||||
public class ClassificationReport extends Report<MonitorQueryItem, TimeIntervalColumnHeader> {
|
||||
|
||||
public ClassificationReport(List<TimeIntervalColumnHeader> timeIntervalColumnHeaders) {
|
||||
super(timeIntervalColumnHeaders);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package pro.taskana.impl.report.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pro.taskana.impl.report.Report;
|
||||
|
||||
/**
|
||||
* TODO.
|
||||
*/
|
||||
public class CustomFieldValueReport extends Report<MonitorQueryItem, TimeIntervalColumnHeader> {
|
||||
|
||||
public CustomFieldValueReport(List<TimeIntervalColumnHeader> timeIntervalColumnHeaders) {
|
||||
super(timeIntervalColumnHeaders);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package pro.taskana.impl.report.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pro.taskana.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.impl.DaysToWorkingDaysConverter;
|
||||
import pro.taskana.impl.report.QueryItemPreprocessor;
|
||||
|
||||
/**
|
||||
* Uses {@link DaysToWorkingDaysConverter} to convert an <Item>s age to working days.
|
||||
* @param <Item> QueryItem which is being processed
|
||||
*/
|
||||
public class DaysToWorkingDaysPreProcessor<Item extends MonitorQueryItem> implements QueryItemPreprocessor<Item> {
|
||||
|
||||
private DaysToWorkingDaysConverter instance;
|
||||
|
||||
public DaysToWorkingDaysPreProcessor(List<TimeIntervalColumnHeader> columnHeaders)
|
||||
throws InvalidArgumentException {
|
||||
instance = DaysToWorkingDaysConverter.initialize(columnHeaders);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item apply(Item item) {
|
||||
item.setAgeInDays(instance.convertDaysToWorkingDays(item.getAgeInDays()));
|
||||
return item;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package pro.taskana.impl.report.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pro.taskana.impl.report.Report;
|
||||
|
||||
/**
|
||||
* The DetailedClassificationReport is a functional extension of the {@link ClassificationReport}.
|
||||
* Its {@link DetailedReportRow}s contain an additional list of {@link pro.taskana.impl.report.ReportRow}s
|
||||
* for the classifications of the attachments of the tasks.
|
||||
*/
|
||||
public class DetailedClassificationReport extends Report<DetailedMonitorQueryItem, TimeIntervalColumnHeader> {
|
||||
|
||||
public DetailedClassificationReport(List<TimeIntervalColumnHeader> workbasketLevelReportColumnHeaders) {
|
||||
super(workbasketLevelReportColumnHeaders);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DetailedReportRow createReportRow(int columnSize) {
|
||||
return new DetailedReportRow(columnSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DetailedReportRow getRow(String key) {
|
||||
return (DetailedReportRow) super.getRow(key);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,23 +1,19 @@
|
|||
package pro.taskana.impl;
|
||||
|
||||
/**
|
||||
* The DetailedMonitorQueryItem extends the MonitorQueryItem. The additional attachment key is used for the detailed
|
||||
* classification report.
|
||||
*/
|
||||
public class DetailedMonitorQueryItem extends MonitorQueryItem {
|
||||
|
||||
private String attachmentKey;
|
||||
|
||||
public DetailedMonitorQueryItem() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getAttachmentKey() {
|
||||
return attachmentKey;
|
||||
}
|
||||
|
||||
public void setAttachmentKey(String attachmentKey) {
|
||||
this.attachmentKey = attachmentKey;
|
||||
}
|
||||
|
||||
}
|
||||
package pro.taskana.impl.report.impl;
|
||||
|
||||
/**
|
||||
* The DetailedMonitorQueryItem extends the {@link MonitorQueryItem}.
|
||||
* The additional attachment key is used for the detailed classification report.
|
||||
*/
|
||||
public class DetailedMonitorQueryItem extends MonitorQueryItem {
|
||||
|
||||
private String attachmentKey;
|
||||
|
||||
public String getAttachmentKey() {
|
||||
return attachmentKey;
|
||||
}
|
||||
|
||||
public void setAttachmentKey(String attachmentKey) {
|
||||
this.attachmentKey = attachmentKey;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package pro.taskana.impl.report.impl;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import pro.taskana.impl.report.ReportRow;
|
||||
|
||||
/**
|
||||
* The DetailedReportRow extends the {@link ReportRow}.
|
||||
* In contrast to the ReportRow there is an additional list of ReportRows for the classifications of the
|
||||
* attachments of the tasks.
|
||||
*/
|
||||
public class DetailedReportRow extends ReportRow<DetailedMonitorQueryItem> {
|
||||
|
||||
private Map<String, ReportRow<DetailedMonitorQueryItem>> detailRows = new LinkedHashMap<>();
|
||||
private int columnCount;
|
||||
|
||||
public DetailedReportRow(int columnCount) {
|
||||
super(columnCount);
|
||||
this.columnCount = columnCount;
|
||||
}
|
||||
|
||||
public Map<String, ReportRow<DetailedMonitorQueryItem>> getDetailRows() {
|
||||
return detailRows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTotalValue(DetailedMonitorQueryItem item) {
|
||||
super.updateTotalValue(item);
|
||||
|
||||
if (item.getAttachmentKey() != null) {
|
||||
detailRows.computeIfAbsent(item.getAttachmentKey(), (s) -> new ReportRow<>(columnCount))
|
||||
.updateTotalValue(item);
|
||||
} else {
|
||||
detailRows.computeIfAbsent("N/A", (s) -> new ReportRow<>(columnCount))
|
||||
.updateTotalValue(item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addItem(DetailedMonitorQueryItem item, int index) {
|
||||
super.addItem(item, index);
|
||||
|
||||
if (item.getAttachmentKey() != null) {
|
||||
detailRows.computeIfAbsent(item.getAttachmentKey(), (s) -> new ReportRow<>(columnCount))
|
||||
.addItem(item, index);
|
||||
} else {
|
||||
detailRows.computeIfAbsent("N/A", (s) -> new ReportRow<>(columnCount))
|
||||
.addItem(item, index);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,36 +1,38 @@
|
|||
package pro.taskana.impl;
|
||||
|
||||
/**
|
||||
* The MonitorQueryItem entity contains the number of tasks for a key (e.g. workbasketKey) and age in days.
|
||||
*/
|
||||
public class MonitorQueryItem {
|
||||
|
||||
private String key;
|
||||
private int ageInDays;
|
||||
private int numberOfTasks;
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public int getAgeInDays() {
|
||||
return ageInDays;
|
||||
}
|
||||
|
||||
public void setAgeInDays(int ageInDays) {
|
||||
this.ageInDays = ageInDays;
|
||||
}
|
||||
|
||||
public int getNumberOfTasks() {
|
||||
return numberOfTasks;
|
||||
}
|
||||
|
||||
public void setNumberOfTasks(int numberOfTasks) {
|
||||
this.numberOfTasks = numberOfTasks;
|
||||
}
|
||||
|
||||
}
|
||||
package pro.taskana.impl.report.impl;
|
||||
|
||||
import pro.taskana.impl.report.QueryItem;
|
||||
|
||||
/**
|
||||
* The MonitorQueryItem entity contains the number of tasks for a key (e.g. workbasketKey) and age in days.
|
||||
*/
|
||||
public class MonitorQueryItem implements QueryItem {
|
||||
|
||||
private String key;
|
||||
private int ageInDays;
|
||||
private int numberOfTasks;
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public int getAgeInDays() {
|
||||
return ageInDays;
|
||||
}
|
||||
|
||||
public void setAgeInDays(int ageInDays) {
|
||||
this.ageInDays = ageInDays;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return numberOfTasks;
|
||||
}
|
||||
|
||||
public void setNumberOfTasks(int numberOfTasks) {
|
||||
this.numberOfTasks = numberOfTasks;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,49 +1,50 @@
|
|||
package pro.taskana.impl;
|
||||
|
||||
/**
|
||||
* A ReportLineItemDefinition has a lower and an upper age limit which subdivide the count of tasks into different
|
||||
* sections. Days in past are represented as negative values and days in the future are represented as positive values.
|
||||
* To avoid tasks are counted multiple times or not be listed in the report, these reportLineItemDefinitions should not
|
||||
* overlap and should not have gaps. If the ReportLineDefinition should represent a single day, lowerAgeLimit and
|
||||
* upperAgeLimit have to be equal. The outer cluster of a report should have open ends. These open ends are represented
|
||||
* with Integer.MIN_VALUE and Integer.MAX_VALUE.
|
||||
*/
|
||||
public class ReportLineItemDefinition {
|
||||
|
||||
private int lowerAgeLimit;
|
||||
private int upperAgeLimit;
|
||||
|
||||
public ReportLineItemDefinition() {
|
||||
}
|
||||
|
||||
public ReportLineItemDefinition(int ageInDays) {
|
||||
this.lowerAgeLimit = ageInDays;
|
||||
this.upperAgeLimit = ageInDays;
|
||||
}
|
||||
|
||||
public ReportLineItemDefinition(int lowerAgeLimit, int upperAgeLimit) {
|
||||
this.lowerAgeLimit = lowerAgeLimit;
|
||||
this.upperAgeLimit = upperAgeLimit;
|
||||
}
|
||||
|
||||
public int getLowerAgeLimit() {
|
||||
return lowerAgeLimit;
|
||||
}
|
||||
|
||||
public void setLowerAgeLimit(int lowerAgeLimit) {
|
||||
this.lowerAgeLimit = lowerAgeLimit;
|
||||
}
|
||||
|
||||
public int getUpperAgeLimit() {
|
||||
return upperAgeLimit;
|
||||
}
|
||||
|
||||
public void setUpperAgeLimit(int upperAgeLimit) {
|
||||
this.upperAgeLimit = upperAgeLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "(" + this.lowerAgeLimit + "," + this.upperAgeLimit + ")";
|
||||
}
|
||||
}
|
||||
package pro.taskana.impl.report.impl;
|
||||
|
||||
import pro.taskana.impl.report.ReportColumnHeader;
|
||||
|
||||
/**
|
||||
* A TimeIntervalColumnHeader has a lower and an upper age limit which subdivide the count of tasks into different
|
||||
* sections. Days in past are represented as negative values and days in the future are represented as positive values.
|
||||
* To avoid tasks are counted multiple times or not be listed in the report, these TimeIntervalColumnHeaders should not
|
||||
* overlap and should not have gaps. If the TimeIntervalColumnHeader should represent a single day, lowerAgeLimit and
|
||||
* upperAgeLimit have to be equal. The outer cluster of a report should have open ends. These open ends are represented
|
||||
* with Integer.MIN_VALUE and Integer.MAX_VALUE.
|
||||
*/
|
||||
public class TimeIntervalColumnHeader implements ReportColumnHeader<MonitorQueryItem> {
|
||||
|
||||
private final int lowerAgeLimit;
|
||||
private final int upperAgeLimit;
|
||||
|
||||
public TimeIntervalColumnHeader(int ageInDays) {
|
||||
this.lowerAgeLimit = ageInDays;
|
||||
this.upperAgeLimit = ageInDays;
|
||||
}
|
||||
|
||||
public TimeIntervalColumnHeader(int lowerAgeLimit, int upperAgeLimit) {
|
||||
this.lowerAgeLimit = lowerAgeLimit;
|
||||
this.upperAgeLimit = upperAgeLimit;
|
||||
}
|
||||
|
||||
public int getLowerAgeLimit() {
|
||||
return lowerAgeLimit;
|
||||
}
|
||||
|
||||
public int getUpperAgeLimit() {
|
||||
return upperAgeLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return displayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String displayName() {
|
||||
return "(" + this.lowerAgeLimit + "," + this.upperAgeLimit + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fits(MonitorQueryItem item) {
|
||||
return lowerAgeLimit <= item.getAgeInDays() && upperAgeLimit >= item.getAgeInDays();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package pro.taskana.impl.report.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pro.taskana.impl.report.Report;
|
||||
|
||||
/**
|
||||
* TODO.
|
||||
*/
|
||||
public class WorkbasketLevelReport extends Report<MonitorQueryItem, TimeIntervalColumnHeader> {
|
||||
|
||||
public WorkbasketLevelReport(List<TimeIntervalColumnHeader> timeIntervalColumnHeaders) {
|
||||
super(timeIntervalColumnHeaders);
|
||||
}
|
||||
|
||||
}
|
|
@ -9,9 +9,9 @@ import org.apache.ibatis.annotations.Select;
|
|||
|
||||
import pro.taskana.CustomField;
|
||||
import pro.taskana.TaskState;
|
||||
import pro.taskana.impl.DetailedMonitorQueryItem;
|
||||
import pro.taskana.impl.MonitorQueryItem;
|
||||
import pro.taskana.impl.SelectedItem;
|
||||
import pro.taskana.impl.report.impl.DetailedMonitorQueryItem;
|
||||
import pro.taskana.impl.report.impl.MonitorQueryItem;
|
||||
|
||||
/**
|
||||
* This class is the mybatis mapping of task monitoring.
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.io.IOException;
|
|||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
@ -22,11 +23,11 @@ import pro.taskana.TaskanaEngine.ConnectionManagementMode;
|
|||
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||
import pro.taskana.database.TestDataGenerator;
|
||||
import pro.taskana.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.impl.ReportLineItemDefinition;
|
||||
import pro.taskana.impl.SelectedItem;
|
||||
import pro.taskana.impl.TaskanaEngineImpl;
|
||||
import pro.taskana.impl.configuration.DBCleaner;
|
||||
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest;
|
||||
import pro.taskana.impl.report.impl.TimeIntervalColumnHeader;
|
||||
|
||||
/**
|
||||
* Acceptance test for all "get task ids of category report" scenarios.
|
||||
|
@ -59,7 +60,7 @@ public class GetTaskIdsOfCategoryReportAccTest {
|
|||
public void testGetTaskIdsOfCategoryReport() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
|
||||
|
||||
List<SelectedItem> selectedItems = new ArrayList<>();
|
||||
|
||||
|
@ -82,7 +83,7 @@ public class GetTaskIdsOfCategoryReportAccTest {
|
|||
selectedItems.add(s3);
|
||||
|
||||
List<String> ids = taskMonitorService.getTaskIdsOfCategoryReportLineItems(null, null, null, null, null, null,
|
||||
reportLineItemDefinitions, selectedItems);
|
||||
columnHeaders, selectedItems);
|
||||
|
||||
assertEquals(11, ids.size());
|
||||
assertTrue(ids.contains("TKI:000000000000000000000000000000000006"));
|
||||
|
@ -102,8 +103,8 @@ public class GetTaskIdsOfCategoryReportAccTest {
|
|||
public void testGetTaskIdsOfCategoryReportWithWorkbasketFilter() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
|
||||
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
|
||||
|
||||
List<SelectedItem> selectedItems = new ArrayList<>();
|
||||
|
||||
|
@ -126,7 +127,7 @@ public class GetTaskIdsOfCategoryReportAccTest {
|
|||
selectedItems.add(s3);
|
||||
|
||||
List<String> ids = taskMonitorService.getTaskIdsOfCategoryReportLineItems(workbasketIds, null, null, null, null,
|
||||
null, reportLineItemDefinitions, selectedItems);
|
||||
null, columnHeaders, selectedItems);
|
||||
|
||||
assertEquals(4, ids.size());
|
||||
assertTrue(ids.contains("TKI:000000000000000000000000000000000006"));
|
||||
|
@ -139,8 +140,8 @@ public class GetTaskIdsOfCategoryReportAccTest {
|
|||
public void testGetTaskIdsOfCategoryReportWithStateFilter() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<TaskState> states = Arrays.asList(TaskState.READY);
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
|
||||
List<TaskState> states = Collections.singletonList(TaskState.READY);
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
|
||||
|
||||
List<SelectedItem> selectedItems = new ArrayList<>();
|
||||
|
||||
|
@ -163,7 +164,7 @@ public class GetTaskIdsOfCategoryReportAccTest {
|
|||
selectedItems.add(s3);
|
||||
|
||||
List<String> ids = taskMonitorService.getTaskIdsOfCategoryReportLineItems(null, states, null, null, null, null,
|
||||
reportLineItemDefinitions, selectedItems);
|
||||
columnHeaders, selectedItems);
|
||||
|
||||
assertEquals(11, ids.size());
|
||||
assertTrue(ids.contains("TKI:000000000000000000000000000000000006"));
|
||||
|
@ -184,7 +185,7 @@ public class GetTaskIdsOfCategoryReportAccTest {
|
|||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
|
||||
|
||||
List<SelectedItem> selectedItems = new ArrayList<>();
|
||||
|
||||
|
@ -201,7 +202,7 @@ public class GetTaskIdsOfCategoryReportAccTest {
|
|||
selectedItems.add(s2);
|
||||
|
||||
List<String> ids = taskMonitorService.getTaskIdsOfCategoryReportLineItems(null, null, categories, null, null,
|
||||
null, reportLineItemDefinitions, selectedItems);
|
||||
null, columnHeaders, selectedItems);
|
||||
|
||||
assertEquals(3, ids.size());
|
||||
assertTrue(ids.contains("TKI:000000000000000000000000000000000006"));
|
||||
|
@ -213,8 +214,8 @@ public class GetTaskIdsOfCategoryReportAccTest {
|
|||
public void testGetTaskIdsOfCategoryReportWithDomainFilter() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<String> domains = Arrays.asList("DOMAIN_A");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
|
||||
List<String> domains = Collections.singletonList("DOMAIN_A");
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
|
||||
|
||||
List<SelectedItem> selectedItems = new ArrayList<>();
|
||||
|
||||
|
@ -237,7 +238,7 @@ public class GetTaskIdsOfCategoryReportAccTest {
|
|||
selectedItems.add(s3);
|
||||
|
||||
List<String> ids = taskMonitorService.getTaskIdsOfCategoryReportLineItems(null, null, null, domains, null, null,
|
||||
reportLineItemDefinitions, selectedItems);
|
||||
columnHeaders, selectedItems);
|
||||
|
||||
assertEquals(4, ids.size());
|
||||
assertTrue(ids.contains("TKI:000000000000000000000000000000000020"));
|
||||
|
@ -251,8 +252,8 @@ public class GetTaskIdsOfCategoryReportAccTest {
|
|||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
|
||||
List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
|
||||
|
||||
List<SelectedItem> selectedItems = new ArrayList<>();
|
||||
|
||||
|
@ -275,7 +276,7 @@ public class GetTaskIdsOfCategoryReportAccTest {
|
|||
selectedItems.add(s3);
|
||||
|
||||
List<String> ids = taskMonitorService.getTaskIdsOfCategoryReportLineItems(null, null, null, null, customField,
|
||||
customFieldValues, reportLineItemDefinitions, selectedItems);
|
||||
customFieldValues, columnHeaders, selectedItems);
|
||||
|
||||
assertEquals(5, ids.size());
|
||||
assertTrue(ids.contains("TKI:000000000000000000000000000000000020"));
|
||||
|
@ -285,18 +286,18 @@ public class GetTaskIdsOfCategoryReportAccTest {
|
|||
assertTrue(ids.contains("TKI:000000000000000000000000000000000032"));
|
||||
}
|
||||
|
||||
private List<ReportLineItemDefinition> getListOfReportLineItemDefinitions() {
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = new ArrayList<>();
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(Integer.MIN_VALUE, -11));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-10, -6));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-5, -2));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-1));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(0));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(1));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(2, 5));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(6, 10));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(11, Integer.MAX_VALUE));
|
||||
return reportLineItemDefinitions;
|
||||
private List<TimeIntervalColumnHeader> getListOfColumnHeaders() {
|
||||
List<TimeIntervalColumnHeader> columnHeaders = new ArrayList<>();
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(Integer.MIN_VALUE, -11));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-10, -6));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-5, -2));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-1));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(0));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(1));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(2, 5));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(6, 10));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(11, Integer.MAX_VALUE));
|
||||
return columnHeaders;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package acceptance.monitoring;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
|
@ -7,7 +8,9 @@ import java.io.IOException;
|
|||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
|
@ -24,21 +27,20 @@ import pro.taskana.TaskanaEngine.ConnectionManagementMode;
|
|||
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||
import pro.taskana.database.TestDataGenerator;
|
||||
import pro.taskana.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.impl.Report;
|
||||
import pro.taskana.impl.ReportLineItem;
|
||||
import pro.taskana.impl.ReportLineItemDefinition;
|
||||
import pro.taskana.impl.TaskanaEngineImpl;
|
||||
import pro.taskana.impl.configuration.DBCleaner;
|
||||
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest;
|
||||
import pro.taskana.impl.report.impl.CategoryReport;
|
||||
import pro.taskana.impl.report.impl.TimeIntervalColumnHeader;
|
||||
|
||||
/**
|
||||
* Acceptance test for all "category report" scenarios.
|
||||
*/
|
||||
public class ProvideCategoryReportAccTest {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideCategoryReportAccTest.class);
|
||||
protected static TaskanaEngineConfiguration taskanaEngineConfiguration;
|
||||
protected static TaskanaEngine taskanaEngine;
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideCategoryReportAccTest.class);
|
||||
|
||||
@BeforeClass
|
||||
public static void setupTest() throws Exception {
|
||||
|
@ -63,61 +65,49 @@ public class ProvideCategoryReportAccTest {
|
|||
public void testGetTotalNumbersOfTasksOfCategoryReport() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
Report report = taskMonitorService.getCategoryReport(null, null, null, null, null, null);
|
||||
CategoryReport report = taskMonitorService.getCategoryReport(null, null, null, null, null, null);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report));
|
||||
}
|
||||
|
||||
assertNotNull(report);
|
||||
assertEquals(33, report.getReportLines().get("EXTERN").getTotalNumberOfTasks());
|
||||
assertEquals(7, report.getReportLines().get("AUTOMATIC").getTotalNumberOfTasks());
|
||||
assertEquals(10, report.getReportLines().get("MANUAL").getTotalNumberOfTasks());
|
||||
assertEquals(0, report.getReportLines().get("EXTERN").getLineItems().size());
|
||||
assertEquals(0, report.getReportLines().get("AUTOMATIC").getLineItems().size());
|
||||
assertEquals(0, report.getReportLines().get("MANUAL").getLineItems().size());
|
||||
assertEquals(50, report.getSumLine().getTotalNumberOfTasks());
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
assertEquals(33, report.getRow("EXTERN").getTotalValue());
|
||||
assertEquals(7, report.getRow("AUTOMATIC").getTotalValue());
|
||||
assertEquals(10, report.getRow("MANUAL").getTotalValue());
|
||||
assertEquals(0, report.getRow("EXTERN").getCells().length);
|
||||
assertEquals(0, report.getRow("AUTOMATIC").getCells().length);
|
||||
assertEquals(0, report.getRow("MANUAL").getCells().length);
|
||||
assertEquals(50, report.getSumRow().getTotalValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCategoryReportWithReportLineItemDefinitions() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getCategoryReport(null, null, null, null, null, null,
|
||||
reportLineItemDefinitions);
|
||||
CategoryReport report = taskMonitorService.getCategoryReport(null, null, null, null, null, null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
int sumLineCount = report.getSumLine().getLineItems().get(0).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(1).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(2).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(3).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(4).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(5).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(6).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(7).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(8).getNumberOfTasks();
|
||||
int sumLineCount = IntStream.of(report.getSumRow().getCells()).sum();
|
||||
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
assertEquals(33, report.getReportLines().get("EXTERN").getTotalNumberOfTasks());
|
||||
assertEquals(7, report.getReportLines().get("AUTOMATIC").getTotalNumberOfTasks());
|
||||
assertEquals(10, report.getReportLines().get("MANUAL").getTotalNumberOfTasks());
|
||||
assertEquals(33, report.getRow("EXTERN").getTotalValue());
|
||||
assertEquals(7, report.getRow("AUTOMATIC").getTotalValue());
|
||||
assertEquals(10, report.getRow("MANUAL").getTotalValue());
|
||||
|
||||
assertEquals(10, report.getSumLine().getLineItems().get(0).getNumberOfTasks());
|
||||
assertEquals(9, report.getSumLine().getLineItems().get(1).getNumberOfTasks());
|
||||
assertEquals(11, report.getSumLine().getLineItems().get(2).getNumberOfTasks());
|
||||
assertEquals(0, report.getSumLine().getLineItems().get(3).getNumberOfTasks());
|
||||
assertEquals(4, report.getSumLine().getLineItems().get(4).getNumberOfTasks());
|
||||
assertEquals(0, report.getSumLine().getLineItems().get(5).getNumberOfTasks());
|
||||
assertEquals(7, report.getSumLine().getLineItems().get(6).getNumberOfTasks());
|
||||
assertEquals(4, report.getSumLine().getLineItems().get(7).getNumberOfTasks());
|
||||
assertEquals(5, report.getSumLine().getLineItems().get(8).getNumberOfTasks());
|
||||
assertEquals(50, report.getSumLine().getTotalNumberOfTasks());
|
||||
int[] sumRow = report.getSumRow().getCells();
|
||||
assertArrayEquals(new int[] {10, 9, 11, 0, 4, 0, 7, 4, 5}, sumRow);
|
||||
assertEquals(50, report.getSumRow().getTotalValue());
|
||||
assertEquals(50, sumLineCount);
|
||||
}
|
||||
|
||||
|
@ -125,142 +115,106 @@ public class ProvideCategoryReportAccTest {
|
|||
public void testEachItemOfCategoryReport() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getCategoryReport(null, null, null, null, null, null,
|
||||
reportLineItemDefinitions);
|
||||
CategoryReport report = taskMonitorService.getCategoryReport(null, null, null, null, null, null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
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(2, line1.get(4).getNumberOfTasks());
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
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(3, line2.get(4).getNumberOfTasks());
|
||||
int[] row1 = report.getRow("EXTERN").getCells();
|
||||
assertArrayEquals(new int[] {15, 8, 2, 6, 2}, row1);
|
||||
|
||||
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(4, line3.get(4).getNumberOfTasks());
|
||||
int[] row2 = report.getRow("AUTOMATIC").getCells();
|
||||
assertArrayEquals(new int[] {2, 1, 0, 1, 3}, row2);
|
||||
|
||||
int[] row3 = report.getRow("MANUAL").getCells();
|
||||
assertArrayEquals(new int[] {2, 2, 2, 0, 4}, row3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEachItemOfCategoryReportNotInWorkingDays() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getCategoryReport(null, null, null, null, null, null,
|
||||
reportLineItemDefinitions, false);
|
||||
CategoryReport report = taskMonitorService.getCategoryReport(null, null, null, null, null, null,
|
||||
columnHeaders, false);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
List<ReportLineItem> line1 = report.getReportLines().get("EXTERN").getLineItems();
|
||||
assertEquals(23, line1.get(0).getNumberOfTasks());
|
||||
assertEquals(0, line1.get(1).getNumberOfTasks());
|
||||
assertEquals(2, line1.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line1.get(3).getNumberOfTasks());
|
||||
assertEquals(8, line1.get(4).getNumberOfTasks());
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
List<ReportLineItem> line2 = report.getReportLines().get("AUTOMATIC").getLineItems();
|
||||
assertEquals(3, line2.get(0).getNumberOfTasks());
|
||||
assertEquals(0, line2.get(1).getNumberOfTasks());
|
||||
assertEquals(0, line2.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line2.get(3).getNumberOfTasks());
|
||||
assertEquals(4, line2.get(4).getNumberOfTasks());
|
||||
int[] row1 = report.getRow("EXTERN").getCells();
|
||||
assertArrayEquals(new int[] {23, 0, 2, 0, 8}, row1);
|
||||
|
||||
List<ReportLineItem> line3 = report.getReportLines().get("MANUAL").getLineItems();
|
||||
assertEquals(4, line3.get(0).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(1).getNumberOfTasks());
|
||||
assertEquals(2, line3.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(3).getNumberOfTasks());
|
||||
assertEquals(4, line3.get(4).getNumberOfTasks());
|
||||
int[] row2 = report.getRow("AUTOMATIC").getCells();
|
||||
assertArrayEquals(new int[] {3, 0, 0, 0, 4}, row2);
|
||||
|
||||
int[] row3 = report.getRow("MANUAL").getCells();
|
||||
assertArrayEquals(new int[] {4, 0, 2, 0, 4}, row3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEachItemOfCategoryReportWithWorkbasketFilter() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getCategoryReport(workbasketIds, null, null, null, null, null,
|
||||
reportLineItemDefinitions);
|
||||
CategoryReport report = taskMonitorService.getCategoryReport(workbasketIds, null, null, null, null, null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
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());
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
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());
|
||||
int[] row1 = report.getRow("EXTERN").getCells();
|
||||
assertArrayEquals(new int[] {10, 2, 0, 0, 0}, row1);
|
||||
|
||||
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());
|
||||
int[] row2 = report.getRow("AUTOMATIC").getCells();
|
||||
assertArrayEquals(new int[] {2, 1, 0, 1, 1}, row2);
|
||||
|
||||
int[] row3 = report.getRow("MANUAL").getCells();
|
||||
assertArrayEquals(new int[] {1, 0, 1, 0, 1}, row3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEachItemOfCategoryReportWithStateFilter() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<TaskState> states = Arrays.asList(TaskState.READY);
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<TaskState> states = Collections.singletonList(TaskState.READY);
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getCategoryReport(null, states, null, null, null, null,
|
||||
reportLineItemDefinitions);
|
||||
CategoryReport report = taskMonitorService.getCategoryReport(null, states, null, null, null, null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
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());
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
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());
|
||||
int[] row1 = report.getRow("EXTERN").getCells();
|
||||
assertArrayEquals(new int[] {15, 8, 2, 6, 0}, row1);
|
||||
|
||||
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());
|
||||
int[] row2 = report.getRow("AUTOMATIC").getCells();
|
||||
assertArrayEquals(new int[] {2, 1, 0, 1, 0}, row2);
|
||||
|
||||
int[] row3 = report.getRow("MANUAL").getCells();
|
||||
assertArrayEquals(new int[] {2, 2, 2, 0, 0}, row3);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -268,66 +222,51 @@ public class ProvideCategoryReportAccTest {
|
|||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getCategoryReport(null, null, categories, null, null, null,
|
||||
reportLineItemDefinitions);
|
||||
CategoryReport report = taskMonitorService.getCategoryReport(null, null, categories, null, null, null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
List<ReportLineItem> line1 = report.getReportLines().get("AUTOMATIC").getLineItems();
|
||||
assertEquals(2, line1.get(0).getNumberOfTasks());
|
||||
assertEquals(1, line1.get(1).getNumberOfTasks());
|
||||
assertEquals(0, line1.get(2).getNumberOfTasks());
|
||||
assertEquals(1, line1.get(3).getNumberOfTasks());
|
||||
assertEquals(3, line1.get(4).getNumberOfTasks());
|
||||
assertNotNull(report);
|
||||
assertEquals(2, report.rowSize());
|
||||
|
||||
List<ReportLineItem> line2 = report.getReportLines().get("MANUAL").getLineItems();
|
||||
assertEquals(2, line2.get(0).getNumberOfTasks());
|
||||
assertEquals(2, line2.get(1).getNumberOfTasks());
|
||||
assertEquals(2, line2.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line2.get(3).getNumberOfTasks());
|
||||
assertEquals(4, line2.get(4).getNumberOfTasks());
|
||||
int[] row1 = report.getRow("AUTOMATIC").getCells();
|
||||
assertArrayEquals(new int[] {2, 1, 0, 1, 3}, row1);
|
||||
|
||||
int[] row2 = report.getRow("MANUAL").getCells();
|
||||
assertArrayEquals(new int[] {2, 2, 2, 0, 4}, row2);
|
||||
|
||||
assertEquals(2, report.getReportLines().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEachItemOfCategoryReportWithDomainFilter() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<String> domains = Arrays.asList("DOMAIN_A");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<String> domains = Collections.singletonList("DOMAIN_A");
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getCategoryReport(null, null, null, domains, null, null,
|
||||
reportLineItemDefinitions);
|
||||
CategoryReport report = taskMonitorService.getCategoryReport(null, null, null, domains, null, null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
List<ReportLineItem> line1 = report.getReportLines().get("EXTERN").getLineItems();
|
||||
assertEquals(8, line1.get(0).getNumberOfTasks());
|
||||
assertEquals(4, line1.get(1).getNumberOfTasks());
|
||||
assertEquals(2, line1.get(2).getNumberOfTasks());
|
||||
assertEquals(4, line1.get(3).getNumberOfTasks());
|
||||
assertEquals(0, line1.get(4).getNumberOfTasks());
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
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());
|
||||
int[] row1 = report.getRow("EXTERN").getCells();
|
||||
assertArrayEquals(new int[] {8, 4, 2, 4, 0}, row1);
|
||||
|
||||
List<ReportLineItem> line3 = report.getReportLines().get("MANUAL").getLineItems();
|
||||
assertEquals(2, line3.get(0).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(1).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(3).getNumberOfTasks());
|
||||
assertEquals(3, line3.get(4).getNumberOfTasks());
|
||||
int[] row2 = report.getRow("AUTOMATIC").getCells();
|
||||
assertArrayEquals(new int[] {1, 0, 0, 1, 1}, row2);
|
||||
|
||||
int[] row3 = report.getRow("MANUAL").getCells();
|
||||
assertArrayEquals(new int[] {2, 0, 0, 0, 3}, row3);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -335,72 +274,64 @@ public class ProvideCategoryReportAccTest {
|
|||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getCategoryReport(null, null, null, null, customField, customFieldValues,
|
||||
reportLineItemDefinitions);
|
||||
CategoryReport report = taskMonitorService.getCategoryReport(null, null, null, null, customField,
|
||||
customFieldValues, columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
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());
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
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());
|
||||
int[] row1 = report.getRow("EXTERN").getCells();
|
||||
assertArrayEquals(new int[] {9, 3, 1, 3, 0}, row1);
|
||||
|
||||
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());
|
||||
int[] row2 = report.getRow("AUTOMATIC").getCells();
|
||||
assertArrayEquals(new int[] {1, 0, 0, 1, 1}, row2);
|
||||
|
||||
int[] row3 = report.getRow("MANUAL").getCells();
|
||||
assertArrayEquals(new int[] {1, 1, 2, 0, 2}, row3);
|
||||
}
|
||||
|
||||
private List<ReportLineItemDefinition> getListOfReportLineItemDefinitions() {
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = new ArrayList<>();
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(Integer.MIN_VALUE, -11));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-10, -6));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-5, -2));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-1));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(0));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(1));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(2, 5));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(6, 10));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(11, Integer.MAX_VALUE));
|
||||
return reportLineItemDefinitions;
|
||||
private List<TimeIntervalColumnHeader> getListOfColumnHeaders() {
|
||||
List<TimeIntervalColumnHeader> columnHeaders = new ArrayList<>();
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(Integer.MIN_VALUE, -11));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-10, -6));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-5, -2));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-1));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(0));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(1));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(2, 5));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(6, 10));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(11, Integer.MAX_VALUE));
|
||||
return columnHeaders;
|
||||
}
|
||||
|
||||
private List<ReportLineItemDefinition> getShortListOfReportLineItemDefinitions() {
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = new ArrayList<>();
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(Integer.MIN_VALUE, -6));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-5, -1));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(0));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(1, 5));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(6, Integer.MAX_VALUE));
|
||||
return reportLineItemDefinitions;
|
||||
private List<TimeIntervalColumnHeader> getShortListOfColumnHeaders() {
|
||||
List<TimeIntervalColumnHeader> columnHeaders = new ArrayList<>();
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(Integer.MIN_VALUE, -6));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-5, -1));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(0));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(1, 5));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(6, Integer.MAX_VALUE));
|
||||
return columnHeaders;
|
||||
}
|
||||
|
||||
private String reportToString(Report report) {
|
||||
private String reportToString(CategoryReport report) {
|
||||
return reportToString(report, null);
|
||||
}
|
||||
|
||||
private String reportToString(Report report, List<ReportLineItemDefinition> reportLineItemDefinitions) {
|
||||
private String reportToString(CategoryReport report,
|
||||
List<TimeIntervalColumnHeader> columnHeaders) {
|
||||
String formatColumWidth = "| %-7s ";
|
||||
String formatFirstColumn = "| %-36s %-4s ";
|
||||
String formatFirstColumnFirstLine = "| %-29s %12s ";
|
||||
String formatFirstColumnSumLine = "| %-36s %-5s";
|
||||
int reportWidth = reportLineItemDefinitions == null ? 46 : reportLineItemDefinitions.size() * 10 + 46;
|
||||
int reportWidth = columnHeaders == null ? 46 : columnHeaders.size() * 10 + 46;
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("\n");
|
||||
|
@ -409,8 +340,8 @@ public class ProvideCategoryReportAccTest {
|
|||
}
|
||||
builder.append("\n");
|
||||
builder.append(String.format(formatFirstColumnFirstLine, "Categories", "Total"));
|
||||
if (reportLineItemDefinitions != null) {
|
||||
for (ReportLineItemDefinition def : reportLineItemDefinitions) {
|
||||
if (columnHeaders != null) {
|
||||
for (TimeIntervalColumnHeader def : columnHeaders) {
|
||||
if (def.getLowerAgeLimit() == Integer.MIN_VALUE) {
|
||||
builder.append(String.format(formatColumWidth, "< " + def.getUpperAgeLimit()));
|
||||
} else if (def.getUpperAgeLimit() == Integer.MAX_VALUE) {
|
||||
|
@ -434,12 +365,12 @@ public class ProvideCategoryReportAccTest {
|
|||
}
|
||||
builder.append("\n");
|
||||
|
||||
for (String rl : report.getReportLines().keySet()) {
|
||||
for (String rl : report.getRowTitles()) {
|
||||
builder
|
||||
.append(String.format(formatFirstColumn, rl, report.getReportLines().get(rl).getTotalNumberOfTasks()));
|
||||
if (reportLineItemDefinitions != null) {
|
||||
for (ReportLineItem reportLineItem : report.getReportLines().get(rl).getLineItems()) {
|
||||
builder.append(String.format(formatColumWidth, reportLineItem.getNumberOfTasks()));
|
||||
.append(String.format(formatFirstColumn, rl, report.getRow(rl).getTotalValue()));
|
||||
if (columnHeaders != null) {
|
||||
for (int cell : report.getRow(rl).getCells()) {
|
||||
builder.append(String.format(formatColumWidth, cell));
|
||||
}
|
||||
}
|
||||
builder.append("|\n");
|
||||
|
@ -448,9 +379,9 @@ public class ProvideCategoryReportAccTest {
|
|||
}
|
||||
builder.append("\n");
|
||||
}
|
||||
builder.append(String.format(formatFirstColumnSumLine, "Total", report.getSumLine().getTotalNumberOfTasks()));
|
||||
for (ReportLineItem sumLine : report.getSumLine().getLineItems()) {
|
||||
builder.append(String.format(formatColumWidth, sumLine.getNumberOfTasks()));
|
||||
builder.append(String.format(formatFirstColumnSumLine, "Total", report.getSumRow().getTotalValue()));
|
||||
for (int cell : report.getSumRow().getCells()) {
|
||||
builder.append(String.format(formatColumWidth, cell));
|
||||
}
|
||||
builder.append("|\n");
|
||||
for (int i = 0; i < reportWidth; i++) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package acceptance.monitoring;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
|
@ -7,7 +8,9 @@ import java.io.IOException;
|
|||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
|
@ -24,21 +27,20 @@ import pro.taskana.TaskanaEngine.ConnectionManagementMode;
|
|||
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||
import pro.taskana.database.TestDataGenerator;
|
||||
import pro.taskana.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.impl.Report;
|
||||
import pro.taskana.impl.ReportLineItem;
|
||||
import pro.taskana.impl.ReportLineItemDefinition;
|
||||
import pro.taskana.impl.TaskanaEngineImpl;
|
||||
import pro.taskana.impl.configuration.DBCleaner;
|
||||
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest;
|
||||
import pro.taskana.impl.report.impl.ClassificationReport;
|
||||
import pro.taskana.impl.report.impl.TimeIntervalColumnHeader;
|
||||
|
||||
/**
|
||||
* Acceptance test for all "classification report" scenarios.
|
||||
*/
|
||||
public class ProvideClassificationReportAccTest {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideClassificationReportAccTest.class);
|
||||
protected static TaskanaEngineConfiguration taskanaEngineConfiguration;
|
||||
protected static TaskanaEngine taskanaEngine;
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideClassificationReportAccTest.class);
|
||||
|
||||
@BeforeClass
|
||||
public static void setupTest() throws Exception {
|
||||
|
@ -59,71 +61,66 @@ public class ProvideClassificationReportAccTest {
|
|||
testDataGenerator.generateMonitoringTestData(dataSource);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test
|
||||
public void testGetTotalNumbersOfTasksOfClassificationReport() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
Report report = taskMonitorService.getClassificationReport(null, null, null, null, null, null);
|
||||
ClassificationReport report = taskMonitorService.getClassificationReport(null, null, null, null, null, null);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report));
|
||||
}
|
||||
|
||||
assertNotNull(report);
|
||||
assertEquals(10, report.getReportLines().get("L10000").getTotalNumberOfTasks());
|
||||
assertEquals(10, report.getReportLines().get("L20000").getTotalNumberOfTasks());
|
||||
assertEquals(7, report.getReportLines().get("L30000").getTotalNumberOfTasks());
|
||||
assertEquals(10, report.getReportLines().get("L40000").getTotalNumberOfTasks());
|
||||
assertEquals(13, report.getReportLines().get("L50000").getTotalNumberOfTasks());
|
||||
assertEquals(0, report.getReportLines().get("L10000").getLineItems().size());
|
||||
assertEquals(0, report.getReportLines().get("L20000").getLineItems().size());
|
||||
assertEquals(0, report.getReportLines().get("L30000").getLineItems().size());
|
||||
assertEquals(0, report.getReportLines().get("L40000").getLineItems().size());
|
||||
assertEquals(0, report.getReportLines().get("L50000").getLineItems().size());
|
||||
assertEquals(50, report.getSumLine().getTotalNumberOfTasks());
|
||||
assertEquals(5, report.rowSize());
|
||||
|
||||
assertEquals(10, report.getRow("L10000").getTotalValue());
|
||||
assertEquals(10, report.getRow("L20000").getTotalValue());
|
||||
assertEquals(7, report.getRow("L30000").getTotalValue());
|
||||
assertEquals(10, report.getRow("L40000").getTotalValue());
|
||||
assertEquals(13, report.getRow("L50000").getTotalValue());
|
||||
assertEquals(0, report.getRow("L10000").getCells().length);
|
||||
assertEquals(0, report.getRow("L20000").getCells().length);
|
||||
assertEquals(0, report.getRow("L30000").getCells().length);
|
||||
assertEquals(0, report.getRow("L40000").getCells().length);
|
||||
assertEquals(0, report.getRow("L50000").getCells().length);
|
||||
assertEquals(50, report.getSumRow().getTotalValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetClassificationReportWithReportLineItemDefinitions() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> reportLineItemDefinitions = getListOfColumnsHeaders();
|
||||
|
||||
Report report = taskMonitorService.getClassificationReport(null, null, null, null, null, null,
|
||||
ClassificationReport report = taskMonitorService.getClassificationReport(null, null, null, null, null, null,
|
||||
reportLineItemDefinitions);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
}
|
||||
|
||||
int sumLineCount = report.getSumLine().getLineItems().get(0).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(1).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(2).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(3).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(4).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(5).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(6).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(7).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(8).getNumberOfTasks();
|
||||
int sumLineCount = IntStream.of(report.getSumRow().getCells()).sum();
|
||||
|
||||
assertNotNull(report);
|
||||
assertEquals(5, report.rowSize());
|
||||
|
||||
assertEquals(10, report.getReportLines().get("L10000").getTotalNumberOfTasks());
|
||||
assertEquals(10, report.getReportLines().get("L20000").getTotalNumberOfTasks());
|
||||
assertEquals(7, report.getReportLines().get("L30000").getTotalNumberOfTasks());
|
||||
assertEquals(10, report.getReportLines().get("L40000").getTotalNumberOfTasks());
|
||||
assertEquals(13, report.getReportLines().get("L50000").getTotalNumberOfTasks());
|
||||
assertEquals(10, report.getRow("L10000").getTotalValue());
|
||||
assertEquals(10, report.getRow("L20000").getTotalValue());
|
||||
assertEquals(7, report.getRow("L30000").getTotalValue());
|
||||
assertEquals(10, report.getRow("L40000").getTotalValue());
|
||||
assertEquals(13, report.getRow("L50000").getTotalValue());
|
||||
|
||||
assertEquals(10, report.getSumLine().getLineItems().get(0).getNumberOfTasks());
|
||||
assertEquals(9, report.getSumLine().getLineItems().get(1).getNumberOfTasks());
|
||||
assertEquals(11, report.getSumLine().getLineItems().get(2).getNumberOfTasks());
|
||||
assertEquals(0, report.getSumLine().getLineItems().get(3).getNumberOfTasks());
|
||||
assertEquals(4, report.getSumLine().getLineItems().get(4).getNumberOfTasks());
|
||||
assertEquals(0, report.getSumLine().getLineItems().get(5).getNumberOfTasks());
|
||||
assertEquals(7, report.getSumLine().getLineItems().get(6).getNumberOfTasks());
|
||||
assertEquals(4, report.getSumLine().getLineItems().get(7).getNumberOfTasks());
|
||||
assertEquals(5, report.getSumLine().getLineItems().get(8).getNumberOfTasks());
|
||||
assertEquals(50, report.getSumLine().getTotalNumberOfTasks());
|
||||
assertEquals(10, report.getSumRow().getCells()[0]);
|
||||
assertEquals(9, report.getSumRow().getCells()[1]);
|
||||
assertEquals(11, report.getSumRow().getCells()[2]);
|
||||
assertEquals(0, report.getSumRow().getCells()[3]);
|
||||
assertEquals(4, report.getSumRow().getCells()[4]);
|
||||
assertEquals(0, report.getSumRow().getCells()[5]);
|
||||
assertEquals(7, report.getSumRow().getCells()[6]);
|
||||
assertEquals(4, report.getSumRow().getCells()[7]);
|
||||
assertEquals(5, report.getSumRow().getCells()[8]);
|
||||
assertEquals(50, report.getSumRow().getTotalValue());
|
||||
assertEquals(50, sumLineCount);
|
||||
}
|
||||
|
||||
|
@ -131,198 +128,131 @@ public class ProvideClassificationReportAccTest {
|
|||
public void testEachItemOfClassificationReport() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getClassificationReport(null, null, null, null, null, null,
|
||||
reportLineItemDefinitions);
|
||||
ClassificationReport report = taskMonitorService.getClassificationReport(null, null, null, null, null, null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
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());
|
||||
assertNotNull(report);
|
||||
assertEquals(5, report.rowSize());
|
||||
|
||||
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());
|
||||
int[] row1 = report.getRow("L10000").getCells();
|
||||
assertArrayEquals(new int[] {7, 2, 1, 0, 0}, row1);
|
||||
|
||||
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(3, line3.get(4).getNumberOfTasks());
|
||||
int[] row2 = report.getRow("L20000").getCells();
|
||||
assertArrayEquals(new int[] {5, 3, 1, 1, 0}, row2);
|
||||
|
||||
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(4, line4.get(4).getNumberOfTasks());
|
||||
int[] row3 = report.getRow("L30000").getCells();
|
||||
assertArrayEquals(new int[] {2, 1, 0, 1, 3}, row3);
|
||||
|
||||
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(2, line5.get(4).getNumberOfTasks());
|
||||
int[] row4 = report.getRow("L40000").getCells();
|
||||
assertArrayEquals(new int[] {2, 2, 2, 0, 4}, row4);
|
||||
|
||||
int[] row5 = report.getRow("L50000").getCells();
|
||||
assertArrayEquals(new int[] {3, 3, 0, 5, 2}, row5);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEachItemOfClassificationReportNotInWorkingDays() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> reportLineItemDefinitions = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getClassificationReport(null, null, null, null, null, null,
|
||||
ClassificationReport report = taskMonitorService.getClassificationReport(null, null, null, null, null, null,
|
||||
reportLineItemDefinitions, false);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
}
|
||||
|
||||
List<ReportLineItem> line1 = report.getReportLines().get("L10000").getLineItems();
|
||||
assertEquals(9, line1.get(0).getNumberOfTasks());
|
||||
assertEquals(0, line1.get(1).getNumberOfTasks());
|
||||
assertEquals(1, line1.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line1.get(3).getNumberOfTasks());
|
||||
assertEquals(0, line1.get(4).getNumberOfTasks());
|
||||
assertNotNull(report);
|
||||
assertEquals(5, report.rowSize());
|
||||
|
||||
List<ReportLineItem> line2 = report.getReportLines().get("L20000").getLineItems();
|
||||
assertEquals(8, line2.get(0).getNumberOfTasks());
|
||||
assertEquals(0, line2.get(1).getNumberOfTasks());
|
||||
assertEquals(1, line2.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line2.get(3).getNumberOfTasks());
|
||||
assertEquals(1, line2.get(4).getNumberOfTasks());
|
||||
int[] row1 = report.getRow("L10000").getCells();
|
||||
assertArrayEquals(new int[] {9, 0, 1, 0, 0}, row1);
|
||||
|
||||
List<ReportLineItem> line3 = report.getReportLines().get("L30000").getLineItems();
|
||||
assertEquals(3, line3.get(0).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(1).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(3).getNumberOfTasks());
|
||||
assertEquals(4, line3.get(4).getNumberOfTasks());
|
||||
int[] row2 = report.getRow("L20000").getCells();
|
||||
assertArrayEquals(new int[] {8, 0, 1, 0, 1}, row2);
|
||||
|
||||
List<ReportLineItem> line4 = report.getReportLines().get("L40000").getLineItems();
|
||||
assertEquals(4, line4.get(0).getNumberOfTasks());
|
||||
assertEquals(0, line4.get(1).getNumberOfTasks());
|
||||
assertEquals(2, line4.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line4.get(3).getNumberOfTasks());
|
||||
assertEquals(4, line4.get(4).getNumberOfTasks());
|
||||
int[] row3 = report.getRow("L30000").getCells();
|
||||
assertArrayEquals(new int[] {3, 0, 0, 0, 4}, row3);
|
||||
|
||||
List<ReportLineItem> line5 = report.getReportLines().get("L50000").getLineItems();
|
||||
assertEquals(6, line5.get(0).getNumberOfTasks());
|
||||
assertEquals(0, line5.get(1).getNumberOfTasks());
|
||||
assertEquals(0, line5.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line5.get(3).getNumberOfTasks());
|
||||
assertEquals(7, line5.get(4).getNumberOfTasks());
|
||||
int[] row4 = report.getRow("L40000").getCells();
|
||||
assertArrayEquals(new int[] {4, 0, 2, 0, 4}, row4);
|
||||
|
||||
int[] row5 = report.getRow("L50000").getCells();
|
||||
assertArrayEquals(new int[] {6, 0, 0, 0, 7}, row5);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEachItemOfClassificationReportWithWorkbasketFilter() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getClassificationReport(workbasketIds, null, null, null, null, null,
|
||||
reportLineItemDefinitions);
|
||||
ClassificationReport report = taskMonitorService.getClassificationReport(workbasketIds, null, null, null, null,
|
||||
null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
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());
|
||||
assertNotNull(report);
|
||||
assertEquals(5, report.rowSize());
|
||||
|
||||
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());
|
||||
int[] row1 = report.getRow("L10000").getCells();
|
||||
assertArrayEquals(new int[] {6, 0, 0, 0, 0}, row1);
|
||||
|
||||
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());
|
||||
int[] row2 = report.getRow("L20000").getCells();
|
||||
assertArrayEquals(new int[] {2, 0, 0, 0, 0}, row2);
|
||||
|
||||
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());
|
||||
int[] row3 = report.getRow("L30000").getCells();
|
||||
assertArrayEquals(new int[] {2, 1, 0, 1, 1}, row3);
|
||||
|
||||
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());
|
||||
int[] row4 = report.getRow("L40000").getCells();
|
||||
assertArrayEquals(new int[] {1, 0, 1, 0, 1}, row4);
|
||||
|
||||
int[] row5 = report.getRow("L50000").getCells();
|
||||
assertArrayEquals(new int[] {2, 2, 0, 0, 0}, row5);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEachItemOfClassificationReportWithStateFilter() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<TaskState> states = Arrays.asList(TaskState.READY);
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<TaskState> states = Collections.singletonList(TaskState.READY);
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getClassificationReport(null, states, null, null, null, null,
|
||||
reportLineItemDefinitions);
|
||||
ClassificationReport report = taskMonitorService.getClassificationReport(null, states, null, null, null, null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
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());
|
||||
assertNotNull(report);
|
||||
assertEquals(5, report.rowSize());
|
||||
|
||||
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());
|
||||
int[] row1 = report.getRow("L10000").getCells();
|
||||
assertArrayEquals(new int[] {7, 2, 1, 0, 0}, row1);
|
||||
|
||||
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());
|
||||
int[] row2 = report.getRow("L20000").getCells();
|
||||
assertArrayEquals(new int[] {5, 3, 1, 1, 0}, row2);
|
||||
|
||||
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());
|
||||
int[] row3 = report.getRow("L30000").getCells();
|
||||
assertArrayEquals(new int[] {2, 1, 0, 1, 0}, row3);
|
||||
|
||||
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());
|
||||
int[] row4 = report.getRow("L40000").getCells();
|
||||
assertArrayEquals(new int[] {2, 2, 2, 0, 0}, row4);
|
||||
|
||||
int[] row5 = report.getRow("L50000").getCells();
|
||||
assertArrayEquals(new int[] {3, 3, 0, 5, 0}, row5);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -330,80 +260,57 @@ public class ProvideClassificationReportAccTest {
|
|||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getClassificationReport(null, null, categories, null, null, null,
|
||||
reportLineItemDefinitions);
|
||||
ClassificationReport report = taskMonitorService.getClassificationReport(null, null, categories, null, null,
|
||||
null, columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
List<ReportLineItem> line1 = report.getReportLines().get("L30000").getLineItems();
|
||||
assertEquals(2, line1.get(0).getNumberOfTasks());
|
||||
assertEquals(1, line1.get(1).getNumberOfTasks());
|
||||
assertEquals(0, line1.get(2).getNumberOfTasks());
|
||||
assertEquals(1, line1.get(3).getNumberOfTasks());
|
||||
assertEquals(3, line1.get(4).getNumberOfTasks());
|
||||
assertNotNull(report);
|
||||
assertEquals(2, report.rowSize());
|
||||
|
||||
List<ReportLineItem> line2 = report.getReportLines().get("L40000").getLineItems();
|
||||
assertEquals(2, line2.get(0).getNumberOfTasks());
|
||||
assertEquals(2, line2.get(1).getNumberOfTasks());
|
||||
assertEquals(2, line2.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line2.get(3).getNumberOfTasks());
|
||||
assertEquals(4, line2.get(4).getNumberOfTasks());
|
||||
int[] row1 = report.getRow("L30000").getCells();
|
||||
assertArrayEquals(new int[] {2, 1, 0, 1, 3}, row1);
|
||||
|
||||
int[] row2 = report.getRow("L40000").getCells();
|
||||
assertArrayEquals(new int[] {2, 2, 2, 0, 4}, row2);
|
||||
|
||||
assertEquals(2, report.getReportLines().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEachItemOfClassificationReportWithDomainFilter() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<String> domains = Arrays.asList("DOMAIN_A");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<String> domains = Collections.singletonList("DOMAIN_A");
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getClassificationReport(null, null, null, domains, null, null,
|
||||
reportLineItemDefinitions);
|
||||
ClassificationReport report = taskMonitorService.getClassificationReport(null, null, null, domains, null, null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
List<ReportLineItem> line1 = report.getReportLines().get("L10000").getLineItems();
|
||||
assertEquals(5, 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());
|
||||
assertNotNull(report);
|
||||
assertEquals(5, report.rowSize());
|
||||
|
||||
List<ReportLineItem> line2 = report.getReportLines().get("L20000").getLineItems();
|
||||
assertEquals(3, 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());
|
||||
int[] row1 = report.getRow("L10000").getCells();
|
||||
assertArrayEquals(new int[] {5, 2, 1, 0, 0}, row1);
|
||||
|
||||
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());
|
||||
int[] row2 = report.getRow("L20000").getCells();
|
||||
assertArrayEquals(new int[] {3, 1, 1, 1, 0}, row2);
|
||||
|
||||
List<ReportLineItem> line4 = report.getReportLines().get("L40000").getLineItems();
|
||||
assertEquals(2, line4.get(0).getNumberOfTasks());
|
||||
assertEquals(0, line4.get(1).getNumberOfTasks());
|
||||
assertEquals(0, line4.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line4.get(3).getNumberOfTasks());
|
||||
assertEquals(3, line4.get(4).getNumberOfTasks());
|
||||
int[] row3 = report.getRow("L30000").getCells();
|
||||
assertArrayEquals(new int[] {1, 0, 0, 1, 1}, row3);
|
||||
|
||||
List<ReportLineItem> line5 = report.getReportLines().get("L50000").getLineItems();
|
||||
assertEquals(0, line5.get(0).getNumberOfTasks());
|
||||
assertEquals(1, line5.get(1).getNumberOfTasks());
|
||||
assertEquals(0, line5.get(2).getNumberOfTasks());
|
||||
assertEquals(3, line5.get(3).getNumberOfTasks());
|
||||
assertEquals(0, line5.get(4).getNumberOfTasks());
|
||||
int[] row4 = report.getRow("L40000").getCells();
|
||||
assertArrayEquals(new int[] {2, 0, 0, 0, 3}, row4);
|
||||
|
||||
int[] row5 = report.getRow("L50000").getCells();
|
||||
assertArrayEquals(new int[] {0, 1, 0, 3, 0}, row5);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -411,86 +318,69 @@ public class ProvideClassificationReportAccTest {
|
|||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getClassificationReport(null, null, null, null, customField,
|
||||
customFieldValues, reportLineItemDefinitions);
|
||||
ClassificationReport report = taskMonitorService.getClassificationReport(null, null, null, null, customField,
|
||||
customFieldValues, columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
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());
|
||||
assertNotNull(report);
|
||||
assertEquals(5, report.rowSize());
|
||||
|
||||
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());
|
||||
int[] row1 = report.getRow("L10000").getCells();
|
||||
assertArrayEquals(new int[] {4, 0, 0, 0, 0}, row1);
|
||||
|
||||
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());
|
||||
int[] row2 = report.getRow("L20000").getCells();
|
||||
assertArrayEquals(new int[] {4, 1, 1, 1, 0}, row2);
|
||||
|
||||
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());
|
||||
int[] row3 = report.getRow("L30000").getCells();
|
||||
assertArrayEquals(new int[] {1, 0, 0, 1, 1}, row3);
|
||||
|
||||
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());
|
||||
int[] row4 = report.getRow("L40000").getCells();
|
||||
assertArrayEquals(new int[] {1, 1, 2, 0, 2}, row4);
|
||||
|
||||
int[] row5 = report.getRow("L50000").getCells();
|
||||
assertArrayEquals(new int[] {1, 2, 0, 2, 0}, row5);
|
||||
}
|
||||
|
||||
private List<ReportLineItemDefinition> getListOfReportLineItemDefinitions() {
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = new ArrayList<>();
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(Integer.MIN_VALUE, -11));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-10, -6));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-5, -2));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-1));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(0));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(1));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(2, 5));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(6, 10));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(11, Integer.MAX_VALUE));
|
||||
private List<TimeIntervalColumnHeader> getListOfColumnsHeaders() {
|
||||
List<TimeIntervalColumnHeader> columnHeaders = new ArrayList<>();
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(Integer.MIN_VALUE, -11));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-10, -6));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-5, -2));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-1));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(0));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(1));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(2, 5));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(6, 10));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(11, Integer.MAX_VALUE));
|
||||
return columnHeaders;
|
||||
}
|
||||
|
||||
private List<TimeIntervalColumnHeader> getShortListOfColumnHeaders() {
|
||||
List<TimeIntervalColumnHeader> reportLineItemDefinitions = new ArrayList<>();
|
||||
reportLineItemDefinitions.add(new TimeIntervalColumnHeader(Integer.MIN_VALUE, -6));
|
||||
reportLineItemDefinitions.add(new TimeIntervalColumnHeader(-5, -1));
|
||||
reportLineItemDefinitions.add(new TimeIntervalColumnHeader(0));
|
||||
reportLineItemDefinitions.add(new TimeIntervalColumnHeader(1, 5));
|
||||
reportLineItemDefinitions.add(new TimeIntervalColumnHeader(6, Integer.MAX_VALUE));
|
||||
return reportLineItemDefinitions;
|
||||
}
|
||||
|
||||
private List<ReportLineItemDefinition> getShortListOfReportLineItemDefinitions() {
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = new ArrayList<>();
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(Integer.MIN_VALUE, -6));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-5, -1));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(0));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(1, 5));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(6, Integer.MAX_VALUE));
|
||||
return reportLineItemDefinitions;
|
||||
}
|
||||
|
||||
private String reportToString(Report report) {
|
||||
private String reportToString(ClassificationReport report) {
|
||||
return reportToString(report, null);
|
||||
}
|
||||
|
||||
private String reportToString(Report report, List<ReportLineItemDefinition> reportLineItemDefinitions) {
|
||||
private String reportToString(ClassificationReport report, List<TimeIntervalColumnHeader> columnHeaders) {
|
||||
String formatColumWidth = "| %-7s ";
|
||||
String formatFirstColumn = "| %-36s %-4s ";
|
||||
String formatFirstColumnFirstLine = "| %-29s %12s ";
|
||||
String formatFirstColumnSumLine = "| %-36s %-5s";
|
||||
int reportWidth = reportLineItemDefinitions == null ? 46 : reportLineItemDefinitions.size() * 10 + 46;
|
||||
int reportWidth = columnHeaders == null ? 46 : columnHeaders.size() * 10 + 46;
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("\n");
|
||||
|
@ -499,8 +389,8 @@ public class ProvideClassificationReportAccTest {
|
|||
}
|
||||
builder.append("\n");
|
||||
builder.append(String.format(formatFirstColumnFirstLine, "Classifications", "Total"));
|
||||
if (reportLineItemDefinitions != null) {
|
||||
for (ReportLineItemDefinition def : reportLineItemDefinitions) {
|
||||
if (columnHeaders != null) {
|
||||
for (TimeIntervalColumnHeader def : columnHeaders) {
|
||||
if (def.getLowerAgeLimit() == Integer.MIN_VALUE) {
|
||||
builder.append(String.format(formatColumWidth, "< " + def.getUpperAgeLimit()));
|
||||
} else if (def.getUpperAgeLimit() == Integer.MAX_VALUE) {
|
||||
|
@ -524,12 +414,12 @@ public class ProvideClassificationReportAccTest {
|
|||
}
|
||||
builder.append("\n");
|
||||
|
||||
for (String rl : report.getReportLines().keySet()) {
|
||||
for (String rl : report.getRowTitles()) {
|
||||
builder
|
||||
.append(String.format(formatFirstColumn, rl, report.getReportLines().get(rl).getTotalNumberOfTasks()));
|
||||
if (reportLineItemDefinitions != null) {
|
||||
for (ReportLineItem reportLineItem : report.getReportLines().get(rl).getLineItems()) {
|
||||
builder.append(String.format(formatColumWidth, reportLineItem.getNumberOfTasks()));
|
||||
.append(String.format(formatFirstColumn, rl, report.getRow(rl).getTotalValue()));
|
||||
if (columnHeaders != null) {
|
||||
for (int cell : report.getRow(rl).getCells()) {
|
||||
builder.append(String.format(formatColumWidth, cell));
|
||||
}
|
||||
}
|
||||
builder.append("|\n");
|
||||
|
@ -538,9 +428,9 @@ public class ProvideClassificationReportAccTest {
|
|||
}
|
||||
builder.append("\n");
|
||||
}
|
||||
builder.append(String.format(formatFirstColumnSumLine, "Total", report.getSumLine().getTotalNumberOfTasks()));
|
||||
for (ReportLineItem sumLine : report.getSumLine().getLineItems()) {
|
||||
builder.append(String.format(formatColumWidth, sumLine.getNumberOfTasks()));
|
||||
builder.append(String.format(formatFirstColumnSumLine, "Total", report.getSumRow().getTotalValue()));
|
||||
for (int cell : report.getSumRow().getCells()) {
|
||||
builder.append(String.format(formatColumWidth, cell));
|
||||
}
|
||||
builder.append("|\n");
|
||||
for (int i = 0; i < reportWidth; i++) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package acceptance.monitoring;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
|
@ -7,6 +8,7 @@ import java.io.IOException;
|
|||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
@ -24,21 +26,19 @@ import pro.taskana.TaskanaEngine.ConnectionManagementMode;
|
|||
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||
import pro.taskana.database.TestDataGenerator;
|
||||
import pro.taskana.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.impl.Report;
|
||||
import pro.taskana.impl.ReportLineItem;
|
||||
import pro.taskana.impl.ReportLineItemDefinition;
|
||||
import pro.taskana.impl.TaskanaEngineImpl;
|
||||
import pro.taskana.impl.configuration.DBCleaner;
|
||||
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest;
|
||||
import pro.taskana.impl.report.impl.CustomFieldValueReport;
|
||||
import pro.taskana.impl.report.impl.TimeIntervalColumnHeader;
|
||||
|
||||
/**
|
||||
* Acceptance test for all "classification report" scenarios.
|
||||
*/
|
||||
public class ProvideCustomFieldValueReportAccTest {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideCustomFieldValueReportAccTest.class);
|
||||
protected static TaskanaEngineConfiguration taskanaEngineConfiguration;
|
||||
protected static TaskanaEngine taskanaEngine;
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideCustomFieldValueReportAccTest.class);
|
||||
|
||||
@BeforeClass
|
||||
public static void setupTest() throws Exception {
|
||||
|
@ -53,7 +53,7 @@ public class ProvideCustomFieldValueReportAccTest {
|
|||
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false);
|
||||
taskanaEngineConfiguration.setGermanPublicHolidaysEnabled(false);
|
||||
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
|
||||
((TaskanaEngineImpl) taskanaEngine).setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
|
||||
taskanaEngine.setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
|
||||
cleaner.clearDb(dataSource, false);
|
||||
TestDataGenerator testDataGenerator = new TestDataGenerator();
|
||||
testDataGenerator.generateMonitoringTestData(dataSource);
|
||||
|
@ -65,21 +65,24 @@ public class ProvideCustomFieldValueReportAccTest {
|
|||
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
|
||||
Report report = taskMonitorService.getCustomFieldValueReport(null, null, null, null, customField, null);
|
||||
CustomFieldValueReport report = taskMonitorService.getCustomFieldValueReport(null, null, null, null,
|
||||
customField, null);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report));
|
||||
}
|
||||
|
||||
assertNotNull(report);
|
||||
assertEquals(25, report.getReportLines().get("Geschaeftsstelle A").getTotalNumberOfTasks());
|
||||
assertEquals(10, report.getReportLines().get("Geschaeftsstelle B").getTotalNumberOfTasks());
|
||||
assertEquals(15, report.getReportLines().get("Geschaeftsstelle C").getTotalNumberOfTasks());
|
||||
assertEquals(0, report.getReportLines().get("Geschaeftsstelle A").getLineItems().size());
|
||||
assertEquals(0, report.getReportLines().get("Geschaeftsstelle B").getLineItems().size());
|
||||
assertEquals(0, report.getReportLines().get("Geschaeftsstelle C").getLineItems().size());
|
||||
assertEquals(3, report.getReportLines().size());
|
||||
assertEquals(50, report.getSumLine().getTotalNumberOfTasks());
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
assertEquals(25, report.getRow("Geschaeftsstelle A").getTotalValue());
|
||||
assertEquals(10, report.getRow("Geschaeftsstelle B").getTotalValue());
|
||||
assertEquals(15, report.getRow("Geschaeftsstelle C").getTotalValue());
|
||||
assertEquals(0, report.getRow("Geschaeftsstelle A").getCells().length);
|
||||
assertEquals(0, report.getRow("Geschaeftsstelle B").getCells().length);
|
||||
assertEquals(0, report.getRow("Geschaeftsstelle C").getCells().length);
|
||||
|
||||
assertEquals(50, report.getSumRow().getTotalValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -88,21 +91,23 @@ public class ProvideCustomFieldValueReportAccTest {
|
|||
|
||||
CustomField customField = CustomField.CUSTOM_2;
|
||||
|
||||
Report report = taskMonitorService.getCustomFieldValueReport(null, null, null, null, customField, null);
|
||||
CustomFieldValueReport report = taskMonitorService.getCustomFieldValueReport(null, null, null, null,
|
||||
customField, null);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report));
|
||||
}
|
||||
|
||||
assertNotNull(report);
|
||||
assertEquals(21, report.getReportLines().get("Vollkasko").getTotalNumberOfTasks());
|
||||
assertEquals(29, report.getReportLines().get("Teilkasko").getTotalNumberOfTasks());
|
||||
assertEquals(2, report.rowSize());
|
||||
|
||||
assertEquals(0, report.getReportLines().get("Vollkasko").getLineItems().size());
|
||||
assertEquals(0, report.getReportLines().get("Teilkasko").getLineItems().size());
|
||||
assertEquals(21, report.getRow("Vollkasko").getTotalValue());
|
||||
assertEquals(29, report.getRow("Teilkasko").getTotalValue());
|
||||
|
||||
assertEquals(2, report.getReportLines().size());
|
||||
assertEquals(50, report.getSumLine().getTotalNumberOfTasks());
|
||||
assertEquals(0, report.getRow("Vollkasko").getCells().length);
|
||||
assertEquals(0, report.getRow("Teilkasko").getCells().length);
|
||||
|
||||
assertEquals(50, report.getSumRow().getTotalValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -110,33 +115,26 @@ public class ProvideCustomFieldValueReportAccTest {
|
|||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getCustomFieldValueReport(null, null, null, null, customField, null,
|
||||
reportLineItemDefinitions);
|
||||
CustomFieldValueReport report = taskMonitorService.getCustomFieldValueReport(null, null, null, null,
|
||||
customField, null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
assertEquals(25, report.getReportLines().get("Geschaeftsstelle A").getTotalNumberOfTasks());
|
||||
assertEquals(10, report.getReportLines().get("Geschaeftsstelle B").getTotalNumberOfTasks());
|
||||
assertEquals(15, report.getReportLines().get("Geschaeftsstelle C").getTotalNumberOfTasks());
|
||||
assertEquals(25, report.getRow("Geschaeftsstelle A").getTotalValue());
|
||||
assertEquals(10, report.getRow("Geschaeftsstelle B").getTotalValue());
|
||||
assertEquals(15, report.getRow("Geschaeftsstelle C").getTotalValue());
|
||||
|
||||
assertEquals(10, report.getSumLine().getLineItems().get(0).getNumberOfTasks());
|
||||
assertEquals(9, report.getSumLine().getLineItems().get(1).getNumberOfTasks());
|
||||
assertEquals(11, report.getSumLine().getLineItems().get(2).getNumberOfTasks());
|
||||
assertEquals(0, report.getSumLine().getLineItems().get(3).getNumberOfTasks());
|
||||
assertEquals(4, report.getSumLine().getLineItems().get(4).getNumberOfTasks());
|
||||
assertEquals(0, report.getSumLine().getLineItems().get(5).getNumberOfTasks());
|
||||
assertEquals(7, report.getSumLine().getLineItems().get(6).getNumberOfTasks());
|
||||
assertEquals(4, report.getSumLine().getLineItems().get(7).getNumberOfTasks());
|
||||
assertEquals(5, report.getSumLine().getLineItems().get(8).getNumberOfTasks());
|
||||
assertArrayEquals(new int[] {10, 9, 11, 0, 4, 0, 7, 4, 5}, report.getSumRow().getCells());
|
||||
|
||||
assertEquals(3, report.getReportLines().size());
|
||||
assertEquals(50, report.getSumLine().getTotalNumberOfTasks());
|
||||
assertEquals(50, report.getSumRow().getTotalValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -144,35 +142,27 @@ public class ProvideCustomFieldValueReportAccTest {
|
|||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getCustomFieldValueReport(null, null, null, null, customField, null,
|
||||
reportLineItemDefinitions);
|
||||
CustomFieldValueReport report = taskMonitorService.getCustomFieldValueReport(null, null, null, null,
|
||||
customField, null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
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());
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
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());
|
||||
int[] row1 = report.getRow("Geschaeftsstelle A").getCells();
|
||||
assertArrayEquals(new int[] {11, 4, 3, 4, 3}, row1);
|
||||
|
||||
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(6, line3.get(4).getNumberOfTasks());
|
||||
int[] row2 = report.getRow("Geschaeftsstelle B").getCells();
|
||||
assertArrayEquals(new int[] {5, 3, 0, 2, 0}, row2);
|
||||
|
||||
int[] row3 = report.getRow("Geschaeftsstelle C").getCells();
|
||||
assertArrayEquals(new int[] {3, 4, 1, 1, 6}, row3);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -180,109 +170,85 @@ public class ProvideCustomFieldValueReportAccTest {
|
|||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getCustomFieldValueReport(null, null, null, null, customField, null,
|
||||
reportLineItemDefinitions, false);
|
||||
CustomFieldValueReport report = taskMonitorService.getCustomFieldValueReport(null, null, null, null,
|
||||
customField, null,
|
||||
columnHeaders, false);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
List<ReportLineItem> line1 = report.getReportLines().get("Geschaeftsstelle A").getLineItems();
|
||||
assertEquals(15, line1.get(0).getNumberOfTasks());
|
||||
assertEquals(0, line1.get(1).getNumberOfTasks());
|
||||
assertEquals(3, line1.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line1.get(3).getNumberOfTasks());
|
||||
assertEquals(7, line1.get(4).getNumberOfTasks());
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
List<ReportLineItem> line2 = report.getReportLines().get("Geschaeftsstelle B").getLineItems();
|
||||
assertEquals(8, line2.get(0).getNumberOfTasks());
|
||||
assertEquals(0, line2.get(1).getNumberOfTasks());
|
||||
assertEquals(0, line2.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line2.get(3).getNumberOfTasks());
|
||||
assertEquals(2, line2.get(4).getNumberOfTasks());
|
||||
int[] row1 = report.getRow("Geschaeftsstelle A").getCells();
|
||||
assertArrayEquals(new int[] {15, 0, 3, 0, 7}, row1);
|
||||
|
||||
List<ReportLineItem> line3 = report.getReportLines().get("Geschaeftsstelle C").getLineItems();
|
||||
assertEquals(7, line3.get(0).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(1).getNumberOfTasks());
|
||||
assertEquals(1, line3.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(3).getNumberOfTasks());
|
||||
assertEquals(7, line3.get(4).getNumberOfTasks());
|
||||
int[] row2 = report.getRow("Geschaeftsstelle B").getCells();
|
||||
assertArrayEquals(new int[] {8, 0, 0, 0, 2}, row2);
|
||||
|
||||
int[] row3 = report.getRow("Geschaeftsstelle C").getCells();
|
||||
assertArrayEquals(new int[] {7, 0, 1, 0, 7}, row3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEachItemOfCustomFieldValueReportWithWorkbasketFilter() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
|
||||
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getCustomFieldValueReport(workbasketIds, null, null, null, customField, null,
|
||||
reportLineItemDefinitions);
|
||||
CustomFieldValueReport report = taskMonitorService.getCustomFieldValueReport(workbasketIds, null, null, null,
|
||||
customField, null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
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());
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
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());
|
||||
int[] row1 = report.getRow("Geschaeftsstelle A").getCells();
|
||||
assertArrayEquals(new int[] {6, 1, 1, 1, 1}, row1);
|
||||
|
||||
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());
|
||||
int[] row2 = report.getRow("Geschaeftsstelle B").getCells();
|
||||
assertArrayEquals(new int[] {4, 1, 0, 0, 0}, row2);
|
||||
|
||||
int[] row3 = report.getRow("Geschaeftsstelle C").getCells();
|
||||
assertArrayEquals(new int[] {3, 1, 0, 0, 1}, row3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEachItemOfCustomFieldValueReportWithStateFilter() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<TaskState> states = Arrays.asList(TaskState.READY);
|
||||
List<TaskState> states = Collections.singletonList(TaskState.READY);
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getCustomFieldValueReport(null, states, null, null, customField, null,
|
||||
reportLineItemDefinitions);
|
||||
CustomFieldValueReport report = taskMonitorService.getCustomFieldValueReport(null, states, null, null,
|
||||
customField, null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
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());
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
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());
|
||||
int[] row1 = report.getRow("Geschaeftsstelle A").getCells();
|
||||
assertArrayEquals(new int[] {11, 4, 3, 4, 0}, row1);
|
||||
|
||||
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());
|
||||
int[] row2 = report.getRow("Geschaeftsstelle B").getCells();
|
||||
assertArrayEquals(new int[] {5, 3, 0, 2, 0}, row2);
|
||||
|
||||
int[] row3 = report.getRow("Geschaeftsstelle C").getCells();
|
||||
assertArrayEquals(new int[] {3, 4, 1, 1, 0}, row3);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -292,72 +258,56 @@ public class ProvideCustomFieldValueReportAccTest {
|
|||
List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getCustomFieldValueReport(null, null, categories, null, customField, null,
|
||||
reportLineItemDefinitions);
|
||||
CustomFieldValueReport report = taskMonitorService.getCustomFieldValueReport(null, null, categories, null,
|
||||
customField, null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
List<ReportLineItem> line1 = report.getReportLines().get("Geschaeftsstelle A").getLineItems();
|
||||
assertEquals(2, line1.get(0).getNumberOfTasks());
|
||||
assertEquals(1, line1.get(1).getNumberOfTasks());
|
||||
assertEquals(2, line1.get(2).getNumberOfTasks());
|
||||
assertEquals(1, line1.get(3).getNumberOfTasks());
|
||||
assertEquals(3, line1.get(4).getNumberOfTasks());
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
List<ReportLineItem> line2 = report.getReportLines().get("Geschaeftsstelle B").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());
|
||||
int[] row1 = report.getRow("Geschaeftsstelle A").getCells();
|
||||
assertArrayEquals(new int[] {2, 1, 2, 1, 3}, row1);
|
||||
|
||||
List<ReportLineItem> line3 = report.getReportLines().get("Geschaeftsstelle C").getLineItems();
|
||||
assertEquals(0, line3.get(0).getNumberOfTasks());
|
||||
assertEquals(2, line3.get(1).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(3).getNumberOfTasks());
|
||||
assertEquals(4, line3.get(4).getNumberOfTasks());
|
||||
int[] row2 = report.getRow("Geschaeftsstelle B").getCells();
|
||||
assertArrayEquals(new int[] {2, 0, 0, 0, 0}, row2);
|
||||
|
||||
int[] row3 = report.getRow("Geschaeftsstelle C").getCells();
|
||||
assertArrayEquals(new int[] {0, 2, 0, 0, 4}, row3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEachItemOfCustomFieldValueReportWithDomainFilter() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<String> domains = Arrays.asList("DOMAIN_A");
|
||||
List<String> domains = Collections.singletonList("DOMAIN_A");
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getCustomFieldValueReport(null, null, null, domains, customField, null,
|
||||
reportLineItemDefinitions);
|
||||
CustomFieldValueReport report = taskMonitorService.getCustomFieldValueReport(null, null, null, domains,
|
||||
customField, null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
List<ReportLineItem> line1 = report.getReportLines().get("Geschaeftsstelle A").getLineItems();
|
||||
assertEquals(8, line1.get(0).getNumberOfTasks());
|
||||
assertEquals(1, line1.get(1).getNumberOfTasks());
|
||||
assertEquals(1, line1.get(2).getNumberOfTasks());
|
||||
assertEquals(4, line1.get(3).getNumberOfTasks());
|
||||
assertEquals(1, line1.get(4).getNumberOfTasks());
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
List<ReportLineItem> line2 = report.getReportLines().get("Geschaeftsstelle B").getLineItems();
|
||||
assertEquals(2, line2.get(0).getNumberOfTasks());
|
||||
assertEquals(2, line2.get(1).getNumberOfTasks());
|
||||
assertEquals(0, line2.get(2).getNumberOfTasks());
|
||||
assertEquals(1, line2.get(3).getNumberOfTasks());
|
||||
assertEquals(0, line2.get(4).getNumberOfTasks());
|
||||
int[] row1 = report.getRow("Geschaeftsstelle A").getCells();
|
||||
assertArrayEquals(new int[] {8, 1, 1, 4, 1}, row1);
|
||||
|
||||
List<ReportLineItem> line3 = report.getReportLines().get("Geschaeftsstelle C").getLineItems();
|
||||
assertEquals(1, line3.get(0).getNumberOfTasks());
|
||||
assertEquals(1, line3.get(1).getNumberOfTasks());
|
||||
assertEquals(1, line3.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(3).getNumberOfTasks());
|
||||
assertEquals(3, line3.get(4).getNumberOfTasks());
|
||||
int[] row2 = report.getRow("Geschaeftsstelle B").getCells();
|
||||
assertArrayEquals(new int[] {2, 2, 0, 1, 0}, row2);
|
||||
|
||||
int[] row3 = report.getRow("Geschaeftsstelle C").getCells();
|
||||
assertArrayEquals(new int[] {1, 1, 1, 0, 3}, row3);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -365,60 +315,58 @@ public class ProvideCustomFieldValueReportAccTest {
|
|||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getCustomFieldValueReport(null, null, null, null, customField,
|
||||
customFieldValues, reportLineItemDefinitions);
|
||||
CustomFieldValueReport report = taskMonitorService.getCustomFieldValueReport(null, null, null, null,
|
||||
customField,
|
||||
customFieldValues, columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
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());
|
||||
assertNotNull(report);
|
||||
assertEquals(1, report.rowSize());
|
||||
|
||||
assertEquals(1, report.getReportLines().size());
|
||||
int[] row1 = report.getRow("Geschaeftsstelle A").getCells();
|
||||
assertArrayEquals(new int[] {11, 4, 3, 4, 3}, row1);
|
||||
}
|
||||
|
||||
private List<ReportLineItemDefinition> getListOfReportLineItemDefinitions() {
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = new ArrayList<>();
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(Integer.MIN_VALUE, -11));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-10, -6));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-5, -2));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-1));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(0));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(1));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(2, 5));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(6, 10));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(11, Integer.MAX_VALUE));
|
||||
return reportLineItemDefinitions;
|
||||
private List<TimeIntervalColumnHeader> getListOfColumnHeaders() {
|
||||
List<TimeIntervalColumnHeader> columnHeaders = new ArrayList<>();
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(Integer.MIN_VALUE, -11));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-10, -6));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-5, -2));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-1));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(0));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(1));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(2, 5));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(6, 10));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(11, Integer.MAX_VALUE));
|
||||
return columnHeaders;
|
||||
}
|
||||
|
||||
private List<ReportLineItemDefinition> getShortListOfReportLineItemDefinitions() {
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = new ArrayList<>();
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(Integer.MIN_VALUE, -6));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-5, -1));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(0));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(1, 5));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(6, Integer.MAX_VALUE));
|
||||
return reportLineItemDefinitions;
|
||||
private List<TimeIntervalColumnHeader> getShortListOfColumnHeaders() {
|
||||
List<TimeIntervalColumnHeader> columnHeaders = new ArrayList<>();
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(Integer.MIN_VALUE, -6));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-5, -1));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(0));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(1, 5));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(6, Integer.MAX_VALUE));
|
||||
return columnHeaders;
|
||||
}
|
||||
|
||||
private String reportToString(Report report) {
|
||||
private String reportToString(CustomFieldValueReport report) {
|
||||
return reportToString(report, null);
|
||||
}
|
||||
|
||||
private String reportToString(Report report, List<ReportLineItemDefinition> reportLineItemDefinitions) {
|
||||
private String reportToString(CustomFieldValueReport report, List<TimeIntervalColumnHeader> columnHeaders) {
|
||||
String formatColumWidth = "| %-7s ";
|
||||
String formatFirstColumn = "| %-36s %-4s ";
|
||||
String formatFirstColumnFirstLine = "| %-29s %12s ";
|
||||
String formatFirstColumnSumLine = "| %-36s %-5s";
|
||||
int reportWidth = reportLineItemDefinitions == null ? 46 : reportLineItemDefinitions.size() * 10 + 46;
|
||||
int reportWidth = columnHeaders == null ? 46 : columnHeaders.size() * 10 + 46;
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("\n");
|
||||
|
@ -427,8 +375,8 @@ public class ProvideCustomFieldValueReportAccTest {
|
|||
}
|
||||
builder.append("\n");
|
||||
builder.append(String.format(formatFirstColumnFirstLine, "Custom field values", "Total"));
|
||||
if (reportLineItemDefinitions != null) {
|
||||
for (ReportLineItemDefinition def : reportLineItemDefinitions) {
|
||||
if (columnHeaders != null) {
|
||||
for (TimeIntervalColumnHeader def : columnHeaders) {
|
||||
if (def.getLowerAgeLimit() == Integer.MIN_VALUE) {
|
||||
builder.append(String.format(formatColumWidth, "< " + def.getUpperAgeLimit()));
|
||||
} else if (def.getUpperAgeLimit() == Integer.MAX_VALUE) {
|
||||
|
@ -452,12 +400,12 @@ public class ProvideCustomFieldValueReportAccTest {
|
|||
}
|
||||
builder.append("\n");
|
||||
|
||||
for (String rl : report.getReportLines().keySet()) {
|
||||
for (String rl : report.getRowTitles()) {
|
||||
builder
|
||||
.append(String.format(formatFirstColumn, rl, report.getReportLines().get(rl).getTotalNumberOfTasks()));
|
||||
if (reportLineItemDefinitions != null) {
|
||||
for (ReportLineItem reportLineItem : report.getReportLines().get(rl).getLineItems()) {
|
||||
builder.append(String.format(formatColumWidth, reportLineItem.getNumberOfTasks()));
|
||||
.append(String.format(formatFirstColumn, rl, report.getRow(rl).getTotalValue()));
|
||||
if (columnHeaders != null) {
|
||||
for (int cell : report.getRow(rl).getCells()) {
|
||||
builder.append(String.format(formatColumWidth, cell));
|
||||
}
|
||||
}
|
||||
builder.append("|\n");
|
||||
|
@ -466,9 +414,9 @@ public class ProvideCustomFieldValueReportAccTest {
|
|||
}
|
||||
builder.append("\n");
|
||||
}
|
||||
builder.append(String.format(formatFirstColumnSumLine, "Total", report.getSumLine().getTotalNumberOfTasks()));
|
||||
for (ReportLineItem sumLine : report.getSumLine().getLineItems()) {
|
||||
builder.append(String.format(formatColumWidth, sumLine.getNumberOfTasks()));
|
||||
builder.append(String.format(formatFirstColumnSumLine, "Total", report.getSumRow().getTotalValue()));
|
||||
for (int cell : report.getSumRow().getCells()) {
|
||||
builder.append(String.format(formatColumWidth, cell));
|
||||
}
|
||||
builder.append("|\n");
|
||||
for (int i = 0; i < reportWidth; i++) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,6 @@
|
|||
package acceptance.monitoring;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
|
@ -7,7 +8,9 @@ import java.io.IOException;
|
|||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
|
@ -24,21 +27,19 @@ import pro.taskana.TaskanaEngine.ConnectionManagementMode;
|
|||
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||
import pro.taskana.database.TestDataGenerator;
|
||||
import pro.taskana.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.impl.Report;
|
||||
import pro.taskana.impl.ReportLineItem;
|
||||
import pro.taskana.impl.ReportLineItemDefinition;
|
||||
import pro.taskana.impl.TaskanaEngineImpl;
|
||||
import pro.taskana.impl.configuration.DBCleaner;
|
||||
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest;
|
||||
import pro.taskana.impl.report.impl.TimeIntervalColumnHeader;
|
||||
import pro.taskana.impl.report.impl.WorkbasketLevelReport;
|
||||
|
||||
/**
|
||||
* Acceptance test for all "workbasket level report" scenarios.
|
||||
*/
|
||||
public class ProvideWorkbasketLevelReportAccTest {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideWorkbasketLevelReportAccTest.class);
|
||||
protected static TaskanaEngineConfiguration taskanaEngineConfiguration;
|
||||
protected static TaskanaEngine taskanaEngine;
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideWorkbasketLevelReportAccTest.class);
|
||||
|
||||
@BeforeClass
|
||||
public static void setupTest() throws Exception {
|
||||
|
@ -53,7 +54,7 @@ public class ProvideWorkbasketLevelReportAccTest {
|
|||
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false);
|
||||
taskanaEngineConfiguration.setGermanPublicHolidaysEnabled(false);
|
||||
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
|
||||
((TaskanaEngineImpl) taskanaEngine).setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
|
||||
taskanaEngine.setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
|
||||
cleaner.clearDb(dataSource, false);
|
||||
TestDataGenerator testDataGenerator = new TestDataGenerator();
|
||||
testDataGenerator.generateMonitoringTestData(dataSource);
|
||||
|
@ -63,58 +64,48 @@ public class ProvideWorkbasketLevelReportAccTest {
|
|||
public void testGetTotalNumbersOfTasksOfWorkbasketLevelReport() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
Report report = taskMonitorService.getWorkbasketLevelReport(null, null, null, null, null, null);
|
||||
WorkbasketLevelReport report = taskMonitorService.getWorkbasketLevelReport(null, null, null, null, null, null);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report));
|
||||
}
|
||||
|
||||
assertNotNull(report);
|
||||
assertEquals(20, report.getReportLines().get("USER_1_1").getTotalNumberOfTasks());
|
||||
assertEquals(20, report.getReportLines().get("USER_1_2").getTotalNumberOfTasks());
|
||||
assertEquals(10, report.getReportLines().get("USER_1_3").getTotalNumberOfTasks());
|
||||
assertEquals(50, report.getSumLine().getTotalNumberOfTasks());
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
assertEquals(20, report.getRow("USER_1_1").getTotalValue());
|
||||
assertEquals(20, report.getRow("USER_1_2").getTotalValue());
|
||||
assertEquals(10, report.getRow("USER_1_3").getTotalValue());
|
||||
|
||||
assertEquals(50, report.getSumRow().getTotalValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetWorkbasketLevelReportWithReportLineItemDefinitions() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getWorkbasketLevelReport(null, null, null, null, null, null,
|
||||
reportLineItemDefinitions);
|
||||
WorkbasketLevelReport report = taskMonitorService.getWorkbasketLevelReport(null, null, null, null, null, null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
int sumLineCount = report.getSumLine().getLineItems().get(0).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(1).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(2).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(3).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(4).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(5).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(6).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(7).getNumberOfTasks()
|
||||
+ report.getSumLine().getLineItems().get(8).getNumberOfTasks();
|
||||
int sumLineCount = IntStream.of(report.getSumRow().getCells()).sum();
|
||||
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
assertEquals(20, report.getReportLines().get("USER_1_1").getTotalNumberOfTasks());
|
||||
assertEquals(20, report.getReportLines().get("USER_1_2").getTotalNumberOfTasks());
|
||||
assertEquals(10, report.getReportLines().get("USER_1_3").getTotalNumberOfTasks());
|
||||
assertEquals(20, report.getRow("USER_1_1").getTotalValue());
|
||||
assertEquals(20, report.getRow("USER_1_2").getTotalValue());
|
||||
assertEquals(10, report.getRow("USER_1_3").getTotalValue());
|
||||
|
||||
assertEquals(10, report.getSumLine().getLineItems().get(0).getNumberOfTasks());
|
||||
assertEquals(9, report.getSumLine().getLineItems().get(1).getNumberOfTasks());
|
||||
assertEquals(11, report.getSumLine().getLineItems().get(2).getNumberOfTasks());
|
||||
assertEquals(0, report.getSumLine().getLineItems().get(3).getNumberOfTasks());
|
||||
assertEquals(4, report.getSumLine().getLineItems().get(4).getNumberOfTasks());
|
||||
assertEquals(0, report.getSumLine().getLineItems().get(5).getNumberOfTasks());
|
||||
assertEquals(7, report.getSumLine().getLineItems().get(6).getNumberOfTasks());
|
||||
assertEquals(4, report.getSumLine().getLineItems().get(7).getNumberOfTasks());
|
||||
assertEquals(5, report.getSumLine().getLineItems().get(8).getNumberOfTasks());
|
||||
assertEquals(50, report.getSumLine().getTotalNumberOfTasks());
|
||||
int[] sumRow = report.getSumRow().getCells();
|
||||
assertArrayEquals(new int[] {10, 9, 11, 0, 4, 0, 7, 4, 5}, sumRow);
|
||||
|
||||
assertEquals(50, report.getSumRow().getTotalValue());
|
||||
assertEquals(50, sumLineCount);
|
||||
}
|
||||
|
||||
|
@ -122,130 +113,102 @@ public class ProvideWorkbasketLevelReportAccTest {
|
|||
public void testEachItemOfWorkbasketLevelReport() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getWorkbasketLevelReport(null, null, null, null, null, null,
|
||||
reportLineItemDefinitions);
|
||||
WorkbasketLevelReport report = taskMonitorService.getWorkbasketLevelReport(null, null, null, null, null, null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
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());
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
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(1, line2.get(4).getNumberOfTasks());
|
||||
int[] row1 = report.getRow("USER_1_1").getCells();
|
||||
assertArrayEquals(new int[] {13, 3, 1, 1, 2}, row1);
|
||||
|
||||
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(6, line3.get(4).getNumberOfTasks());
|
||||
int[] row2 = report.getRow("USER_1_2").getCells();
|
||||
assertArrayEquals(new int[] {4, 6, 3, 6, 1}, row2);
|
||||
|
||||
int[] row3 = report.getRow("USER_1_3").getCells();
|
||||
assertArrayEquals(new int[] {2, 2, 0, 0, 6}, row3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEachItemOfWorkbasketLevelReportNotInWorkingDays() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getWorkbasketLevelReport(null, null, null, null, null, null,
|
||||
reportLineItemDefinitions, false);
|
||||
WorkbasketLevelReport report = taskMonitorService.getWorkbasketLevelReport(null, null, null, null, null, null,
|
||||
columnHeaders, false);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
List<ReportLineItem> line1 = report.getReportLines().get("USER_1_1").getLineItems();
|
||||
assertEquals(16, line1.get(0).getNumberOfTasks());
|
||||
assertEquals(0, line1.get(1).getNumberOfTasks());
|
||||
assertEquals(1, line1.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line1.get(3).getNumberOfTasks());
|
||||
assertEquals(3, line1.get(4).getNumberOfTasks());
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
List<ReportLineItem> line2 = report.getReportLines().get("USER_1_2").getLineItems();
|
||||
assertEquals(10, line2.get(0).getNumberOfTasks());
|
||||
assertEquals(0, line2.get(1).getNumberOfTasks());
|
||||
assertEquals(3, line2.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line2.get(3).getNumberOfTasks());
|
||||
assertEquals(7, line2.get(4).getNumberOfTasks());
|
||||
int[] row1 = report.getRow("USER_1_1").getCells();
|
||||
assertArrayEquals(new int[] {16, 0, 1, 0, 3}, row1);
|
||||
|
||||
List<ReportLineItem> line3 = report.getReportLines().get("USER_1_3").getLineItems();
|
||||
assertEquals(4, line3.get(0).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(1).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(3).getNumberOfTasks());
|
||||
assertEquals(6, line3.get(4).getNumberOfTasks());
|
||||
int[] row2 = report.getRow("USER_1_2").getCells();
|
||||
assertArrayEquals(new int[] {10, 0, 3, 0, 7}, row2);
|
||||
|
||||
int[] row3 = report.getRow("USER_1_3").getCells();
|
||||
assertArrayEquals(new int[] {4, 0, 0, 0, 6}, row3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEachItemOfWorkbasketLevelReportWithWorkbasketFilter() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getWorkbasketLevelReport(workbasketIds, null, null, null, null, null,
|
||||
reportLineItemDefinitions);
|
||||
WorkbasketLevelReport report = taskMonitorService.getWorkbasketLevelReport(workbasketIds, null, null, null,
|
||||
null, null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
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());
|
||||
assertNotNull(report);
|
||||
assertEquals(1, report.rowSize());
|
||||
|
||||
int[] row1 = report.getRow("USER_1_1").getCells();
|
||||
assertArrayEquals(new int[] {13, 3, 1, 1, 2}, row1);
|
||||
|
||||
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();
|
||||
List<TaskState> states = Collections.singletonList(TaskState.READY);
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getWorkbasketLevelReport(null, states, null, null, null, null,
|
||||
reportLineItemDefinitions);
|
||||
WorkbasketLevelReport report = taskMonitorService.getWorkbasketLevelReport(null, states, null, null, null, null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
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());
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
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());
|
||||
int[] row1 = report.getRow("USER_1_1").getCells();
|
||||
assertArrayEquals(new int[] {13, 3, 1, 1, 0}, row1);
|
||||
|
||||
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());
|
||||
int[] row2 = report.getRow("USER_1_2").getCells();
|
||||
assertArrayEquals(new int[] {4, 6, 3, 6, 0}, row2);
|
||||
|
||||
int[] row3 = report.getRow("USER_1_3").getCells();
|
||||
assertArrayEquals(new int[] {2, 2, 0, 0, 0}, row3);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -253,73 +216,56 @@ public class ProvideWorkbasketLevelReportAccTest {
|
|||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getWorkbasketLevelReport(null, null, categories, null, null, null,
|
||||
reportLineItemDefinitions);
|
||||
WorkbasketLevelReport report = taskMonitorService.getWorkbasketLevelReport(null, null, categories, null, null,
|
||||
null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
List<ReportLineItem> line1 = report.getReportLines().get("USER_1_1").getLineItems();
|
||||
assertEquals(3, line1.get(0).getNumberOfTasks());
|
||||
assertEquals(1, line1.get(1).getNumberOfTasks());
|
||||
assertEquals(1, line1.get(2).getNumberOfTasks());
|
||||
assertEquals(1, line1.get(3).getNumberOfTasks());
|
||||
assertEquals(2, line1.get(4).getNumberOfTasks());
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
List<ReportLineItem> line2 = report.getReportLines().get("USER_1_2").getLineItems();
|
||||
assertEquals(1, line2.get(0).getNumberOfTasks());
|
||||
assertEquals(1, line2.get(1).getNumberOfTasks());
|
||||
assertEquals(1, line2.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line2.get(3).getNumberOfTasks());
|
||||
assertEquals(1, line2.get(4).getNumberOfTasks());
|
||||
int[] row1 = report.getRow("USER_1_1").getCells();
|
||||
assertArrayEquals(new int[] {3, 1, 1, 1, 2}, row1);
|
||||
|
||||
List<ReportLineItem> line3 = report.getReportLines().get("USER_1_3").getLineItems();
|
||||
assertEquals(0, line3.get(0).getNumberOfTasks());
|
||||
assertEquals(1, line3.get(1).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(3).getNumberOfTasks());
|
||||
assertEquals(4, line3.get(4).getNumberOfTasks());
|
||||
int[] row2 = report.getRow("USER_1_2").getCells();
|
||||
assertArrayEquals(new int[] {1, 1, 1, 0, 1}, row2);
|
||||
|
||||
int[] row3 = report.getRow("USER_1_3").getCells();
|
||||
assertArrayEquals(new int[] {0, 1, 0, 0, 4}, row3);
|
||||
|
||||
assertEquals(3, report.getReportLines().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEachItemOfWorkbasketLevelReportWithDomainFilter() throws InvalidArgumentException {
|
||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
List<String> domains = Arrays.asList("DOMAIN_A");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<String> domains = Collections.singletonList("DOMAIN_A");
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getWorkbasketLevelReport(null, null, null, domains, null, null,
|
||||
reportLineItemDefinitions);
|
||||
WorkbasketLevelReport report = taskMonitorService.getWorkbasketLevelReport(null, null, null, domains, null,
|
||||
null,
|
||||
columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
List<ReportLineItem> line1 = report.getReportLines().get("USER_1_1").getLineItems();
|
||||
assertEquals(8, line1.get(0).getNumberOfTasks());
|
||||
assertEquals(1, line1.get(1).getNumberOfTasks());
|
||||
assertEquals(0, line1.get(2).getNumberOfTasks());
|
||||
assertEquals(1, line1.get(3).getNumberOfTasks());
|
||||
assertEquals(2, line1.get(4).getNumberOfTasks());
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
List<ReportLineItem> line2 = report.getReportLines().get("USER_1_2").getLineItems();
|
||||
assertEquals(2, line2.get(0).getNumberOfTasks());
|
||||
assertEquals(2, line2.get(1).getNumberOfTasks());
|
||||
assertEquals(2, line2.get(2).getNumberOfTasks());
|
||||
assertEquals(4, line2.get(3).getNumberOfTasks());
|
||||
assertEquals(0, line2.get(4).getNumberOfTasks());
|
||||
int[] row1 = report.getRow("USER_1_1").getCells();
|
||||
assertArrayEquals(new int[] {8, 1, 0, 1, 2}, row1);
|
||||
|
||||
List<ReportLineItem> line3 = report.getReportLines().get("USER_1_3").getLineItems();
|
||||
assertEquals(1, line3.get(0).getNumberOfTasks());
|
||||
assertEquals(1, line3.get(1).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(2).getNumberOfTasks());
|
||||
assertEquals(0, line3.get(3).getNumberOfTasks());
|
||||
assertEquals(2, line3.get(4).getNumberOfTasks());
|
||||
int[] row2 = report.getRow("USER_1_2").getCells();
|
||||
assertArrayEquals(new int[] {2, 2, 2, 4, 0}, row2);
|
||||
|
||||
int[] row3 = report.getRow("USER_1_3").getCells();
|
||||
assertArrayEquals(new int[] {1, 1, 0, 0, 2}, row3);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -327,67 +273,59 @@ public class ProvideWorkbasketLevelReportAccTest {
|
|||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
|
||||
List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
|
||||
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
|
||||
|
||||
Report report = taskMonitorService.getWorkbasketLevelReport(null, null, null, null,
|
||||
customField, customFieldValues, reportLineItemDefinitions);
|
||||
WorkbasketLevelReport report = taskMonitorService.getWorkbasketLevelReport(null, null, null, null,
|
||||
customField, customFieldValues, columnHeaders);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(reportToString(report, reportLineItemDefinitions));
|
||||
LOGGER.debug(reportToString(report, columnHeaders));
|
||||
}
|
||||
|
||||
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());
|
||||
assertNotNull(report);
|
||||
assertEquals(3, report.rowSize());
|
||||
|
||||
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());
|
||||
int[] row1 = report.getRow("USER_1_1").getCells();
|
||||
assertArrayEquals(new int[] {6, 1, 1, 1, 1}, row1);
|
||||
|
||||
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());
|
||||
int[] row2 = report.getRow("USER_1_2").getCells();
|
||||
assertArrayEquals(new int[] {3, 2, 2, 3, 1}, row2);
|
||||
|
||||
int[] row3 = report.getRow("USER_1_3").getCells();
|
||||
assertArrayEquals(new int[] {2, 1, 0, 0, 1}, row3);
|
||||
}
|
||||
|
||||
private List<ReportLineItemDefinition> getListOfReportLineItemDefinitions() {
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = new ArrayList<>();
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(Integer.MIN_VALUE, -11));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-10, -6));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-5, -2));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-1));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(0));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(1));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(2, 5));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(6, 10));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(11, Integer.MAX_VALUE));
|
||||
return reportLineItemDefinitions;
|
||||
private List<TimeIntervalColumnHeader> getListOfColumnHeaders() {
|
||||
List<TimeIntervalColumnHeader> columnHeaders = new ArrayList<>();
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(Integer.MIN_VALUE, -11));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-10, -6));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-5, -2));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-1));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(0));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(1));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(2, 5));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(6, 10));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(11, Integer.MAX_VALUE));
|
||||
return columnHeaders;
|
||||
}
|
||||
|
||||
private List<ReportLineItemDefinition> getShortListOfReportLineItemDefinitions() {
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = new ArrayList<>();
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(Integer.MIN_VALUE, -6));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-5, -1));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(0));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(1, 5));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(6, Integer.MAX_VALUE));
|
||||
return reportLineItemDefinitions;
|
||||
private List<TimeIntervalColumnHeader> getShortListOfColumnHeaders() {
|
||||
List<TimeIntervalColumnHeader> columnHeaders = new ArrayList<>();
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(Integer.MIN_VALUE, -6));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-5, -1));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(0));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(1, 5));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(6, Integer.MAX_VALUE));
|
||||
return columnHeaders;
|
||||
}
|
||||
|
||||
private String reportToString(Report report) {
|
||||
private String reportToString(WorkbasketLevelReport report) {
|
||||
return reportToString(report, null);
|
||||
}
|
||||
|
||||
private String reportToString(Report report, List<ReportLineItemDefinition> reportLineItemDefinitions) {
|
||||
private String reportToString(WorkbasketLevelReport report,
|
||||
List<TimeIntervalColumnHeader> reportLineItemDefinitions) {
|
||||
String formatColumWidth = "| %-7s ";
|
||||
String formatFirstColumn = "| %-36s %-4s ";
|
||||
String formatFirstColumnFirstLine = "| %-29s %12s ";
|
||||
|
@ -402,7 +340,7 @@ public class ProvideWorkbasketLevelReportAccTest {
|
|||
builder.append("\n");
|
||||
builder.append(String.format(formatFirstColumnFirstLine, "Workbasket levels", "Total"));
|
||||
if (reportLineItemDefinitions != null) {
|
||||
for (ReportLineItemDefinition def : reportLineItemDefinitions) {
|
||||
for (TimeIntervalColumnHeader def : reportLineItemDefinitions) {
|
||||
if (def.getLowerAgeLimit() == Integer.MIN_VALUE) {
|
||||
builder.append(String.format(formatColumWidth, "< " + def.getUpperAgeLimit()));
|
||||
} else if (def.getUpperAgeLimit() == Integer.MAX_VALUE) {
|
||||
|
@ -426,12 +364,12 @@ public class ProvideWorkbasketLevelReportAccTest {
|
|||
}
|
||||
builder.append("\n");
|
||||
|
||||
for (String rl : report.getReportLines().keySet()) {
|
||||
for (String rl : report.getRowTitles()) {
|
||||
builder
|
||||
.append(String.format(formatFirstColumn, rl, report.getReportLines().get(rl).getTotalNumberOfTasks()));
|
||||
.append(String.format(formatFirstColumn, rl, report.getRow(rl).getTotalValue()));
|
||||
if (reportLineItemDefinitions != null) {
|
||||
for (ReportLineItem reportLineItem : report.getReportLines().get(rl).getLineItems()) {
|
||||
builder.append(String.format(formatColumWidth, reportLineItem.getNumberOfTasks()));
|
||||
for (int cell : report.getRow(rl).getCells()) {
|
||||
builder.append(String.format(formatColumWidth, cell));
|
||||
}
|
||||
}
|
||||
builder.append("|\n");
|
||||
|
@ -440,9 +378,9 @@ public class ProvideWorkbasketLevelReportAccTest {
|
|||
}
|
||||
builder.append("\n");
|
||||
}
|
||||
builder.append(String.format(formatFirstColumnSumLine, "Total", report.getSumLine().getTotalNumberOfTasks()));
|
||||
for (ReportLineItem sumLine : report.getSumLine().getLineItems()) {
|
||||
builder.append(String.format(formatColumWidth, sumLine.getNumberOfTasks()));
|
||||
builder.append(String.format(formatFirstColumnSumLine, "Total", report.getSumRow().getTotalValue()));
|
||||
for (int cell : report.getSumRow().getCells()) {
|
||||
builder.append(String.format(formatColumWidth, cell));
|
||||
}
|
||||
builder.append("|\n");
|
||||
for (int i = 0; i < reportWidth; i++) {
|
||||
|
|
|
@ -10,8 +10,7 @@ import static org.junit.Assert.fail;
|
|||
import java.sql.SQLException;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.session.Configuration;
|
||||
|
@ -34,9 +33,9 @@ import pro.taskana.exceptions.TaskAlreadyExistException;
|
|||
import pro.taskana.exceptions.TaskNotFoundException;
|
||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||
import pro.taskana.impl.DaysToWorkingDaysConverter;
|
||||
import pro.taskana.impl.ReportLineItemDefinition;
|
||||
import pro.taskana.impl.TaskanaEngineImpl;
|
||||
import pro.taskana.impl.TaskanaEngineProxyForTest;
|
||||
import pro.taskana.impl.report.impl.TimeIntervalColumnHeader;
|
||||
import pro.taskana.mappings.AttachmentMapper;
|
||||
import pro.taskana.mappings.TaskTestMapper;
|
||||
import pro.taskana.security.CurrentUserContext;
|
||||
|
@ -287,7 +286,7 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
assertTrue(readTask.getPriority() == 99);
|
||||
|
||||
DaysToWorkingDaysConverter converter = DaysToWorkingDaysConverter
|
||||
.initialize(new ArrayList<>(Arrays.asList(new ReportLineItemDefinition(0))), Instant.now());
|
||||
.initialize(Collections.singletonList(new TimeIntervalColumnHeader(0)), Instant.now());
|
||||
long calendarDays = converter.convertWorkingDaysToDays(readTask.getPlanned(), 1);
|
||||
|
||||
assertTrue(readTask.getDue().equals(readTask.getPlanned().plus(Duration.ofDays(calendarDays))));
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.sql.SQLException;
|
|||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
@ -35,8 +35,8 @@ import pro.taskana.exceptions.TaskNotFoundException;
|
|||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||
import pro.taskana.impl.AttachmentImpl;
|
||||
import pro.taskana.impl.DaysToWorkingDaysConverter;
|
||||
import pro.taskana.impl.ReportLineItemDefinition;
|
||||
import pro.taskana.impl.TaskImpl;
|
||||
import pro.taskana.impl.report.impl.TimeIntervalColumnHeader;
|
||||
import pro.taskana.security.CurrentUserContext;
|
||||
import pro.taskana.security.JAASRunner;
|
||||
import pro.taskana.security.WithAccessId;
|
||||
|
@ -364,7 +364,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
|
|||
assertTrue(task.getPriority() == 99);
|
||||
|
||||
DaysToWorkingDaysConverter converter = DaysToWorkingDaysConverter
|
||||
.initialize(new ArrayList<>(Arrays.asList(new ReportLineItemDefinition(0))), Instant.now());
|
||||
.initialize(Collections.singletonList(new TimeIntervalColumnHeader(0)), Instant.now());
|
||||
long calendarDays = converter.convertWorkingDaysToDays(task.getDue(), 16);
|
||||
|
||||
assertTrue(task.getDue().equals(task.getPlanned().plus(Duration.ofDays(calendarDays))));
|
||||
|
@ -477,8 +477,8 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
|
|||
|
||||
assertTrue(readTask.getPriority() == 99);
|
||||
|
||||
DaysToWorkingDaysConverter converter = DaysToWorkingDaysConverter
|
||||
.initialize(new ArrayList<>(Arrays.asList(new ReportLineItemDefinition(0))), Instant.now());
|
||||
DaysToWorkingDaysConverter converter = DaysToWorkingDaysConverter.initialize(
|
||||
Collections.singletonList(new TimeIntervalColumnHeader(0)), Instant.now());
|
||||
long calendarDays = converter.convertWorkingDaysToDays(readTask.getPlanned(), 1);
|
||||
|
||||
assertTrue(readTask.getDue().equals(readTask.getPlanned().plus(Duration.ofDays(calendarDays))));
|
||||
|
|
|
@ -8,12 +8,14 @@ import java.time.Instant;
|
|||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import pro.taskana.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.impl.report.impl.TimeIntervalColumnHeader;
|
||||
|
||||
/**
|
||||
* Test for the DaysToWorkingDaysConverter.
|
||||
|
@ -31,11 +33,11 @@ public class DaysToWorkingDaysConverterTest {
|
|||
@Test
|
||||
public void testInitializeForDifferentReportLineItemDefinitions() throws InvalidArgumentException {
|
||||
DaysToWorkingDaysConverter instance1 = DaysToWorkingDaysConverter
|
||||
.initialize(getShortListOfReportLineItemDefinitions(), Instant.parse("2018-02-03T00:00:00.000Z"));
|
||||
.initialize(getShortListOfColumnHeaders(), Instant.parse("2018-02-03T00:00:00.000Z"));
|
||||
DaysToWorkingDaysConverter instance2 = DaysToWorkingDaysConverter
|
||||
.initialize(getShortListOfReportLineItemDefinitions(), Instant.parse("2018-02-03T00:00:00.000Z"));
|
||||
.initialize(getShortListOfColumnHeaders(), Instant.parse("2018-02-03T00:00:00.000Z"));
|
||||
DaysToWorkingDaysConverter instance3 = DaysToWorkingDaysConverter
|
||||
.initialize(getLargeListOfReportLineItemDefinitions(), Instant.parse("2018-02-03T00:00:00.000Z"));
|
||||
.initialize(getLargeListOfColumnHeaders(), Instant.parse("2018-02-03T00:00:00.000Z"));
|
||||
|
||||
assertEquals(instance1, instance2);
|
||||
assertNotEquals(instance1, instance3);
|
||||
|
@ -43,7 +45,7 @@ public class DaysToWorkingDaysConverterTest {
|
|||
|
||||
@Test
|
||||
public void testConvertWorkingDaysToDaysForTasks() {
|
||||
List<ReportLineItemDefinition> reportItems = new ArrayList<>(Arrays.asList(new ReportLineItemDefinition(0)));
|
||||
List<TimeIntervalColumnHeader> reportItems = Collections.singletonList(new TimeIntervalColumnHeader(0));
|
||||
try {
|
||||
DaysToWorkingDaysConverter converter = DaysToWorkingDaysConverter.initialize(reportItems, Instant.now());
|
||||
|
||||
|
@ -100,9 +102,9 @@ public class DaysToWorkingDaysConverterTest {
|
|||
@Test
|
||||
public void testInitializeForDifferentDates() throws InvalidArgumentException {
|
||||
DaysToWorkingDaysConverter instance1 = DaysToWorkingDaysConverter
|
||||
.initialize(getShortListOfReportLineItemDefinitions(), Instant.parse("2018-02-04T00:00:00.000Z"));
|
||||
.initialize(getShortListOfColumnHeaders(), Instant.parse("2018-02-04T00:00:00.000Z"));
|
||||
DaysToWorkingDaysConverter instance2 = DaysToWorkingDaysConverter
|
||||
.initialize(getShortListOfReportLineItemDefinitions(), Instant.parse("2018-02-05T00:00:00.000Z"));
|
||||
.initialize(getShortListOfColumnHeaders(), Instant.parse("2018-02-05T00:00:00.000Z"));
|
||||
|
||||
assertNotEquals(instance1, instance2);
|
||||
}
|
||||
|
@ -110,7 +112,7 @@ public class DaysToWorkingDaysConverterTest {
|
|||
@Test
|
||||
public void testConvertDaysToWorkingDays() throws InvalidArgumentException {
|
||||
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||
.initialize(getLargeListOfReportLineItemDefinitions(), Instant.parse("2018-02-06T00:00:00.000Z"));
|
||||
.initialize(getLargeListOfColumnHeaders(), Instant.parse("2018-02-06T00:00:00.000Z"));
|
||||
|
||||
assertEquals(-16, instance.convertDaysToWorkingDays(-16));
|
||||
assertEquals(-11, instance.convertDaysToWorkingDays(-15));
|
||||
|
@ -134,7 +136,7 @@ public class DaysToWorkingDaysConverterTest {
|
|||
@Test
|
||||
public void testConvertWorkingDaysToDays() throws InvalidArgumentException {
|
||||
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||
.initialize(getLargeListOfReportLineItemDefinitions(), Instant.parse("2018-02-27T00:00:00.000Z"));
|
||||
.initialize(getLargeListOfColumnHeaders(), Instant.parse("2018-02-27T00:00:00.000Z"));
|
||||
|
||||
assertEquals(Arrays.asList(-13), instance.convertWorkingDaysToDays(-13));
|
||||
assertEquals(Arrays.asList(-12), instance.convertWorkingDaysToDays(-12));
|
||||
|
@ -167,7 +169,7 @@ public class DaysToWorkingDaysConverterTest {
|
|||
@Test
|
||||
public void testConvertWorkingDaysToDaysAtWeekend() throws InvalidArgumentException {
|
||||
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||
.initialize(getLargeListOfReportLineItemDefinitions(), Instant.parse("2018-03-10T00:00:00.000Z"));
|
||||
.initialize(getLargeListOfColumnHeaders(), Instant.parse("2018-03-10T00:00:00.000Z"));
|
||||
|
||||
assertEquals(Arrays.asList(-13), instance.convertWorkingDaysToDays(-13));
|
||||
assertEquals(Arrays.asList(-12), instance.convertWorkingDaysToDays(-12));
|
||||
|
@ -200,7 +202,7 @@ public class DaysToWorkingDaysConverterTest {
|
|||
@Test
|
||||
public void testConvertWorkingDaysToDaysOnEasterSunday() throws InvalidArgumentException {
|
||||
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||
.initialize(getLargeListOfReportLineItemDefinitions(), Instant.parse("2018-04-01T00:00:00.000Z"));
|
||||
.initialize(getLargeListOfColumnHeaders(), Instant.parse("2018-04-01T00:00:00.000Z"));
|
||||
|
||||
assertEquals(Arrays.asList(-13), instance.convertWorkingDaysToDays(-13));
|
||||
assertEquals(Arrays.asList(-12), instance.convertWorkingDaysToDays(-12));
|
||||
|
@ -233,7 +235,7 @@ public class DaysToWorkingDaysConverterTest {
|
|||
@Test
|
||||
public void testEasterHolidays() throws InvalidArgumentException {
|
||||
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||
.initialize(getLargeListOfReportLineItemDefinitions(), Instant.parse("2018-03-28T00:00:00.000Z"));
|
||||
.initialize(getLargeListOfColumnHeaders(), Instant.parse("2018-03-28T00:00:00.000Z"));
|
||||
|
||||
assertEquals(0, instance.convertDaysToWorkingDays(0));
|
||||
assertEquals(1, instance.convertDaysToWorkingDays(1));
|
||||
|
@ -247,7 +249,7 @@ public class DaysToWorkingDaysConverterTest {
|
|||
@Test
|
||||
public void testWhitsunHolidays() throws InvalidArgumentException {
|
||||
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||
.initialize(getLargeListOfReportLineItemDefinitions(), Instant.parse("2018-05-16T00:00:00.000Z"));
|
||||
.initialize(getLargeListOfColumnHeaders(), Instant.parse("2018-05-16T00:00:00.000Z"));
|
||||
|
||||
assertEquals(0, instance.convertDaysToWorkingDays(0));
|
||||
assertEquals(1, instance.convertDaysToWorkingDays(1));
|
||||
|
@ -261,7 +263,7 @@ public class DaysToWorkingDaysConverterTest {
|
|||
@Test
|
||||
public void testLabourDayHoliday() throws InvalidArgumentException {
|
||||
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||
.initialize(getLargeListOfReportLineItemDefinitions(), Instant.parse("2018-04-26T00:00:00.000Z"));
|
||||
.initialize(getLargeListOfColumnHeaders(), Instant.parse("2018-04-26T00:00:00.000Z"));
|
||||
|
||||
assertEquals(0, instance.convertDaysToWorkingDays(0));
|
||||
assertEquals(1, instance.convertDaysToWorkingDays(1));
|
||||
|
@ -276,7 +278,7 @@ public class DaysToWorkingDaysConverterTest {
|
|||
@Test
|
||||
public void testAscensionDayHoliday() throws InvalidArgumentException {
|
||||
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||
.initialize(getLargeListOfReportLineItemDefinitions(), Instant.parse("2018-05-07T00:00:00.000Z"));
|
||||
.initialize(getLargeListOfColumnHeaders(), Instant.parse("2018-05-07T00:00:00.000Z"));
|
||||
|
||||
assertEquals(0, instance.convertDaysToWorkingDays(0));
|
||||
assertEquals(1, instance.convertDaysToWorkingDays(1));
|
||||
|
@ -291,7 +293,7 @@ public class DaysToWorkingDaysConverterTest {
|
|||
@Test
|
||||
public void testDayOfGermanUnityHoliday() throws InvalidArgumentException {
|
||||
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||
.initialize(getLargeListOfReportLineItemDefinitions(), Instant.parse("2018-10-01T00:00:00.000Z"));
|
||||
.initialize(getLargeListOfColumnHeaders(), Instant.parse("2018-10-01T00:00:00.000Z"));
|
||||
|
||||
assertEquals(0, instance.convertDaysToWorkingDays(0));
|
||||
assertEquals(1, instance.convertDaysToWorkingDays(1));
|
||||
|
@ -306,7 +308,7 @@ public class DaysToWorkingDaysConverterTest {
|
|||
@Test
|
||||
public void testChristmasAndNewYearHolidays() throws InvalidArgumentException {
|
||||
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||
.initialize(getLargeListOfReportLineItemDefinitions(), Instant.parse("2018-12-20T00:00:00.000Z"));
|
||||
.initialize(getLargeListOfColumnHeaders(), Instant.parse("2018-12-20T00:00:00.000Z"));
|
||||
|
||||
assertEquals(0, instance.convertDaysToWorkingDays(0));
|
||||
assertEquals(1, instance.convertDaysToWorkingDays(1));
|
||||
|
@ -328,7 +330,7 @@ public class DaysToWorkingDaysConverterTest {
|
|||
@Test
|
||||
public void testCustomHolidaysWithDayOfReformationAndAllSaintsDay() throws InvalidArgumentException {
|
||||
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||
.initialize(getLargeListOfReportLineItemDefinitions(), Instant.parse("2018-10-26T00:00:00.000Z"));
|
||||
.initialize(getLargeListOfColumnHeaders(), Instant.parse("2018-10-26T00:00:00.000Z"));
|
||||
|
||||
assertEquals(0, instance.convertDaysToWorkingDays(0));
|
||||
assertEquals(0, instance.convertDaysToWorkingDays(1));
|
||||
|
@ -344,7 +346,7 @@ public class DaysToWorkingDaysConverterTest {
|
|||
@Test
|
||||
public void testGetEasterSunday() throws InvalidArgumentException {
|
||||
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||
.initialize(getShortListOfReportLineItemDefinitions(), Instant.parse("2018-02-27T00:00:00.000Z"));
|
||||
.initialize(getShortListOfColumnHeaders(), Instant.parse("2018-02-27T00:00:00.000Z"));
|
||||
|
||||
assertEquals(LocalDate.of(2018, 4, 1), instance.getEasterSunday(2018));
|
||||
assertEquals(LocalDate.of(2019, 4, 21), instance.getEasterSunday(2019));
|
||||
|
@ -370,27 +372,27 @@ public class DaysToWorkingDaysConverterTest {
|
|||
|
||||
}
|
||||
|
||||
private List<ReportLineItemDefinition> getShortListOfReportLineItemDefinitions() {
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = new ArrayList<>();
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(Integer.MIN_VALUE, -3));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-1, -2));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(0));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(1, 2));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(3, Integer.MAX_VALUE));
|
||||
return reportLineItemDefinitions;
|
||||
private List<TimeIntervalColumnHeader> getShortListOfColumnHeaders() {
|
||||
List<TimeIntervalColumnHeader> columnHeaders = new ArrayList<>();
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(Integer.MIN_VALUE, -3));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-1, -2));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(0));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(1, 2));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(3, Integer.MAX_VALUE));
|
||||
return columnHeaders;
|
||||
}
|
||||
|
||||
private List<ReportLineItemDefinition> getLargeListOfReportLineItemDefinitions() {
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = new ArrayList<>();
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(Integer.MIN_VALUE, -11));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-10, -6));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-5, -2));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(-1));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(0));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(1));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(2, 5));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(6, 10));
|
||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(11, Integer.MAX_VALUE));
|
||||
return reportLineItemDefinitions;
|
||||
private List<TimeIntervalColumnHeader> getLargeListOfColumnHeaders() {
|
||||
List<TimeIntervalColumnHeader> columnHeaders = new ArrayList<>();
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(Integer.MIN_VALUE, -11));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-10, -6));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-5, -2));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(-1));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(0));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(1));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(2, 5));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(6, 10));
|
||||
columnHeaders.add(new TimeIntervalColumnHeader(11, Integer.MAX_VALUE));
|
||||
return columnHeaders;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Before;
|
||||
|
@ -25,6 +26,14 @@ import pro.taskana.CustomField;
|
|||
import pro.taskana.TaskState;
|
||||
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||
import pro.taskana.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.impl.report.impl.CategoryReport;
|
||||
import pro.taskana.impl.report.impl.ClassificationReport;
|
||||
import pro.taskana.impl.report.impl.CustomFieldValueReport;
|
||||
import pro.taskana.impl.report.impl.DetailedClassificationReport;
|
||||
import pro.taskana.impl.report.impl.DetailedMonitorQueryItem;
|
||||
import pro.taskana.impl.report.impl.DetailedReportRow;
|
||||
import pro.taskana.impl.report.impl.TimeIntervalColumnHeader;
|
||||
import pro.taskana.impl.report.impl.WorkbasketLevelReport;
|
||||
import pro.taskana.mappings.TaskMonitorMapper;
|
||||
|
||||
/**
|
||||
|
@ -57,22 +66,23 @@ public class TaskMonitorServiceImplTest {
|
|||
|
||||
@Test
|
||||
public void testGetTotalNumbersOfWorkbasketLevelReport() throws InvalidArgumentException {
|
||||
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
|
||||
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
|
||||
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
|
||||
List<String> categories = Arrays.asList("EXTERN");
|
||||
List<String> domains = Arrays.asList("DOMAIN_A");
|
||||
List<String> categories = Collections.singletonList("EXTERN");
|
||||
List<String> domains = Collections.singletonList("DOMAIN_A");
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
|
||||
List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
|
||||
|
||||
List<MonitorQueryItem> expectedResult = new ArrayList<>();
|
||||
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
|
||||
List<pro.taskana.impl.report.impl.MonitorQueryItem> expectedResult = new ArrayList<>();
|
||||
pro.taskana.impl.report.impl.MonitorQueryItem monitorQueryItem = new pro.taskana.impl.report.impl.MonitorQueryItem();
|
||||
monitorQueryItem.setKey("WBI:000000000000000000000000000000000001");
|
||||
monitorQueryItem.setNumberOfTasks(1);
|
||||
expectedResult.add(monitorQueryItem);
|
||||
doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfWorkbaskets(workbasketIds, states,
|
||||
categories, domains, customField, customFieldValues);
|
||||
|
||||
Report actualResult = cut.getWorkbasketLevelReport(workbasketIds, states, categories, domains, customField,
|
||||
WorkbasketLevelReport actualResult = cut.getWorkbasketLevelReport(workbasketIds, states, categories, domains,
|
||||
customField,
|
||||
customFieldValues);
|
||||
|
||||
verify(taskanaEngineImplMock, times(1)).openConnection();
|
||||
|
@ -86,23 +96,23 @@ public class TaskMonitorServiceImplTest {
|
|||
|
||||
assertNotNull(actualResult);
|
||||
assertEquals(
|
||||
actualResult.getReportLines().get("WBI:000000000000000000000000000000000001").getTotalNumberOfTasks(), 1);
|
||||
assertEquals(actualResult.getSumLine().getTotalNumberOfTasks(), 1);
|
||||
actualResult.getRow("WBI:000000000000000000000000000000000001").getTotalValue(), 1);
|
||||
assertEquals(actualResult.getSumRow().getTotalValue(), 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetWorkbasketLevelReportWithReportLineItemDefinitions() throws InvalidArgumentException {
|
||||
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
|
||||
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
|
||||
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
|
||||
List<String> categories = Arrays.asList("EXTERN");
|
||||
List<String> domains = Arrays.asList("DOMAIN_A");
|
||||
List<String> categories = Collections.singletonList("EXTERN");
|
||||
List<String> domains = Collections.singletonList("DOMAIN_A");
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = Arrays.asList(new ReportLineItemDefinition(),
|
||||
new ReportLineItemDefinition());
|
||||
List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
|
||||
List<TimeIntervalColumnHeader> reportLineItemDefinitions = Collections.singletonList(
|
||||
new TimeIntervalColumnHeader(0, 0));
|
||||
|
||||
List<MonitorQueryItem> expectedResult = new ArrayList<>();
|
||||
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
|
||||
List<pro.taskana.impl.report.impl.MonitorQueryItem> expectedResult = new ArrayList<>();
|
||||
pro.taskana.impl.report.impl.MonitorQueryItem monitorQueryItem = new pro.taskana.impl.report.impl.MonitorQueryItem();
|
||||
monitorQueryItem.setKey("WBI:000000000000000000000000000000000001");
|
||||
monitorQueryItem.setAgeInDays(0);
|
||||
monitorQueryItem.setNumberOfTasks(1);
|
||||
|
@ -110,7 +120,8 @@ public class TaskMonitorServiceImplTest {
|
|||
doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfWorkbaskets(workbasketIds, states,
|
||||
categories, domains, customField, customFieldValues);
|
||||
|
||||
Report actualResult = cut.getWorkbasketLevelReport(workbasketIds, states, categories, domains, customField,
|
||||
WorkbasketLevelReport actualResult = cut.getWorkbasketLevelReport(workbasketIds, states, categories, domains,
|
||||
customField,
|
||||
customFieldValues, reportLineItemDefinitions);
|
||||
|
||||
verify(taskanaEngineImplMock, times(1)).openConnection();
|
||||
|
@ -123,35 +134,30 @@ public class TaskMonitorServiceImplTest {
|
|||
|
||||
assertNotNull(actualResult);
|
||||
assertEquals(
|
||||
actualResult.getReportLines().get("WBI:000000000000000000000000000000000001").getTotalNumberOfTasks(), 1);
|
||||
assertEquals(
|
||||
actualResult.getReportLines()
|
||||
.get("WBI:000000000000000000000000000000000001")
|
||||
.getLineItems()
|
||||
.get(0)
|
||||
.getNumberOfTasks(),
|
||||
1);
|
||||
assertEquals(actualResult.getSumLine().getTotalNumberOfTasks(), 1);
|
||||
actualResult.getRow("WBI:000000000000000000000000000000000001").getTotalValue(), 1);
|
||||
assertEquals(actualResult.getRow("WBI:000000000000000000000000000000000001").getCells()[0], 1);
|
||||
assertEquals(actualResult.getSumRow().getTotalValue(), 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTotalNumbersOfCatgoryReport() throws InvalidArgumentException {
|
||||
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
|
||||
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
|
||||
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
|
||||
List<String> categories = Arrays.asList("EXTERN");
|
||||
List<String> domains = Arrays.asList("DOMAIN_A");
|
||||
List<String> categories = Collections.singletonList("EXTERN");
|
||||
List<String> domains = Collections.singletonList("DOMAIN_A");
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
|
||||
List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
|
||||
|
||||
List<MonitorQueryItem> expectedResult = new ArrayList<>();
|
||||
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
|
||||
List<pro.taskana.impl.report.impl.MonitorQueryItem> expectedResult = new ArrayList<>();
|
||||
pro.taskana.impl.report.impl.MonitorQueryItem monitorQueryItem = new pro.taskana.impl.report.impl.MonitorQueryItem();
|
||||
monitorQueryItem.setKey("EXTERN");
|
||||
monitorQueryItem.setNumberOfTasks(1);
|
||||
expectedResult.add(monitorQueryItem);
|
||||
doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfCategories(workbasketIds, states, categories,
|
||||
domains, customField, customFieldValues);
|
||||
|
||||
Report actualResult = cut.getCategoryReport(workbasketIds, states, categories, domains, customField,
|
||||
CategoryReport actualResult = cut.getCategoryReport(workbasketIds, states, categories, domains,
|
||||
customField,
|
||||
customFieldValues);
|
||||
|
||||
verify(taskanaEngineImplMock, times(1)).openConnection();
|
||||
|
@ -163,23 +169,23 @@ public class TaskMonitorServiceImplTest {
|
|||
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
|
||||
|
||||
assertNotNull(actualResult);
|
||||
assertEquals(actualResult.getReportLines().get("EXTERN").getTotalNumberOfTasks(), 1);
|
||||
assertEquals(actualResult.getSumLine().getTotalNumberOfTasks(), 1);
|
||||
assertEquals(actualResult.getRow("EXTERN").getTotalValue(), 1);
|
||||
assertEquals(actualResult.getSumRow().getTotalValue(), 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCategoryReportWithReportLineItemDefinitions() throws InvalidArgumentException {
|
||||
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
|
||||
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
|
||||
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
|
||||
List<String> categories = Arrays.asList("EXTERN");
|
||||
List<String> domains = Arrays.asList("DOMAIN_A");
|
||||
List<String> categories = Collections.singletonList("EXTERN");
|
||||
List<String> domains = Collections.singletonList("DOMAIN_A");
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = Arrays.asList(new ReportLineItemDefinition(),
|
||||
new ReportLineItemDefinition());
|
||||
List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
|
||||
List<TimeIntervalColumnHeader> reportLineItemDefinitions = Collections.singletonList(
|
||||
new TimeIntervalColumnHeader(0, 0));
|
||||
|
||||
List<MonitorQueryItem> expectedResult = new ArrayList<>();
|
||||
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
|
||||
List<pro.taskana.impl.report.impl.MonitorQueryItem> expectedResult = new ArrayList<>();
|
||||
pro.taskana.impl.report.impl.MonitorQueryItem monitorQueryItem = new pro.taskana.impl.report.impl.MonitorQueryItem();
|
||||
monitorQueryItem.setKey("EXTERN");
|
||||
monitorQueryItem.setAgeInDays(0);
|
||||
monitorQueryItem.setNumberOfTasks(1);
|
||||
|
@ -187,7 +193,8 @@ public class TaskMonitorServiceImplTest {
|
|||
doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfCategories(workbasketIds, states, categories,
|
||||
domains, customField, customFieldValues);
|
||||
|
||||
Report actualResult = cut.getCategoryReport(workbasketIds, states, categories, domains, customField,
|
||||
CategoryReport actualResult = cut.getCategoryReport(workbasketIds, states, categories, domains,
|
||||
customField,
|
||||
customFieldValues, reportLineItemDefinitions);
|
||||
|
||||
verify(taskanaEngineImplMock, times(1)).openConnection();
|
||||
|
@ -199,22 +206,22 @@ public class TaskMonitorServiceImplTest {
|
|||
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
|
||||
|
||||
assertNotNull(actualResult);
|
||||
assertEquals(actualResult.getReportLines().get("EXTERN").getTotalNumberOfTasks(), 1);
|
||||
assertEquals(actualResult.getReportLines().get("EXTERN").getLineItems().get(0).getNumberOfTasks(), 1);
|
||||
assertEquals(actualResult.getSumLine().getTotalNumberOfTasks(), 1);
|
||||
assertEquals(actualResult.getRow("EXTERN").getTotalValue(), 1);
|
||||
assertEquals(actualResult.getRow("EXTERN").getCells()[0], 1);
|
||||
assertEquals(actualResult.getSumRow().getTotalValue(), 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTotalNumbersOfClassificationReport() throws InvalidArgumentException {
|
||||
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
|
||||
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
|
||||
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
|
||||
List<String> categories = Arrays.asList("EXTERN");
|
||||
List<String> domains = Arrays.asList("DOMAIN_A");
|
||||
List<String> categories = Collections.singletonList("EXTERN");
|
||||
List<String> domains = Collections.singletonList("DOMAIN_A");
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
|
||||
List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
|
||||
|
||||
List<MonitorQueryItem> expectedResult = new ArrayList<>();
|
||||
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
|
||||
List<pro.taskana.impl.report.impl.MonitorQueryItem> expectedResult = new ArrayList<>();
|
||||
pro.taskana.impl.report.impl.MonitorQueryItem monitorQueryItem = new pro.taskana.impl.report.impl.MonitorQueryItem();
|
||||
monitorQueryItem.setKey("CLI:000000000000000000000000000000000001");
|
||||
monitorQueryItem.setNumberOfTasks(1);
|
||||
expectedResult.add(monitorQueryItem);
|
||||
|
@ -234,24 +241,24 @@ public class TaskMonitorServiceImplTest {
|
|||
|
||||
assertNotNull(actualResult);
|
||||
assertEquals(
|
||||
actualResult.getReportLines().get("CLI:000000000000000000000000000000000001").getTotalNumberOfTasks(), 1);
|
||||
assertEquals(actualResult.getSumLine().getTotalNumberOfTasks(), 1);
|
||||
actualResult.getRow("CLI:000000000000000000000000000000000001").getTotalValue(), 1);
|
||||
assertEquals(actualResult.getSumRow().getTotalValue(), 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetClassificationReportWithReportLineItemDefinitions() throws InvalidArgumentException {
|
||||
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
|
||||
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
|
||||
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
|
||||
List<String> categories = Arrays.asList("EXTERN");
|
||||
List<String> domains = Arrays.asList("DOMAIN_A");
|
||||
List<String> categories = Collections.singletonList("EXTERN");
|
||||
List<String> domains = Collections.singletonList("DOMAIN_A");
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
|
||||
List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
|
||||
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = Arrays.asList(new ReportLineItemDefinition(),
|
||||
new ReportLineItemDefinition());
|
||||
List<TimeIntervalColumnHeader> reportLineItemDefinitions = Collections.singletonList(
|
||||
new TimeIntervalColumnHeader(0, 0));
|
||||
|
||||
List<MonitorQueryItem> expectedResult = new ArrayList<>();
|
||||
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
|
||||
List<pro.taskana.impl.report.impl.MonitorQueryItem> expectedResult = new ArrayList<>();
|
||||
pro.taskana.impl.report.impl.MonitorQueryItem monitorQueryItem = new pro.taskana.impl.report.impl.MonitorQueryItem();
|
||||
monitorQueryItem.setKey("CLI:000000000000000000000000000000000001");
|
||||
monitorQueryItem.setAgeInDays(0);
|
||||
monitorQueryItem.setNumberOfTasks(1);
|
||||
|
@ -272,23 +279,19 @@ public class TaskMonitorServiceImplTest {
|
|||
|
||||
assertNotNull(actualResult);
|
||||
assertEquals(
|
||||
actualResult.getReportLines().get("CLI:000000000000000000000000000000000001").getTotalNumberOfTasks(), 1);
|
||||
assertEquals(actualResult.getReportLines()
|
||||
.get("CLI:000000000000000000000000000000000001")
|
||||
.getLineItems()
|
||||
.get(0)
|
||||
.getNumberOfTasks(), 1);
|
||||
assertEquals(actualResult.getSumLine().getTotalNumberOfTasks(), 1);
|
||||
actualResult.getRow("CLI:000000000000000000000000000000000001").getTotalValue(), 1);
|
||||
assertEquals(actualResult.getRow("CLI:000000000000000000000000000000000001").getCells()[0], 1);
|
||||
assertEquals(actualResult.getSumRow().getTotalValue(), 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTotalNumbersOfDetailedClassificationReport() throws InvalidArgumentException {
|
||||
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
|
||||
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
|
||||
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
|
||||
List<String> categories = Arrays.asList("EXTERN");
|
||||
List<String> domains = Arrays.asList("DOMAIN_A");
|
||||
List<String> categories = Collections.singletonList("EXTERN");
|
||||
List<String> domains = Collections.singletonList("DOMAIN_A");
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
|
||||
List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
|
||||
|
||||
List<DetailedMonitorQueryItem> expectedResult = new ArrayList<>();
|
||||
DetailedMonitorQueryItem detailedMonitorQueryItem = new DetailedMonitorQueryItem();
|
||||
|
@ -311,24 +314,23 @@ public class TaskMonitorServiceImplTest {
|
|||
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
||||
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
|
||||
|
||||
DetailedReportLine line = (DetailedReportLine) actualResult.getReportLines()
|
||||
.get("CLI:000000000000000000000000000000000001");
|
||||
DetailedReportRow line = actualResult.getRow("CLI:000000000000000000000000000000000001");
|
||||
assertNotNull(actualResult);
|
||||
assertEquals(line.getTotalNumberOfTasks(), 1);
|
||||
assertEquals(line.getDetailLines().get("CLI:000000000000000000000000000000000006").getTotalNumberOfTasks(), 1);
|
||||
assertEquals(actualResult.getSumLine().getTotalNumberOfTasks(), 1);
|
||||
assertEquals(line.getTotalValue(), 1);
|
||||
assertEquals(line.getDetailRows().get("CLI:000000000000000000000000000000000006").getTotalValue(), 1);
|
||||
assertEquals(actualResult.getSumRow().getTotalValue(), 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDetailedClassificationReportWithReportLineItemDefinitions() throws InvalidArgumentException {
|
||||
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
|
||||
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
|
||||
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
|
||||
List<String> categories = Arrays.asList("EXTERN");
|
||||
List<String> domains = Arrays.asList("DOMAIN_A");
|
||||
List<String> categories = Collections.singletonList("EXTERN");
|
||||
List<String> domains = Collections.singletonList("DOMAIN_A");
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = Arrays.asList(new ReportLineItemDefinition(),
|
||||
new ReportLineItemDefinition());
|
||||
List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
|
||||
List<TimeIntervalColumnHeader> reportLineItemDefinitions = Collections.singletonList(
|
||||
new TimeIntervalColumnHeader(0, 0));
|
||||
|
||||
List<DetailedMonitorQueryItem> expectedResult = new ArrayList<>();
|
||||
DetailedMonitorQueryItem detailedMonitorQueryItem = new DetailedMonitorQueryItem();
|
||||
|
@ -352,32 +354,27 @@ public class TaskMonitorServiceImplTest {
|
|||
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
||||
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
|
||||
|
||||
DetailedReportLine line = (DetailedReportLine) actualResult.getReportLines()
|
||||
.get("CLI:000000000000000000000000000000000001");
|
||||
DetailedReportRow line = actualResult.getRow("CLI:000000000000000000000000000000000001");
|
||||
assertNotNull(actualResult);
|
||||
assertEquals(line.getTotalNumberOfTasks(), 1);
|
||||
assertEquals(line.getDetailLines().get("CLI:000000000000000000000000000000000006").getTotalNumberOfTasks(), 1);
|
||||
assertEquals(line.getLineItems().get(0).getNumberOfTasks(), 1);
|
||||
assertEquals(line.getDetailLines()
|
||||
.get("CLI:000000000000000000000000000000000006")
|
||||
.getLineItems()
|
||||
.get(0)
|
||||
.getNumberOfTasks(), 1);
|
||||
assertEquals(actualResult.getSumLine().getTotalNumberOfTasks(), 1);
|
||||
assertEquals(actualResult.getSumLine().getLineItems().get(0).getNumberOfTasks(), 1);
|
||||
assertEquals(line.getTotalValue(), 1);
|
||||
assertEquals(line.getDetailRows().get("CLI:000000000000000000000000000000000006").getTotalValue(), 1);
|
||||
assertEquals(line.getCells()[0], 1);
|
||||
assertEquals(line.getDetailRows().get("CLI:000000000000000000000000000000000006").getCells()[0], 1);
|
||||
assertEquals(actualResult.getSumRow().getTotalValue(), 1);
|
||||
assertEquals(actualResult.getSumRow().getCells()[0], 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTotalNumbersOfCustomFieldValueReport() throws InvalidArgumentException {
|
||||
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
|
||||
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
|
||||
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
|
||||
List<String> categories = Arrays.asList("EXTERN");
|
||||
List<String> domains = Arrays.asList("DOMAIN_A");
|
||||
List<String> categories = Collections.singletonList("EXTERN");
|
||||
List<String> domains = Collections.singletonList("DOMAIN_A");
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
|
||||
List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
|
||||
|
||||
List<MonitorQueryItem> expectedResult = new ArrayList<>();
|
||||
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
|
||||
List<pro.taskana.impl.report.impl.MonitorQueryItem> expectedResult = new ArrayList<>();
|
||||
pro.taskana.impl.report.impl.MonitorQueryItem monitorQueryItem = new pro.taskana.impl.report.impl.MonitorQueryItem();
|
||||
monitorQueryItem.setKey("Geschaeftsstelle A");
|
||||
monitorQueryItem.setNumberOfTasks(1);
|
||||
expectedResult.add(monitorQueryItem);
|
||||
|
@ -385,7 +382,7 @@ public class TaskMonitorServiceImplTest {
|
|||
.getTaskCountOfCustomFieldValues(workbasketIds, states, categories, domains, customField,
|
||||
customFieldValues);
|
||||
|
||||
Report actualResult = cut.getCustomFieldValueReport(workbasketIds, states, categories, domains,
|
||||
CustomFieldValueReport actualResult = cut.getCustomFieldValueReport(workbasketIds, states, categories, domains,
|
||||
customField, customFieldValues);
|
||||
|
||||
verify(taskanaEngineImplMock, times(1)).openConnection();
|
||||
|
@ -398,23 +395,23 @@ public class TaskMonitorServiceImplTest {
|
|||
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
|
||||
|
||||
assertNotNull(actualResult);
|
||||
assertEquals(actualResult.getReportLines().get("Geschaeftsstelle A").getTotalNumberOfTasks(), 1);
|
||||
assertEquals(actualResult.getSumLine().getTotalNumberOfTasks(), 1);
|
||||
assertEquals(actualResult.getRow("Geschaeftsstelle A").getTotalValue(), 1);
|
||||
assertEquals(actualResult.getSumRow().getTotalValue(), 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCustomFieldValueReportWithReportLineItemDefinitions() throws InvalidArgumentException {
|
||||
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
|
||||
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
|
||||
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
|
||||
List<String> categories = Arrays.asList("EXTERN");
|
||||
List<String> domains = Arrays.asList("DOMAIN_A");
|
||||
List<String> categories = Collections.singletonList("EXTERN");
|
||||
List<String> domains = Collections.singletonList("DOMAIN_A");
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = Arrays.asList(new ReportLineItemDefinition(),
|
||||
new ReportLineItemDefinition());
|
||||
List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
|
||||
List<TimeIntervalColumnHeader> reportLineItemDefinitions = Collections.singletonList(
|
||||
new TimeIntervalColumnHeader(0, 0));
|
||||
|
||||
List<MonitorQueryItem> expectedResult = new ArrayList<>();
|
||||
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
|
||||
List<pro.taskana.impl.report.impl.MonitorQueryItem> expectedResult = new ArrayList<>();
|
||||
pro.taskana.impl.report.impl.MonitorQueryItem monitorQueryItem = new pro.taskana.impl.report.impl.MonitorQueryItem();
|
||||
monitorQueryItem.setKey("Geschaeftsstelle A");
|
||||
monitorQueryItem.setAgeInDays(0);
|
||||
monitorQueryItem.setNumberOfTasks(1);
|
||||
|
@ -423,7 +420,7 @@ public class TaskMonitorServiceImplTest {
|
|||
.getTaskCountOfCustomFieldValues(workbasketIds, states, categories, domains, customField,
|
||||
customFieldValues);
|
||||
|
||||
Report actualResult = cut.getCustomFieldValueReport(workbasketIds, states, categories, domains,
|
||||
CustomFieldValueReport actualResult = cut.getCustomFieldValueReport(workbasketIds, states, categories, domains,
|
||||
customField, customFieldValues, reportLineItemDefinitions);
|
||||
|
||||
verify(taskanaEngineImplMock, times(1)).openConnection();
|
||||
|
@ -436,30 +433,29 @@ public class TaskMonitorServiceImplTest {
|
|||
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
|
||||
|
||||
assertNotNull(actualResult);
|
||||
assertEquals(actualResult.getReportLines().get("Geschaeftsstelle A").getTotalNumberOfTasks(), 1);
|
||||
assertEquals(actualResult.getReportLines().get("Geschaeftsstelle A").getLineItems().get(0).getNumberOfTasks(),
|
||||
1);
|
||||
assertEquals(actualResult.getSumLine().getTotalNumberOfTasks(), 1);
|
||||
assertEquals(actualResult.getRow("Geschaeftsstelle A").getTotalValue(), 1);
|
||||
assertEquals(actualResult.getRow("Geschaeftsstelle A").getCells()[0], 1);
|
||||
assertEquals(actualResult.getSumRow().getTotalValue(), 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTaskIdsOfCategoryReportLineItems() throws InvalidArgumentException {
|
||||
List<String> workbasketIds = Arrays.asList("WBI:000000000000000000000000000000000001");
|
||||
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
|
||||
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
|
||||
List<String> categories = Arrays.asList("EXTERN");
|
||||
List<String> domains = Arrays.asList("DOMAIN_A");
|
||||
List<String> categories = Collections.singletonList("EXTERN");
|
||||
List<String> domains = Collections.singletonList("DOMAIN_A");
|
||||
CustomField customField = CustomField.CUSTOM_1;
|
||||
List<String> customFieldValues = Arrays.asList("Geschaeftsstelle A");
|
||||
List<ReportLineItemDefinition> reportLineItemDefinitions = Arrays.asList(new ReportLineItemDefinition(),
|
||||
new ReportLineItemDefinition());
|
||||
List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
|
||||
List<TimeIntervalColumnHeader> reportLineItemDefinitions = Collections.singletonList(
|
||||
new TimeIntervalColumnHeader(0, 0));
|
||||
|
||||
SelectedItem selectedItem = new SelectedItem();
|
||||
selectedItem.setKey("EXTERN");
|
||||
selectedItem.setLowerAgeLimit(1);
|
||||
selectedItem.setUpperAgeLimit(5);
|
||||
List<SelectedItem> selectedItems = Arrays.asList(selectedItem);
|
||||
List<SelectedItem> selectedItems = Collections.singletonList(selectedItem);
|
||||
|
||||
List<String> expectedResult = Arrays.asList("TKI:000000000000000000000000000000000001");
|
||||
List<String> expectedResult = Collections.singletonList("TKI:000000000000000000000000000000000001");
|
||||
doReturn(expectedResult).when(taskMonitorMapperMock).getTaskIdsOfCategoriesBySelectedItems(workbasketIds,
|
||||
states, categories, domains, customField, customFieldValues, selectedItems);
|
||||
|
||||
|
|
Loading…
Reference in New Issue