X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ECOMP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fpolicycontroller%2FPolicyCreation.java;h=0d84519d3de8d878d895e3c0cd62c0a07824b7d9;hb=eb654437ee2815028602daa943d0a939a5bee3cd;hp=3437dab039be08d59812a4d7af110a2752dc27c5;hpb=bb927b5325d7b82cdc65bf25aa217ad7c56a46b3;p=policy%2Fengine.git diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/policycontroller/PolicyCreation.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/policycontroller/PolicyCreation.java index 3437dab03..0d84519d3 100644 --- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/policycontroller/PolicyCreation.java +++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/policycontroller/PolicyCreation.java @@ -82,6 +82,14 @@ public class PolicyCreation extends AbstractPolicyCreation{ private static CommonClassDao commonClassDao; + public static CommonClassDao getCommonClassDao() { + return commonClassDao; + } + + public static void setCommonClassDao(CommonClassDao commonClassDao) { + PolicyCreation.commonClassDao = commonClassDao; + } + @Autowired public PolicyCreation(CommonClassDao commonClassDao){ PolicyCreation.commonClassDao = commonClassDao; @@ -334,12 +342,15 @@ public class PolicyCreation extends AbstractPolicyCreation{ } else if (policyType.equalsIgnoreCase("Decision")) { if(policyData.getApiflag() == null){ Map settingsMap = new HashMap<>(); + Map treatmentMap = new HashMap<>(); List dynamicRuleAlgorithmLabels = new LinkedList<>(); List dynamicRuleAlgorithmCombo = new LinkedList<>(); List dynamicRuleAlgorithmField1 = new LinkedList<>(); List dynamicRuleAlgorithmField2 = new LinkedList<>(); List dynamicVariableList = new LinkedList<>(); List dataTypeList = new LinkedList<>(); + List errorCodeList = new LinkedList<>(); + List treatmentList = new LinkedList<>(); if(policyData.getSettings().size() > 0){ for(Object settingsData : policyData.getSettings()){ @@ -365,7 +376,8 @@ public class PolicyCreation extends AbstractPolicyCreation{ } } if(policyData.getRuleProvider()!=null && (policyData.getRuleProvider().equals(DecisionPolicy.GUARD_YAML)|| policyData.getRuleProvider().equals(DecisionPolicy.GUARD_BL_YAML)) - && policyData.getYamlparams()!=null){ attributeMap.put("actor", policyData.getYamlparams().getActor()); + && policyData.getYamlparams()!=null){ + attributeMap.put("actor", policyData.getYamlparams().getActor()); attributeMap.put("recipe", policyData.getYamlparams().getRecipe()); attributeMap.put("limit", policyData.getYamlparams().getLimit()); attributeMap.put("timeWindow", policyData.getYamlparams().getTimeWindow()); @@ -376,6 +388,23 @@ public class PolicyCreation extends AbstractPolicyCreation{ attributeMap.put("blackList", blackList); } } + if(policyData.getRuleProvider()!=null && policyData.getRuleProvider().equals(DecisionPolicy.RAINY_DAY)){ + attributeMap.put("ServiceType", policyData.getRainyday().getServiceType()); + attributeMap.put("VNFType", policyData.getRainyday().getVnfType()); + attributeMap.put("BB_ID", policyData.getRainyday().getBbid()); + attributeMap.put("WorkStep", policyData.getRainyday().getWorkstep()); + + if(policyData.getRainyday().getTreatmentTableChoices()!=null && policyData.getRainyday().getTreatmentTableChoices().size() > 0){ + for (Object table : policyData.getRainyday().getTreatmentTableChoices()){ + if(table instanceof LinkedHashMap){ + String errorcode = ((LinkedHashMap) table).get("errorcode").toString(); + String treatment = ((LinkedHashMap) table).get("treatment").toString(); + treatmentMap.put(errorcode, treatment); + } + } + } + } + policyData.setDynamicRuleAlgorithmLabels(dynamicRuleAlgorithmLabels); policyData.setDynamicRuleAlgorithmCombo(dynamicRuleAlgorithmCombo); policyData.setDynamicRuleAlgorithmField1(dynamicRuleAlgorithmField1); @@ -384,6 +413,9 @@ public class PolicyCreation extends AbstractPolicyCreation{ policyData.setDynamicSettingsMap(settingsMap); policyData.setDynamicFieldConfigAttributes(attributeMap); policyData.setDataTypeList(dataTypeList); + policyData.setRainydayMap(treatmentMap); + policyData.setErrorCodeList(errorCodeList); + policyData.setTreatmentList(treatmentList); } newPolicy = new DecisionPolicy(policyData); } @@ -480,7 +512,7 @@ public class PolicyCreation extends AbstractPolicyCreation{ } } catch (Exception e){ - LOGGER.error("Exception Occured"+e); + LOGGER.error("Exception Occured : "+e); } return new ResponseEntity(body, status); }