summaryrefslogtreecommitdiffstats
path: root/ECOMP-PAP-REST/src
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
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')
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/HibernateSession.java6
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/XACMLPapServlet.java20
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ActionPolicy.java14
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/AutoPushPolicy.java4
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ClosedLoopPolicy.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ConfigPolicy.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBRMSRuleTemplate.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java12
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsRawPolicy.java4
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateNewMicroSerivceModel.java12
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/DecisionPolicy.java39
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/FirewallConfigPolicy.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java20
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java4
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDao.java17
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ActionPolicyDictionaryController.java4
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/BRMSDictionaryController.java12
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java24
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java4
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DescriptiveDictionaryController.java4
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DictionaryController.java8
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/EnforcerDictionaryController.java4
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/FirewallDictionaryController.java40
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java38
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/PolicyScopeDictionaryController.java22
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/SafePolicyController.java8
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElasticSearchPolicyUpdate.java311
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnectorImpl.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java10
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/DeleteHandler.java33
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/SavePolicyHandler.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/PDPPolicyContainer.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/RemoveGroupPolicy.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/policycontroller/PolicyCreation.java45
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java21
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/MetricService.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/util/JPAUtils.java4
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/CheckPDP.java6
-rw-r--r--ECOMP-PAP-REST/src/main/resources/logback.xml4
-rw-r--r--ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/ia/DbAuditCompareEntriesTest.java36
42 files changed, 583 insertions, 229 deletions
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/HibernateSession.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/HibernateSession.java
index 4d872c32c..93fe33727 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/HibernateSession.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/HibernateSession.java
@@ -20,7 +20,6 @@
package org.openecomp.policy.pap.xacml.rest;
-import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
@@ -53,13 +52,12 @@ public class HibernateSession{
StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());
xacmlsessionFactory = configuration.configure("/hibernate.cfg.xml").buildSessionFactory(builder.build());
- } catch (Throwable ex) {
+ } catch (Exception ex) {
LOGGER.error("Exception Occured While Creating Hiberante Session Factory"+ex);
- throw new ExceptionInInitializerError(ex);
}
}
- public static Session getSessionFactory() throws HibernateException {
+ public static Session getSessionFactory(){
return xacmlsessionFactory.openSession();
}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/XACMLPapServlet.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/XACMLPapServlet.java
index 1b5f85477..5e7e2436f 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/XACMLPapServlet.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/XACMLPapServlet.java
@@ -1275,12 +1275,12 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
PolicyLogger.info("JSON request from PolicyEngine API: " + json);
// convert Object sent as JSON into local object
StdPDPPolicy policy = PolicyUtils.jsonStringToObject(json, StdPDPPolicy.class);
- Set<PDPPolicy> policies = new HashSet<PDPPolicy>();
+ Set<PDPPolicy> policies = new HashSet<>();
if(policy!=null){
policies.add(policy);
}
//Get the current policies from the Group and Add the new one
- Set<PDPPolicy> currentPoliciesInGroup = new HashSet<PDPPolicy>();
+ Set<PDPPolicy> currentPoliciesInGroup = new HashSet<>();
currentPoliciesInGroup = group.getPolicies();
//If the selected policy is in the group we must remove it because the name is default
Iterator<PDPPolicy> policyIterator = policies.iterator();
@@ -1296,7 +1296,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
}
}
//Update the PDP Group after removing old version of policy
- Set<PDPPolicy> updatedPoliciesInGroup = new HashSet<PDPPolicy>();
+ Set<PDPPolicy> updatedPoliciesInGroup = new HashSet<>();
updatedPoliciesInGroup = group.getPolicies();
//need to remove the policy with default name from group
for (PDPPolicy updatedPolicy : currentPoliciesInGroup) {
@@ -1319,9 +1319,13 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
throw new PAPException(e.getMessage());
}
papEngine.updateGroup(group);
+ String policyId = "empty";
+ if(policy!=null){
+ policyId = policy.getId();
+ }
response.setStatus(HttpServletResponse.SC_NO_CONTENT);
response.addHeader("operation", "push");
- response.addHeader("policyId", policy.getId());
+ response.addHeader("policyId", policyId);
response.addHeader("groupId", groupId);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Group '" + group.getId() + "' updated");
@@ -1992,7 +1996,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
moveToGroup = papEngine.getGroup(moveToGroupId);
}
// get list of PDPs in the group being deleted so we can notify them that they got changed
- Set<EcompPDP> movedPDPs = new HashSet<EcompPDP>();
+ Set<EcompPDP> movedPDPs = new HashSet<>();
movedPDPs.addAll(group.getEcompPdps());
// do the move/remove
try{
@@ -2049,7 +2053,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
*/
private class Heartbeat implements Runnable {
private PAPPolicyEngine papEngine;
- private Set<EcompPDP> pdps = new HashSet<EcompPDP>();
+ private Set<EcompPDP> pdps = new HashSet<>();
private int heartbeatInterval;
private int heartbeatTimeout;
@@ -2075,7 +2079,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
synchronized(this) {
this.isRunning = true;
}
- HashMap<String, URL> idToURLMap = new HashMap<String, URL>();
+ HashMap<String, URL> idToURLMap = new HashMap<>();
try {
while (this.isRunning()) {
// Wait the given time
@@ -2382,7 +2386,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
private class NotifyACThread implements Runnable {
public void run() {
- List<String> disconnectedACs = new ArrayList<String>();
+ List<String> disconnectedACs = new ArrayList<>();
// There should be no Concurrent exception here because the list is a CopyOnWriteArrayList.
// The "for each" loop uses the collection's iterator under the covers, so it should be correct.
for (String acURL : adminConsoleURLStringList) {
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ActionPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ActionPolicy.java
index aee2b3886..63fa04210 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ActionPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ActionPolicy.java
@@ -89,12 +89,12 @@ public class ActionPolicy extends Policy {
public static boolean isAttribute = false;
- List<String> dynamicLabelRuleAlgorithms = new LinkedList<String>();
- List<String> dynamicFieldFunctionRuleAlgorithms = new LinkedList<String>();
- List<String> dynamicFieldOneRuleAlgorithms = new LinkedList<String>();
- List<String> dynamicFieldTwoRuleAlgorithms = new LinkedList<String>();
+ List<String> dynamicLabelRuleAlgorithms = new LinkedList<>();
+ List<String> dynamicFieldFunctionRuleAlgorithms = new LinkedList<>();
+ List<String> dynamicFieldOneRuleAlgorithms = new LinkedList<>();
+ List<String> dynamicFieldTwoRuleAlgorithms = new LinkedList<>();
- protected Map<String, String> dropDownMap = new HashMap<String, String>();
+ protected Map<String, String> dropDownMap = new HashMap<>();
public ActionPolicy() {
@@ -108,7 +108,7 @@ public class ActionPolicy 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;
@@ -490,7 +490,7 @@ public class ActionPolicy extends Policy {
LOGGER.error("Exception Occured"+e);
}
Map<Datatype, List<FunctionDefinition>> functionMap = jpaUtils.getFunctionDatatypeMap();
- Map<String, String> dropDownMap = new HashMap<String, String>();
+ Map<String, String> dropDownMap = new HashMap<>();
for (Datatype id : functionMap.keySet()) {
List<FunctionDefinition> functionDefinitions = (List<FunctionDefinition>) functionMap
.get(id);
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/AutoPushPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/AutoPushPolicy.java
index 4d4859349..b9ed78ef6 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/AutoPushPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/AutoPushPolicy.java
@@ -72,7 +72,7 @@ public class AutoPushPolicy {
* @param papEngine
*/
public Set<StdPDPGroup> checkGroupsToPush(String policyToCreateUpdate, PAPPolicyEngine papEngine) {
- Set<StdPDPGroup> changedGroups= new HashSet<StdPDPGroup>();
+ Set<StdPDPGroup> changedGroups= new HashSet<>();
// Check if the file has been modified. then re-load the properties file.
newModified = propFile.lastModified();
try {
@@ -135,7 +135,7 @@ public class AutoPushPolicy {
StdPDPPolicy policy = new StdPDPPolicy(policyId, true, policyName, null);
//Get the current policies from the Group and Add the new one
Set<PDPPolicy> currentPoliciesInGroup = pdpGroup.getPolicies();
- Set<PDPPolicy> policies = new HashSet<PDPPolicy>();
+ Set<PDPPolicy> policies = new HashSet<>();
if(policy!=null){
policies.add(policy);
}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ClosedLoopPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ClosedLoopPolicy.java
index 264602a1d..1281bd083 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ClosedLoopPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ClosedLoopPolicy.java
@@ -116,7 +116,7 @@ public class ClosedLoopPolicy 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;
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ConfigPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ConfigPolicy.java
index cab76b9e5..0cf9c6546 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ConfigPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ConfigPolicy.java
@@ -236,7 +236,7 @@ public class ConfigPolicy 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;
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBRMSRuleTemplate.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBRMSRuleTemplate.java
index 2f122647d..078ba1040 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBRMSRuleTemplate.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBRMSRuleTemplate.java
@@ -45,7 +45,7 @@ public class CreateBRMSRuleTemplate {
public CreateBRMSRuleTemplate() {}
public Map<String, String> addRule(String rule, String ruleName, String description, String userID) {
- Map<String,String> responseMap = new HashMap<String,String>();
+ Map<String,String> responseMap = new HashMap<>();
if(rule!=null && !PolicyUtils.brmsRawValidate(rule).contains("[ERR")){
List<Object> duplicateData = commonClassDao.checkDuplicateEntry(ruleName, "ruleName", BRMSParamTemplate.class);
if(duplicateData!=null && !duplicateData.isEmpty()){
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());
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsRawPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsRawPolicy.java
index dfd647c6e..350bbc4ff 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsRawPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsRawPolicy.java
@@ -117,7 +117,7 @@ public class CreateBrmsRawPolicy 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;
@@ -405,7 +405,7 @@ public class CreateBrmsRawPolicy 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());
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java
index dcb2a93d4..a16ab9a79 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java
@@ -101,7 +101,7 @@ public class CreateClosedLoopPerformanceMetrics 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;
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateNewMicroSerivceModel.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateNewMicroSerivceModel.java
index c1740ae30..30a95f901 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateNewMicroSerivceModel.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateNewMicroSerivceModel.java
@@ -58,7 +58,7 @@ import com.att.research.xacml.util.XACMLProperties;
public class CreateNewMicroSerivceModel {
private static final Logger logger = FlexLogger.getLogger(CreateNewMicroSerivceModel.class);
private MicroServiceModels newModel = null;
- private HashMap<String,MSAttributeObject > classMap = new HashMap<String,MSAttributeObject>();
+ private HashMap<String,MSAttributeObject > classMap = new HashMap<>();
/*
* These are the parameters needed for DB access from the PAP
@@ -85,7 +85,7 @@ public class CreateNewMicroSerivceModel {
this.newModel.setUserCreatedBy(userInfo);
String cleanUpFile = null;
- HashMap<String, MSAttributeObject> tempMap = new HashMap<String, MSAttributeObject>();
+ HashMap<String, MSAttributeObject> tempMap = new HashMap<>();
//Need to delete the file
if (importFile.contains(".zip")){
extractFolder(randomID + ".zip");
@@ -118,7 +118,7 @@ public class CreateNewMicroSerivceModel {
private List<File> listModelFiles(String directoryName) {
File directory = new File(directoryName);
- List<File> resultList = new ArrayList<File>();
+ List<File> resultList = new ArrayList<>();
File[] fList = directory.listFiles();
for (File file : fList) {
if (file.isFile()) {
@@ -185,7 +185,7 @@ public class CreateNewMicroSerivceModel {
public Map<String, String> addValuesToNewModel() {
- Map<String, String> successMap = new HashMap<String,String>();
+ Map<String, String> successMap = new HashMap<>();
MSAttributeObject mainClass = null;
ArrayList<String> dependency = null;
String subAttribute = null;
@@ -227,13 +227,13 @@ public class CreateNewMicroSerivceModel {
@SuppressWarnings("resource")
public Map<String, String> saveImportService(){
- Map<String, String> successMap = new HashMap<String,String>();
+ Map<String, String> successMap = new HashMap<>();
Connection con = null;
Statement st = null;
ResultSet rs = null;
String modelName = this.newModel.getModelName();
- String imported_by = "API";////////////////////////////////////////////
+ String imported_by = "API";
String version = this.newModel.getVersion();
String insertQuery = null;
int ID = 0;
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/DecisionPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/DecisionPolicy.java
index e5a114ba8..8d2617ce2 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/DecisionPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/DecisionPolicy.java
@@ -88,13 +88,13 @@ public class DecisionPolicy extends Policy {
private static final String XACMLTEMPLATE = "Decision_GuardPolicyTemplate.xml";
- List<String> dynamicLabelRuleAlgorithms = new LinkedList<String>();
- List<String> dynamicFieldComboRuleAlgorithms = new LinkedList<String>();
- List<String> dynamicFieldOneRuleAlgorithms = new LinkedList<String>();
- List<String> dynamicFieldTwoRuleAlgorithms = new LinkedList<String>();
- List<String> dataTypeList = new LinkedList<String>();
+ List<String> dynamicLabelRuleAlgorithms = new LinkedList<>();
+ List<String> dynamicFieldComboRuleAlgorithms = new LinkedList<>();
+ List<String> dynamicFieldOneRuleAlgorithms = new LinkedList<>();
+ List<String> dynamicFieldTwoRuleAlgorithms = new LinkedList<>();
+ List<String> dataTypeList = new LinkedList<>();
- protected Map<String, String> dropDownMap = new HashMap<String, String>();
+ protected Map<String, String> dropDownMap = new HashMap<>();
public DecisionPolicy() {
@@ -108,7 +108,7 @@ public class DecisionPolicy 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;
@@ -153,7 +153,7 @@ public class DecisionPolicy extends Policy {
policyName = policyAdapter.getNewFileName();
if(policyAdapter.getRuleProvider().equals(GUARD_YAML)){
- Map<String, String> yamlParams = new HashMap<String, String>();
+ Map<String, String> yamlParams = new HashMap<>();
yamlParams.put("description", (policyAdapter.getPolicyDescription()!=null)? policyAdapter.getPolicyDescription(): "YAML Guard Policy");
String fileName = policyAdapter.getNewFileName();
String name = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.length());
@@ -191,7 +191,7 @@ public class DecisionPolicy extends Policy {
Map<String, String> dynamicFieldComponentAttributes = policyAdapter.getDynamicFieldConfigAttributes();
if(policyAdapter.getRuleProvider()!=null && policyAdapter.getRuleProvider().equals(AAFProvider)){
- dynamicFieldComponentAttributes = new HashMap<String,String>();
+ dynamicFieldComponentAttributes = new HashMap<>();
}
// If there is any dynamic field attributes create the matches here
@@ -214,7 +214,7 @@ public class DecisionPolicy extends Policy {
//dynamicVariableList = policyAdapter.getDynamicVariableList();
if(policyAdapter.getRuleProvider()!=null && policyAdapter.getRuleProvider().equals(AAFProvider)){
- dynamicFieldDecisionSettings = new HashMap<String,String>();
+ dynamicFieldDecisionSettings = new HashMap<>();
}
// settings are dynamic so check how many rows are added and add all
@@ -240,11 +240,12 @@ public class DecisionPolicy extends Policy {
ControlLoopGuardBuilder builder = ControlLoopGuardBuilder.Factory.buildControlLoopGuard(new Guard());
GuardPolicy policy1 = new GuardPolicy((policyAdapter.getUuid()!=null? policyAdapter.getUuid(): UUID.randomUUID().toString()) ,yamlParams.get("PolicyName"), yamlParams.get("description"), yamlParams.get("actor"), yamlParams.get("recipe"));
builder = builder.addGuardPolicy(policy1);
- Map<String, String> time_in_range = new HashMap<String, String>();
+ Map<String, String> time_in_range = new HashMap<>();
time_in_range.put("arg2", yamlParams.get("guardActiveStart"));
time_in_range.put("arg3", yamlParams.get("guardActiveEnd"));
- Constraint cons = new Constraint(Integer.parseInt(yamlParams.get("limit")), yamlParams.get("timeWindow"), time_in_range);
- builder = builder.addLimitConstraint(policy1.id, cons);
+ Constraint cons = new Constraint(Integer.parseInt(yamlParams.get("limit")), yamlParams.get("timeWindow"));
+ cons.setTime_in_range(time_in_range);
+ builder = builder.addLimitConstraint(policy1.getId(), cons);
// Build the specification
Results results = builder.buildSpecification();
// YAML TO XACML
@@ -257,12 +258,12 @@ public class DecisionPolicy extends Policy {
yamlSpecs.put("PolicyName", yamlParams.get("PolicyName"));
yamlSpecs.put("description", yamlParams.get("description"));
yamlSpecs.put("ECOMPName", yamlParams.get("ECOMPName"));
- yamlSpecs.put("actor", yamlGuardObject.guards.getFirst().actor);
- yamlSpecs.put("recipe", yamlGuardObject.guards.getFirst().recipe);
- yamlSpecs.put("limit", yamlGuardObject.guards.getFirst().limit_constraints.getFirst().num.toString());
- yamlSpecs.put("timeWindow", yamlGuardObject.guards.getFirst().limit_constraints.getFirst().duration);
- yamlSpecs.put("guardActiveStart", yamlGuardObject.guards.getFirst().limit_constraints.getFirst().time_in_range.get("arg2"));
- yamlSpecs.put("guardActiveEnd", yamlGuardObject.guards.getFirst().limit_constraints.getFirst().time_in_range.get("arg3"));
+ yamlSpecs.put("actor", ((LinkedList<GuardPolicy>)yamlGuardObject.getGuards()).getFirst().getActor());
+ yamlSpecs.put("recipe", ((LinkedList<GuardPolicy>)yamlGuardObject.getGuards()).getFirst().getRecipe());
+ yamlSpecs.put("limit", ((LinkedList<Constraint>)((LinkedList<GuardPolicy>)yamlGuardObject.getGuards()).getFirst().getLimit_constraints()).getFirst().getNum().toString());
+ yamlSpecs.put("timeWindow", ((LinkedList<Constraint>)((LinkedList<GuardPolicy>)yamlGuardObject.getGuards()).getFirst().getLimit_constraints()).getFirst().getDuration());
+ yamlSpecs.put("guardActiveStart", ((LinkedList<Constraint>)((LinkedList<GuardPolicy>)yamlGuardObject.getGuards()).getFirst().getLimit_constraints()).getFirst().getTime_in_range().get("arg2"));
+ yamlSpecs.put("guardActiveEnd", ((LinkedList<Constraint>)((LinkedList<GuardPolicy>)yamlGuardObject.getGuards()).getFirst().getLimit_constraints()).getFirst().getTime_in_range().get("arg3"));
String xacmlPolicyContent = SafePolicyBuilder.generateXacmlGuard(xacmlTemplateContent,yamlSpecs);
// Convert the Policy into Stream input to Policy Adapter.
Object policy = XACMLPolicyScanner.readPolicy(new ByteArrayInputStream(xacmlPolicyContent.getBytes(StandardCharsets.UTF_8)));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/FirewallConfigPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/FirewallConfigPolicy.java
index 9e590732c..b4b1a410e 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/FirewallConfigPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/FirewallConfigPolicy.java
@@ -138,7 +138,7 @@ public class FirewallConfigPolicy 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;
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java
index 736069d00..5fc4370e1 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java
@@ -76,8 +76,8 @@ public class MicroServiceConfigPolicy extends Policy {
private static String papDbUrl = null;
private static String papDbUser = null;
private static String papDbPassword = null;
- private static Map<String, String> mapAttribute = new HashMap<String,String>();
- private static Map<String, String> matchMap = new HashMap<String,String>();
+ private static Map<String, String> mapAttribute = new HashMap<>();
+ private static Map<String, String> matchMap = new HashMap<>();
public MicroServiceConfigPolicy() {
super();
@@ -105,7 +105,7 @@ public class MicroServiceConfigPolicy 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;
@@ -188,7 +188,7 @@ public class MicroServiceConfigPolicy extends Policy {
matching = getValueFromDictionary(policyAdapter.getServiceType() + "-v" + jsonVersion);
}
- matchMap = new HashMap<String,String>();
+ matchMap = new HashMap<>();
if (matching != null && !matching.isEmpty()){
matchMap = Splitter.on(",").withKeyValueSeparator("=").split(matching);
if(policyAdapter.getJsonBody() != null){
@@ -372,9 +372,15 @@ public class MicroServiceConfigPolicy extends Policy {
PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "MicroServiceModels", "Exception querying MicroServiceModels");
} finally {
try{
- if (con!=null) con.close();
- if (rs!=null) rs.close();
- if (st!=null) st.close();
+ if (con!=null){
+ con.close();
+ }
+ if (rs!=null){
+ rs.close();
+ }
+ if (st!=null){
+ st.close();
+ }
} catch (Exception ex){
LOGGER.error("Exception Occured While Closing the Database Connection"+ex);
}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java
index 743883b01..48431fe93 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java
@@ -118,7 +118,7 @@ public abstract class Policy {
public static String ACTION_HOME = null;
public static String CONFIG_URL = null;
- protected Map<String, String> performer = new HashMap<String, String>();
+ protected Map<String, String> performer = new HashMap<>();
private static String actionHome = null;
private static String configHome = null;
@@ -287,7 +287,7 @@ public abstract class Policy {
//create policy once all the validations are completed
protected Map<String, String> createPolicy(final Path policyPath, final Object policyData) {
- Map<String, String> success = new HashMap<String, String>();
+ Map<String, String> success = new HashMap<>();
//
// Is the root a PolicySet or Policy?
//
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDao.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDao.java
index eaceb6575..51fcb3d09 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDao.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDao.java
@@ -213,7 +213,7 @@ public class PolicyDBDao {
*/
private List<?> getRemotePolicyDBDaoList(){
logger.debug("getRemotePolicyDBDaoList() as getRemotePolicyDBDaoList() called");
- List<?> policyDBDaoEntityList = new LinkedList<Object>();
+ List<?> policyDBDaoEntityList = new LinkedList<>();
EntityManager em = emf.createEntityManager();
startTransactionSynced(em, 1000);
try{
@@ -375,7 +375,6 @@ public class PolicyDBDao {
em.close();
} catch(Exception e2){
PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e2, "PolicyDBDao", "COULD NOT CREATE DATABASELOCK ROW. WILL TRY ONE MORE TIME");
- e2.printStackTrace();
}
em = null;
em = emf.createEntityManager();
@@ -446,7 +445,7 @@ public class PolicyDBDao {
}
public void notifyOthers(long entityId, String entityType, String newGroupId){
logger.debug("notifyOthers(long entityId, String entityType, long newGroupId) as notifyOthers("+entityId+","+entityType+","+newGroupId+") called");
- LinkedList<Thread> notifyThreads = new LinkedList<Thread>();
+ LinkedList<Thread> notifyThreads = new LinkedList<>();
//we're going to run notiftions in parellel threads to speed things up
for(Object obj : otherServers){
@@ -855,7 +854,7 @@ public class PolicyDBDao {
//this must always be true since we don't explicitly know when a delete is occuring
boolean didUpdate = true;
HashMap<String,PDPPolicy> currentPolicySet = new HashMap<String,PDPPolicy>(oldPdpGroup.getPolicies().size());
- HashSet<PDPPolicy> newPolicySet = new HashSet<PDPPolicy>();
+ HashSet<PDPPolicy> newPolicySet = new HashSet<>();
for(PDPPolicy pdpPolicy : oldPdpGroup.getPolicies()){
currentPolicySet.put(pdpPolicy.getId(), pdpPolicy);
}
@@ -1127,7 +1126,7 @@ public class PolicyDBDao {
Properties propertyFileProperties = new Properties();
String groupList = "";
String defaultGroup = "";
- HashSet<String> currentGroupPaths = new HashSet<String>();
+ HashSet<String> currentGroupPaths = new HashSet<>();
for(Object o : groups){
GroupEntity group = (GroupEntity)o;
Path groupPath = Paths.get(pdpsPath.toString(), group.getGroupId());
@@ -1663,7 +1662,7 @@ public class PolicyDBDao {
getPolicyEntitiesQuery.setParameter("deleted", false);
policyEntityList = getPolicyEntitiesQuery.getResultList();
} catch(Exception e){
- policyEntityList = new LinkedList<PolicyEntity>();
+ policyEntityList = new LinkedList<>();
}
for (PolicyEntity policy: policyEntityList){
@@ -1971,7 +1970,7 @@ public class PolicyDBDao {
}
String gitPath = getGitPath();
- ArrayList<String> gitPathParts = new ArrayList<String>();
+ ArrayList<String> gitPathParts = new ArrayList<>();
Iterator<?> gitPathIterator = Paths.get(gitPath).iterator();
while(gitPathIterator.hasNext()){
gitPathParts.add(gitPathIterator.next().toString());
@@ -2528,7 +2527,7 @@ public class PolicyDBDao {
getGroups.setParameter("pid", existingPolicy.getPolicyId());
groups = getGroups.getResultList();
}catch(Exception e){
- groups = new LinkedList<GroupEntity>();
+ groups = new LinkedList<>();
}
for(Object o : groups){
GroupEntity group = (GroupEntity)o;
@@ -3104,7 +3103,7 @@ public class PolicyDBDao {
PolicyLogger.error("We cannot get the group from the papEngine to delete policies");
} else {
- Set<String> newPolicySet = new HashSet<String>(group.getPolicies().size());
+ Set<String> newPolicySet = new HashSet<>(group.getPolicies().size());
//a multiple of n runtime is faster than n^2, so I am using a hashset to do the comparison
for(PDPPolicy pol: group.getPolicies()){
newPolicySet.add(pol.getId());
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ActionPolicyDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ActionPolicyDictionaryController.java
index 1f9250383..65f0ede26 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ActionPolicyDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ActionPolicyDictionaryController.java
@@ -69,7 +69,7 @@ public class ActionPolicyDictionaryController {
@RequestMapping(value={"/get_ActionPolicyDictDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getActionEntitybyName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("actionPolicyDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ActionPolicyDict.class, "attributeName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -84,7 +84,7 @@ public class ActionPolicyDictionaryController {
@RequestMapping(value={"/get_ActionPolicyDictData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getActionPolicyDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("actionPolicyDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ActionPolicyDict.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/BRMSDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/BRMSDictionaryController.java
index 31f2e73db..eb03aa996 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/BRMSDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/BRMSDictionaryController.java
@@ -79,7 +79,7 @@ public class BRMSDictionaryController{
@RequestMapping(value={"/get_BRMSParamDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getBRMSParamDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("brmsParamDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(BRMSParamTemplate.class, "ruleName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -94,7 +94,7 @@ public class BRMSDictionaryController{
@RequestMapping(value={"/get_BRMSParamData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getBRMSParamDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("brmsParamDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(BRMSParamTemplate.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -233,7 +233,7 @@ public class BRMSDictionaryController{
@RequestMapping(value={"/get_BRMSDependencyDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getBRMSDependencyDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("brmsDependencyDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(BRMSDependency.class, "dependencyName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -248,7 +248,7 @@ public class BRMSDictionaryController{
@RequestMapping(value={"/get_BRMSDependencyData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getBRMSDependencyDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("brmsDependencyDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(BRMSDependency.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -391,7 +391,7 @@ public class BRMSDictionaryController{
@RequestMapping(value={"/get_BRMSControllerDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getBRMSControllerDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("brmsControllerDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(BRMSController.class, "controllerName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -406,7 +406,7 @@ public class BRMSDictionaryController{
@RequestMapping(value={"/get_BRMSControllerData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getBRMSControllerDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("brmsControllerDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(BRMSController.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
index 26d9a6535..9aab267d6 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
@@ -76,7 +76,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_VSCLActionDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getVSCLActionDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("vsclActionDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(VSCLAction.class, "vsclaction")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -92,7 +92,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_VSCLActionData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getVSCLActionDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("vsclActionDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(VSCLAction.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -111,7 +111,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_VNFTypeDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getVNFTypeDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("vnfTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(VNFType.class, "vnftype")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -128,7 +128,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_VNFTypeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getVNFTypeDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("vnfTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(VNFType.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -147,7 +147,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_PEPOptionsDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPEPOptionsDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("pepOptionsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PEPOptions.class, "pepName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -162,7 +162,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_PEPOptionsData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPEPOptionsDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("pepOptionsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PEPOptions.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -181,7 +181,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_VarbindDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getVarbindDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("varbindDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(VarbindDictionary.class, "varbindName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -196,7 +196,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_VarbindDictionaryData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getVarbindDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("varbindDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(VarbindDictionary.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -215,7 +215,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_ClosedLoopServicesDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getClosedLoopServiceDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("closedLoopServiceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ClosedLoopD2Services.class, "serviceName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -230,7 +230,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_ClosedLoopServicesData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getClosedLoopServiceDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("closedLoopServiceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ClosedLoopD2Services.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -249,7 +249,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_ClosedLoopSiteDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getClosedLoopSiteDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("closedLoopSiteDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ClosedLoopSite.class, "siteName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -264,7 +264,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_ClosedLoopSiteData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getClosedLoopSiteDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("closedLoopSiteDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ClosedLoopSite.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java
index 60ed95a07..db3ebda44 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java
@@ -69,7 +69,7 @@ public class DecisionPolicyDictionaryController {
@RequestMapping(value={"/get_SettingsDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getSettingsDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("settingsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(DecisionSettings.class, "xacmlId")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -85,7 +85,7 @@ public class DecisionPolicyDictionaryController {
@RequestMapping(value={"/get_SettingsDictionaryData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getSettingsDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("settingsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(DecisionSettings.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DescriptiveDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DescriptiveDictionaryController.java
index aa05f5209..a64cdf77e 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DescriptiveDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DescriptiveDictionaryController.java
@@ -70,7 +70,7 @@ public class DescriptiveDictionaryController {
@RequestMapping(value={"/get_DescriptiveScopeByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getDescriptiveDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("descriptiveScopeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(DescriptiveScope.class, "descriptiveScopeName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -85,7 +85,7 @@ public class DescriptiveDictionaryController {
@RequestMapping(value={"/get_DescriptiveScope"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getDescriptiveDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("descriptiveScopeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(DescriptiveScope.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DictionaryController.java
index c08bba6ca..49d841a6e 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DictionaryController.java
@@ -87,7 +87,7 @@ public class DictionaryController {
public void getAttributeDictionaryEntityDatabyAttributeName(HttpServletRequest request, HttpServletResponse response){
try{
System.out.println();
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("attributeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(Attribute.class, "xacmlId")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -104,7 +104,7 @@ public class DictionaryController {
public void getAttributeDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
System.out.println();
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("attributeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(Attribute.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -278,7 +278,7 @@ public class DictionaryController {
public void getEcompNameDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
LOGGER.info("get_EcompNameDataByName is called");
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("ecompNameDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(EcompName.class, "ecompName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -293,7 +293,7 @@ public class DictionaryController {
@RequestMapping(value={"/get_EcompNameData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getEcompNameDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("ecompNameDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(EcompName.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/EnforcerDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/EnforcerDictionaryController.java
index b04020270..bfccb984a 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/EnforcerDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/EnforcerDictionaryController.java
@@ -56,10 +56,10 @@ public class EnforcerDictionaryController {
@RequestMapping(value={"/get_EnforcerTypeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getEnforcerDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
List<Object> list = commonClassDao.getData(EnforcingType.class);
- List<String> dictList = new ArrayList<String>();
+ List<String> dictList = new ArrayList<>();
for(int i = 0; i < list.size(); i++){
EnforcingType dict = (EnforcingType) list.get(i);
dictList.add(dict.getEnforcingType());
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/FirewallDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/FirewallDictionaryController.java
index a553d61db..6c9d713ef 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/FirewallDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/FirewallDictionaryController.java
@@ -87,7 +87,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_PrefixListDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPrefixListDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("prefixListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PrefixList.class, "prefixListName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -102,7 +102,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_PrefixListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPrefixListDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("prefixListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PrefixList.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -263,7 +263,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_PortListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPortListDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("portListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PortList.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -500,7 +500,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_AddressGroupDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getAddressGroupDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("addressGroupDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(AddressGroup.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -515,7 +515,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_AddressGroupData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getAddressGroupDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("addressGroupDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(AddressGroup.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -671,10 +671,10 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_ActionListDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getActionListDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
List<Object> list = commonClassDao.getData(ActionList.class);
- List<String> dictList = new ArrayList<String>();
+ List<String> dictList = new ArrayList<>();
for(int i = 0; i < list.size(); i++){
ActionList dict = (ActionList) list.get(i);
dictList.add(dict.getActionName());
@@ -692,7 +692,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_ActionListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getActionListDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("actionListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ActionList.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -821,7 +821,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_ServiceGroupData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getServiceGroupDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("serviceGroupDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(GroupServiceList.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -840,7 +840,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_ServiceGroupDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getServiceGroupDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("serviceGroupDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(GroupServiceList.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -994,7 +994,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_SecurityZoneDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getSecurityZoneDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("securityZoneDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(SecurityZone.class, "zoneName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -1009,7 +1009,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_SecurityZoneData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getSecurityZoneDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("securityZoneDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(SecurityZone.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -1142,7 +1142,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_ServiceListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getServiceListDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("serviceListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ServiceList.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -1161,7 +1161,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_ServiceListDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getServiceListDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("serviceListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ServiceList.class, "serviceName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -1323,7 +1323,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_ZoneData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getZoneDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("zoneDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(Zone.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -1340,7 +1340,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_ZoneDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getZoneDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("zoneDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(Zone.class, "zoneName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -1735,7 +1735,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_FWDictionaryListDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getFWDictListDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("fwDictListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(FirewallDictionaryList.class, "parentItemName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -1750,7 +1750,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_FWDictionaryListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getFWDictionaryListEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("fwDictListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(FirewallDictionaryList.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -2039,7 +2039,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_TagNameByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getTagNameEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("fwTagDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(FWTag.class, "fwTagName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -2054,7 +2054,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_TagListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getTagDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("fwTagDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(FWTag.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java
index 876f380d4..dce0dd613 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java
@@ -82,7 +82,7 @@ public class MicroServiceDictionaryController {
private static String ERROR = "error";
private static String DICTIONARYDBQUERY = "dictionaryDBQuery";
private HashMap<String,MSAttributeObject > classMap;
- private List<String> modelList = new ArrayList<String>();
+ private List<String> modelList = new ArrayList<>();
@@ -93,7 +93,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_DCAEUUIDDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getDCAEUUIDDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("dcaeUUIDDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(DCAEuuid.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -108,7 +108,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_DCAEUUIDData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getDCAEUUIDDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("dcaeUUIDDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(DCAEuuid.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -239,7 +239,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceConfigNameDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceConfigNameByNameDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("microServiceCongigNameDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(MicroServiceConfigName.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -256,7 +256,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceConfigNameData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceConfigNameDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("microServiceCongigNameDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(MicroServiceConfigName.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -387,7 +387,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceLocationDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceLocationByNameDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("microServiceLocationDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(MicroServiceLocation.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -402,7 +402,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceLocationData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceLocationDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("microServiceLocationDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(MicroServiceLocation.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -533,7 +533,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceAttributeDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceAttributeByNameDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("microServiceAttributeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(MicroServiceAttribute.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -548,7 +548,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceAttributeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceAttributeDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("microServiceAttributeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(MicroServiceAttribute.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -679,7 +679,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceModelsDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceModelsDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("microServiceModelsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(MicroServiceModels.class, "modelName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -694,7 +694,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceModelsDataByVersion"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceModelsDictionaryByVersionEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
JsonNode root = mapper.readTree(request.getReader());
String modelName = null;
@@ -718,7 +718,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceModelsData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceModelsDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("microServiceModelsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(MicroServiceModels.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -737,9 +737,9 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceModelsDataServiceVersion"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceModelsDictionaryEntityDataServiceVersion(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
- List<String> data = new ArrayList<String>();
+ List<String> data = new ArrayList<>();
List<Object> datas = commonClassDao.getData(MicroServiceModels.class);
for(int i = 0; i < datas.size(); i++){
MicroServiceModels msmodel = (MicroServiceModels) datas.get(i);
@@ -765,7 +765,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceModelsDataByClass"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceModelsDictionaryClassEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("microServiceModelsDictionaryClassDatas", mapper.writeValueAsString(modelList));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -816,7 +816,7 @@ public class MicroServiceDictionaryController {
}
MSAttributeObject mainClass = null;
- classMap = new HashMap<String, MSAttributeObject>();
+ classMap = new HashMap<>();
JsonNode data = root.get("classMap");
ObjectMapper mapper1 = new ObjectMapper();
String data1 = data.toString().substring(1, data.toString().length()-1);
@@ -880,7 +880,7 @@ public class MicroServiceDictionaryController {
}
}
if(root.has("classMap")){
- classMap = new HashMap<String, MSAttributeObject>();
+ classMap = new HashMap<>();
JsonNode data = root.get("classMap");
ObjectMapper mapper1 = new ObjectMapper();
String data1 = data.toString().substring(1, data.toString().length()-1);
@@ -1024,8 +1024,8 @@ public class MicroServiceDictionaryController {
}
private ArrayList<String> getFullDependencyList(ArrayList<String> dependency) {
- ArrayList<String> returnList = new ArrayList<String>();
- ArrayList<String> workingList = new ArrayList<String>();
+ ArrayList<String> returnList = new ArrayList<>();
+ ArrayList<String> workingList = new ArrayList<>();
returnList.addAll(dependency);
for (String element : dependency ){
if (classMap.containsKey(element)){
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/PolicyScopeDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/PolicyScopeDictionaryController.java
index bfab03fa5..08635c157 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/PolicyScopeDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/PolicyScopeDictionaryController.java
@@ -75,7 +75,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_GroupPolicyScopeDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getGroupPolicyScopeEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("groupPolicyScopeListDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(GroupPolicyScopeList.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -90,7 +90,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_GroupPolicyScopeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getGroupPolicyScopeEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("groupPolicyScopeListDatas", mapper.writeValueAsString(commonClassDao.getData(GroupPolicyScopeList.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -176,7 +176,7 @@ public class PolicyScopeDictionaryController {
}
}
- ArrayList<String> valueList = new ArrayList<String>();
+ ArrayList<String> valueList = new ArrayList<>();
String list = null;
String resourceValue = groupData.getResource();
String typeValue = groupData.getType();
@@ -288,7 +288,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_PSClosedLoopDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPSClosedLoopEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("psClosedLoopDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PolicyScopeClosedLoop.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -303,7 +303,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_PSClosedLoopData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPSClosedLoopEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("psClosedLoopDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PolicyScopeClosedLoop.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -440,7 +440,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_PSServiceDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPSServiceEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("psServiceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PolicyScopeService.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -455,7 +455,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_PSServiceData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPSServiceEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("psServiceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PolicyScopeService.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -589,7 +589,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_PSTypeDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPSTypeEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("psTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PolicyScopeType.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -604,7 +604,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_PSTypeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPSTypeEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("psTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PolicyScopeType.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -744,7 +744,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_PSResourceDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPSResourceEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("psResourceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PolicyScopeResource.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -759,7 +759,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_PSResourceData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPSResourceEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("psResourceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PolicyScopeResource.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/SafePolicyController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/SafePolicyController.java
index 6f8f3db8b..42dfb88fe 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/SafePolicyController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/SafePolicyController.java
@@ -71,7 +71,7 @@ public class SafePolicyController {
org.springframework.web.bind.annotation.RequestMethod.GET }, produces = MediaType.APPLICATION_JSON_VALUE)
public void getRiskTypeDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response) {
try {
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("riskTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(RiskType.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -86,7 +86,7 @@ public class SafePolicyController {
org.springframework.web.bind.annotation.RequestMethod.GET }, produces = MediaType.APPLICATION_JSON_VALUE)
public void getEcompNameDictionaryEntityData(HttpServletRequest request, HttpServletResponse response) {
try {
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("riskTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(RiskType.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -229,7 +229,7 @@ public class SafePolicyController {
org.springframework.web.bind.annotation.RequestMethod.GET }, produces = MediaType.APPLICATION_JSON_VALUE)
public void getSafePolicyWarningEntityDataByName(HttpServletRequest request, HttpServletResponse response) {
try {
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("safePolicyWarningDatas",
mapper.writeValueAsString(commonClassDao.getDataByColumn(SafePolicyWarning.class, "name")));
@@ -245,7 +245,7 @@ public class SafePolicyController {
org.springframework.web.bind.annotation.RequestMethod.GET }, produces = MediaType.APPLICATION_JSON_VALUE)
public void getSafePolicyWarningeEntityData(HttpServletRequest request, HttpServletResponse response) {
try {
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("safePolicyWarningDatas",
mapper.writeValueAsString(commonClassDao.getData(SafePolicyWarning.class)));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java
index 256d75f4d..63c71e98f 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java
@@ -382,7 +382,7 @@ public class CommonClassDaoImpl implements CommonClassDao{
if(closedloopsdata!=null && !closedloopsdata.isEmpty()) {
LOGGER.info("ClosedLoops exist in the database, we need to delete them in our first step to buildCache().");
- for(int i=0; i > closedloopsdata.size(); i++) {
+ for(int i=0; i < closedloopsdata.size(); i++) {
ClosedLoops cl = closedloopsdata.get(i);
session.delete(cl);
}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElasticSearchPolicyUpdate.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElasticSearchPolicyUpdate.java
new file mode 100644
index 000000000..facc6e06f
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElasticSearchPolicyUpdate.java
@@ -0,0 +1,311 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.elk.client;
+
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+import com.google.gson.Gson;
+
+import io.searchbox.client.JestClientFactory;
+import io.searchbox.client.config.HttpClientConfig;
+import io.searchbox.client.http.JestHttpClient;
+import io.searchbox.core.Bulk;
+import io.searchbox.core.Bulk.Builder;
+import io.searchbox.core.BulkResult;
+import io.searchbox.core.Index;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeValueType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.MatchType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
+
+
+
+/**
+ * This code will deals with parsing the XACML content on reading from
+ * database(PolicyEntity, ConfigurationDataEntity and ActionBodyEntity tables)
+ * and convert the data into json to do bulk operation on putting to elastic search database.
+ * Which is used to support Elastic Search in Policy Application GUI to search policies.
+ *
+ *
+ *
+ * properties should be configured in policyelk.properties
+ *
+ */
+public class ElasticSearchPolicyUpdate {
+
+ private static final Logger LOGGER = FlexLogger.getLogger(ElasticSearchPolicyUpdate.class);
+ protected final static JestClientFactory jestFactory = new JestClientFactory();
+
+ public static void main(String[] args) {
+
+ String elkURL = null;
+ String databseUrl = null;
+ String userName = null;
+ String password = null;
+ String databaseDriver = null;
+
+ String propertyFile = System.getProperty("PROPERTY_FILE");
+ Properties config = new Properties();
+ Path file = Paths.get(propertyFile);
+ if(Files.notExists(file)){
+ LOGGER.error("Config File doesn't Exist in the specified Path " + file.toString());
+ }else{
+ if(file.toString().endsWith(".properties")){
+ try {
+ InputStream in = new FileInputStream(file.toFile());
+ config.load(in);
+ elkURL = config.getProperty("policy.elk.url");
+ databseUrl = config.getProperty("policy.database.url");
+ userName = config.getProperty("policy.database.username");
+ password = config.getProperty("policy.database.password");
+ databaseDriver = config.getProperty("policy.database.driver");
+ if(elkURL == null || databseUrl == null || userName == null || password == null || databaseDriver == null){
+ LOGGER.error("One of the Property is null in policyelk.properties = elkurl:databaseurl:username:password:databasedriver "
+ + elkURL + ":"+ databseUrl + ":"+ userName + ":"+ password + ":"+ databaseDriver + ":");
+ }
+ } catch (Exception e) {
+ LOGGER.error("Config File doesn't Exist in the specified Path " + file.toString());
+ }
+ }
+ }
+
+ Builder bulk = null;
+
+ HttpClientConfig httpClientConfig = new HttpClientConfig.Builder(elkURL).multiThreaded(true).build();
+ jestFactory.setHttpClientConfig(httpClientConfig);
+ JestHttpClient client = (JestHttpClient) jestFactory.getObject();
+
+ Connection conn = null;
+ Statement stmt = null;
+
+ List<Index> listIndex = new ArrayList<Index>();
+
+ try {
+ Class.forName(databaseDriver);
+ conn = DriverManager.getConnection(databseUrl, userName, password);
+ stmt = conn.createStatement();
+
+ String policyEntityQuery = "Select * from PolicyEntity";
+ ResultSet result = stmt.executeQuery(policyEntityQuery);
+
+ while(result.next()){
+ StringBuilder policyDataString = new StringBuilder("{");
+ String scope = result.getString("scope");
+ String policyName = result.getString("policyName");
+ if(policyName != null){
+ policyDataString.append("\"policyName\":\""+scope+"."+policyName+"\",");
+ }
+ String description = result.getString("description");
+ if(description != null){
+ policyDataString.append("\"policyDescription\":\""+description+"\",");
+ }
+ Object policyData = result.getString("policydata");
+
+ if(scope != null){
+ policyDataString.append("\"scope\":\""+scope+"\",");
+ }
+ String actionbodyid = result.getString("actionbodyid");
+ String configurationdataid = result.getString("configurationdataid");
+
+
+ String policyWithScopeName = scope + "." + policyName;
+ String _type = null;
+
+ if(policyWithScopeName.contains(".Config_")){
+ policyDataString.append("\"policyType\":\"Config\",");
+ if(policyWithScopeName.contains(".Config_Fault_")){
+ _type = "closedloop";
+ policyDataString.append("\"configPolicyType\":\"ClosedLoop_Fault\",");
+ }else if(policyWithScopeName.contains(".Config_PM_")){
+ _type = "closedloop";
+ policyDataString.append("\"configPolicyType\":\"ClosedLoop_PM\",");
+ }else{
+ _type = "config";
+ policyDataString.append("\"configPolicyType\":\"Base\",");
+ }
+ }else if(policyWithScopeName.contains(".Action_")){
+ _type = "action";
+ policyDataString.append("\"policyType\":\"Action\",");
+ }else if(policyWithScopeName.contains(".Decision_")){
+ _type = "decision";
+ policyDataString.append("\"policyType\":\"Decision\",");
+ }
+
+ if(!"decision".equals(_type)){
+ if(configurationdataid != null){
+ String configEntityQuery = "Select * from ConfigurationDataEntity where configurationDataId = "+configurationdataid+"";
+ Statement configstmt = conn.createStatement();
+ ResultSet configResult = configstmt.executeQuery(configEntityQuery);
+ while(configResult.next()){
+ String configBody = configResult.getString("configbody");
+ String configType = configResult.getString("configtype");
+ if("JSON".equalsIgnoreCase(configType)){
+ policyDataString.append("\"jsonBodyData\":"+configBody+",\"configType\":\""+configType+"\",");
+ }else if("OTHER".equalsIgnoreCase(configType)){
+ if(configBody!=null){
+ configBody= configBody.replaceAll("\"", "");
+ policyDataString.append("\"jsonBodyData\":\""+configBody+"\",\"configType\":\""+configType+"\",");
+ }
+ }
+ }
+ configResult.close();
+ }
+
+ if(actionbodyid != null){
+ String actionEntityQuery = "Select * from ActionBodyEntity where actionBodyId = "+actionbodyid+"";
+ Statement actionstmt = conn.createStatement();
+ ResultSet actionResult = actionstmt.executeQuery(actionEntityQuery);
+ while(actionResult.next()){
+ String actionBody = actionResult.getString("actionbody");
+ policyDataString.append("\"jsonBodyData\":"+actionBody+",");
+ }
+ actionResult.close();
+ }
+ }
+
+ String _id = policyWithScopeName;
+
+ policyDataString.append(constructPolicyData(policyData, policyDataString));
+
+ String dataString = policyDataString.toString();
+ dataString = dataString.substring(0, dataString.length()-1);
+ dataString = dataString.trim().replace(System.getProperty("line.separator"), "") + "}";
+ dataString = dataString.replace("null", "\"\"");
+ dataString = dataString.replaceAll(" ", "").replaceAll("\n", "");
+
+ try{
+ Gson gson = new Gson();
+ gson.fromJson(dataString, Object.class);
+ }catch(Exception e){
+ continue;
+ }
+
+ if("config".equals(_type)){
+ listIndex.add(new Index.Builder(dataString).index("policy").type("config").id(_id).build());
+ }else if("closedloop".equals(_type)){
+ listIndex.add(new Index.Builder(dataString).index("policy").type("closedloop").id(_id).build());
+ }else if("action".equals(_type)){
+ listIndex.add(new Index.Builder(dataString).index("policy").type("action").id(_id).build());
+ }else if("decision".equals(_type)){
+ listIndex.add(new Index.Builder(dataString).index("policy").type("decision").id(_id).build());
+ }
+ }
+
+ result.close();
+ bulk = new Bulk.Builder();
+ for(int i =0; i < listIndex.size(); i++){
+ bulk.addAction(listIndex.get(i));
+ }
+ BulkResult searchResult = client.execute(bulk.build());
+ if(searchResult.isSucceeded()){
+ LOGGER.debug("Success");
+ }else{
+ LOGGER.error("Failure");
+ }
+ } catch (Exception e) {
+ LOGGER.error("Exception Occured while performing database Operation for Elastic Search Policy Upgrade"+e);
+ }finally{
+ if(conn != null){
+ try {
+ conn.close();
+ } catch (Exception e) {
+ LOGGER.error("Exception Occured while closing the connection"+e);
+ }
+ }
+ }
+ }
+
+ private static String constructPolicyData(Object policyData, StringBuilder policyDataString){
+ if(policyData instanceof PolicyType){
+ PolicyType policy = (PolicyType) policyData;
+ TargetType target = policy.getTarget();
+ if (target != null) {
+ // Under target we have AnyOFType
+ List<AnyOfType> anyOfList = target.getAnyOf();
+ if (anyOfList != null) {
+ Iterator<AnyOfType> iterAnyOf = anyOfList.iterator();
+ while (iterAnyOf.hasNext()) {
+ AnyOfType anyOf = iterAnyOf.next();
+ // Under AnyOFType we have AllOFType
+ List<AllOfType> allOfList = anyOf.getAllOf();
+ if (allOfList != null) {
+ Iterator<AllOfType> iterAllOf = allOfList.iterator();
+ while (iterAllOf.hasNext()) {
+ AllOfType allOf = iterAllOf.next();
+ // Under AllOFType we have Match
+ List<MatchType> matchList = allOf.getMatch();
+ if (matchList != null) {
+ Iterator<MatchType> iterMatch = matchList.iterator();
+ while (iterMatch.hasNext()) {
+ MatchType match = iterMatch.next();
+ //
+ // Under the match we have attribute value and
+ // attributeDesignator. So,finally down to the actual attribute.
+ //
+ AttributeValueType attributeValue = match.getAttributeValue();
+ String value = (String) attributeValue.getContent().get(0);
+ AttributeDesignatorType designator = match.getAttributeDesignator();
+ String attributeId = designator.getAttributeId();
+ // First match in the target is EcompName, so set that value.
+ if ("ECOMPName".equals(attributeId)) {
+ policyDataString.append("\"ecompName\":\""+value+"\",");
+ }
+ if ("RiskType".equals(attributeId)){
+ policyDataString.append("\"riskType\":\""+value+"\",");
+ }
+ if ("RiskLevel".equals(attributeId)){
+ policyDataString.append("\"riskLevel\":\""+value+"\",");
+ }
+ if ("guard".equals(attributeId)){
+ policyDataString.append("\"guard\":\""+value+"\",");
+ }
+ if ("ConfigName".equals(attributeId)){
+ policyDataString.append("\"configName\":\""+value+"\",");
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return policyDataString.toString();
+ }
+
+} \ No newline at end of file
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnectorImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnectorImpl.java
index 5508ddc69..75bd725f0 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnectorImpl.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnectorImpl.java
@@ -378,7 +378,7 @@ public class ElkConnectorImpl implements ElkConnector{
result = jestClient.execute(deleteRequest);
} catch (IllegalArgumentException | IOException e) {
LOGGER.warn(XACMLErrorConstants.ERROR_SYSTEM_ERROR + ": delete:" +
- ((indexType != null) ? indexType.name() : "null") + ":" + policyData.getNewFileName() + ": " +
+ indexType + ": null" + ":" + policyData.getNewFileName() + ": " +
e.getMessage(), e);
throw new IllegalStateException(e);
}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java
index 3a87a16ca..a18a2295a 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java
@@ -198,8 +198,8 @@ public class PolicyElasticSearchController{
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
PolicyRestAdapter policyData = new PolicyRestAdapter();
PolicyElasticSearchController controller = new PolicyElasticSearchController();
- Map<String, String> searchKeyValue = new HashMap<String, String>();
- List<String> policyList = new ArrayList<String>();
+ Map<String, String> searchKeyValue = new HashMap<>();
+ List<String> policyList = new ArrayList<>();
if(request.getParameter("policyName") != null){
String policyName = request.getParameter("policyName");
policyData.setNewFileName(policyName);
@@ -340,7 +340,7 @@ public class PolicyElasticSearchController{
String dictionaryType = root.get("type").textValue();
Mode mode = Mode.valueOf(dictionaryType);
String value;
- List<String> policyList = new ArrayList<String>();
+ List<String> policyList = new ArrayList<>();
switch (mode){
case attribute :
Attribute attributedata = (Attribute)mapper.readValue(root.get("data").toString(), Attribute.class);
@@ -451,12 +451,12 @@ public class PolicyElasticSearchController{
//Search the Elk database
public List<String> searchElkDatabase(PolicyIndexType type, String key, String value){
PolicyElasticSearchController controller = new PolicyElasticSearchController();
- Map<String, String> searchKeyValue = new HashMap<String, String>();
+ Map<String, String> searchKeyValue = new HashMap<>();
if(!"pholder".equals(key)){
searchKeyValue.put(key, value);
}
- List<String> policyList = new ArrayList<String>();
+ List<String> policyList = new ArrayList<>();
JestResult policyResultList = controller.search(type, value, searchKeyValue);
if(policyResultList.isSucceeded()){
JsonArray resultObject = policyResultList.getJsonObject().get("hits").getAsJsonObject().get("hits").getAsJsonArray();
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/DeleteHandler.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/DeleteHandler.java
index 15e1faa04..ff454ade9 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/DeleteHandler.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/DeleteHandler.java
@@ -123,7 +123,14 @@ public class DeleteHandler {
}else if(policyName.contains("Decision_")){
splitPolicyName = removeVersionExtension.replace(".Decision_", ":Decision_");
}
- split = splitPolicyName.split(":");
+ if(splitPolicyName != null){
+ split = splitPolicyName.split(":");
+ }else{
+ PolicyLogger.error(MessageCodes.ERROR_UNKNOWN + "Failed to delete the policy. Please, provide the valid policyname.");
+ response.addHeader("error", "unknown");
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
+ return;
+ }
policyEntityQuery = em.createQuery("SELECT p FROM PolicyEntity p WHERE p.policyName LIKE :pName and p.scope=:pScope");
}else if(policy.getDeleteCondition().equalsIgnoreCase("Current Version")) {
if(policyName.contains("Config_")){
@@ -249,7 +256,9 @@ public class DeleteHandler {
return;
} finally {
em.close();
- con.close();
+ if(con != null){
+ con.close();
+ }
}
if (policyVersionDeleted) {
@@ -290,12 +299,16 @@ public class DeleteHandler {
PolicyEntity policyEntity = (PolicyEntity) peData;
Statement st = null;
ResultSet rs = null;
- st = con.createStatement();
- rs = st.executeQuery("Select * from PolicyGroupEntity where policyid = '"+policyEntity.getPolicyId()+"'");
- boolean gEntityList = rs.next();
- rs.close();
- if(gEntityList){
- return true;
+ try{
+ st = con.createStatement();
+ rs = st.executeQuery("Select * from PolicyGroupEntity where policyid = '"+policyEntity.getPolicyId()+"'");
+ boolean gEntityList = rs.next();
+ rs.close();
+ if(gEntityList){
+ return true;
+ }
+ }finally{
+ st.close();
}
}
return false;
@@ -392,8 +405,8 @@ public class DeleteHandler {
} catch (PAPException e1) {
PolicyLogger.error("Exception occured While Deleting Policy From PDP Group"+e1);
}
- if (group == null || ! (group instanceof StdPDPGroup) || ! (group.getId().equals(existingGroup.getId()))) {
- PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Group update had bad input. id=" + existingGroup.getId() + " objectFromJSON="+group);
+ if (group == null || ! (group instanceof StdPDPGroup) || existingGroup == null || ! (group.getId().equals(existingGroup.getId()))) {
+ PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Group update had bad input. id=" + existingGroup != null ? existingGroup.getId() : "null" + " objectFromJSON="+group);
loggingContext.transactionEnded();
PolicyLogger.audit("Transaction Failed - See Error.log");
response = "No Group";
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/SavePolicyHandler.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/SavePolicyHandler.java
index ae75ad24c..4624f74aa 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/SavePolicyHandler.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/SavePolicyHandler.java
@@ -139,7 +139,7 @@ public class SavePolicyHandler {
public void addErrorHeader(String key, String value){
if(ErrorHeaders==null){
- ErrorHeaders= new HashMap<String, String>();
+ ErrorHeaders= new HashMap<>();
}
ErrorHeaders.put(key, value);
}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/PDPPolicyContainer.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/PDPPolicyContainer.java
index 0482310ff..13a1801bd 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/PDPPolicyContainer.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/PDPPolicyContainer.java
@@ -177,7 +177,7 @@ public class PDPPolicyContainer extends PolicyItemSetChangeNotifier implements P
@Override
public Collection<?> getItemIds() {
- final Collection<Object> items = new ArrayList<Object>();
+ final Collection<Object> items = new ArrayList<>();
items.addAll(this.policies);
return Collections.unmodifiableCollection(items);
}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/RemoveGroupPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/RemoveGroupPolicy.java
index 24e2f04d4..83d0991f5 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/RemoveGroupPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/RemoveGroupPolicy.java
@@ -77,7 +77,7 @@ public class RemoveGroupPolicy {
null);
// replace the original set of Policies with the set from the container (possibly modified by the user)
- Set<PDPPolicy> changedPolicies = new HashSet<PDPPolicy>();
+ Set<PDPPolicy> changedPolicies = new HashSet<>();
changedPolicies.addAll((Collection<PDPPolicy>) RemoveGroupPolicy.policyContainer.getItemIds());
updatedGroupObject.setPolicies(changedPolicies);
updatedGroupObject.setEcompPdps(this.group.getEcompPdps());
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 46d02d94e..c21164920 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
@@ -93,8 +93,8 @@ public class PolicyCreation extends AbstractPolicyCreation{
public ResponseEntity<String> savePolicy(@RequestBody PolicyRestAdapter policyData, HttpServletResponse response) throws Exception{
String body = null;
HttpStatus status = HttpStatus.BAD_REQUEST;
- Map<String, String> successMap = new HashMap<String, String>();
- Map<String, String> attributeMap = new HashMap<String, String>();
+ Map<String, String> successMap = new HashMap<>();
+ Map<String, String> attributeMap = new HashMap<>();
PolicyVersion policyVersionDao;
try {
@@ -161,7 +161,7 @@ public class PolicyCreation extends AbstractPolicyCreation{
highestVersion = policyVersion.getHigherVersion();
}
- if(highestVersion != 0){
+ if(highestVersion != 0 && policyVersion != null){
if(policyData.isEditPolicy){
version = highestVersion +1;
if(userId ==null){
@@ -239,7 +239,7 @@ public class PolicyCreation extends AbstractPolicyCreation{
}else if (policyConfigType.equalsIgnoreCase("BRMS_Param")) {
policyData.setEcompName("DROOLS");
policyData.setConfigName("BRMS_PARAM_RULE");
- Map<String, String> drlRuleAndUIParams = new HashMap<String, String>();
+ Map<String, String> drlRuleAndUIParams = new HashMap<>();
if(policyData.getApiflag() == null){
// If there is any dynamic field create the matches here
String key="templateName";
@@ -288,10 +288,10 @@ public class PolicyCreation extends AbstractPolicyCreation{
}
}else if(policyType.equalsIgnoreCase("Action")) {
if(policyData.getApiflag() == null){
- List<String> dynamicRuleAlgorithmLabels = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmCombo = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmField1 = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmField2 = new LinkedList<String>();
+ List<String> dynamicRuleAlgorithmLabels = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmCombo = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmField1 = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmField2 = new LinkedList<>();
if(policyData.getRuleAlgorithmschoices().size() > 0){
@@ -332,13 +332,13 @@ public class PolicyCreation extends AbstractPolicyCreation{
newPolicy = new ActionPolicy(policyData);
} else if (policyType.equalsIgnoreCase("Decision")) {
if(policyData.getApiflag() == null){
- Map<String, String> settingsMap = new HashMap<String, String>();
- List<String> dynamicRuleAlgorithmLabels = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmCombo = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmField1 = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmField2 = new LinkedList<String>();
- List<Object> dynamicVariableList = new LinkedList<Object>();
- List<String> dataTypeList = new LinkedList<String>();
+ Map<String, String> settingsMap = new HashMap<>();
+ List<String> dynamicRuleAlgorithmLabels = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmCombo = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmField1 = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmField2 = new LinkedList<>();
+ List<Object> dynamicVariableList = new LinkedList<>();
+ List<String> dataTypeList = new LinkedList<>();
if(policyData.getSettings().size() > 0){
for(Object settingsData : policyData.getSettings()){
@@ -383,7 +383,15 @@ public class PolicyCreation extends AbstractPolicyCreation{
newPolicy = new DecisionPolicy(policyData);
}
- newPolicy.prepareToSave();
+ if(newPolicy != null){
+ newPolicy.prepareToSave();
+ }else{
+ body = "error";
+ status = HttpStatus.INTERNAL_SERVER_ERROR;
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ response.addHeader("error", "error");
+ return new ResponseEntity<String>(body, status);
+ }
PolicyDBDaoTransaction policyDBDaoTransaction = null;
try{
@@ -461,9 +469,10 @@ public class PolicyCreation extends AbstractPolicyCreation{
response.addHeader("error", "error");
}
}catch(Exception e){
- policyDBDaoTransaction.rollbackTransaction();
+ if(policyDBDaoTransaction != null){
+ policyDBDaoTransaction.rollbackTransaction();
+ }
}
-
}
catch (Exception e){
LOGGER.error("Exception Occured"+e);
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java
index 39a0485e8..3ff279d8d 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java
@@ -45,7 +45,7 @@ public class ImportService {
String version = request.getParameter("version");
String serviceName = request.getParameter("serviceName");
String description = request.getParameter("description");
- Map<String, String> successMap = new HashMap<String, String>();
+ Map<String, String> successMap = new HashMap<>();
switch(importServiceCreation){
case "BRMSPARAM":
StringBuilder builder = new StringBuilder();
@@ -94,19 +94,30 @@ public class ImportService {
return;
}
}else{
+ InputStream inputStream = null;
+ FileOutputStream outputStream = null;
try {
- InputStream inputStream = request.getInputStream();
- FileOutputStream outputStream = new FileOutputStream("ExtractDir" + File.separator + randomID+".zip");
+ inputStream = request.getInputStream();
+ outputStream = new FileOutputStream("ExtractDir" + File.separator + randomID+".zip");
byte[] buffer = new byte[4096];
int bytesRead = -1 ;
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead) ;
}
- outputStream.close() ;
- inputStream.close() ;
} catch (IOException e) {
PolicyLogger.error("Error in reading in Zip File from API call");
return;
+ }finally{
+ try {
+ if(inputStream != null){
+ inputStream.close();
+ }
+ if(outputStream != null){
+ outputStream.close();
+ }
+ } catch (IOException e) {
+ PolicyLogger.error("Exception Occured while closing the input/output stream"+e);
+ }
}
}
newMS = new CreateNewMicroSerivceModel(fileName, serviceName, "API", version, randomID);
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/MetricService.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/MetricService.java
index 21a630125..97e53e8eb 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/MetricService.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/MetricService.java
@@ -38,7 +38,7 @@ import com.att.research.xacml.api.pap.PDPPolicy;
public class MetricService {
public static void doGetPolicyMetrics(HttpServletRequest request, HttpServletResponse response) {
- Set<EcompPDPGroup> groups = new HashSet<EcompPDPGroup>();
+ Set<EcompPDPGroup> groups = new HashSet<>();
try {
//get the count of policies on the PDP
if(XACMLPapServlet.getPAPEngine()!=null){
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/util/JPAUtils.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/util/JPAUtils.java
index 397c30594..9a23beed3 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/util/JPAUtils.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/util/JPAUtils.java
@@ -159,8 +159,8 @@ public class JPAUtils {
}
private void buildFunctionMaps() throws ServletException {
- mapDatatype2Function = new HashMap<Datatype, List<FunctionDefinition>>();
- mapID2Function = new HashMap<String, FunctionDefinition>();
+ mapDatatype2Function = new HashMap<>();
+ mapID2Function = new HashMap<>();
EntityManager em = emf.createEntityManager();
Query getFunctionDefinitions = em.createNamedQuery("FunctionDefinition.findAll");
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/CheckPDP.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/CheckPDP.java
index 7b88569fe..c1a1907c0 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/CheckPDP.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/CheckPDP.java
@@ -109,7 +109,7 @@ public class CheckPDP {
throw new Exception("Cannot Load the Properties file", e);
}
// Read the Properties and Load the PDPs and encoding.
- pdpMap = new HashMap<String, String>();
+ pdpMap = new HashMap<>();
// Check the Keys for PDP_URLs
Collection<Object> unsorted = pdpProp.keySet();
List<String> sorted = new ArrayList(unsorted);
@@ -121,7 +121,7 @@ public class CheckPDP {
throw new Exception("Properties file doesn't have the PDP_URL parameter");
}
if (check_val.contains(";")) {
- List<String> pdp_default = new ArrayList<String>(Arrays.asList(check_val.split("\\s*;\\s*")));
+ List<String> pdp_default = new ArrayList<>(Arrays.asList(check_val.split("\\s*;\\s*")));
int pdpCount = 0;
while (pdpCount < pdp_default.size()) {
String pdpVal = pdp_default.get(pdpCount);
@@ -141,7 +141,7 @@ public class CheckPDP {
private static void readPDPParam(String pdpVal) throws Exception{
if(pdpVal.contains(",")){
- List<String> pdpValues = new ArrayList<String>(Arrays.asList(pdpVal.split("\\s*,\\s*")));
+ List<String> pdpValues = new ArrayList<>(Arrays.asList(pdpVal.split("\\s*,\\s*")));
if(pdpValues.size()==3){
// 1:2 will be UserID:Password
String userID = pdpValues.get(1);
diff --git a/ECOMP-PAP-REST/src/main/resources/logback.xml b/ECOMP-PAP-REST/src/main/resources/logback.xml
index b119a4e3b..d406431db 100644
--- a/ECOMP-PAP-REST/src/main/resources/logback.xml
+++ b/ECOMP-PAP-REST/src/main/resources/logback.xml
@@ -29,7 +29,7 @@
<!-- specify the component name
<ECOMP-component-name>::= "MSO" | "DCAE" | "ASDC " | "AAI" |"Policy" | "SDNC" | "AC" -->
<property name="componentName" value="Policy"></property>
- <property name="subComponentName" value="XACML-PAP-REST"></property>
+ <property name="subComponentName" value="ECOMP-PAP-REST"></property>
<!-- log file names -->
<property name="errorLogName" value="error" />
@@ -206,7 +206,7 @@
<maxIndex>9</maxIndex>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>INFO</level>
+ <level>DEBUG</level>
</filter>
<triggeringPolicy
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
diff --git a/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/ia/DbAuditCompareEntriesTest.java b/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/ia/DbAuditCompareEntriesTest.java
index 6ab3d3588..d3b5cbbea 100644
--- a/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/ia/DbAuditCompareEntriesTest.java
+++ b/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/ia/DbAuditCompareEntriesTest.java
@@ -181,8 +181,8 @@ public class DbAuditCompareEntriesTest {
dbAudit.writeAuditDebugLog(className, resourceName1, resourceName2, entry1, entry2);
- HashMap<Object, Object> myEntries = new HashMap<Object, Object>();
- HashMap<Object, Object> theirEntries = new HashMap<Object, Object>();
+ HashMap<Object, Object> myEntries = new HashMap<>();
+ HashMap<Object, Object> theirEntries = new HashMap<>();
myEntries.put("pdp1", entry1);
theirEntries.put("pdp1", entry2);
@@ -205,8 +205,8 @@ public class DbAuditCompareEntriesTest {
*/
entry2.setDesignated(true);
- myEntries = new HashMap<Object, Object>();
- theirEntries = new HashMap<Object, Object>();
+ myEntries = new HashMap<>();
+ theirEntries = new HashMap<>();
myEntries.put("pdp1", entry1);
theirEntries.put("pdp1", entry2);
@@ -240,8 +240,8 @@ public class DbAuditCompareEntriesTest {
// Clone the first entry
entry2 = SerializationUtils.clone(entry1);
- HashMap<Object, Object> myEntries = new HashMap<Object, Object>();
- HashMap<Object, Object> theirEntries = new HashMap<Object, Object>();
+ HashMap<Object, Object> myEntries = new HashMap<>();
+ HashMap<Object, Object> theirEntries = new HashMap<>();
myEntries.put("pdp1", entry1);
theirEntries.put("pdp1", entry2);
@@ -264,8 +264,8 @@ public class DbAuditCompareEntriesTest {
entry2.setFlag("flag2");
- myEntries = new HashMap<Object, Object>();
- theirEntries = new HashMap<Object, Object>();
+ myEntries = new HashMap<>();
+ theirEntries = new HashMap<>();
myEntries.put("pdp1", entry1);
theirEntries.put("pdp1", entry2);
@@ -300,8 +300,8 @@ public class DbAuditCompareEntriesTest {
// Clone the first entry
entry2 = SerializationUtils.clone(entry1);
- HashMap<Object, Object> myEntries = new HashMap<Object, Object>();
- HashMap<Object, Object> theirEntries = new HashMap<Object, Object>();
+ HashMap<Object, Object> myEntries = new HashMap<>();
+ HashMap<Object, Object> theirEntries = new HashMap<>();
myEntries.put("pdp1", entry1);
theirEntries.put("pdp1", entry2);
@@ -324,8 +324,8 @@ public class DbAuditCompareEntriesTest {
entry2.setAdminState("unlocked");
- myEntries = new HashMap<Object, Object>();
- theirEntries = new HashMap<Object, Object>();
+ myEntries = new HashMap<>();
+ theirEntries = new HashMap<>();
myEntries.put("pdp1", entry1);
theirEntries.put("pdp1", entry2);
@@ -379,8 +379,8 @@ public class DbAuditCompareEntriesTest {
entry2.setFpcCount(321L);
- myEntries = new HashMap<Object, Object>();
- theirEntries = new HashMap<Object, Object>();
+ myEntries = new HashMap<>();
+ theirEntries = new HashMap<>();
myEntries.put("pdp1", entry1);
theirEntries.put("pdp1", entry2);
@@ -414,8 +414,8 @@ public class DbAuditCompareEntriesTest {
// Clone the first entry
entry2 = SerializationUtils.clone(entry1);
- HashMap<Object, Object> myEntries = new HashMap<Object, Object>();
- HashMap<Object, Object> theirEntries = new HashMap<Object, Object>();
+ HashMap<Object, Object> myEntries = new HashMap<>();
+ HashMap<Object, Object> theirEntries = new HashMap<>();
myEntries.put("pdp1", entry1);
theirEntries.put("pdp1", entry2);
@@ -436,8 +436,8 @@ public class DbAuditCompareEntriesTest {
entry2.setSite("site_1a");
- myEntries = new HashMap<Object, Object>();
- theirEntries = new HashMap<Object, Object>();
+ myEntries = new HashMap<>();
+ theirEntries = new HashMap<>();
myEntries.put("pdp1", entry1);
theirEntries.put("pdp1", entry2);