diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/rsql/VirtualPropertyReplacer.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/rsql/VirtualPropertyReplacer.java deleted file mode 100644 index fb3449170..000000000 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/rsql/VirtualPropertyReplacer.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2015 Bosch Software Innovations 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 java.io.Serializable; - -/** - * Implementations map a placeholder to the associated value. - *
- * This is used in context of string replacement.
- *
- * @deprecated Since 0.10.0, used only in deprecated specification builders
- */
-@Deprecated(since = "0.10.0", forRemoval = true)
-@FunctionalInterface
-public interface VirtualPropertyReplacer extends Serializable {
-
- /**
- * Looks up a placeholders and replaces them
- *
- * @param input the input string in which virtual properties should be replaced
- * @return the result of the replacement
- */
- String replace(String input);
-}
\ No newline at end of file
diff --git a/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/rsql/VirtualPropertyResolver.java b/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/rsql/VirtualPropertyResolver.java
index ad802adc3..cd3dc41d0 100644
--- a/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/rsql/VirtualPropertyResolver.java
+++ b/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/rsql/VirtualPropertyResolver.java
@@ -33,7 +33,7 @@ import org.eclipse.hawkbit.repository.TimestampCalculator;
* and pollingOverdueInterval are retrieved from tenant-specific system configuration.
*
*/
-public class VirtualPropertyResolver implements VirtualPropertyReplacer {
+public class VirtualPropertyResolver {
@Serial
private static final long serialVersionUID = 1L;
@@ -42,7 +42,6 @@ public class VirtualPropertyResolver implements VirtualPropertyReplacer {
StringLookupFactory.builder().get().functionStringLookup(VirtualPropertyResolver::lookup),
StringSubstitutor.DEFAULT_PREFIX, StringSubstitutor.DEFAULT_SUFFIX, StringSubstitutor.DEFAULT_ESCAPE);
- @Override
public String replace(final String input) {
return STRING_SUBSTITUTOR.replace(input);
}
diff --git a/hawkbit-repository/hawkbit-repository-jpa-ql/src/main/java/org/eclipse/hawkbit/repository/jpa/ql/QLSupport.java b/hawkbit-repository/hawkbit-repository-jpa-ql/src/main/java/org/eclipse/hawkbit/repository/jpa/ql/QLSupport.java
index 371ebfc91..f381037d7 100644
--- a/hawkbit-repository/hawkbit-repository-jpa-ql/src/main/java/org/eclipse/hawkbit/repository/jpa/ql/QLSupport.java
+++ b/hawkbit-repository/hawkbit-repository-jpa-ql/src/main/java/org/eclipse/hawkbit/repository/jpa/ql/QLSupport.java
@@ -31,7 +31,6 @@ import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldExc
import org.eclipse.hawkbit.repository.jpa.ql.Node.Comparison;
import org.eclipse.hawkbit.repository.jpa.rsql.RsqlParser;
import org.eclipse.hawkbit.repository.jpa.rsql.legacy.SpecificationBuilderLegacy;
-import org.eclipse.hawkbit.repository.rsql.VirtualPropertyReplacer;
import org.eclipse.hawkbit.repository.rsql.VirtualPropertyResolver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -75,6 +74,7 @@ import org.springframework.orm.jpa.vendor.Database;
@Slf4j
@Getter
@NoArgsConstructor(access = AccessLevel.PRIVATE)
+@SuppressWarnings("java:S6548") // singleton holder ensures static access to spring resources in some places
public class QLSupport {
private static final QLSupport SINGLETON = new QLSupport();
@@ -110,9 +110,9 @@ public class QLSupport {
@SuppressWarnings({ "rawtypes", "unchecked" })
private QueryParser parser;
- private VirtualPropertyReplacer virtualPropertyReplacer;
private Database database;
private EntityManager entityManager;
+ private VirtualPropertyResolver virtualPropertyResolver;
/**
* @return The holder singleton instance.
@@ -126,11 +126,6 @@ public class QLSupport {
this.parser = parser;
}
- @Autowired(required = false)
- void setVirtualPropertyReplacer(final VirtualPropertyReplacer virtualPropertyReplacer) {
- this.virtualPropertyReplacer = virtualPropertyReplacer;
- }
-
@Autowired
void setDatabase(final JpaProperties jpaProperties) {
database = jpaProperties.getDatabase();
@@ -141,6 +136,11 @@ public class QLSupport {
this.entityManager = entityManager;
}
+ @Autowired(required = false)
+ void setVirtualPropertyResolver(final VirtualPropertyResolver virtualPropertyResolver) {
+ this.virtualPropertyResolver = virtualPropertyResolver;
+ }
+
/**
* Builds a JPA {@link Specification} which corresponds with the given RSQL query. The specification can be used to filter for JPA entities
* with the given RSQL query.
@@ -157,7 +157,7 @@ public class QLSupport {
return new SpecificationBuilder