diff options
author | liamfallon <liam.fallon@est.tech> | 2019-04-08 17:30:54 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2019-04-08 17:30:54 +0000 |
commit | 0b15f3bf60162a62505593186737bca98bd4349c (patch) | |
tree | 0935b5d9321c9a988256741309d9dfdb688f4521 /models-tosca/src | |
parent | a32b49c3ec54e5f3bf23634a5fb538909905f8e6 (diff) |
Add lists and tests for PDP filters
The policy type and policy filters for PDP groups are added
in this review.
Also filter tests for PDP group filter is completed.
Issue-ID: POLICY-1095
Change-Id: Ia28776c809f2ab879af4007b3480621637a83f69
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-tosca/src')
2 files changed, 4 insertions, 6 deletions
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyFilter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyFilter.java index 102b1fe2e..bb0026e9a 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyFilter.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyFilter.java @@ -30,8 +30,7 @@ import lombok.NonNull; import org.onap.policy.models.base.PfObjectFilter; /** - * Filter class for searches for {@link ToscaPolicy} instances. - * If any fields are null, they are ignored. + * Filter class for searches for {@link ToscaPolicy} instances. If any fields are null, they are ignored. * * @author Liam Fallon (liam.fallon@est.tech) */ @@ -58,7 +57,7 @@ public class ToscaPolicyFilter implements PfObjectFilter<ToscaPolicy> { // @formatter:off List<ToscaPolicy> returnList = originalList.stream() .filter(p -> filterString(p.getName(), name)) - .filter(p -> (version != null && LATEST_VERSION.equals(version)) + .filter(p -> LATEST_VERSION.equals(version) || filterString(p.getVersion(), version)) .filter(p -> filterString(p.getType(), type)) .filter(p -> filterString(p.getTypeVersion(), typeVersion)) diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilter.java index 7d6fbacee..c72192927 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilter.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilter.java @@ -30,8 +30,7 @@ import lombok.NonNull; import org.onap.policy.models.base.PfObjectFilter; /** - * Filter class for searches for {@link ToscaPolicyType} instances. - * If any fields are null, they are ignored. + * Filter class for searches for {@link ToscaPolicyType} instances. If any fields are null, they are ignored. * * @author Liam Fallon (liam.fallon@est.tech) */ @@ -52,7 +51,7 @@ public class ToscaPolicyTypeFilter implements PfObjectFilter<ToscaPolicyType> { // @formatter:off List<ToscaPolicyType> returnList = originalList.stream() .filter(p -> filterString(p.getName(), name)) - .filter(p -> (version != null && LATEST_VERSION.equals(version)) + .filter(p -> LATEST_VERSION.equals(version) || filterString(p.getVersion(), version)) .collect(Collectors.toList()); // @formatter:off |