Fix comple attribute RSQL filters (#2564)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-07-24 14:01:49 +03:00
committed by GitHub
parent 9b1fdc2f49
commit 7752ec6c24
3 changed files with 36 additions and 15 deletions

View File

@@ -11,17 +11,16 @@ package org.eclipse.hawkbit.repository.jpa.specifications;
import java.util.List;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.Specification;
/**
* Helper class to easily combine {@link Specification} instances.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class SpecificationsBuilder {
private SpecificationsBuilder() {
}
/**
* Combine all given specification with and. The first specification is the
* where clause.
@@ -33,11 +32,10 @@ public final class SpecificationsBuilder {
if (specList.isEmpty()) {
return null;
}
Specification<T> specs = Specification.where(specList.get(0));
Specification<T> specs = specList.get(0);
for (final Specification<T> specification : specList.subList(1, specList.size())) {
specs = specs.and(specification);
}
return specs;
}
}
}