diff options
author | Jorge Hernandez <jh1730@att.com> | 2017-09-28 03:40:01 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-09-28 03:40:01 +0000 |
commit | b6dee4c18a7384e765a36a8dbbaef301da232847 (patch) | |
tree | 75f3981be56fe1d4420cde6e564b71916cbc01b3 /ONAP-PDP-REST | |
parent | b5caf28492a151d811dd3ce7e6ade26e56deade9 (diff) | |
parent | d86da782fa13652ab4fa7227394d4a3d1fe55e18 (diff) |
Merge "Policy API support for Rainy Day Decision Policy"
Diffstat (limited to 'ONAP-PDP-REST')
2 files changed, 9 insertions, 3 deletions
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyService.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyService.java index c283ff14c..915e3b30f 100644 --- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyService.java +++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyService.java @@ -80,6 +80,8 @@ public class DecisionPolicyService{ } Map<String,String> matchingAttributes = null; Map<String,String> settingsAttributes = null; + + //Get the MATCHING and/or SETTINGS attributes if (policyParameters.getAttributes()!=null && policyParameters.getAttributes().containsKey(AttributeType.MATCHING) && policyParameters.getAttributes().containsKey(AttributeType.SETTINGS)) { matchingAttributes = policyParameters.getAttributes().get(AttributeType.MATCHING); settingsAttributes = policyParameters.getAttributes().get(AttributeType.SETTINGS); @@ -88,9 +90,10 @@ public class DecisionPolicyService{ }else if(policyParameters.getAttributes()!=null && policyParameters.getAttributes().containsKey(AttributeType.MATCHING) && !policyParameters.getAttributes().containsKey(AttributeType.SETTINGS)){ matchingAttributes = policyParameters.getAttributes().get(AttributeType.MATCHING); } - // Create Policy. - StdPAPPolicy newPAPPolicy = new StdPAPPolicy(policyName, policyParameters.getPolicyDescription(), onapName, ruleProvider.toString(), matchingAttributes, settingsAttributes, policyParameters.getDynamicRuleAlgorithmLabels(), - policyParameters.getDynamicRuleAlgorithmFunctions(), policyParameters.getDynamicRuleAlgorithmField1(), policyParameters.getDynamicRuleAlgorithmField2(), null, null, null, updateFlag, policyScope, 0); + // Create StdPAPPolicy object used to send policy data to PAP-REST. + StdPAPPolicy newPAPPolicy = new StdPAPPolicy(policyName, policyParameters.getPolicyDescription(), onapName, ruleProvider.toString(), matchingAttributes, settingsAttributes, + policyParameters.getTreatments(), policyParameters.getDynamicRuleAlgorithmLabels(), policyParameters.getDynamicRuleAlgorithmFunctions(), + policyParameters.getDynamicRuleAlgorithmField1(), policyParameters.getDynamicRuleAlgorithmField2(), null, null, null, updateFlag, policyScope, 0); // Send JSON to PAP. response = (String) papServices.callPAP(newPAPPolicy, new String[] {"operation="+operation, "apiflag=api", "policyType=Decision"}, policyParameters.getRequestID(), "Decision"); LOGGER.info(message); diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDictionaryService.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDictionaryService.java index 8f88ef7c7..d3628f3c1 100644 --- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDictionaryService.java +++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDictionaryService.java @@ -171,6 +171,9 @@ public class GetDictionaryService { case "Settings": jsonString = jsonString.replace("settingsDictionaryDatas", "DictionaryDatas"); break; + case "RainyDayTreatments": + jsonString = jsonString.replace("rainyDayDictionaryDatas", "DictionaryDatas"); + break; case "DescriptiveScope": jsonString = jsonString.replace("descriptiveScopeDictionaryDatas", "DictionaryDatas"); break; |