TSK-685 renaming and refactoring of components for better understanding

This commit is contained in:
Mustapha Zorgati 2019-03-28 13:46:55 +01:00
parent 9830268ecd
commit c1f743fd6c
39 changed files with 172 additions and 175 deletions

View File

@ -3,7 +3,7 @@ package pro.taskana;
import pro.taskana.report.CategoryReport;
import pro.taskana.report.ClassificationReport;
import pro.taskana.report.CustomFieldValueReport;
import pro.taskana.report.DailyEntryExitReport;
import pro.taskana.report.TimestampReport;
import pro.taskana.report.TaskStatusReport;
import pro.taskana.report.WorkbasketReport;
@ -55,10 +55,10 @@ public interface TaskMonitorService {
TaskStatusReport.Builder createTaskStatusReportBuilder();
/**
* Provides a {@link DailyEntryExitReport.Builder} for creating a {@link DailyEntryExitReport}.
* Provides a {@link TimestampReport.Builder} for creating a {@link TimestampReport}.
*
* @return a {@link DailyEntryExitReport.Builder}
* @return a {@link TimestampReport.Builder}
*/
DailyEntryExitReport.Builder createDailyEntryExitReportBuilder();
TimestampReport.Builder createTimestampReportBuilder();
}

View File

@ -1,8 +0,0 @@
package pro.taskana;
/**
* This enum contains all statuses of a {@link pro.taskana.Task}.
*/
public enum TaskStatus {
CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE
}

View File

@ -6,7 +6,7 @@ import pro.taskana.mappings.TaskMonitorMapper;
import pro.taskana.report.CategoryReport;
import pro.taskana.report.ClassificationReport;
import pro.taskana.report.CustomFieldValueReport;
import pro.taskana.report.DailyEntryExitReport;
import pro.taskana.report.TimestampReport;
import pro.taskana.report.TaskStatusReport;
import pro.taskana.report.WorkbasketReport;
@ -50,8 +50,8 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
}
@Override
public DailyEntryExitReport.Builder createDailyEntryExitReportBuilder() {
return new DailyEntryExitReportBuilderImpl(taskanaEngineImpl, taskMonitorMapper);
public TimestampReport.Builder createTimestampReportBuilder() {
return new TimestampReportBuilderImpl(taskanaEngineImpl, taskMonitorMapper);
}
}

View File

@ -16,7 +16,7 @@ import pro.taskana.TaskanaRole;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
import pro.taskana.impl.report.item.DateQueryItem;
import pro.taskana.impl.report.item.AgeQueryItem;
import pro.taskana.impl.util.LoggerUtils;
import pro.taskana.mappings.TaskMonitorMapper;
import pro.taskana.report.ClassificationReport;
@ -25,10 +25,10 @@ import pro.taskana.report.TimeIntervalReportBuilder;
/**
* Implementation of {@link TimeIntervalReportBuilder}.
* @param <B> the true Builder behind this Interface
* @param <I> the true DateQueryItem inside the Report
* @param <I> the true AgeQueryItem inside the Report
* @param <H> the column header
*/
abstract class TimeIntervalReportBuilderImpl<B extends TimeIntervalReportBuilder<B, I, H>, I extends DateQueryItem, H extends TimeIntervalColumnHeader>
abstract class TimeIntervalReportBuilderImpl<B extends TimeIntervalReportBuilder<B, I, H>, I extends AgeQueryItem, H extends TimeIntervalColumnHeader>
implements TimeIntervalReportBuilder<B, I, H> {
private static final Logger LOGGER = LoggerFactory.getLogger(TimeIntervalReportBuilder.class);

View File

@ -10,39 +10,39 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pro.taskana.TaskState;
import pro.taskana.TaskStatus;
import pro.taskana.impl.report.item.TimestampQueryItem;
import pro.taskana.report.Timestamp;
import pro.taskana.TaskanaEngine;
import pro.taskana.TaskanaRole;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
import pro.taskana.impl.report.item.DailyEntryExitQueryItem;
import pro.taskana.impl.report.preprocessor.DaysToWorkingDaysPreProcessor;
import pro.taskana.mappings.TaskMonitorMapper;
import pro.taskana.report.DailyEntryExitReport;
import pro.taskana.report.TimestampReport;
/**
* The implementation of {@link DailyEntryExitReport.Builder}.
* The implementation of {@link TimestampReport.Builder}.
*/
public class DailyEntryExitReportBuilderImpl extends
TimeIntervalReportBuilderImpl<DailyEntryExitReport.Builder, DailyEntryExitQueryItem, TimeIntervalColumnHeader.Date>
implements DailyEntryExitReport.Builder {
public class TimestampReportBuilderImpl extends
TimeIntervalReportBuilderImpl<TimestampReport.Builder, TimestampQueryItem, TimeIntervalColumnHeader.Date>
implements TimestampReport.Builder {
private static final Logger LOGGER = LoggerFactory.getLogger(DailyEntryExitReport.Builder.class);
private List<TaskStatus> status = Arrays.asList(TaskStatus.CREATED, TaskStatus.COMPLETED);
private static final Logger LOGGER = LoggerFactory.getLogger(TimestampReport.Builder.class);
private List<Timestamp> status = Arrays.asList(Timestamp.CREATED, Timestamp.COMPLETED);
DailyEntryExitReportBuilderImpl(TaskanaEngine taskanaEngine, TaskMonitorMapper taskMonitorMapper) {
TimestampReportBuilderImpl(TaskanaEngine taskanaEngine, TaskMonitorMapper taskMonitorMapper) {
super(taskanaEngine, taskMonitorMapper);
}
@Override
public DailyEntryExitReport.Builder stateIn(List<TaskState> states) {
public TimestampReport.Builder stateIn(List<TaskState> states) {
throw new UnsupportedOperationException(
"The states have no influence regarding this report. Use statusIn instead");
"The states have no influence regarding this report. Use withTimestamps instead");
}
@Override
protected DailyEntryExitReport.Builder _this() {
protected TimestampReport.Builder _this() {
return this;
}
@ -57,19 +57,19 @@ public class DailyEntryExitReportBuilderImpl extends
}
@Override
public DailyEntryExitReport.Builder statusIn(List<TaskStatus> statuses) {
public TimestampReport.Builder withTimestamps(List<Timestamp> statuses) {
this.status = new ArrayList<>(statuses);
return _this();
}
@Override
public DailyEntryExitReport buildReport() throws NotAuthorizedException, InvalidArgumentException {
public TimestampReport buildReport() throws NotAuthorizedException, InvalidArgumentException {
LOGGER.debug("entry to buildDetailedReport(), this = {}", this);
this.taskanaEngine.checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN);
try {
this.taskanaEngine.openConnection();
DailyEntryExitReport report = new DailyEntryExitReport(this.columnHeaders);
List<DailyEntryExitQueryItem> items = status.stream()
TimestampReport report = new TimestampReport(this.columnHeaders);
List<TimestampQueryItem> items = status.stream()
// This can also be implemented into a single sql query which combines all statuses with the union
// operator. That would reduce the readability of the sql template. That's why "the loop" is done
// outside of mybatis.
@ -86,7 +86,7 @@ public class DailyEntryExitReportBuilderImpl extends
}
}
private List<DailyEntryExitQueryItem> getTasksCountForStatusGroupedByOrgLevel(TaskStatus s) {
private List<TimestampQueryItem> getTasksCountForStatusGroupedByOrgLevel(Timestamp s) {
return taskMonitorMapper.getTasksCountForStatusGroupedByOrgLevel(s, categories, classificationIds,
excludedClassificationIds, domains, customAttributeFilter);
}

View File

@ -2,7 +2,7 @@ package pro.taskana.impl.report.header;
import pro.taskana.TaskState;
import pro.taskana.impl.report.item.TaskQueryItem;
import pro.taskana.report.structure.ColumnHeader;
import pro.taskana.impl.report.structure.ColumnHeader;
/**
* The TaskStatusColumnHeader represents a column for each {@link TaskState}.

View File

@ -4,8 +4,8 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
import pro.taskana.impl.report.item.DateQueryItem;
import pro.taskana.report.structure.ColumnHeader;
import pro.taskana.impl.report.item.AgeQueryItem;
import pro.taskana.impl.report.structure.ColumnHeader;
/**
* A TimeIntervalColumnHeader has a lower and an upper age limit which subdivide the count of tasks into different
@ -15,7 +15,7 @@ import pro.taskana.report.structure.ColumnHeader;
* 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 ColumnHeader<DateQueryItem> {
public class TimeIntervalColumnHeader implements ColumnHeader<AgeQueryItem> {
private final int lowerAgeLimit;
private final int upperAgeLimit;
@ -49,7 +49,7 @@ public class TimeIntervalColumnHeader implements ColumnHeader<DateQueryItem> {
}
@Override
public boolean fits(DateQueryItem item) {
public boolean fits(AgeQueryItem item) {
return lowerAgeLimit <= item.getAgeInDays() && upperAgeLimit >= item.getAgeInDays();
}

View File

@ -1,11 +1,11 @@
package pro.taskana.impl.report.item;
import pro.taskana.report.structure.QueryItem;
import pro.taskana.impl.report.structure.QueryItem;
/**
* The MonitorQueryItem entity contains the number of tasks for a key (e.g. workbasketKey) and age in days.
*/
public interface DateQueryItem extends QueryItem {
public interface AgeQueryItem extends QueryItem {
int getAgeInDays();

View File

@ -3,7 +3,7 @@ package pro.taskana.impl.report.item;
/**
* The MonitorQueryItem entity contains the number of tasks for a key (e.g. workbasketKey) and age in days.
*/
public class MonitorQueryItem implements DateQueryItem {
public class MonitorQueryItem implements AgeQueryItem {
private String key;
private int ageInDays;

View File

@ -1,7 +1,7 @@
package pro.taskana.impl.report.item;
import pro.taskana.TaskState;
import pro.taskana.report.structure.QueryItem;
import pro.taskana.impl.report.structure.QueryItem;
/**
* The TaskQueryItem entity contains the number of tasks for a domain which have a specific state.

View File

@ -1,15 +1,15 @@
package pro.taskana.impl.report.item;
import pro.taskana.TaskStatus;
import pro.taskana.report.Timestamp;
/**
* The DailyEntryExitQueryItem contains the necessary information for the {@link pro.taskana.report.DailyEntryExitReport}.
* The TimestampQueryItem contains the necessary information for the {@link pro.taskana.report.TimestampReport}.
*/
public class DailyEntryExitQueryItem implements DateQueryItem {
public class TimestampQueryItem implements AgeQueryItem {
private static final String N_A = "N/A";
private int count;
private TaskStatus status;
private Timestamp status;
private int ageInDays;
private String orgLevel1;
private String orgLevel2;

View File

@ -5,14 +5,14 @@ import java.util.List;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.impl.DaysToWorkingDaysConverter;
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
import pro.taskana.impl.report.item.DateQueryItem;
import pro.taskana.report.structure.QueryItemPreprocessor;
import pro.taskana.impl.report.item.AgeQueryItem;
import pro.taskana.impl.report.structure.QueryItemPreprocessor;
/**
* Uses {@link DaysToWorkingDaysConverter} to convert an &lt;I&gt;s age to working days.
* @param <I> QueryItem which is being processed
*/
public class DaysToWorkingDaysPreProcessor<I extends DateQueryItem> implements QueryItemPreprocessor<I> {
public class DaysToWorkingDaysPreProcessor<I extends AgeQueryItem> implements QueryItemPreprocessor<I> {
private DaysToWorkingDaysConverter instance;

View File

@ -1,7 +1,7 @@
package pro.taskana.impl.report.row;
import pro.taskana.impl.report.item.DetailedMonitorQueryItem;
import pro.taskana.report.structure.Row;
import pro.taskana.impl.report.structure.Row;
/**
* Represents a single Row inside {@link pro.taskana.report.ClassificationReport.DetailedClassificationReport}.

View File

@ -6,15 +6,15 @@ import java.util.Set;
import java.util.function.Function;
import pro.taskana.impl.util.LoggerUtils;
import pro.taskana.report.structure.QueryItem;
import pro.taskana.report.structure.Row;
import pro.taskana.impl.report.structure.QueryItem;
import pro.taskana.impl.report.structure.Row;
/**
* The FoldableRow extends the {@link SingleRow}.
* In contrast to the {@link SingleRow} the FoldableRow contains rows which can be collapsed or expanded.
* The FoldableRow itself displays the sum of all foldable rows.
*
* @param <I> the {@link QueryItem} on which the {@link pro.taskana.report.structure.Report} is based on.
* @param <I> the {@link QueryItem} on which the {@link pro.taskana.impl.report.structure.Report} is based on.
*/
public abstract class FoldableRow<I extends QueryItem> extends SingleRow<I> {

View File

@ -1,13 +1,13 @@
package pro.taskana.impl.report.row;
import pro.taskana.report.structure.QueryItem;
import pro.taskana.report.structure.Row;
import pro.taskana.impl.report.structure.QueryItem;
import pro.taskana.impl.report.structure.Row;
/**
* A SingleRow represents a single row in a {@link pro.taskana.report.structure.Report}.
* It contains an array of cells whose index corresponds to the {@link pro.taskana.report.structure.ColumnHeader} index in the {@link pro.taskana.report.structure.Report}.
* A SingleRow represents a single row in a {@link pro.taskana.impl.report.structure.Report}.
* It contains an array of cells whose index corresponds to the {@link pro.taskana.impl.report.structure.ColumnHeader} index in the {@link pro.taskana.impl.report.structure.Report}.
*
* @param <I> {@link QueryItem} on which the {@link pro.taskana.report.structure.Report} is based on.
* @param <I> {@link QueryItem} on which the {@link pro.taskana.impl.report.structure.Report} is based on.
*/
public class SingleRow<I extends QueryItem> implements Row<I> {

View File

@ -1,16 +1,16 @@
package pro.taskana.impl.report.row;
import pro.taskana.impl.report.item.DailyEntryExitQueryItem;
import pro.taskana.report.structure.Row;
import pro.taskana.impl.report.item.TimestampQueryItem;
import pro.taskana.impl.report.structure.Row;
/**
* A single Row inside the {@link pro.taskana.report.DailyEntryExitReport}.
* A single Row inside the {@link pro.taskana.report.TimestampReport}.
* It contains 4 sub-rows for each org level respectively.
*/
public class DailyEntryExitRow extends FoldableRow<DailyEntryExitQueryItem> {
public class TimestampRow extends FoldableRow<TimestampQueryItem> {
public DailyEntryExitRow(int columnSize) {
super(columnSize, DailyEntryExitQueryItem::getOrgLevel1);
public TimestampRow(int columnSize) {
super(columnSize, TimestampQueryItem::getOrgLevel1);
}
@Override
@ -24,13 +24,13 @@ public class DailyEntryExitRow extends FoldableRow<DailyEntryExitQueryItem> {
}
/**
* Row inside the {@link pro.taskana.report.DailyEntryExitReport} containing
* Row inside the {@link pro.taskana.report.TimestampReport} containing
* the information regarding a specific org level 1.
*/
public static final class OrgLevel1Row extends FoldableRow<DailyEntryExitQueryItem> {
public static final class OrgLevel1Row extends FoldableRow<TimestampQueryItem> {
private OrgLevel1Row(int columnSize) {
super(columnSize, DailyEntryExitQueryItem::getOrgLevel2);
super(columnSize, TimestampQueryItem::getOrgLevel2);
}
@Override
@ -45,13 +45,13 @@ public class DailyEntryExitRow extends FoldableRow<DailyEntryExitQueryItem> {
}
/**
* Row inside the {@link pro.taskana.report.DailyEntryExitReport} containing
* Row inside the {@link pro.taskana.report.TimestampReport} containing
* the information regarding a specific org level 2.
*/
public static final class OrgLevel2Row extends FoldableRow<DailyEntryExitQueryItem> {
public static final class OrgLevel2Row extends FoldableRow<TimestampQueryItem> {
private OrgLevel2Row(int columnSize) {
super(columnSize, DailyEntryExitQueryItem::getOrgLevel3);
super(columnSize, TimestampQueryItem::getOrgLevel3);
}
@Override
@ -66,23 +66,23 @@ public class DailyEntryExitRow extends FoldableRow<DailyEntryExitQueryItem> {
}
/**
* Row inside the {@link pro.taskana.report.DailyEntryExitReport} containing
* Row inside the {@link pro.taskana.report.TimestampReport} containing
* the information regarding a specific org level 3.
*/
public static final class OrgLevel3Row extends FoldableRow<DailyEntryExitQueryItem> {
public static final class OrgLevel3Row extends FoldableRow<TimestampQueryItem> {
private OrgLevel3Row(int columnSize) {
super(columnSize, DailyEntryExitQueryItem::getOrgLevel4);
super(columnSize, TimestampQueryItem::getOrgLevel4);
}
@Override
Row<DailyEntryExitQueryItem> buildRow(int columnSize) {
Row<TimestampQueryItem> buildRow(int columnSize) {
return new SingleRow<>(columnSize);
}
@Override
public SingleRow<DailyEntryExitQueryItem> getFoldableRow(String key) {
return (SingleRow<DailyEntryExitQueryItem>) super.getFoldableRow(key);
public SingleRow<TimestampQueryItem> getFoldableRow(String key) {
return (SingleRow<TimestampQueryItem>) super.getFoldableRow(key);
}
}

View File

@ -1,4 +1,4 @@
package pro.taskana.report.structure;
package pro.taskana.impl.report.structure;
/**
* A ColumnHeader is an element of a {@link Report}.

View File

@ -1,4 +1,4 @@
package pro.taskana.report.structure;
package pro.taskana.impl.report.structure;
/**
* A QueryItem is en entity on which a {@link Report} is based on.

View File

@ -1,4 +1,4 @@
package pro.taskana.report.structure;
package pro.taskana.impl.report.structure;
/**
* The QueryItemPreprocessor is used when adding {@link QueryItem}s into a {@link Report}. It defines a processing

View File

@ -1,4 +1,4 @@
package pro.taskana.report.structure;
package pro.taskana.impl.report.structure;
import java.util.ArrayList;
import java.util.LinkedHashMap;

View File

@ -1,4 +1,4 @@
package pro.taskana.report.structure;
package pro.taskana.impl.report.structure;
/**
* Representation of a row in a {@link Report}.

View File

@ -10,10 +10,10 @@ import org.apache.ibatis.annotations.Select;
import pro.taskana.CustomField;
import pro.taskana.TaskState;
import pro.taskana.TaskStatus;
import pro.taskana.report.Timestamp;
import pro.taskana.impl.SelectedItem;
import pro.taskana.impl.report.CombinedClassificationFilter;
import pro.taskana.impl.report.item.DailyEntryExitQueryItem;
import pro.taskana.impl.report.item.TimestampQueryItem;
import pro.taskana.impl.report.item.DetailedMonitorQueryItem;
import pro.taskana.impl.report.item.MonitorQueryItem;
import pro.taskana.impl.report.item.TaskQueryItem;
@ -426,7 +426,7 @@ public interface TaskMonitorMapper {
@Result(column = "ORG_LEVEL_3", property = "orgLevel3"),
@Result(column = "ORG_LEVEL_4", property = "orgLevel4")
})
List<DailyEntryExitQueryItem> getTasksCountForStatusGroupedByOrgLevel(@Param("status") TaskStatus status,
List<TimestampQueryItem> getTasksCountForStatusGroupedByOrgLevel(@Param("status") Timestamp status,
@Param("categories") List<String> categories, @Param("classificationIds") List<String> classificationIds,
@Param("excludedClassificationIds") List<String> excludedClassificationIds,
@Param("domains") List<String> domains,

View File

@ -6,7 +6,7 @@ import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
import pro.taskana.impl.report.item.MonitorQueryItem;
import pro.taskana.report.structure.Report;
import pro.taskana.impl.report.structure.Report;
/**
* A CategoryReport contains the total numbers of tasks of the respective category as well as the total number of

View File

@ -8,10 +8,10 @@ import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
import pro.taskana.impl.report.item.DetailedMonitorQueryItem;
import pro.taskana.impl.report.item.MonitorQueryItem;
import pro.taskana.impl.report.row.DetailedClassificationRow;
import pro.taskana.report.structure.Report;
import pro.taskana.impl.report.structure.Report;
/**
* The ClassificationReport extends the Report. The {@link pro.taskana.report.structure.Row}s of the ClassificationReport are grouped by
* The ClassificationReport extends the Report. The {@link pro.taskana.impl.report.structure.Row}s of the ClassificationReport are grouped by
* classifications.
*/
public class ClassificationReport extends Report<MonitorQueryItem, TimeIntervalColumnHeader> {
@ -32,7 +32,7 @@ public class ClassificationReport extends Report<MonitorQueryItem, TimeIntervalC
* Returns a {@link DetailedClassificationReport} containing all tasks after applying the filters. If the column
* headers are set the report is subdivided into clusters. Its
* {@link pro.taskana.impl.report.row.FoldableRow}s contain an additional list of
* {@link pro.taskana.report.structure.Row}s for the classifications of the attachments of the tasks.
* {@link pro.taskana.impl.report.structure.Row}s for the classifications of the attachments of the tasks.
*
* @throws InvalidArgumentException
* if the column headers are not initialized
@ -45,7 +45,7 @@ public class ClassificationReport extends Report<MonitorQueryItem, TimeIntervalC
/**
* The DetailedClassificationReport is a functional extension of the {@link ClassificationReport}.
* Its {@link pro.taskana.impl.report.row.FoldableRow}s contain an additional list of {@link pro.taskana.report.structure.Row}s
* Its {@link pro.taskana.impl.report.row.FoldableRow}s contain an additional list of {@link pro.taskana.impl.report.structure.Row}s
* for the classifications of the attachments of the tasks.
*/
public static class DetailedClassificationReport

View File

@ -7,7 +7,7 @@ import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
import pro.taskana.impl.report.item.MonitorQueryItem;
import pro.taskana.report.structure.Report;
import pro.taskana.impl.report.structure.Report;
/**
* A CustomFieldValueReport contains the total numbers of tasks of the respective custom field as well as

View File

@ -1,43 +0,0 @@
package pro.taskana.report;
import java.util.List;
import pro.taskana.TaskStatus;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
import pro.taskana.impl.report.item.DailyEntryExitQueryItem;
import pro.taskana.impl.report.row.DailyEntryExitRow;
import pro.taskana.report.structure.Report;
/**
* A {@link DailyEntryExitReport} displays created and competed tasks for a specific dates.
*/
public class DailyEntryExitReport extends Report<DailyEntryExitQueryItem, TimeIntervalColumnHeader.Date> {
public DailyEntryExitReport(List<TimeIntervalColumnHeader.Date> dates) {
super(dates, "STATES");
}
@Override
protected DailyEntryExitRow createRow(int columnSize) {
return new DailyEntryExitRow(columnSize);
}
@Override
public DailyEntryExitRow getRow(String key) {
return (DailyEntryExitRow) super.getRow(key);
}
/**
* Builder for {@link DailyEntryExitReport}.
*/
public interface Builder extends
TimeIntervalReportBuilder<DailyEntryExitReport.Builder, DailyEntryExitQueryItem, TimeIntervalColumnHeader.Date> {
@Override
DailyEntryExitReport buildReport() throws NotAuthorizedException, InvalidArgumentException;
Builder statusIn(List<TaskStatus> statuses);
}
}

View File

@ -9,7 +9,7 @@ import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.report.item.TaskQueryItem;
import pro.taskana.impl.report.header.TaskStatusColumnHeader;
import pro.taskana.report.structure.Report;
import pro.taskana.impl.report.structure.Report;
/**
* A TaskStatusReport contains the total number of tasks, clustered in their task status.

View File

@ -9,16 +9,16 @@ import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.SelectedItem;
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
import pro.taskana.impl.report.item.DateQueryItem;
import pro.taskana.report.structure.Report;
import pro.taskana.impl.report.item.AgeQueryItem;
import pro.taskana.impl.report.structure.Report;
/**
* "Super" Interface for all TimeIntervalReportBuilders.
* @param <B> the true Builder behind this Interface.
* @param <I> the DateQueryItem which will be inserted into the Report.
* @param <I> the AgeQueryItem which will be inserted into the Report.
* @param <H> the column Header
*/
public interface TimeIntervalReportBuilder<B extends TimeIntervalReportBuilder<B, I, H>, I extends DateQueryItem, H extends TimeIntervalColumnHeader>
public interface TimeIntervalReportBuilder<B extends TimeIntervalReportBuilder<B, I, H>, I extends AgeQueryItem, H extends TimeIntervalColumnHeader>
extends Report.Builder<I, H> {
/**

View File

@ -0,0 +1,8 @@
package pro.taskana.report;
/**
* This enum contains all timestamps saved in the database table for a {@link pro.taskana.Task}.
*/
public enum Timestamp {
CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE
}

View File

@ -0,0 +1,42 @@
package pro.taskana.report;
import java.util.List;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
import pro.taskana.impl.report.item.TimestampQueryItem;
import pro.taskana.impl.report.row.TimestampRow;
import pro.taskana.impl.report.structure.Report;
/**
* A {@link TimestampReport} displays created and competed tasks for a specific dates.
*/
public class TimestampReport extends Report<TimestampQueryItem, TimeIntervalColumnHeader.Date> {
public TimestampReport(List<TimeIntervalColumnHeader.Date> dates) {
super(dates, "STATES");
}
@Override
protected TimestampRow createRow(int columnSize) {
return new TimestampRow(columnSize);
}
@Override
public TimestampRow getRow(String key) {
return (TimestampRow) super.getRow(key);
}
/**
* Builder for {@link TimestampReport}.
*/
public interface Builder extends
TimeIntervalReportBuilder<TimestampReport.Builder, TimestampQueryItem, TimeIntervalColumnHeader.Date> {
@Override
TimestampReport buildReport() throws NotAuthorizedException, InvalidArgumentException;
Builder withTimestamps(List<Timestamp> statuses);
}
}

View File

@ -7,7 +7,7 @@ import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.report.CombinedClassificationFilter;
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
import pro.taskana.impl.report.item.MonitorQueryItem;
import pro.taskana.report.structure.Report;
import pro.taskana.impl.report.structure.Report;
/**
* A WorkbasketReport contains the total numbers of tasks of the respective workbasket as well as the

View File

@ -25,7 +25,7 @@ import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
import pro.taskana.impl.report.item.DetailedMonitorQueryItem;
import pro.taskana.impl.report.row.FoldableRow;
import pro.taskana.report.ClassificationReport.DetailedClassificationReport;
import pro.taskana.report.structure.Row;
import pro.taskana.impl.report.structure.Row;
import pro.taskana.security.JAASRunner;
import pro.taskana.security.WithAccessId;

View File

@ -19,7 +19,7 @@ import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.report.header.TaskStatusColumnHeader;
import pro.taskana.impl.report.item.TaskQueryItem;
import pro.taskana.report.structure.Row;
import pro.taskana.impl.report.structure.Row;
import pro.taskana.report.TaskStatusReport;
import pro.taskana.security.JAASRunner;
import pro.taskana.security.WithAccessId;

View File

@ -15,21 +15,21 @@ import org.junit.runner.RunWith;
import pro.taskana.TaskMonitorService;
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
import pro.taskana.impl.report.item.DailyEntryExitQueryItem;
import pro.taskana.impl.report.row.DailyEntryExitRow;
import pro.taskana.impl.report.item.TimestampQueryItem;
import pro.taskana.impl.report.row.TimestampRow;
import pro.taskana.impl.report.row.SingleRow;
import pro.taskana.report.DailyEntryExitReport;
import pro.taskana.report.TimestampReport;
import pro.taskana.security.JAASRunner;
import pro.taskana.security.WithAccessId;
/**
* Test class for {@link pro.taskana.report.DailyEntryExitReport}.
* Test class for {@link TimestampReport}.
*/
@RunWith(JAASRunner.class)
public class ProvideDailyEntryExitReportAccTest extends AbstractReportAccTest {
public class ProvideTimestampReportAccTest extends AbstractReportAccTest {
/**
* This test covers every insert operation of the DailyEntryExitReport.
* This test covers every insert operation of the TimestampReport.
* We have two definitions for org level 1: 'org1' and 'N/A'.
* All other org levels only contain 'N/A'. Thus this test only tests the separation for org level1.
* Since every OrgLevelRow is a FoldableRow this is sufficient
@ -40,25 +40,25 @@ public class ProvideDailyEntryExitReportAccTest extends AbstractReportAccTest {
@WithAccessId(userName = "monitor")
@Test
public void testProperInsertionOfQueryItems() throws Exception {
TaskMonitorService mapper = taskanaEngine.getTaskMonitorService();
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
//last 14 days. Today excluded.
List<TimeIntervalColumnHeader.Date> collect = IntStream.range(-14, 0)
List<TimeIntervalColumnHeader.Date> headers = IntStream.range(-14, 0)
.mapToObj(TimeIntervalColumnHeader.Date::new)
.collect(Collectors.toList());
DailyEntryExitReport dailyEntryExitReport = mapper.createDailyEntryExitReportBuilder()
.withColumnHeaders(collect)
TimestampReport timestampReport = taskMonitorService.createTimestampReportBuilder()
.withColumnHeaders(headers)
.buildReport();
final HashSet<String> org1Set = new HashSet<>(Arrays.asList("N/A", "org1"));
final HashSet<String> allOtherOrgLevelSet = new HashSet<>(Collections.singletonList("N/A"));
assertEquals(2, dailyEntryExitReport.getRows().size());
assertEquals(2, timestampReport.getRows().size());
assertEquals(new HashSet<>(Arrays.asList("CREATED", "COMPLETED")),
dailyEntryExitReport.getRows().keySet());
timestampReport.getRows().keySet());
// * * * * * * * * * * * * * * * * * * * * * TEST THE CREATED ROW * * * * * * * * * * * * * * * * * * * * *
DailyEntryExitRow statusRow = dailyEntryExitReport.getRow("CREATED");
TimestampRow statusRow = timestampReport.getRow("CREATED");
assertEquals(2, statusRow.getFoldableRowCount());
assertEquals(org1Set, statusRow.getFoldableRowKeySet());
// 2 Entries with -8 days and one with -9 days.
@ -66,7 +66,7 @@ public class ProvideDailyEntryExitReportAccTest extends AbstractReportAccTest {
assertEquals(3, statusRow.getTotalValue());
// 'CREATED' -> 'org1'
DailyEntryExitRow.OrgLevel1Row org1Row = statusRow.getFoldableRow("org1");
TimestampRow.OrgLevel1Row org1Row = statusRow.getFoldableRow("org1");
assertEquals(1, org1Row.getFoldableRowCount());
assertEquals(allOtherOrgLevelSet, org1Row.getFoldableRowKeySet());
// only task TKI:000000000000000000000000000000000029 in 'org1'.
@ -74,7 +74,7 @@ public class ProvideDailyEntryExitReportAccTest extends AbstractReportAccTest {
assertEquals(1, org1Row.getTotalValue());
// 'CREATED' -> 'org1'/'N/A'
DailyEntryExitRow.OrgLevel2Row org2Row = org1Row.getFoldableRow("N/A");
TimestampRow.OrgLevel2Row org2Row = org1Row.getFoldableRow("N/A");
assertEquals(1, org2Row.getFoldableRowCount());
assertEquals(allOtherOrgLevelSet, org2Row.getFoldableRowKeySet());
// Since no further separation (in org level) they should be the same.
@ -82,7 +82,7 @@ public class ProvideDailyEntryExitReportAccTest extends AbstractReportAccTest {
assertEquals(org1Row.getTotalValue(), org2Row.getTotalValue());
// 'CREATED' -> 'org1'/'N/A'/'N/A'
DailyEntryExitRow.OrgLevel3Row org3Row = org2Row.getFoldableRow("N/A");
TimestampRow.OrgLevel3Row org3Row = org2Row.getFoldableRow("N/A");
assertEquals(1, org2Row.getFoldableRowCount());
assertEquals(allOtherOrgLevelSet, org3Row.getFoldableRowKeySet());
// Since no further separation (in org level) they should be the same.
@ -90,7 +90,7 @@ public class ProvideDailyEntryExitReportAccTest extends AbstractReportAccTest {
assertEquals(org2Row.getTotalValue(), org3Row.getTotalValue());
// 'CREATED' -> 'org1'/'N/A'/'N/A'/'N/A'
SingleRow<DailyEntryExitQueryItem> org4Row = org3Row.getFoldableRow("N/A");
SingleRow<TimestampQueryItem> org4Row = org3Row.getFoldableRow("N/A");
// Since no further separation (in org level) they should be the same.
assertArrayEquals(org3Row.getCells(), org4Row.getCells());
assertEquals(org3Row.getTotalValue(), org4Row.getTotalValue());
@ -128,7 +128,7 @@ public class ProvideDailyEntryExitReportAccTest extends AbstractReportAccTest {
// * * * * * * * * * * * * * * * * * * * * * TEST THE COMPLETED ROW * * * * * * * * * * * * * * * * * * * * *
statusRow = dailyEntryExitReport.getRow("COMPLETED");
statusRow = timestampReport.getRow("COMPLETED");
assertEquals(2, statusRow.getFoldableRowCount());
assertEquals(org1Set, statusRow.getFoldableRowKeySet());
// 2 Entries with -1 days, one with -2 days and one with -7 days.

View File

@ -6,8 +6,6 @@ import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.List;
import org.apache.ibatis.session.SqlSession;

View File

@ -1,4 +1,4 @@
package pro.taskana.report.structure;
package pro.taskana.impl.report.structure;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;

View File

@ -100,7 +100,7 @@ public class MonitorController {
.collect(Collectors.toList());
return ResponseEntity.status(HttpStatus.OK)
.body(reportAssembler.toResource(
taskMonitorService.createDailyEntryExitReportBuilder()
taskMonitorService.createTimestampReportBuilder()
.withColumnHeaders(columnHeaders)
.buildReport()));
}

View File

@ -17,13 +17,13 @@ import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.report.row.FoldableRow;
import pro.taskana.impl.report.row.SingleRow;
import pro.taskana.report.ClassificationReport;
import pro.taskana.report.DailyEntryExitReport;
import pro.taskana.report.TimestampReport;
import pro.taskana.report.TaskStatusReport;
import pro.taskana.report.WorkbasketReport;
import pro.taskana.report.structure.ColumnHeader;
import pro.taskana.report.structure.QueryItem;
import pro.taskana.report.structure.Report;
import pro.taskana.report.structure.Row;
import pro.taskana.impl.report.structure.ColumnHeader;
import pro.taskana.impl.report.structure.QueryItem;
import pro.taskana.impl.report.structure.Report;
import pro.taskana.impl.report.structure.Row;
import pro.taskana.rest.MonitorController;
/**
@ -59,7 +59,7 @@ public class ReportAssembler {
return resource;
}
public ReportResource toResource(DailyEntryExitReport report)
public ReportResource toResource(TimestampReport report)
throws NotAuthorizedException, InvalidArgumentException {
ReportResource resource = toReportResource(report);
resource.add(linkTo(methodOn(MonitorController.class).getDailyEntryExitReport()).withSelfRel().expand());
@ -74,7 +74,7 @@ public class ReportAssembler {
Report<I, H> report, Instant time) {
String[] header = report.getColumnHeaders()
.stream()
.map(ColumnHeader::getDisplayName)
.map(H::getDisplayName)
.toArray(String[]::new);
ReportResource.MetaInformation meta = new ReportResource.MetaInformation(
report.getClass().getSimpleName(),

View File

@ -9,7 +9,7 @@ import org.springframework.hateoas.ResourceSupport;
import pro.taskana.impl.util.LoggerUtils;
/**
* Resource class for {@link pro.taskana.report.structure.Report}.
* Resource class for {@link pro.taskana.impl.report.structure.Report}.
*/
public class ReportResource extends ResourceSupport {
@ -38,7 +38,7 @@ public class ReportResource extends ResourceSupport {
}
/**
* Resource Interface for {@link pro.taskana.report.structure.Row}.
* Resource Interface for {@link pro.taskana.impl.report.structure.Row}.
*/
public interface RowResource {