From 912ec77e299317691521b94b04878b50b0338781 Mon Sep 17 00:00:00 2001 From: Timm Fitschen <t.fitschen@indiscale.com> Date: Tue, 10 Nov 2020 16:04:44 +0100 Subject: [PATCH] Handle unsupported versioned subproperties --- src/main/java/org/caosdb/server/query/Backreference.java | 5 ++++- src/main/java/org/caosdb/server/query/POV.java | 6 +++++- src/main/java/org/caosdb/server/query/SubProperty.java | 7 +------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/caosdb/server/query/Backreference.java b/src/main/java/org/caosdb/server/query/Backreference.java index e5d73eba..684beef2 100644 --- a/src/main/java/org/caosdb/server/query/Backreference.java +++ b/src/main/java/org/caosdb/server/query/Backreference.java @@ -103,9 +103,12 @@ public class Backreference implements EntityFilterInterface, QueryInterface { return "@(" + getEntity() + "," + getProperty() + ")"; } - /** */ @Override public void apply(final QueryInterface query) throws QueryException { + if (query.isVersioned() && hasSubProperty()) { + throw new UnsupportedOperationException( + "Versioned queries are not supported for subqueries yet. Please file a feature request."); + } final long t1 = System.currentTimeMillis(); this.query = query; this.targetSet = query.getTargetSet(); diff --git a/src/main/java/org/caosdb/server/query/POV.java b/src/main/java/org/caosdb/server/query/POV.java index 01860ba5..3aebeef2 100644 --- a/src/main/java/org/caosdb/server/query/POV.java +++ b/src/main/java/org/caosdb/server/query/POV.java @@ -155,7 +155,7 @@ public class POV implements EntityFilterInterface { this.unit = getUnit(unitStr); } catch (final ParserException e) { e.printStackTrace(); - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException("Could not parse the unit."); } this.stdUnitSig = this.unit.normalize().getSignature(); @@ -214,6 +214,10 @@ public class POV implements EntityFilterInterface { @Override public void apply(final QueryInterface query) throws QueryException { + if (query.isVersioned() && hasSubProperty()) { + throw new UnsupportedOperationException( + "Versioned queries are not supported for subqueries yet. Please file a feature request."); + } final long t1 = System.currentTimeMillis(); try { this.connection = query.getConnection(); diff --git a/src/main/java/org/caosdb/server/query/SubProperty.java b/src/main/java/org/caosdb/server/query/SubProperty.java index 9edfe795..4668935e 100644 --- a/src/main/java/org/caosdb/server/query/SubProperty.java +++ b/src/main/java/org/caosdb/server/query/SubProperty.java @@ -165,11 +165,6 @@ public class SubProperty implements QueryInterface, EntityFilterInterface { @Override public boolean isVersioned() { - boolean is_versioned = this.query.isVersioned(); - if (is_versioned) { - throw new QueryException( - "Versioned queries are not supported for subqueries yet. Please file a feature request."); - } - return is_versioned; + return this.query.isVersioned(); } } -- GitLab