summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChenfei Gao <cgao@research.att.com>2019-05-10 17:15:39 -0400
committerChenfei Gao <cgao@research.att.com>2019-05-10 17:16:11 -0400
commitb4f85884da84b63e1d51d8304cddc0fb987747a6 (patch)
tree34dd8cdccec62f0be7fafece742890b3c81a64ee
parent90555d0346c7e852e6a4dc9622ed29343353b95c (diff)
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 <cgao@research.att.com>
-rw-r--r--main/src/main/java/org/onap/policy/api/main/rest/provider/PolicyProvider.java4
1 files changed, 3 insertions, 1 deletions
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<ToscaPolicyTypeIdentifier> 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<PdpGroup> pdpGroups = modelsProvider.getFilteredPdpGroups(pdpGroupFilter);
if (pdpGroups.isEmpty()) {