aboutsummaryrefslogtreecommitdiffstats
path: root/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java
diff options
context:
space:
mode:
authorRavindra Bakkamanthala <rb7147@att.com>2017-05-23 14:56:12 -0400
committerRavindra Bakkamanthala <rb7147@att.com>2017-05-23 16:49:56 -0400
commit87c95be02a8a4d77e165dede90777e811b59dcae (patch)
tree4712199fc3520b530dda0c4d3b074c327df547f2 /ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java
parent7e547eaa55920dfbc9691eab33bb728395b50cf2 (diff)
Commit includes ControlLoopPolicy API and bugfixes
Change-Id: I3e18bb8b4c31a0d908bb0cff4c85e2a3fb450a63 Signed-off-by: Ravindra Bakkamanthala <rb7147@att.com>
Diffstat (limited to 'ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java')
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java12
1 files changed, 7 insertions, 5 deletions
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<String, String> brmsParamBody) {
- Set<String> keySet= new HashSet<String>();
+ Set<String> keySet= new HashSet<>();
Map<String,String> 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<String, String> savePolicies() throws Exception {
- Map<String, String> successMap = new HashMap<String,String>();
+ Map<String, String> 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<String, String>();
+ successMap = new HashMap<>();
if (dbIsUpdated) {
successMap = createPolicy(newPolicyPath,getCorrectPolicyDataObject());
} else {
@@ -253,7 +255,7 @@ public class CreateBrmsParamPolicy extends Policy {
}
protected Map<String, String> findType(String rule) {
- Map<String, String> mapFieldType= new HashMap<String,String>();
+ Map<String, String> 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<String> dependencies = new ArrayList<String>();
+ ArrayList<String> dependencies = new ArrayList<>();
StringBuilder key = new StringBuilder();
for(String dependencyName: policyAdapter.getBrmsDependency()){
dependencies.add(brmsDicitonaryController.getDependencyDataByID(dependencyName).getDependency());