From 87c95be02a8a4d77e165dede90777e811b59dcae Mon Sep 17 00:00:00 2001 From: Ravindra Bakkamanthala Date: Tue, 23 May 2017 14:56:12 -0400 Subject: Commit includes ControlLoopPolicy API and bugfixes Change-Id: I3e18bb8b4c31a0d908bb0cff4c85e2a3fb450a63 Signed-off-by: Ravindra Bakkamanthala --- .../pap/xacml/rest/components/CreateBrmsParamPolicy.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java') diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java index 0aaf1b1d2..535b2edd3 100644 --- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java +++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java @@ -40,6 +40,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; +import java.util.UUID; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -93,13 +94,14 @@ public class CreateBrmsParamPolicy extends Policy { public String expandConfigBody(String ruleContents, Map brmsParamBody) { - Set keySet= new HashSet(); + Set keySet= new HashSet<>(); Map copyMap=new HashMap<>(); copyMap.putAll(brmsParamBody); copyMap.put("policyName", policyName.substring(0, policyName.replace(".xml", "").lastIndexOf("."))); copyMap.put("policyScope", policyAdapter.getDomainDir()); copyMap.put("policyVersion",policyAdapter.getHighestVersion().toString()); + copyMap.put("unique", ("p"+policyName+UUID.randomUUID().toString()).replaceAll("[^A-Za-z0-9]", "")); //Finding all the keys in the Map data-structure. keySet= copyMap.keySet(); @@ -179,7 +181,7 @@ public class CreateBrmsParamPolicy extends Policy { @Override public Map savePolicies() throws Exception { - Map successMap = new HashMap(); + Map successMap = new HashMap<>(); if(isPolicyExists()){ successMap.put("EXISTS", "This Policy already exist on the PAP"); return successMap; @@ -195,7 +197,7 @@ public class CreateBrmsParamPolicy extends Policy { Boolean dbIsUpdated = true; - successMap = new HashMap(); + successMap = new HashMap<>(); if (dbIsUpdated) { successMap = createPolicy(newPolicyPath,getCorrectPolicyDataObject()); } else { @@ -253,7 +255,7 @@ public class CreateBrmsParamPolicy extends Policy { } protected Map findType(String rule) { - Map mapFieldType= new HashMap(); + Map mapFieldType= new HashMap<>(); if(rule!=null){ try { String params = ""; @@ -658,7 +660,7 @@ public class CreateBrmsParamPolicy extends Policy { // Adding Dependencies. if(policyAdapter.getBrmsDependency()!=null){ BRMSDictionaryController brmsDicitonaryController = new BRMSDictionaryController(); - ArrayList dependencies = new ArrayList(); + ArrayList dependencies = new ArrayList<>(); StringBuilder key = new StringBuilder(); for(String dependencyName: policyAdapter.getBrmsDependency()){ dependencies.add(brmsDicitonaryController.getDependencyDataByID(dependencyName).getDependency()); -- cgit 1.2.3-korg