diff --git a/irs-policy-store/src/main/java/org/eclipse/tractusx/irs/policystore/common/SearchParameterParser.java b/irs-policy-store/src/main/java/org/eclipse/tractusx/irs/policystore/common/SearchParameterParser.java index 2c1cdddcd..47bd0df6a 100644 --- a/irs-policy-store/src/main/java/org/eclipse/tractusx/irs/policystore/common/SearchParameterParser.java +++ b/irs-policy-store/src/main/java/org/eclipse/tractusx/irs/policystore/common/SearchParameterParser.java @@ -39,8 +39,9 @@ public class SearchParameterParser { CommonConstants.PROPERTY_CREATED_ON); public static final String CRITERIA_INNER_SEPARATOR = ","; + public static final int NUM_PARTS_OF_FILTERS = 3; - final List> searchCriteria; + private final List> searchCriteria; public SearchParameterParser(final List searchParameters) { searchCriteria = parseSearchParameters(searchParameters); @@ -54,7 +55,7 @@ private List> parseSearchParameters(final List searchP final String searchParameter = searchParameterList.get(i); final String[] splittedSearchParam = StringUtils.split(searchParameter, CRITERIA_INNER_SEPARATOR); - if (splittedSearchParam.length < 3) { + if (splittedSearchParam.length < NUM_PARTS_OF_FILTERS) { throw new IllegalArgumentException(("Illegal search parameter at index %s. " + "Format should be ,,.").formatted(i)); } diff --git a/irs-policy-store/src/main/java/org/eclipse/tractusx/irs/policystore/services/PolicyPagingService.java b/irs-policy-store/src/main/java/org/eclipse/tractusx/irs/policystore/services/PolicyPagingService.java index 40416024e..0a5ccdffb 100644 --- a/irs-policy-store/src/main/java/org/eclipse/tractusx/irs/policystore/services/PolicyPagingService.java +++ b/irs-policy-store/src/main/java/org/eclipse/tractusx/irs/policystore/services/PolicyPagingService.java @@ -86,15 +86,16 @@ private PageImpl applyPaging(final Pageable pageable, final List< /** * Builder for {@link Comparator} for sorting a list of {@link PolicyWithBpn} objects. */ - static class PolicyComparatorBuilder { + private static class PolicyComparatorBuilder { + // TODO (mfischer): #639: maybe extract to separate class private final Pageable pageable; - PolicyComparatorBuilder(final Pageable pageable) { + /* package */ PolicyComparatorBuilder(final Pageable pageable) { this.pageable = pageable; } - public Comparator build() { + /* package */ Comparator build() { Comparator comparator = null; @@ -163,15 +164,16 @@ public Sort.Direction getSortDirection(final Pageable pageable, final String fie /** * Builder for {@link Predicate} for filtering a list of {@link PolicyWithBpn} objects. */ - static class PolicyFilterBuilder { + private static class PolicyFilterBuilder { + // TODO (mfischer): #639: maybe extract to separate class private final List> searchCriteriaList; - PolicyFilterBuilder(final List> searchCriteriaList) { + /* package */ PolicyFilterBuilder(final List> searchCriteriaList) { this.searchCriteriaList = searchCriteriaList; } - private Predicate build() { + /* package */ Predicate build() { Predicate policyFilter = policy -> true; for (final SearchCriteria searchCriteria : searchCriteriaList) {