TSK-1656: Added from and until for created and completed
This commit is contained in:
parent
16c6d18439
commit
7e7970eb59
|
@ -140,6 +140,26 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
|
||||||
*/
|
*/
|
||||||
private final Instant[] created;
|
private final Instant[] created;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter since a given created timestamp.
|
||||||
|
*
|
||||||
|
* <p>The format is ISO-8601.
|
||||||
|
*
|
||||||
|
* <p>This parameter can't be used together with 'created'.
|
||||||
|
*/
|
||||||
|
@JsonProperty("created-from")
|
||||||
|
private final Instant createdFrom;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter until a given created timestamp.
|
||||||
|
*
|
||||||
|
* <p>The format is ISO-8601.
|
||||||
|
*
|
||||||
|
* <p>This parameter can't be used together with 'created'.
|
||||||
|
*/
|
||||||
|
@JsonProperty("created-until")
|
||||||
|
private final Instant createdUntil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter by a time interval within which the task was claimed. To create an open interval you can
|
* Filter by a time interval within which the task was claimed. To create an open interval you can
|
||||||
* just leave it blank.
|
* just leave it blank.
|
||||||
|
@ -156,6 +176,26 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
|
||||||
*/
|
*/
|
||||||
private final Instant[] completed;
|
private final Instant[] completed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter since a given completed timestamp.
|
||||||
|
*
|
||||||
|
* <p>The format is ISO-8601.
|
||||||
|
*
|
||||||
|
* <p>This parameter can't be used together with 'completed'.
|
||||||
|
*/
|
||||||
|
@JsonProperty("completed-from")
|
||||||
|
private final Instant completedFrom;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter until a given completed timestamp.
|
||||||
|
*
|
||||||
|
* <p>The format is ISO-8601.
|
||||||
|
*
|
||||||
|
* <p>This parameter can't be used together with 'completed'.
|
||||||
|
*/
|
||||||
|
@JsonProperty("completed-until")
|
||||||
|
private final Instant completedUntil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter by a time interval within which the task was modified. To create an open interval you
|
* Filter by a time interval within which the task was modified. To create an open interval you
|
||||||
* can just leave it blank.
|
* can just leave it blank.
|
||||||
|
@ -638,8 +678,12 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
|
||||||
"attachment-reference-like",
|
"attachment-reference-like",
|
||||||
"attachment-received",
|
"attachment-received",
|
||||||
"created",
|
"created",
|
||||||
|
"created-from",
|
||||||
|
"created-until",
|
||||||
"claimed",
|
"claimed",
|
||||||
"completed",
|
"completed",
|
||||||
|
"completed-from",
|
||||||
|
"complete-until",
|
||||||
"modified",
|
"modified",
|
||||||
"classification-category",
|
"classification-category",
|
||||||
"classification-category-like",
|
"classification-category-like",
|
||||||
|
@ -736,8 +780,12 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
|
||||||
String[] attachmentReferenceLike,
|
String[] attachmentReferenceLike,
|
||||||
Instant[] attachmentReceived,
|
Instant[] attachmentReceived,
|
||||||
Instant[] created,
|
Instant[] created,
|
||||||
|
Instant createdFrom,
|
||||||
|
Instant createdUntil,
|
||||||
Instant[] claimed,
|
Instant[] claimed,
|
||||||
Instant[] completed,
|
Instant[] completed,
|
||||||
|
Instant completedFrom,
|
||||||
|
Instant completedUntil,
|
||||||
Instant[] modified,
|
Instant[] modified,
|
||||||
String[] classificationCategories,
|
String[] classificationCategories,
|
||||||
String[] classificationCategoriesLike,
|
String[] classificationCategoriesLike,
|
||||||
|
@ -833,8 +881,12 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
|
||||||
this.attachmentReferenceLike = attachmentReferenceLike;
|
this.attachmentReferenceLike = attachmentReferenceLike;
|
||||||
this.attachmentReceived = attachmentReceived;
|
this.attachmentReceived = attachmentReceived;
|
||||||
this.created = created;
|
this.created = created;
|
||||||
|
this.createdFrom = createdFrom;
|
||||||
|
this.createdUntil = createdUntil;
|
||||||
this.claimed = claimed;
|
this.claimed = claimed;
|
||||||
this.completed = completed;
|
this.completed = completed;
|
||||||
|
this.completedFrom = completedFrom;
|
||||||
|
this.completedUntil = completedUntil;
|
||||||
this.modified = modified;
|
this.modified = modified;
|
||||||
this.classificationCategories = classificationCategories;
|
this.classificationCategories = classificationCategories;
|
||||||
this.classificationCategoriesLike = classificationCategoriesLike;
|
this.classificationCategoriesLike = classificationCategoriesLike;
|
||||||
|
@ -948,10 +1000,16 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
|
||||||
.map(this::extractTimeIntervals)
|
.map(this::extractTimeIntervals)
|
||||||
.ifPresent(query::attachmentReceivedWithin);
|
.ifPresent(query::attachmentReceivedWithin);
|
||||||
Optional.ofNullable(created).map(this::extractTimeIntervals).ifPresent(query::createdWithin);
|
Optional.ofNullable(created).map(this::extractTimeIntervals).ifPresent(query::createdWithin);
|
||||||
|
if (createdFrom != null || createdUntil != null) {
|
||||||
|
query.createdWithin(new TimeInterval(createdFrom, createdUntil));
|
||||||
|
}
|
||||||
Optional.ofNullable(claimed).map(this::extractTimeIntervals).ifPresent(query::claimedWithin);
|
Optional.ofNullable(claimed).map(this::extractTimeIntervals).ifPresent(query::claimedWithin);
|
||||||
Optional.ofNullable(completed)
|
Optional.ofNullable(completed)
|
||||||
.map(this::extractTimeIntervals)
|
.map(this::extractTimeIntervals)
|
||||||
.ifPresent(query::completedWithin);
|
.ifPresent(query::completedWithin);
|
||||||
|
if (completedFrom != null || completedUntil != null) {
|
||||||
|
query.completedWithin(new TimeInterval(completedFrom, completedUntil));
|
||||||
|
}
|
||||||
Optional.ofNullable(modified).map(this::extractTimeIntervals).ifPresent(query::modifiedWithin);
|
Optional.ofNullable(modified).map(this::extractTimeIntervals).ifPresent(query::modifiedWithin);
|
||||||
Optional.ofNullable(classificationCategories).ifPresent(query::classificationCategoryIn);
|
Optional.ofNullable(classificationCategories).ifPresent(query::classificationCategoryIn);
|
||||||
Optional.ofNullable(classificationCategoriesLike)
|
Optional.ofNullable(classificationCategoriesLike)
|
||||||
|
@ -1083,8 +1141,20 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
|
||||||
|
|
||||||
if (due != null && (dueFrom != null || dueUntil != null)) {
|
if (due != null && (dueFrom != null || dueUntil != null)) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"It is prohibited to use the param 'due' in combination "
|
"It is prohibited to use the param 'due' in combination with the params "
|
||||||
+ "with the params 'due-from' and / or 'due-until'");
|
+ "'due-from' and / or 'due-until'");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (created != null && (createdFrom != null || createdUntil != null)) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"It is prohibited to use the param 'created' in combination with the params "
|
||||||
|
+ "'created-from' and / or 'created-until'");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (completed != null && (completedFrom != null || completedUntil != null)) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"It is prohibited to use the param 'completed' in combination with the params "
|
||||||
|
+ "'completed-from' and / or 'completed-until'");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wildcardSearchFields == null ^ wildcardSearchValue == null) {
|
if (wildcardSearchFields == null ^ wildcardSearchValue == null) {
|
||||||
|
|
Loading…
Reference in New Issue