diff options
Diffstat (limited to 'models-tosca/src/main/java')
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 |