Correct the sql query for filtering distribution sets by tags (#511)
* Also checks if collection is empty, while building predicate Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * ID of distribution tag buttons should not contain whitespaces Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
committed by
Kai Zimmermann
parent
1661f66006
commit
a59110d147
@@ -27,6 +27,7 @@ import org.eclipse.hawkbit.repository.jpa.model.JpaTarget_;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* Specifications class for {@link DistributionSet}s. The class provides Spring
|
||||
@@ -145,7 +146,7 @@ public final class DistributionSetSpecification {
|
||||
tags.get(JpaDistributionSetTag_.name);
|
||||
final Path<String> exp = tags.get(JpaDistributionSetTag_.name);
|
||||
if (selectDSWithNoTag != null && selectDSWithNoTag) {
|
||||
if (tagNames != null) {
|
||||
if (!CollectionUtils.isEmpty(tagNames)) {
|
||||
return cb.or(exp.isNull(), exp.in(tagNames));
|
||||
} else {
|
||||
return exp.isNull();
|
||||
|
||||
Reference in New Issue
Block a user