From b4f85884da84b63e1d51d8304cddc0fb987747a6 Mon Sep 17 00:00:00 2001 From: Chenfei Gao Date: Fri, 10 May 2019 17:15:39 -0400 Subject: Add more filtering conditions to filter returned PdpGroups with specified policy deployed Add groupState=ACTIVE and pdpState=ACTIVE to pdpGroupFilter for filtering returned pdpGroup list with specified policy deployed in it. Issue-ID: POLICY-1738 Change-Id: Ie777ab1f6438871b2034c8f2fe7a61595a3f633c Signed-off-by: Chenfei Gao --- .../java/org/onap/policy/api/main/rest/provider/PolicyProvider.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main/src/main/java/org/onap/policy/api/main/rest/provider/PolicyProvider.java b/main/src/main/java/org/onap/policy/api/main/rest/provider/PolicyProvider.java index 8060ee7c..102f6f88 100644 --- a/main/src/main/java/org/onap/policy/api/main/rest/provider/PolicyProvider.java +++ b/main/src/main/java/org/onap/policy/api/main/rest/provider/PolicyProvider.java @@ -34,6 +34,7 @@ import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.pdp.concepts.PdpGroup; import org.onap.policy.models.pdp.concepts.PdpGroupFilter; import org.onap.policy.models.pdp.concepts.PdpSubGroup; +import org.onap.policy.models.pdp.enums.PdpState; import org.onap.policy.models.provider.PolicyModelsProvider; import org.onap.policy.models.provider.PolicyModelsProviderFactory; import org.onap.policy.models.provider.PolicyModelsProviderParameters; @@ -133,7 +134,8 @@ public class PolicyProvider implements AutoCloseable { List policyTypes = new ArrayList<>(); policyTypes.add(new ToscaPolicyTypeIdentifier(policyTypeId, policyTypeVersion)); - PdpGroupFilter pdpGroupFilter = PdpGroupFilter.builder().policyTypeList(policyTypes).build(); + PdpGroupFilter pdpGroupFilter = PdpGroupFilter.builder().policyTypeList(policyTypes) + .groupState(PdpState.ACTIVE).pdpState(PdpState.ACTIVE).build(); List pdpGroups = modelsProvider.getFilteredPdpGroups(pdpGroupFilter); if (pdpGroups.isEmpty()) { -- cgit 1.2.3-korg