From b2fe84e2882d25058ee73f9bb6246b3dc647b549 Mon Sep 17 00:00:00 2001 From: Silvan Heller Date: Fri, 13 May 2022 13:57:07 +0200 Subject: [PATCH] Restoring previous REST API behavior (#302) --- build.gradle | 2 +- .../org/vitrivr/cineast/api/messages/general/Ping.java | 6 ------ .../cineast/api/messages/query/MoreLikeThisQuery.java | 6 ------ .../api/messages/query/NeighboringSegmentQuery.java | 5 ----- .../vitrivr/cineast/api/messages/query/SegmentQuery.java | 6 ------ .../cineast/api/messages/query/SimilarityQuery.java | 8 +------- .../vitrivr/cineast/api/messages/query/TemporalQuery.java | 8 +------- .../cineast/api/messages/session/StartSessionMessage.java | 6 ------ 8 files changed, 3 insertions(+), 44 deletions(-) diff --git a/build.gradle b/build.gradle index 41f53102e..fa056df7e 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ allprojects { group = 'org.vitrivr' /* Our current version, on dev branch this should always be release+1-SNAPSHOT */ - version = '3.11.2' + version = '3.11.3' apply plugin: 'java-library' apply plugin: 'maven-publish' diff --git a/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/general/Ping.java b/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/general/Ping.java index 2688559c5..05278f494 100644 --- a/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/general/Ping.java +++ b/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/general/Ping.java @@ -9,12 +9,6 @@ */ public record Ping(StatusEnum status, @JsonProperty(required = true) MessageType messageType) implements Message { - public Ping { - if (messageType != MessageType.PING) { - throw new IllegalStateException("MessageType was not PING, but " + messageType); - } - } - public Ping(StatusEnum status) { this(status, MessageType.PING); } diff --git a/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/MoreLikeThisQuery.java b/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/MoreLikeThisQuery.java index 1aaee71ea..c232ea9b2 100644 --- a/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/MoreLikeThisQuery.java +++ b/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/MoreLikeThisQuery.java @@ -15,12 +15,6 @@ */ public record MoreLikeThisQuery(@JsonProperty(required = true) String segmentId, @JsonProperty(required = true) List categories, List metadataAccessSpec, QueryConfig config, @JsonProperty(required = true) MessageType messageType) implements Query { - public MoreLikeThisQuery { - if (messageType != MessageType.Q_MLT) { - throw new IllegalStateException("MessageType was not Q_MLT, but " + messageType); - } - } - } diff --git a/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/NeighboringSegmentQuery.java b/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/NeighboringSegmentQuery.java index e8ee23a2a..d47b648f0 100644 --- a/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/NeighboringSegmentQuery.java +++ b/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/NeighboringSegmentQuery.java @@ -18,9 +18,4 @@ */ public record NeighboringSegmentQuery(@JsonProperty(required = true) String segmentId, @JsonProperty(required = true) Integer count, List metadataAccessSpec, QueryConfig config, @JsonProperty(required = true) MessageType messageType) implements Query { - public NeighboringSegmentQuery { - if (messageType != MessageType.Q_NESEG) { - throw new IllegalStateException("MessageType was not Q_NESEG, but " + messageType); - } - } } diff --git a/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/SegmentQuery.java b/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/SegmentQuery.java index 5654585be..fed14b3aa 100644 --- a/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/SegmentQuery.java +++ b/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/SegmentQuery.java @@ -12,10 +12,4 @@ */ public record SegmentQuery(@JsonProperty(required = true) String segmentId, @JsonProperty(required = true) List metadataAccessSpec, QueryConfig config, @JsonProperty(required = true) MessageType messageType) implements Query { - public SegmentQuery { - if (messageType != MessageType.Q_SEG) { - throw new IllegalStateException("MessageType was not Q_SEG, but " + messageType); - } - } - } diff --git a/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/SimilarityQuery.java b/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/SimilarityQuery.java index 51cbb334b..b394b7fbc 100644 --- a/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/SimilarityQuery.java +++ b/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/SimilarityQuery.java @@ -10,12 +10,6 @@ /** * A {@link SimilarityQuery} contains a list of {@link QueryTerm}s. This object represents a similarity-query message, i.e. a request for a similarity-search. */ -public record SimilarityQuery(@JsonProperty(required = true) List terms, @JsonProperty(required = true) List metadataAccessSpec, QueryConfig config, MessageType messageType) implements Query { - - public SimilarityQuery { - if (messageType != MessageType.Q_SIM) { - throw new IllegalStateException("MessageType was not Q_SIM, but " + messageType); - } - } +public record SimilarityQuery(@JsonProperty(required = true) List terms, List metadataAccessSpec, QueryConfig config, MessageType messageType) implements Query { } diff --git a/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/TemporalQuery.java b/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/TemporalQuery.java index ab38ff2d6..480294327 100644 --- a/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/TemporalQuery.java +++ b/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/query/TemporalQuery.java @@ -10,13 +10,7 @@ /** * This object represents a temporal-query message of temporal query version 2, i.e. a request for a temporally staged similarity-search. */ -public record TemporalQuery(@JsonProperty(required = true) List queries, @JsonProperty(required = true) List metadataAccessSpec, TemporalQueryConfig config, @JsonProperty(required = true) MessageType messageType) implements Query { - - public TemporalQuery { - if (messageType != MessageType.Q_TEMPORAL) { - throw new IllegalStateException("MessageType was not Q_TEMPORAL, but " + messageType); - } - } +public record TemporalQuery(@JsonProperty(required = true) List queries, List metadataAccessSpec, TemporalQueryConfig config, @JsonProperty(required = true) MessageType messageType) implements Query { /** * Convenience getter for timeDistances. diff --git a/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/session/StartSessionMessage.java b/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/session/StartSessionMessage.java index 917634b21..8966b1102 100644 --- a/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/session/StartSessionMessage.java +++ b/cineast-api/src/main/java/org/vitrivr/cineast/api/messages/session/StartSessionMessage.java @@ -11,12 +11,6 @@ */ public record StartSessionMessage(Credentials credentials, MessageType messageType) implements Message { - public StartSessionMessage { - if (messageType != MessageType.SESSION_START) { - throw new IllegalStateException("MessageType was not SESSION_START, but " + messageType); - } - } - public StartSessionMessage(Credentials credentials) { this(credentials, MessageType.SESSION_START); }