Slight RSQL code improvements (#1839)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -57,7 +57,7 @@ public abstract class AbstractRSQLVisitor<A extends Enum<A> & RsqlQueryField> {
|
|||||||
if (!enumValue.isMap()) {
|
if (!enumValue.isMap()) {
|
||||||
// sub entity need minimum 1 dot
|
// sub entity need minimum 1 dot
|
||||||
if (!enumValue.getSubEntityAttributes().isEmpty() && split.length < 2) {
|
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) };
|
split = new String[] { split[0], enumValue.getSubEntityAttributes().get(0) };
|
||||||
} else {
|
} else {
|
||||||
throw createRSQLParameterUnsupportedException(node, null);
|
throw createRSQLParameterUnsupportedException(node, null);
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ public class JpaQueryRsqlVisitorG2<A extends Enum<A> & RsqlQueryField, T>
|
|||||||
private Predicate toNotExistsSubQueryPredicate(final QuertPath queryField, final Path<Object> fieldPath, final Function<Expression<String>, Predicate> subQueryPredicateProvider) {
|
private Predicate toNotExistsSubQueryPredicate(final QuertPath queryField, final Path<Object> fieldPath, final Function<Expression<String>, Predicate> subQueryPredicateProvider) {
|
||||||
// if a subquery the field's parent joins are not actually used
|
// if a subquery the field's parent joins are not actually used
|
||||||
if (!inOr) {
|
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());
|
root.getJoins().remove(fieldPath.getParentPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,7 +365,7 @@ public class JpaQueryRsqlVisitorG2<A extends Enum<A> & RsqlQueryField, T>
|
|||||||
}
|
}
|
||||||
if (fieldPath instanceof MapJoin) {
|
if (fieldPath instanceof MapJoin) {
|
||||||
// Currently we support only string key. So below cast is safe.
|
// Currently we support only string key. So below cast is safe.
|
||||||
return (Expression<String>) (((MapJoin<?, ?, ?>) pathOfString(fieldPath)).value());
|
return (Expression<String>) (((MapJoin<?, ?, ?>) fieldPath).value());
|
||||||
}
|
}
|
||||||
final String valueFieldName = enumField.getSubEntityMapTuple().map(Entry::getValue)
|
final String valueFieldName = enumField.getSubEntityMapTuple().map(Entry::getValue)
|
||||||
.orElseThrow(() -> new UnsupportedOperationException(
|
.orElseThrow(() -> new UnsupportedOperationException(
|
||||||
|
|||||||
Reference in New Issue
Block a user