From f64d6eb04fe6272200f7bf3c428cfd099853c63b Mon Sep 17 00:00:00 2001 From: Avgustin Marinov Date: Tue, 10 Sep 2024 15:42:37 +0300 Subject: [PATCH] Slight RSQL code improvements (#1839) Signed-off-by: Marinov Avgustin --- .../hawkbit/repository/jpa/rsql/AbstractRSQLVisitor.java | 2 +- .../hawkbit/repository/jpa/rsql/JpaQueryRsqlVisitorG2.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/rsql/AbstractRSQLVisitor.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/rsql/AbstractRSQLVisitor.java index 2183ae392..9db525381 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/rsql/AbstractRSQLVisitor.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/rsql/AbstractRSQLVisitor.java @@ -57,7 +57,7 @@ public abstract class AbstractRSQLVisitor & RsqlQueryField> { if (!enumValue.isMap()) { // sub entity need minimum 1 dot if (!enumValue.getSubEntityAttributes().isEmpty() && split.length < 2) { - if (enumValue.getSubEntityAttributes().size() == 1) { // single sub attribute - so default + if (enumValue.getSubEntityAttributes().size() == 1) { // single sub attribute - so add is as a default split = new String[] { split[0], enumValue.getSubEntityAttributes().get(0) }; } else { throw createRSQLParameterUnsupportedException(node, null); diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/rsql/JpaQueryRsqlVisitorG2.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/rsql/JpaQueryRsqlVisitorG2.java index 52346680a..26d53527b 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/rsql/JpaQueryRsqlVisitorG2.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/rsql/JpaQueryRsqlVisitorG2.java @@ -343,7 +343,7 @@ public class JpaQueryRsqlVisitorG2 & RsqlQueryField, T> private Predicate toNotExistsSubQueryPredicate(final QuertPath queryField, final Path fieldPath, final Function, Predicate> subQueryPredicateProvider) { // if a subquery the field's parent joins are not actually used if (!inOr) { - // so, if not in or (hence not reused) we remove them + // so, if not in or (hence not reused) we remove them. Parent shall be a Join root.getJoins().remove(fieldPath.getParentPath()); } @@ -365,7 +365,7 @@ public class JpaQueryRsqlVisitorG2 & RsqlQueryField, T> } if (fieldPath instanceof MapJoin) { // Currently we support only string key. So below cast is safe. - return (Expression) (((MapJoin) pathOfString(fieldPath)).value()); + return (Expression) (((MapJoin) fieldPath).value()); } final String valueFieldName = enumField.getSubEntityMapTuple().map(Entry::getValue) .orElseThrow(() -> new UnsupportedOperationException(