X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fcontroller%2FCreateClosedLoopPMController.java;h=058542590a9ca547c6293a035f2a72a0f51664a5;hp=8d47be76c00248d4b99fcff030e283d98953f4b4;hb=1e61676b77dd09659027b8984f050df7e8538526;hpb=f18fbfc026de9cf02126f57844c37abfee607394 diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopPMController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopPMController.java index 8d47be76c..058542590 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopPMController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopPMController.java @@ -52,6 +52,12 @@ public class CreateClosedLoopPMController { protected PolicyRestAdapter policyAdapter = null; + /** + * prePopulateClosedLoopPMPolicyData. + * + * @param policyAdapter PolicyRestAdapter + * @param entity PolicyEntity + */ public void prePopulateClosedLoopPMPolicyData(PolicyRestAdapter policyAdapter, PolicyEntity entity) { if (! (policyAdapter.getPolicyData() instanceof PolicyType)) { return; @@ -116,19 +122,8 @@ public class CreateClosedLoopPMController { AttributeDesignatorType designator = match.getAttributeDesignator(); String attributeId = designator.getAttributeId(); // First match in the target is OnapName, so set that value. - if ("ONAPName".equals(attributeId)) { - policyAdapter.setOnapName(value); - } else if ("RiskType".equals(attributeId)) { - policyAdapter.setRiskType(value); - } else if ("RiskLevel".equals(attributeId)) { - policyAdapter.setRiskLevel(value); - } else if ("guard".equals(attributeId)) { - policyAdapter.setGuard(value); - } else if ("TTLDate".equals(attributeId) && !value.contains("NA")) { - PolicyController controller = new PolicyController(); - String newDate = controller.convertDate(value); - policyAdapter.setTtlDate(newDate); - } else if ("ServiceType".equals(attributeId)) { + policyAdapter.setupUsingAttribute(attributeId, value); + if ("ServiceType".equals(attributeId)) { LinkedHashMap serviceTypePolicyName1 = new LinkedHashMap<>(); serviceTypePolicyName1.put(KEY_SERVICE_TYPE_POLICY_NAME, value); policyAdapter.setServiceTypePolicyName(serviceTypePolicyName1);