This parameter can't be used together with 'received-from' or 'received-until'.
+ */
+ private final Instant[] received;
+
+ /**
+ * Filter since a given received timestamp.
+ *
+ *
The format is ISO-8601.
+ *
+ *
This parameter can't be used together with 'received'.
+ */
+ @JsonProperty("received-from")
+ private final Instant receivedFrom;
+
+ /**
+ * Filter until a given received timestamp.
+ *
+ *
The format is ISO-8601.
+ *
+ *
This parameter can't be used together with 'received'.
+ */
+ @JsonProperty("received-until")
+ private final Instant receivedUntil;
+
/**
* Filter by a time interval within which the task was due. To create an open interval you can
* just leave it blank.
@@ -778,6 +808,9 @@ public class TaskQueryFilterParameter implements QueryParameter
"planned",
"planned-from",
"planned-until",
+ "received",
+ "received-from",
+ "received-until",
"due",
"due-from",
"due-until",
@@ -896,6 +929,9 @@ public class TaskQueryFilterParameter implements QueryParameter
Instant[] planned,
Instant plannedFrom,
Instant plannedUntil,
+ Instant[] received,
+ Instant receivedFrom,
+ Instant receivedUntil,
Instant[] due,
Instant dueFrom,
Instant dueUntil,
@@ -1013,6 +1049,9 @@ public class TaskQueryFilterParameter implements QueryParameter
this.planned = planned;
this.plannedFrom = plannedFrom;
this.plannedUntil = plannedUntil;
+ this.received = received;
+ this.receivedFrom = receivedFrom;
+ this.receivedUntil = receivedUntil;
this.due = due;
this.dueFrom = dueFrom;
this.dueUntil = dueUntil;
@@ -1183,6 +1222,10 @@ public class TaskQueryFilterParameter implements QueryParameter
if (plannedFrom != null || plannedUntil != null) {
query.plannedWithin(new TimeInterval(plannedFrom, plannedUntil));
}
+ Optional.ofNullable(received).map(this::extractTimeIntervals).ifPresent(query::receivedWithin);
+ if (receivedFrom != null || receivedUntil != null) {
+ query.receivedWithin(new TimeInterval(receivedFrom, receivedUntil));
+ }
Optional.ofNullable(due).map(this::extractTimeIntervals).ifPresent(query::dueWithin);
if (dueFrom != null || dueUntil != null) {
query.dueWithin(new TimeInterval(dueFrom, dueUntil));
@@ -1269,6 +1312,12 @@ public class TaskQueryFilterParameter implements QueryParameter
+ "with the params 'planned-from' and / or 'planned-until'");
}
+ if (received != null && (receivedFrom != null || receivedUntil != null)) {
+ throw new IllegalArgumentException(
+ "It is prohibited to use the param 'received' in combination "
+ + "with the params 'received-from' and / or 'received-until'");
+ }
+
if (due != null && (dueFrom != null || dueUntil != null)) {
throw new IllegalArgumentException(
"It is prohibited to use the param 'due' in combination with the params "
@@ -1301,6 +1350,11 @@ public class TaskQueryFilterParameter implements QueryParameter
"provided length of the property 'planned' is not dividable by 2");
}
+ if (received != null && received.length % 2 != 0) {
+ throw new InvalidArgumentException(
+ "provided length of the property 'received' is not dividable by 2");
+ }
+
if (due != null && due.length % 2 != 0) {
throw new InvalidArgumentException(
"provided length of the property 'due' is not dividable by 2");
diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/assembler/TaskRepresentationModelAssembler.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/assembler/TaskRepresentationModelAssembler.java
index aaf221860..079bb870d 100644
--- a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/assembler/TaskRepresentationModelAssembler.java
+++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/assembler/TaskRepresentationModelAssembler.java
@@ -58,6 +58,7 @@ public class TaskRepresentationModelAssembler
repModel.setCompleted(task.getCompleted());
repModel.setModified(task.getModified());
repModel.setPlanned(task.getPlanned());
+ repModel.setReceived(task.getReceived());
repModel.setDue(task.getDue());
repModel.setName(task.getName());
repModel.setCreator(task.getCreator());
@@ -120,6 +121,7 @@ public class TaskRepresentationModelAssembler
task.setCompleted(repModel.getCompleted());
task.setModified(repModel.getModified());
task.setPlanned(repModel.getPlanned());
+ task.setReceived(repModel.getReceived());
task.setDue(repModel.getDue());
task.setName(repModel.getName());
task.setCreator(repModel.getCreator());
diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/assembler/TaskSummaryRepresentationModelAssembler.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/assembler/TaskSummaryRepresentationModelAssembler.java
index a4a5afd30..bb42d1675 100644
--- a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/assembler/TaskSummaryRepresentationModelAssembler.java
+++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/assembler/TaskSummaryRepresentationModelAssembler.java
@@ -59,6 +59,7 @@ public class TaskSummaryRepresentationModelAssembler
repModel.setCompleted(taskSummary.getCompleted());
repModel.setModified(taskSummary.getModified());
repModel.setPlanned(taskSummary.getPlanned());
+ repModel.setReceived(taskSummary.getReceived());
repModel.setDue(taskSummary.getDue());
repModel.setName(taskSummary.getName());
repModel.setCreator(taskSummary.getCreator());
@@ -107,6 +108,7 @@ public class TaskSummaryRepresentationModelAssembler
taskSummary.setCompleted(repModel.getCompleted());
taskSummary.setModified(repModel.getModified());
taskSummary.setPlanned(repModel.getPlanned());
+ taskSummary.setReceived(repModel.getReceived());
taskSummary.setDue(repModel.getDue());
taskSummary.setName(repModel.getName());
taskSummary.setCreator(repModel.getCreator());
diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskSummaryRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskSummaryRepresentationModel.java
index f67d84cb6..e54eb6062 100644
--- a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskSummaryRepresentationModel.java
+++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskSummaryRepresentationModel.java
@@ -34,6 +34,11 @@ public class TaskSummaryRepresentationModel
* Planned start of the task. The actual completion of the task should be between PLANNED and DUE.
*/
protected Instant planned;
+ /**
+ * Timestamp when the task has been received. It notes when the surrounding process started and
+ * not just when the actual task was created.
+ */
+ protected Instant received;
/**
* Timestamp when the task is due. The actual completion of the task should be between PLANNED and
* DUE.
@@ -159,6 +164,14 @@ public class TaskSummaryRepresentationModel
this.planned = planned;
}
+ public Instant getReceived() {
+ return received;
+ }
+
+ public void setReceived(Instant received) {
+ this.received = received;
+ }
+
public Instant getDue() {
return due;
}
diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/TaskControllerIntTest.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/TaskControllerIntTest.java
index 1e96a60a9..defb6e2e1 100644
--- a/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/TaskControllerIntTest.java
+++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/TaskControllerIntTest.java
@@ -562,7 +562,45 @@ class TaskControllerIntTest {
TaskRepresentationModel repModel = response.getBody();
assertThat(repModel).isNotNull();
assertThat(repModel.getAttachments()).isNotEmpty();
- assertThat(repModel.getAttachments()).isNotNull();
+ }
+
+ @Test
+ void should_ReturnReceivedDate_When_GettingTask() {
+ String url =
+ restHelper.toUrl(RestEndpoints.URL_TASKS_ID, "TKI:000000000000000000000000000000000024");
+ HttpEntity