[#2176] RSQL filtering with exist/not-exist support (#2396)

* [#2176] RSQL filtering with exist/not-exist support

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>

* [#2176] Big Refactoring

* RSQL: all maps with joins with on

---------

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-05-16 16:13:04 +03:00
committed by GitHub
parent c0e89fbbee
commit 12140e468d
24 changed files with 518 additions and 616 deletions

View File

@@ -11,12 +11,16 @@ package org.eclipse.hawkbit.repository.exception;
import java.io.Serial;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* Exception used by the REST API in case of RSQL search filter query.
*/
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class RSQLParameterSyntaxException extends AbstractServerRtException {
@Serial

View File

@@ -11,12 +11,16 @@ package org.eclipse.hawkbit.repository.exception;
import java.io.Serial;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* Exception used by the REST API in case of invalid field name in the rsql search parameter.
*/
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class RSQLParameterUnsupportedFieldException extends AbstractServerRtException {
@Serial

View File

@@ -15,8 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
/**
* Helper class providing static access to the RSQL configuration as managed the ignoreCase and
* the {@link RsqlVisitorFactory} bean.
* Helper class providing static access to the RSQL configuration as managed bean.
*/
@NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
@Getter
@@ -26,8 +25,7 @@ public final class RsqlConfigHolder {
private static final RsqlConfigHolder SINGLETON = new RsqlConfigHolder();
/**
* If RSQL comparison operators shall ignore the case. If ignore case is <code>true</code>
* "x == ax" will match "x == aX"
* If RSQL comparison operators shall ignore the case. If ignore case is <code>true</code> "x == ax" will match "x == aX"
*/
@Value("${hawkbit.rsql.ignore-case:true}")
private boolean ignoreCase;
@@ -41,13 +39,6 @@ public final class RsqlConfigHolder {
@Value("${hawkbit.rsql.case-insensitive-db:false}")
private boolean caseInsensitiveDB;
private RsqlVisitorFactory rsqlVisitorFactory;
@Autowired
public void setRsqlVisitorFactory(final RsqlVisitorFactory rsqlVisitorFactory) {
this.rsqlVisitorFactory = rsqlVisitorFactory;
}
/**
* @deprecated in favour of G2 RSQL visitor. since 0.6.0
*/

View File

@@ -1,34 +0,0 @@
/**
* Copyright (c) 2021 Bosch.IO GmbH and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.hawkbit.repository.rsql;
import cz.jirutka.rsql.parser.ast.Node;
import cz.jirutka.rsql.parser.ast.RSQLVisitor;
import org.eclipse.hawkbit.repository.RsqlQueryField;
/**
* Factory to obtain {@link RSQLVisitor} instances that can be used to process
* the {@link Node}s representing an RSQL query.
*/
@FunctionalInterface
public interface RsqlVisitorFactory {
/**
* Provides a {@link RSQLVisitor} instance for validating RSQL queries based
* on the given {@link RsqlQueryField}.
*
* @param <A> The type of the {@link RsqlQueryField}.
* @param fieldNameProvider providing accessing to the relevant field names.
* @return An {@link RSQLVisitor} to validate the {@link Node}s of an RSQL
* query.
*/
<A extends Enum<A> & RsqlQueryField> RSQLVisitor<Void, String> validationRsqlVisitor(Class<A> fieldNameProvider);
}

View File

@@ -22,9 +22,8 @@ public interface VirtualPropertyReplacer extends Serializable {
/**
* Looks up a placeholders and replaces them
*
* @param input the input string in which virtual properties should be
* replaced
* @param input the input string in which virtual properties should be replaced
* @return the result of the replacement
*/
String replace(String input);
}
}