From e81da8dac30b0525dd0f84e3518bcc452695e224 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Fri, 15 Nov 2019 14:12:23 -0500 Subject: Support wild cards in "supported policy types" Refactored PfConceptKey, extracting most of it into PfKeyImpl. Added PfSearchableKey as a subclass of PfKeyImpl. Change-Id: I524f4ce9208fc9ba09e77db4cc7dde5a21e1d7fc Issue-ID: POLICY-2224 Signed-off-by: Jim Hahn --- .../models/pdp/persistence/concepts/JpaPdpSubGroup.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'models-pdp/src/main/java') diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java index 3a81c0b30..7d018860e 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java @@ -50,6 +50,7 @@ import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfKey; import org.onap.policy.models.base.PfKeyUse; import org.onap.policy.models.base.PfReferenceKey; +import org.onap.policy.models.base.PfSearchableKey; import org.onap.policy.models.base.PfUtils; import org.onap.policy.models.base.PfValidationMessage; import org.onap.policy.models.base.PfValidationResult; @@ -76,7 +77,7 @@ public class JpaPdpSubGroup extends PfConcept implements PfAuthorative supportedPolicyTypes; + private List supportedPolicyTypes; @ElementCollection private List policies; @@ -127,7 +128,7 @@ public class JpaPdpSubGroup extends PfConcept implements PfAuthorative supportedPolicyTypes, + public JpaPdpSubGroup(@NonNull final PfReferenceKey key, @NonNull final List supportedPolicyTypes, @NonNull List policies, @NonNull final List pdpInstances) { this.key = key; this.supportedPolicyTypes = supportedPolicyTypes; @@ -144,7 +145,7 @@ public class JpaPdpSubGroup extends PfConcept implements PfAuthorative(0)); + PfSearchableKey::new, new ArrayList<>(0)); this.policies = PfUtils.mapList(copyConcept.policies, PfConceptKey::new, new ArrayList<>(0)); this.currentInstanceCount = copyConcept.currentInstanceCount; this.desiredInstanceCount = copyConcept.desiredInstanceCount; @@ -168,7 +169,7 @@ public class JpaPdpSubGroup extends PfConcept implements PfAuthorative()); - for (PfConceptKey supportedPolicyTypeKey : supportedPolicyTypes) { + for (PfSearchableKey supportedPolicyTypeKey : supportedPolicyTypes) { ToscaPolicyTypeIdentifier supportedPolicyTypeIdent = new ToscaPolicyTypeIdentifier( supportedPolicyTypeKey.getName(), supportedPolicyTypeKey.getVersion()); pdpSubgroup.getSupportedPolicyTypes().add(supportedPolicyTypeIdent); @@ -205,7 +206,7 @@ public class JpaPdpSubGroup extends PfConcept implements PfAuthorative getKeys() { List keyList = getKey().getKeys(); - for (PfConceptKey ptkey : supportedPolicyTypes) { + for (PfSearchableKey ptkey : supportedPolicyTypes) { keyList.add(new PfKeyUse(ptkey)); } @@ -256,7 +257,7 @@ public class JpaPdpSubGroup extends PfConcept implements PfAuthorative