aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PAP-REST/src/main/java/org/onap
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2017-08-24 11:13:30 +0000
committerGerrit Code Review <gerrit@onap.org>2017-08-24 11:13:30 +0000
commit6f2b3f2dd0e80895acd0f77aa5784e717be33696 (patch)
tree121317a88f00af85bfccc9a521158384d0103343 /ONAP-PAP-REST/src/main/java/org/onap
parent7ea81288603904f0cb6f57936da44d6a3dd521a6 (diff)
parent7925630b5edc79119f29392edc6ddc84cf7c3757 (diff)
Merge "Sonar fix forONAP-PAP-REST critical sonar issues"
Diffstat (limited to 'ONAP-PAP-REST/src/main/java/org/onap')
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ActionPolicyDictionaryController.java14
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/BRMSDictionaryController.java22
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java26
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java10
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DescriptiveDictionaryController.java6
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DictionaryController.java10
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DictionaryImportController.java4
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/EnforcerDictionaryController.java7
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java61
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java47
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/PolicyScopeDictionaryController.java34
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/PushPolicyController.java2
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/SafePolicyController.java17
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java6
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/ElasticSearchPolicyUpdate.java20
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/ElkConnectorImpl.java1
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java9
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/APIRequestHandler.java3
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java19
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandler.java7
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/PushPolicyHandler.java7
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/SavePolicyHandler.java9
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/model/PDPPolicyContainer.java10
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java3
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/DictionaryService.java599
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/ImportService.java8
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/JPAUtils.java12
27 files changed, 294 insertions, 679 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ActionPolicyDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ActionPolicyDictionaryController.java
index f7a170131..85890fc43 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ActionPolicyDictionaryController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ActionPolicyDictionaryController.java
@@ -20,7 +20,9 @@
package org.onap.policy.pap.xacml.rest.controller;
+import java.io.IOException;
import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@@ -78,7 +80,7 @@ public class ActionPolicyDictionaryController {
response.getWriter().write(j.toString());
}
catch (Exception e){
- LOGGER.error(e.getMessage());
+ LOGGER.error(e.getMessage(),e);
}
}
@@ -95,14 +97,14 @@ public class ActionPolicyDictionaryController {
response.getWriter().write(j.toString());
}
catch (Exception e){
- LOGGER.error(e.getMessage());
+ LOGGER.error(e.getMessage(),e);
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.addHeader("error", "dictionaryDBQuery");
}
}
@RequestMapping(value={"/action_dictionary/save_ActionDict"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveActionPolicyDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveActionPolicyDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -208,7 +210,7 @@ public class ActionPolicyDictionaryController {
}
}
catch (Exception e){
- LOGGER.error(e.getMessage());
+ LOGGER.error(e.getMessage(),e);
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
@@ -218,7 +220,7 @@ public class ActionPolicyDictionaryController {
}
@RequestMapping(value={"/action_dictionary/remove_actionPolicyDict"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeActionPolicyDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeActionPolicyDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -238,7 +240,7 @@ public class ActionPolicyDictionaryController {
return null;
}
catch (Exception e){
- LOGGER.error(e.getMessage());
+ LOGGER.error(e.getMessage(),e);
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/BRMSDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/BRMSDictionaryController.java
index 26d3ccfff..a459adaec 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/BRMSDictionaryController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/BRMSDictionaryController.java
@@ -20,8 +20,10 @@
package org.onap.policy.pap.xacml.rest.controller;
+import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.HashMap;
@@ -112,7 +114,7 @@ public class BRMSDictionaryController{
}
@RequestMapping(value={"/brms_dictionary/set_BRMSParamData"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public void SetRuleData(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public void SetRuleData(HttpServletRequest request, HttpServletResponse response) throws IOException{
StringWriter writer = new StringWriter();
IOUtils.copy(request.getInputStream() , writer, StandardCharsets.UTF_8);
String cleanStreamBoundary = writer.toString().replaceFirst("------(.*)(?s).*octet-stream", "");
@@ -120,7 +122,7 @@ public class BRMSDictionaryController{
}
@RequestMapping(value={"/brms_dictionary/save_BRMSParam"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveBRMSParamDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveBRMSParamDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try {
boolean duplicateflag = false;
boolean fromAPI = false;
@@ -192,7 +194,7 @@ public class BRMSDictionaryController{
}
}
catch (Exception e){
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+ LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW , e);
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
@@ -202,7 +204,7 @@ public class BRMSDictionaryController{
}
@RequestMapping(value={"/brms_dictionary/remove_brmsParam"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeBRMSParamDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeBRMSParamDictionary(HttpServletRequest request, HttpServletResponse response)throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -266,7 +268,7 @@ public class BRMSDictionaryController{
}
@RequestMapping(value={"/brms_dictionary/save_BRMSDependencyData"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveBRMSDependencyDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveBRMSDependencyDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try {
boolean duplicateflag = false;
LOGGER.debug("DictionaryController: saveBRMSDependencyDictionary() is called");
@@ -308,7 +310,7 @@ public class BRMSDictionaryController{
try{
dependency = PolicyUtils.jsonStringToObject(brmsDependency.getDependency(), PEDependency.class);
}catch(Exception e){
- LOGGER.error(XACMLErrorConstants.ERROR_SCHEMA_INVALID + "wrong data given for BRMS PEDependency Dictionary : " + brmsDependency.getDependency());
+ LOGGER.error(XACMLErrorConstants.ERROR_SCHEMA_INVALID + "wrong data given for BRMS PEDependency Dictionary : " + brmsDependency.getDependency(),e);
}
if(dependency==null){
responseString = "Error";
@@ -363,7 +365,7 @@ public class BRMSDictionaryController{
}
@RequestMapping(value={"/brms_dictionary/remove_brmsDependency"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeBRMSDependencyDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeBRMSDependencyDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -425,7 +427,7 @@ public class BRMSDictionaryController{
}
@RequestMapping(value={"/brms_dictionary/save_BRMSControllerData"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveBRMSControllerDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveBRMSControllerDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
LOGGER.debug("DictionaryController: saveBRMSControllerDictionary() is called");
@@ -461,7 +463,7 @@ public class BRMSDictionaryController{
try{
dependency = PolicyUtils.jsonStringToObject(brmsController.getController(), PEDependency.class);
}catch(Exception e){
- LOGGER.error(XACMLErrorConstants.ERROR_SCHEMA_INVALID + "wrong data given for BRMS Controller Dictionary : " + brmsController.getController());
+ LOGGER.error(XACMLErrorConstants.ERROR_SCHEMA_INVALID + "wrong data given for BRMS Controller Dictionary : " + brmsController.getController(),e);
}
if(dependency==null){
responseString = "Error";
@@ -515,7 +517,7 @@ public class BRMSDictionaryController{
}
@RequestMapping(value={"/brms_dictionary/remove_brmsController"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeBRMSControllerDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeBRMSControllerDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
index 75345f99c..a2a6d6e70 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
@@ -20,7 +20,9 @@
package org.onap.policy.pap.xacml.rest.controller;
+import java.io.IOException;
import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
@@ -282,7 +284,7 @@ public class ClosedLoopDictionaryController{
}
@RequestMapping(value={"/cl_dictionary/save_vsclAction"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveVSCLAction(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveVSCLAction(HttpServletRequest request, HttpServletResponse response)throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -376,7 +378,7 @@ public class ClosedLoopDictionaryController{
}
@RequestMapping(value={"/cl_dictionary/remove_VsclAction"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeVSCLAction(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeVSCLAction(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -406,7 +408,7 @@ public class ClosedLoopDictionaryController{
}
@RequestMapping(value={"/cl_dictionary/save_vnfType"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveVnfType(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveVnfType(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -498,7 +500,7 @@ public class ClosedLoopDictionaryController{
}
@RequestMapping(value={"/cl_dictionary/remove_vnfType"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeVnfType(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeVnfType(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -528,7 +530,7 @@ public class ClosedLoopDictionaryController{
}
@RequestMapping(value={"/cl_dictionary/save_pepOptions"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView savePEPOptions(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView savePEPOptions(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -639,7 +641,7 @@ public class ClosedLoopDictionaryController{
}
@RequestMapping(value={"/cl_dictionary/remove_pepOptions"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removePEPOptions(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removePEPOptions(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -669,7 +671,7 @@ public class ClosedLoopDictionaryController{
}
@RequestMapping(value={"/cl_dictionary/save_service"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveServiceType(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveServiceType(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -758,7 +760,7 @@ public class ClosedLoopDictionaryController{
}
@RequestMapping(value={"/cl_dictionary/remove_Service"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeServiceType(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeServiceType(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -788,7 +790,7 @@ public class ClosedLoopDictionaryController{
}
@RequestMapping(value={"/cl_dictionary/save_siteName"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveSiteType(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveSiteType(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -878,7 +880,7 @@ public class ClosedLoopDictionaryController{
}
@RequestMapping(value={"/cl_dictionary/remove_site"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeSiteType(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeSiteType(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -908,7 +910,7 @@ public class ClosedLoopDictionaryController{
}
@RequestMapping(value={"/cl_dictionary/save_varbind"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveVarbind(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveVarbind(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -998,7 +1000,7 @@ public class ClosedLoopDictionaryController{
}
@RequestMapping(value={"/cl_dictionary/remove_varbindDict"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeVarbind(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeVarbind(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java
index ac19b99a2..3ae9a465d 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java
@@ -20,7 +20,9 @@
package org.onap.policy.pap.xacml.rest.controller;
+import java.io.IOException;
import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@@ -106,7 +108,7 @@ public class DecisionPolicyDictionaryController {
}
@RequestMapping(value={"/decision_dictionary/save_Settings"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveSettingsDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveSettingsDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -214,7 +216,7 @@ public class DecisionPolicyDictionaryController {
}
@RequestMapping(value={"/settings_dictionary/remove_settings"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeSettingsDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeSettingsDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -281,7 +283,7 @@ public class DecisionPolicyDictionaryController {
}
@RequestMapping(value={"/decision_dictionary/save_RainyDay"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveRainyDayDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveRainyDayDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -382,7 +384,7 @@ public class DecisionPolicyDictionaryController {
}
@RequestMapping(value={"/decision_dictionary/remove_rainyDay"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeRainyDayDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeRainyDayDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DescriptiveDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DescriptiveDictionaryController.java
index 1811223e6..b5973d732 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DescriptiveDictionaryController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DescriptiveDictionaryController.java
@@ -20,7 +20,9 @@
package org.onap.policy.pap.xacml.rest.controller;
+import java.io.IOException;
import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
@@ -103,7 +105,7 @@ public class DescriptiveDictionaryController {
}
@RequestMapping(value={"/descriptive_dictionary/save_descriptive"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveDescriptiveDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveDescriptiveDictionary(HttpServletRequest request, HttpServletResponse response)throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -214,7 +216,7 @@ public class DescriptiveDictionaryController {
}
@RequestMapping(value={"/descriptive_dictionary/remove_descriptiveScope"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeDescriptiveDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeDescriptiveDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DictionaryController.java
index d16de1f9c..db6acc82c 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DictionaryController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DictionaryController.java
@@ -20,7 +20,9 @@
package org.onap.policy.pap.xacml.rest.controller;
+import java.io.IOException;
import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@@ -122,7 +124,7 @@ public class DictionaryController {
}
@RequestMapping(value={"/attribute_dictionary/save_attribute"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveAttributeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveAttributeDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -248,7 +250,7 @@ public class DictionaryController {
}
@RequestMapping(value={"/attribute_dictionary/remove_attribute"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeAttributeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeAttributeDictionary(HttpServletRequest request, HttpServletResponse response)throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -312,7 +314,7 @@ public class DictionaryController {
}
@RequestMapping(value={"/onap_dictionary/save_onapName"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveOnapDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveOnapDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -402,7 +404,7 @@ public class DictionaryController {
}
@RequestMapping(value={"/onap_dictionary/remove_onap"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeOnapDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeOnapDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DictionaryImportController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DictionaryImportController.java
index 12851917a..719d8dafa 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DictionaryImportController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DictionaryImportController.java
@@ -26,7 +26,9 @@ package org.onap.policy.pap.xacml.rest.controller;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
+import java.io.IOException;
import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
@@ -81,7 +83,7 @@ public class DictionaryImportController {
@RequestMapping(value={"/dictionary/import_dictionary"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public void ImportDictionaryData(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public void ImportDictionaryData(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
//JsonNode root = mapper.readTree(request.getReader());
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/EnforcerDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/EnforcerDictionaryController.java
index f0389fcde..6c5d3a9e3 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/EnforcerDictionaryController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/EnforcerDictionaryController.java
@@ -20,7 +20,9 @@
package org.onap.policy.pap.xacml.rest.controller;
+import java.io.IOException;
import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -75,7 +77,7 @@ public class EnforcerDictionaryController {
}
@RequestMapping(value={"/enforcer_dictionary/save_enforcerType"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveEnforcerDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveEnforcerDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -103,12 +105,13 @@ public class EnforcerDictionaryController {
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
out.write(e.getMessage());
+ LOGGER.error(e);
}
return null;
}
@RequestMapping(value={"/enforcer_dictionary/remove_enforcer"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeEnforcerDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeEnforcerDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java
index ee2d1d622..d4594c020 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java
@@ -20,7 +20,9 @@
package org.onap.policy.pap.xacml.rest.controller;
+import java.io.IOException;
import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Date;
@@ -113,14 +115,14 @@ public class FirewallDictionaryController {
response.getWriter().write(j.toString());
}
catch (Exception e){
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+ LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW, e);
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.addHeader("error", "dictionaryDBQuery");
}
}
@RequestMapping(value={"/fw_dictionary/save_prefixList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView savePrefixListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView savePrefixListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -192,7 +194,7 @@ public class FirewallDictionaryController {
return null;
}
}catch (Exception e){
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+ LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW, e);
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
@@ -202,7 +204,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/remove_PrefixList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removePrefixListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removePrefixListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -230,7 +232,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/validate_prefixList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView validatePrefixListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView validatePrefixListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -240,6 +242,7 @@ public class FirewallDictionaryController {
try{
CIDR.newCIDR(prefixList.getPrefixListValue());
}catch(UnknownHostException e){
+ LOGGER.error(e);
responseValidation = "error";
}
response.setCharacterEncoding("UTF-8");
@@ -281,7 +284,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/save_portName"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView savePortListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView savePortListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
ObjectMapper mapper = new ObjectMapper();
@@ -326,7 +329,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/remove_PortList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removePortListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removePortListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -388,7 +391,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/save_protocolList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveProtocolListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveProtocolListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -470,7 +473,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/remove_protocol"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeProtocolListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeProtocolListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -533,7 +536,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/save_addressGroup"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveAddressGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveAddressGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -641,7 +644,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/remove_AddressGroup"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeAddressGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeAddressGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -710,7 +713,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/save_ActionList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveActionListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveActionListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -792,7 +795,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/remove_ActionList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeActionListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeActionListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -854,7 +857,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/save_serviceGroup"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveServiceGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveServiceGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -963,7 +966,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/remove_serviceGroup"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeServiceGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeServiceGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -1027,7 +1030,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/save_securityZone"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveSecurityZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveSecurityZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -1110,7 +1113,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/remove_securityZone"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeSecurityZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeSecurityZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -1175,7 +1178,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/save_serviceList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveServiceListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveServiceListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -1292,7 +1295,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/remove_serviceList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeServiceListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeServiceListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -1354,7 +1357,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/save_zoneName"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -1436,7 +1439,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/remove_zone"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -1500,7 +1503,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/save_termList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveTermListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveTermListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -1704,7 +1707,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/remove_termList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeTermListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeTermListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -1768,7 +1771,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/save_FWDictionaryList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveFWDictionaryList(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveFWDictionaryList(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
ObjectMapper mapper = new ObjectMapper();
@@ -1844,7 +1847,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/remove_FWDictionaryList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeFWDictionaryListy(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeFWDictionaryListy(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -1905,7 +1908,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/save_fwTagPicker"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveFirewallTagPickerDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveFirewallTagPickerDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean fromAPI = false;
@@ -2010,7 +2013,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/remove_tagPicker"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeFirewallTagPickerDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeFirewallTagPickerDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -2069,7 +2072,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/save_fwTag"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveFirewallTagDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveFirewallTagDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean fromAPI = false;
@@ -2172,7 +2175,7 @@ public class FirewallDictionaryController {
}
@RequestMapping(value={"/fw_dictionary/remove_tagList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeFirewallTagDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeFirewallTagDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java
index 621f0c474..526e28649 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java
@@ -20,7 +20,9 @@
package org.onap.policy.pap.xacml.rest.controller;
+import java.io.IOException;
import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -124,12 +126,12 @@ public class MicroServiceDictionaryController {
catch (Exception e){
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.addHeader(ERROR, DICTIONARYDBQUERY);
- LOGGER.error(e.getMessage());
+ LOGGER.error(e);
}
}
@RequestMapping(value={"/ms_dictionary/save_dcaeUUID"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveDCAEUUIDDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveDCAEUUIDDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -205,12 +207,13 @@ public class MicroServiceDictionaryController {
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
out.write(e.getMessage());
+ LOGGER.error(e);
}
return null;
}
@RequestMapping(value={"/ms_dictionary/remove_dcaeuuid"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeDCAEUUIDDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeDCAEUUIDDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -272,12 +275,12 @@ public class MicroServiceDictionaryController {
catch (Exception e){
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.addHeader(ERROR, DICTIONARYDBQUERY);
- LOGGER.error(e.getMessage());
+ LOGGER.error(e);
}
}
@RequestMapping(value={"/ms_dictionary/save_configName"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveMicroServiceConfigNameDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveMicroServiceConfigNameDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -354,12 +357,13 @@ public class MicroServiceDictionaryController {
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
out.write(e.getMessage());
+ LOGGER.error(e);
}
return null;
}
@RequestMapping(value={"/ms_dictionary/remove_msConfigName"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeMicroServiceConfigNameDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeMicroServiceConfigNameDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -418,12 +422,12 @@ public class MicroServiceDictionaryController {
catch (Exception e){
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.addHeader(ERROR, DICTIONARYDBQUERY);
- LOGGER.error(e.getMessage());
+ LOGGER.error(e);
}
}
@RequestMapping(value={"/ms_dictionary/save_location"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveMicroServiceLocationDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveMicroServiceLocationDictionary(HttpServletRequest request, HttpServletResponse response)throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -500,12 +504,13 @@ public class MicroServiceDictionaryController {
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
out.write(e.getMessage());
+ LOGGER.error(e);
}
return null;
}
@RequestMapping(value={"/ms_dictionary/remove_msLocation"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeMicroServiceLocationDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeMicroServiceLocationDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -545,7 +550,7 @@ public class MicroServiceDictionaryController {
response.getWriter().write(j.toString());
}
catch (Exception e){
- LOGGER.error(e.getMessage());
+ LOGGER.error(e);
}
}
@@ -565,12 +570,12 @@ public class MicroServiceDictionaryController {
catch (Exception e){
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.addHeader(ERROR, DICTIONARYDBQUERY);
- LOGGER.error(e.getMessage());
+ LOGGER.error(e);
}
}
@RequestMapping(value={"/ms_dictionary/save_modelAttribute"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveMicroServiceAttributeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveMicroServiceAttributeDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean fromAPI = false;
@@ -645,12 +650,13 @@ public class MicroServiceDictionaryController {
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
out.write(e.getMessage());
+ LOGGER.error(e);
}
return null;
}
@RequestMapping(value={"/ms_dictionary/remove_modelAttribute"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeMicroServiceAttributeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeMicroServiceAttributeDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -670,7 +676,7 @@ public class MicroServiceDictionaryController {
return null;
}
catch (Exception e){
- LOGGER.error(e.getMessage());
+ LOGGER.error(e);
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
@@ -691,7 +697,7 @@ public class MicroServiceDictionaryController {
response.getWriter().write(j.toString());
}
catch (Exception e){
- LOGGER.error(e.getMessage());
+ LOGGER.error(e);
}
}
@@ -715,7 +721,7 @@ public class MicroServiceDictionaryController {
response.getWriter().write(j.toString());
}
catch (Exception e){
- LOGGER.error(e.getMessage());
+ LOGGER.error(e);
}
}
@@ -734,7 +740,7 @@ public class MicroServiceDictionaryController {
catch (Exception e){
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.addHeader(ERROR, DICTIONARYDBQUERY);
- LOGGER.error(e.getMessage());
+ LOGGER.error(e);
}
}
@@ -782,12 +788,12 @@ public class MicroServiceDictionaryController {
catch (Exception e){
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.addHeader(ERROR, DICTIONARYDBQUERY);
- LOGGER.error(e.getMessage());
+ LOGGER.error(e);
}
}
@RequestMapping(value={"/ms_dictionary/save_model"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveMicroServiceModelsDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView saveMicroServiceModelsDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean fromAPI = false;
@@ -953,12 +959,13 @@ public class MicroServiceDictionaryController {
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
out.write(e.getMessage());
+ LOGGER.error(e);
}
return null;
}
@RequestMapping(value={"/ms_dictionary/remove_msModel"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removeMicroServiceModelsDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removeMicroServiceModelsDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/PolicyScopeDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/PolicyScopeDictionaryController.java
index c2dcbc651..44ab4a3f6 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/PolicyScopeDictionaryController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/PolicyScopeDictionaryController.java
@@ -20,7 +20,9 @@
package org.onap.policy.pap.xacml.rest.controller;
+import java.io.IOException;
import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -107,7 +109,7 @@ public class PolicyScopeDictionaryController {
}
@RequestMapping(value={"/ps_dictionary/save_psGroupPolicyScope"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView savePSGroupScopeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView savePSGroupScopeDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -133,6 +135,7 @@ public class PolicyScopeDictionaryController {
groupData.setClosedloop(root.get("dictionaryFields").get("closedloop").toString().replace("\"", ""));
groupData.setService(root.get("dictionaryFields").get("service").toString().replace("\"", ""));
groupData.setType(root.get("dictionaryFields").get("type").toString().replace("\"", ""));
+ LOGGER.error(e);
}
if(!gpdata.getGroupName().startsWith("PolicyScope")){
@@ -164,6 +167,7 @@ public class PolicyScopeDictionaryController {
try{
groupData = (GroupPolicyScope)mapper.readValue(root.get("groupPolicyScopeListData1").toString(), GroupPolicyScope.class);
}catch(Exception e){
+ LOGGER.error(e);
groupData = new GroupPolicyScope();
groupData.setResource(root.get("groupPolicyScopeListData1").get("resource").toString().replace("\"", ""));
groupData.setClosedloop(root.get("groupPolicyScopeListData1").get("closedloop").toString().replace("\"", ""));
@@ -247,16 +251,18 @@ public class PolicyScopeDictionaryController {
return null;
}
}catch (Exception e){
+ LOGGER.error(e);
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
out.write(e.getMessage());
+
}
return null;
}
@RequestMapping(value={"/ps_dictionary/remove_GroupPolicyScope"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removePSGroupScopeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removePSGroupScopeDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -320,7 +326,7 @@ public class PolicyScopeDictionaryController {
}
@RequestMapping(value={"/ps_dictionary/save_psClosedLoop"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView savePSClosedLoopDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView savePSClosedLoopDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -403,12 +409,13 @@ public class PolicyScopeDictionaryController {
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
out.write(e.getMessage());
+ LOGGER.error(e);
}
return null;
}
@RequestMapping(value={"/ps_dictionary/remove_PSClosedLoop"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removePSClosedLoopDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removePSClosedLoopDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -472,7 +479,7 @@ public class PolicyScopeDictionaryController {
}
@RequestMapping(value={"/ps_dictionary/save_psService"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView savePSServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView savePSServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -552,12 +559,13 @@ public class PolicyScopeDictionaryController {
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
out.write(e.getMessage());
+ LOGGER.error(e);
}
return null;
}
@RequestMapping(value={"/ps_dictionary/remove_PSService"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removePSServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removePSServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -621,7 +629,7 @@ public class PolicyScopeDictionaryController {
}
@RequestMapping(value={"/ps_dictionary/save_psType"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView savePSTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView savePSTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -707,12 +715,13 @@ public class PolicyScopeDictionaryController {
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
out.write(e.getMessage());
+ LOGGER.error(e);
}
return null;
}
@RequestMapping(value={"/ps_dictionary/remove_PSType"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removePSTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removePSTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -769,14 +778,15 @@ public class PolicyScopeDictionaryController {
response.getWriter().write(j.toString());
}
catch (Exception e){
+ LOGGER.error(e);
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.addHeader("error", "dictionaryDBQuery");
- LOGGER.error(e);
+
}
}
@RequestMapping(value={"/ps_dictionary/save_psResource"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView savePSResourceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView savePSResourceDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -855,16 +865,18 @@ public class PolicyScopeDictionaryController {
}
}catch (Exception e){
+ LOGGER.error(e);
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
out.write(e.getMessage());
+
}
return null;
}
@RequestMapping(value={"/ps_dictionary/remove_PSResource"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removePSResourceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public ModelAndView removePSResourceDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/PushPolicyController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/PushPolicyController.java
index a545bb409..ace67a1e9 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/PushPolicyController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/PushPolicyController.java
@@ -156,7 +156,7 @@ public class PushPolicyController {
// Create the policy Object
selectedPolicy = new StdPDPPolicy(policyName, true, policyID, selectedURI);
} catch (IOException e) {
- LOGGER.error("Unable to create policy '" + policyName + "': "+ e.getMessage());
+ LOGGER.error("Unable to create policy '" + policyName + "': "+ e.getMessage(),e);
}
try {
new ObjectOutputStream(response.getOutputStream()).writeObject(selectedPolicy);
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/SafePolicyController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/SafePolicyController.java
index fad6a871f..f994cbacb 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/SafePolicyController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/SafePolicyController.java
@@ -20,7 +20,9 @@
package org.onap.policy.pap.xacml.rest.controller;
+import java.io.IOException;
import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -96,7 +98,7 @@ public class SafePolicyController {
response.addHeader("operation", "getDictionary");
response.getWriter().write(j.toString());
} catch (Exception e) {
- LOGGER.error(e.getMessage());
+ LOGGER.error(e);
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.addHeader("error", "dictionaryDBQuery");
}
@@ -105,7 +107,7 @@ public class SafePolicyController {
@RequestMapping(value = { "/sp_dictionary/save_riskType" }, method = {
org.springframework.web.bind.annotation.RequestMethod.POST })
public ModelAndView saveRiskTypeDictionary(HttpServletRequest request, HttpServletResponse response)
- throws Exception {
+ throws UnsupportedEncodingException, IOException {
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -189,6 +191,7 @@ public class SafePolicyController {
return null;
}
}catch (Exception e) {
+ LOGGER.error(e);
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
@@ -200,7 +203,7 @@ public class SafePolicyController {
@RequestMapping(value = { "/sp_dictionary/remove_riskType" }, method = {
org.springframework.web.bind.annotation.RequestMethod.POST })
public ModelAndView removeOnapDictionary(HttpServletRequest request, HttpServletResponse response)
- throws Exception {
+ throws UnsupportedEncodingException, IOException{
try {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -219,6 +222,7 @@ public class SafePolicyController {
return null;
} catch (Exception e) {
+ LOGGER.error(e);
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
@@ -257,16 +261,16 @@ public class SafePolicyController {
response.addHeader("operation", "getDictionary");
response.getWriter().write(j.toString());
} catch (Exception e) {
+ LOGGER.error(e);
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.addHeader("error", "dictionaryDBQuery");
- LOGGER.error(e.getMessage());
}
}
@RequestMapping(value = { "/sp_dictionary/save_safePolicyWarning" }, method = {
org.springframework.web.bind.annotation.RequestMethod.POST })
public ModelAndView saveSafePolicyWarningDictionary(HttpServletRequest request, HttpServletResponse response)
- throws Exception {
+ throws UnsupportedEncodingException, IOException {
try {
boolean duplicateflag = false;
boolean isFakeUpdate = false;
@@ -342,6 +346,7 @@ public class SafePolicyController {
}
}catch (Exception e) {
+ LOGGER.error(e);
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
@@ -353,7 +358,7 @@ public class SafePolicyController {
@RequestMapping(value = { "/sp_dictionary/remove_SafePolicyWarning" }, method = {
org.springframework.web.bind.annotation.RequestMethod.POST })
public ModelAndView removeSafePolicyWarningDictionary(HttpServletRequest request, HttpServletResponse response)
- throws Exception {
+ throws UnsupportedEncodingException, IOException {
try {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java
index 7b50397ca..e6514469c 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java
@@ -28,6 +28,7 @@ import javax.script.SimpleBindings;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Criteria;
+import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
@@ -251,9 +252,8 @@ public class CommonClassDaoImpl implements CommonClassDao{
}finally{
try{
session.close();
- }catch(Exception e1){
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
- throw e1;
+ }catch(HibernateException e1){
+ LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement",e1);
}
}
return data;
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/ElasticSearchPolicyUpdate.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/ElasticSearchPolicyUpdate.java
index dcd44f84f..ee6fd0568 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/ElasticSearchPolicyUpdate.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/ElasticSearchPolicyUpdate.java
@@ -26,6 +26,7 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.Connection;
import java.sql.DriverManager;
+import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
@@ -99,7 +100,7 @@ public class ElasticSearchPolicyUpdate {
+ elkURL + ":"+ databseUrl + ":"+ userName + ":"+ password + ":"+ databaseDriver + ":");
}
} catch (Exception e) {
- LOGGER.error("Config File doesn't Exist in the specified Path " + file.toString());
+ LOGGER.error("Config File doesn't Exist in the specified Path " + file.toString(),e);
}
}
}
@@ -168,9 +169,11 @@ public class ElasticSearchPolicyUpdate {
if(!"decision".equals(_type)){
if(configurationdataid != null){
- String configEntityQuery = "Select * from ConfigurationDataEntity where configurationDataId = "+configurationdataid+"";
- Statement configstmt = conn.createStatement();
- ResultSet configResult = configstmt.executeQuery(configEntityQuery);
+ String configEntityQuery = "Select * from ConfigurationDataEntity where configurationDataId = ?";
+ PreparedStatement pstmt = null;
+ pstmt = conn.prepareStatement(configEntityQuery);
+ pstmt.setString(1, configurationdataid);
+ ResultSet configResult = pstmt.executeQuery();
while(configResult.next()){
String configBody = configResult.getString("configbody");
String configType = configResult.getString("configtype");
@@ -187,9 +190,11 @@ public class ElasticSearchPolicyUpdate {
}
if(actionbodyid != null){
- String actionEntityQuery = "Select * from ActionBodyEntity where actionBodyId = "+actionbodyid+"";
- Statement actionstmt = conn.createStatement();
- ResultSet actionResult = actionstmt.executeQuery(actionEntityQuery);
+ String actionEntityQuery = "Select * from ActionBodyEntity where actionBodyId = ?";
+ PreparedStatement pstmt = null;
+ pstmt = conn.prepareStatement(actionEntityQuery);
+ pstmt.setString(1, actionbodyid);
+ ResultSet actionResult = pstmt.executeQuery();
while(actionResult.next()){
String actionBody = actionResult.getString("actionbody");
policyDataString.append("\"jsonBodyData\":"+actionBody+",");
@@ -212,6 +217,7 @@ public class ElasticSearchPolicyUpdate {
Gson gson = new Gson();
gson.fromJson(dataString, Object.class);
}catch(Exception e){
+ LOGGER.error(e);
continue;
}
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/ElkConnectorImpl.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/ElkConnectorImpl.java
index 8868db3bc..88f9e2c87 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/ElkConnectorImpl.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/ElkConnectorImpl.java
@@ -322,6 +322,7 @@ public class ElkConnectorImpl implements ElkConnector{
String[] splitPolicyName = policyName.split(":");
indexType = ElkConnector.toPolicyIndexType(splitPolicyName[1]);
} catch (IllegalArgumentException e) {
+ LOGGER.error(e);
throw new IllegalStateException("ELK: Index: " + ELK_INDEX_POLICY + e.getMessage());
}
PolicyElasticData elasticData = new PolicyElasticData(policyData);
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java
index 2f4dc59cf..e9c4af27e 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java
@@ -20,7 +20,9 @@
package org.onap.policy.pap.xacml.rest.elk.client;
+import java.io.IOException;
import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
@@ -91,7 +93,7 @@ public class PolicyElasticSearchController{
psGroupPolicy, safeRisk, safePolicyWarning
}
- public static final HashMap<String, String> name2jsonPath = new HashMap<String, String>() {
+ protected static final HashMap<String, String> name2jsonPath = new HashMap<String, String>() {
private static final long serialVersionUID = 1L;
};
@@ -327,12 +329,12 @@ public class PolicyElasticSearchController{
}catch(Exception e){
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.addHeader("error", "Exception Occured While Performing Elastic Transaction");
- LOGGER.error("Exception Occured While Performing Elastic Transaction"+e.getMessage());
+ LOGGER.error("Exception Occured While Performing Elastic Transaction"+e.getMessage(),e);
}
}
@RequestMapping(value={"/searchDictionary"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView searchDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public ModelAndView searchDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
try{
PolicyIndexType config = PolicyIndexType.config;
PolicyIndexType closedloop = PolicyIndexType.closedloop;
@@ -450,6 +452,7 @@ public class PolicyElasticSearchController{
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
out.write(e.getMessage());
+ LOGGER.error(e);
}
return null;
}
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/APIRequestHandler.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/APIRequestHandler.java
index 36d7c29ef..117fc04e3 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/APIRequestHandler.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/APIRequestHandler.java
@@ -20,6 +20,7 @@
package org.onap.policy.pap.xacml.rest.handler;
import java.io.IOException;
+import java.sql.SQLException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -74,7 +75,7 @@ public class APIRequestHandler {
}
}
- public void doDelete(HttpServletRequest request, HttpServletResponse response, ONAPLoggingContext loggingContext, String apiflag) throws Exception {
+ public void doDelete(HttpServletRequest request, HttpServletResponse response, ONAPLoggingContext loggingContext, String apiflag) throws IOException, SQLException{
DeleteHandler deleteHandler = DeleteHandler.getInstance();
if ("deletePapApi".equalsIgnoreCase(apiflag)) {
deleteHandler.doAPIDeleteFromPAP(request, response, loggingContext);
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java
index 17fd2c12b..a18505478 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java
@@ -36,6 +36,7 @@ import javax.servlet.http.HttpServletResponse;
import org.onap.policy.common.logging.ONAPLoggingContext;
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.common.logging.eelf.PolicyLogger;
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.pap.xacml.rest.XACMLPapServlet;
import org.onap.policy.pap.xacml.rest.components.PolicyDBDaoTransaction;
import org.onap.policy.pap.xacml.rest.elk.client.PolicyElasticSearchController;
@@ -50,7 +51,8 @@ import org.onap.policy.xacml.api.XACMLErrorConstants;
import org.onap.policy.xacml.api.pap.OnapPDPGroup;
import org.onap.policy.xacml.std.pap.StdPAPPolicy;
import org.onap.policy.xacml.std.pap.StdPDPGroup;
-
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
import com.att.research.xacml.api.pap.PAPException;
import com.att.research.xacml.api.pap.PDPPolicy;
import com.att.research.xacml.util.XACMLProperties;
@@ -58,13 +60,14 @@ import com.att.research.xacml.util.XACMLProperties;
public class DeleteHandler {
private OnapPDPGroup newgroup;
-
+ private static Logger logger = FlexLogger.getLogger(DeleteHandler.class);
+
private static String papDbDriver = null;
private static String papDbUrl = null;
private static String papDbUser = null;
private static String papDbPassword = null;
- public void doAPIDeleteFromPAP(HttpServletRequest request, HttpServletResponse response, ONAPLoggingContext loggingContext) throws Exception {
+ public static void doAPIDeleteFromPAP(HttpServletRequest request, HttpServletResponse response, ONAPLoggingContext loggingContext) throws IOException, SQLException {
// get the request content into a String
String json = null;
java.util.Scanner scanner = new java.util.Scanner(request.getInputStream());
@@ -188,6 +191,7 @@ public class DeleteHandler {
policyVersionDeleted = true;
em.remove(pVersion);
}catch(Exception e){
+ logger.error(e.getMessage(),e);
policyVersionDeleted = false;
}
}
@@ -228,6 +232,7 @@ public class DeleteHandler {
policyVersionDeleted = true;
em.persist(pVersion);
}catch(Exception e){
+ logger.error(e.getMessage(),e);
policyVersionDeleted = false;
}
}else{
@@ -235,6 +240,7 @@ public class DeleteHandler {
policyVersionDeleted = true;
em.remove(pVersion);
}catch(Exception e){
+ logger.error(e.getMessage(),e);
policyVersionDeleted = false;
}
}
@@ -274,7 +280,7 @@ public class DeleteHandler {
}
}
- public String deletePolicyEntityData(EntityManager em, PolicyEntity policyEntity) throws SQLException{
+ public static String deletePolicyEntityData(EntityManager em, PolicyEntity policyEntity) throws SQLException{
PolicyElasticSearchController controller = new PolicyElasticSearchController();
PolicyRestAdapter policyData = new PolicyRestAdapter();
String policyName = policyEntity.getPolicyName();
@@ -289,12 +295,13 @@ public class DeleteHandler {
controller.deleteElk(policyData);
em.remove(policyEntity);
}catch(Exception e){
+ logger.error(e.getMessage(),e);
return "error";
}
return "success";
}
- public boolean checkPolicyGroupEntity(EntityManager em, Connection con, List<?> peResult) throws SQLException{
+ public static boolean checkPolicyGroupEntity(EntityManager em, Connection con, List<?> peResult) throws SQLException{
for(Object peData : peResult){
PolicyEntity policyEntity = (PolicyEntity) peData;
Statement st = null;
@@ -469,7 +476,7 @@ public class DeleteHandler {
DeleteHandler instance = (DeleteHandler) deleteHandler.newInstance();
return instance;
} catch (Exception e) {
- PolicyLogger.error(e.getMessage());
+ logger.error(e.getMessage(),e);
}
return null;
}
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandler.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandler.java
index 4fe126fd9..d30c70204 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandler.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandler.java
@@ -23,10 +23,13 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.onap.policy.common.logging.eelf.PolicyLogger;
-
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
import com.att.research.xacml.util.XACMLProperties;
public interface DictionaryHandler {
+ public static final Logger logger = FlexLogger.getLogger(DictionaryHandler.class);
String DICTIONARY_DEFAULT_CLASS = DictionaryHandlerImpl.class.getName();
/*
@@ -38,7 +41,7 @@ public interface DictionaryHandler {
DictionaryHandler instance = (DictionaryHandler) dictionaryHandler.newInstance();
return instance;
} catch (Exception e) {
- PolicyLogger.error(e.getMessage());
+ logger.error(e.getMessage(),e);
}
return null;
}
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/PushPolicyHandler.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/PushPolicyHandler.java
index 9ef0e6f1e..6e348fb1b 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/PushPolicyHandler.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/PushPolicyHandler.java
@@ -34,11 +34,12 @@ import org.onap.policy.pap.xacml.rest.XACMLPapServlet;
import org.onap.policy.rest.jpa.PolicyVersion;
import org.onap.policy.xacml.api.pap.OnapPDPGroup;
import org.onap.policy.xacml.std.pap.StdPDPPolicy;
-
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
import com.att.research.xacml.util.XACMLProperties;
public class PushPolicyHandler {
-
+ private static final Logger logger = FlexLogger.getLogger(PushPolicyHandler.class);
/*
* Get Active Version.
*/
@@ -116,7 +117,7 @@ public class PushPolicyHandler {
PushPolicyHandler instance = (PushPolicyHandler) pushPolicyHandler.newInstance();
return instance;
} catch (Exception e) {
- PolicyLogger.error(e.getMessage());
+ logger.error(e.getMessage(),e);
}
return null;
}
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/SavePolicyHandler.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/SavePolicyHandler.java
index d88aee0cb..3864ba1fd 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/SavePolicyHandler.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/SavePolicyHandler.java
@@ -26,7 +26,8 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.parsers.ParserConfigurationException;
-
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.common.logging.eelf.PolicyLogger;
import org.onap.policy.pap.xacml.rest.XACMLPapServlet;
import org.onap.policy.pap.xacml.rest.policycontroller.PolicyCreation;
@@ -39,6 +40,7 @@ import org.xml.sax.SAXException;
import com.att.research.xacml.util.XACMLProperties;
public class SavePolicyHandler {
+ private static final Logger logger = FlexLogger.getLogger(SavePolicyHandler.class);
private HashMap<String, String> ErrorHeaders = null;
public void doPolicyAPIPut(HttpServletRequest request, HttpServletResponse response) throws IOException {
@@ -77,8 +79,7 @@ public class SavePolicyHandler {
response.addHeader("operation", "create");
}
} catch (Exception e1) {
- PolicyLogger.error(XACMLErrorConstants.ERROR_UNKNOWN +
- "Could not set data to policy adapter "+ e1.getMessage());
+ logger.error("Could not set data to policy adapter "+e1.getMessage(),e1);
}
}
}
@@ -150,7 +151,7 @@ public class SavePolicyHandler {
SavePolicyHandler instance = (SavePolicyHandler) savePolicyHandler.newInstance();
return instance;
} catch (Exception e) {
- PolicyLogger.error(e.getMessage());
+ logger.error(e.getMessage(),e);
}
return null;
}
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/model/PDPPolicyContainer.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/model/PDPPolicyContainer.java
index cbcb7e04b..18f0636a8 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/model/PDPPolicyContainer.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/model/PDPPolicyContainer.java
@@ -46,27 +46,27 @@ public class PDPPolicyContainer extends PolicyItemSetChangeNotifier implements P
/**
* String identifier of a file's "Id" property.
*/
- public static String PROPERTY_ID = "Id";
+ public static final String PROPERTY_ID = "Id";
/**
* String identifier of a file's "name" property.
*/
- public static String PROPERTY_NAME = "Name";
+ public static final String PROPERTY_NAME = "Name";
/**
* String identifier of a file's "name" property.
*/
- public static String PROPERTY_VERSION = "Version";
+ public static final String PROPERTY_VERSION = "Version";
/**
* String identifier of a file's "Description" property.
*/
- public static String PROPERTY_DESCRIPTION = "Description";
+ public static final String PROPERTY_DESCRIPTION = "Description";
/**
* String identifier of a file's "IsRoot" property.
*/
- public static String PROPERTY_ISROOT = "Root";
+ public static final String PROPERTY_ISROOT = "Root";
/**
* List of the string identifiers for the available properties.
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java
index 80657fcd6..eff4e7f2f 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java
@@ -512,13 +512,14 @@ public class PolicyCreation extends AbstractPolicyCreation{
response.addHeader("error", "error");
}
}catch(Exception e){
+ LOGGER.error("Exception Occured : ",e);
if(policyDBDaoTransaction != null){
policyDBDaoTransaction.rollbackTransaction();
}
}
}
catch (Exception e){
- LOGGER.error("Exception Occured : "+e);
+ LOGGER.error("Exception Occured : "+e.getMessage(),e);
body = "error";
response.addHeader("error", e.getMessage());
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/DictionaryService.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/DictionaryService.java
index df1916be9..1c873561f 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/DictionaryService.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/DictionaryService.java
@@ -19,6 +19,8 @@
*/
package org.onap.policy.pap.xacml.rest.service;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -48,541 +50,312 @@ public class DictionaryService {
/*
* Methods that call the controller method directly to Save and Update dictionary data
*/
- public String saveOnapDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveOnapDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
DictionaryController dictionary = new DictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveOnapDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
- }
-
return responseString;
}
- public String saveAttributeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveAttributeDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
DictionaryController dictionary = new DictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveAttributeDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
- }
-
return responseString;
}
- public String saveActionPolicyDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveActionPolicyDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
ActionPolicyDictionaryController action = new ActionPolicyDictionaryController();
String responseString = null;
- try {
ModelAndView result = action.saveActionPolicyDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
- }
-
return responseString;
}
- public String saveBRMSParamDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveBRMSParamDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
BRMSDictionaryController dictionary = new BRMSDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveBRMSParamDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
- }
-
return responseString;
}
- public String saveVSCLAction(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveVSCLAction(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveVSCLAction(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
- }
-
return responseString;
}
- public String saveVnfType(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveVnfType(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveVnfType(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
- }
-
return responseString;
}
- public String savePEPOptions(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String savePEPOptions(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.savePEPOptions(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
- }
-
return responseString;
}
- public String saveVarbind(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveVarbind(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveVarbind(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
- }
-
return responseString;
}
- public String saveServiceType(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveServiceType(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveServiceType(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
- }
-
return responseString;
}
- public String saveSiteType(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveSiteType(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveSiteType(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
- }
-
return responseString;
}
- public String saveSettingsDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveSettingsDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
DecisionPolicyDictionaryController dictionary = new DecisionPolicyDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveSettingsDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String saveDescriptiveDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveDescriptiveDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
DescriptiveDictionaryController dictionary = new DescriptiveDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveDescriptiveDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String saveEnforcerDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveEnforcerDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
EnforcerDictionaryController dictionary = new EnforcerDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveEnforcerDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String saveActionListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveActionListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
FirewallDictionaryController dictionary = new FirewallDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveActionListDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String saveProtocolListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveProtocolListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
FirewallDictionaryController dictionary = new FirewallDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveProtocolListDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String saveZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
FirewallDictionaryController dictionary = new FirewallDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveZoneDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String saveSecurityZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveSecurityZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
FirewallDictionaryController dictionary = new FirewallDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveSecurityZoneDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String savePrefixListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String savePrefixListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
FirewallDictionaryController dictionary = new FirewallDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.savePrefixListDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String saveAddressGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveAddressGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
FirewallDictionaryController dictionary = new FirewallDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveAddressGroupDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String saveServiceGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveServiceGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
FirewallDictionaryController dictionary = new FirewallDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveServiceGroupDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String saveServiceListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveServiceListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
FirewallDictionaryController dictionary = new FirewallDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveServiceListDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String saveTermListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveTermListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
FirewallDictionaryController dictionary = new FirewallDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveTermListDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String saveMicroServiceLocationDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveMicroServiceLocationDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveMicroServiceLocationDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String saveMicroServiceConfigNameDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveMicroServiceConfigNameDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveMicroServiceConfigNameDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String saveDCAEUUIDDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveDCAEUUIDDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveDCAEUUIDDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String saveMicroServiceModelsDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveMicroServiceModelsDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveMicroServiceModelsDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String saveMicroServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveMicroServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveMicroServiceAttributeDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String savePSServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String savePSServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.savePSServiceDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String savePSResourceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String savePSResourceDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.savePSResourceDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String savePSTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String savePSTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.savePSTypeDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String savePSClosedLoopDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String savePSClosedLoopDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.savePSClosedLoopDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String savePSGroupScopeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String savePSGroupScopeDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
String responseString = null;
- try {
ModelAndView result = dictionary.savePSGroupScopeDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String saveRiskTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public String saveRiskTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
SafePolicyController dictionary = new SafePolicyController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveRiskTypeDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
- public String saveSafePolicyWarningDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public String saveSafePolicyWarningDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
SafePolicyController dictionary = new SafePolicyController();
String responseString = null;
- try {
ModelAndView result = dictionary.saveSafePolicyWarningDictionary(request, response);
responseString = result.getViewName();
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
return responseString;
}
@@ -590,406 +363,174 @@ public class DictionaryService {
/*
* Methods that call the controller get methods directly to get dictionary data
*/
- public void getOnapDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getOnapDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
DictionaryController dictionary = new DictionaryController();
- try {
dictionary.getOnapNameDictionaryEntityData(request, response);
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getAttributeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getAttributeDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
DictionaryController dictionary = new DictionaryController();
- try {
dictionary.getAttributeDictionaryEntityData(request, response);
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getActionPolicyDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getActionPolicyDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
ActionPolicyDictionaryController action = new ActionPolicyDictionaryController();
- try {
action.getActionPolicyDictionaryEntityData(request, response);
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getBRMSParamDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getBRMSParamDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
BRMSDictionaryController dictionary = new BRMSDictionaryController();
- try {
dictionary.getBRMSParamDictionaryEntityData(request, response);
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
}
- public void getVSCLAction(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getVSCLAction(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
- try {
dictionary.getVSCLActionDictionaryEntityData(request, response);
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getVnfType(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getVnfType(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
- try {
dictionary.getVNFTypeDictionaryEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
}
- public void getPEPOptions(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getPEPOptions(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
- try {
dictionary.getPEPOptionsDictionaryEntityData(request, response);
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getVarbind(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getVarbind(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
- try {
dictionary.getVarbindDictionaryEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
-
}
- public void getServiceType(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getServiceType(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
- try {
dictionary.getClosedLoopServiceDictionaryEntityData(request, response);
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getSiteType(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getSiteType(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
- try {
dictionary.getClosedLoopSiteDictionaryEntityData(request, response);
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getSettingsDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getSettingsDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
DecisionPolicyDictionaryController dictionary = new DecisionPolicyDictionaryController();
- try {
dictionary.getSettingsDictionaryEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getDescriptiveDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getDescriptiveDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
DescriptiveDictionaryController dictionary = new DescriptiveDictionaryController();
- try {
dictionary.getDescriptiveDictionaryEntityData(request, response);
-
- } catch (Exception e) {
-
- }
}
- public void getEnforcerDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getEnforcerDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
EnforcerDictionaryController dictionary = new EnforcerDictionaryController();
- try {
dictionary.getEnforcerDictionaryEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getActionListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getActionListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
FirewallDictionaryController dictionary = new FirewallDictionaryController();
- try {
dictionary.getActionListDictionaryEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getProtocolListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getProtocolListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
FirewallDictionaryController dictionary = new FirewallDictionaryController();
- try {
dictionary.getProtocolListDictionaryEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
FirewallDictionaryController dictionary = new FirewallDictionaryController();
- try {
dictionary.getZoneDictionaryEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getSecurityZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getSecurityZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
FirewallDictionaryController dictionary = new FirewallDictionaryController();
- try {
dictionary.getSecurityZoneDictionaryEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getPrefixListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getPrefixListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
FirewallDictionaryController dictionary = new FirewallDictionaryController();
- try {
dictionary.getPrefixListDictionaryEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getAddressGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getAddressGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
FirewallDictionaryController dictionary = new FirewallDictionaryController();
- try {
dictionary.getAddressGroupDictionaryEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getServiceGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getServiceGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
FirewallDictionaryController dictionary = new FirewallDictionaryController();
- try {
dictionary.getServiceGroupDictionaryEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getServiceListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getServiceListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
FirewallDictionaryController dictionary = new FirewallDictionaryController();
- try {
dictionary.getServiceListDictionaryEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getTermListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getTermListDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
FirewallDictionaryController dictionary = new FirewallDictionaryController();
- try {
dictionary.getTermListDictionaryEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getMicroServiceLocationDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getMicroServiceLocationDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
- try {
dictionary.getMicroServiceLocationDictionaryEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getMicroServiceConfigNameDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getMicroServiceConfigNameDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
- try {
dictionary.getMicroServiceConfigNameDictionaryEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getDCAEUUIDDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getDCAEUUIDDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
- try {
dictionary.getDCAEUUIDDictionaryEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getMicroServiceModelsDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getMicroServiceModelsDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
- try {
dictionary.getMicroServiceModelsDictionaryEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getMicroServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getMicroServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
- try {
dictionary.getMicroServiceModelsDictionaryEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getPSServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getPSServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
- try {
dictionary.getPSServiceEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getPSResourceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getPSResourceDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
- try {
dictionary.getPSResourceEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getPSTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getPSTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
- try {
dictionary.getPSTypeEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getPSClosedLoopDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getPSClosedLoopDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
- try {
dictionary.getPSClosedLoopEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getPSGroupScopeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getPSGroupScopeDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
- try {
dictionary.getGroupPolicyScopeEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getRiskTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getRiskTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
SafePolicyController dictionary = new SafePolicyController();
- try {
dictionary.getOnapNameDictionaryEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
- public void getSafePolicyWarningDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void getSafePolicyWarningDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{
SafePolicyController dictionary = new SafePolicyController();
- try {
dictionary.getSafePolicyWarningeEntityData(request, response);
-
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-
- }
}
} \ No newline at end of file
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/ImportService.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/ImportService.java
index 0a5da0ec3..166720714 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/ImportService.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/ImportService.java
@@ -34,11 +34,14 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.onap.policy.common.logging.eelf.PolicyLogger;
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.pap.xacml.rest.components.CreateBRMSRuleTemplate;
import org.onap.policy.pap.xacml.rest.components.CreateNewMicroServiceModel;
+import org.onap.policy.pap.xacml.rest.model.PDPPolicyContainer;
public class ImportService {
-
+ private static final Logger logger = FlexLogger.getLogger(ImportService.class);
public void doImportMicroServicePut(HttpServletRequest request, HttpServletResponse response) {
String importServiceCreation = request.getParameter("importService");;
String fileName = request.getParameter("fileName");
@@ -55,6 +58,7 @@ public class ImportService {
builder.append((char)ch);
}
} catch (IOException e) {
+ logger.error(e);
PolicyLogger.error("Error in reading in file from API call");
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
response.addHeader("error", "missing");
@@ -82,6 +86,7 @@ public class ImportService {
xmi = scanner.hasNext() ? scanner.next() : "";
scanner.close();
} catch (IOException e1) {
+ logger.error(e1);
PolicyLogger.error("Error in reading in file from API call");
return;
}
@@ -90,6 +95,7 @@ public class ImportService {
new FileOutputStream("ExtractDir" + File.separator + randomID+".xmi"), "utf-8"))) {
writer.write(xmi);
} catch (IOException e) {
+ logger.error(e);
PolicyLogger.error("Error in reading in file from API call");
return;
}
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/JPAUtils.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/JPAUtils.java
index 732ed2f44..05885ee16 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/JPAUtils.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/JPAUtils.java
@@ -45,7 +45,7 @@ import org.onap.policy.common.logging.flexlogger.Logger;
public class JPAUtils {
private static Logger LOGGER = FlexLogger.getLogger(JPAUtils.class);
- private EntityManagerFactory emf;
+ private static EntityManagerFactory emf;
private static final Object mapAccess = new Object();
private static Map<Datatype, List<FunctionDefinition>> mapDatatype2Function = null;
private static Map<String, FunctionDefinition> mapID2Function = null;
@@ -59,7 +59,7 @@ public class JPAUtils {
* @return The new instance of JPAUtils or throw exception if the given emf is null.
* @throws IllegalStateException if a JPAUtils has already been constructed. Call getJPAUtilsInstance() to get this.
*/
- public static JPAUtils getJPAUtilsInstance(EntityManagerFactory emf) throws Exception{
+ public static JPAUtils getJPAUtilsInstance(EntityManagerFactory emf){
LOGGER.debug("getJPAUtilsInstance(EntityManagerFactory emf) as getJPAUtilsInstance("+emf+") called");
if(currentInstance == null){
if(emf != null){
@@ -81,7 +81,7 @@ public class JPAUtils {
* @return The instance of JPAUtils or throws exception if the given instance is null.
* @throws IllegalStateException if a JPAUtils instance is null. Call getJPAUtilsInstance(EntityManagerFactory emf) to get this.
*/
- public static JPAUtils getJPAUtilsInstance() throws Exception{
+ public static JPAUtils getJPAUtilsInstance(){
LOGGER.debug("getJPAUtilsInstance() as getJPAUtilsInstance() called");
if(currentInstance != null){
return currentInstance;
@@ -89,7 +89,7 @@ public class JPAUtils {
throw new IllegalStateException("The JPAUtils.currentInstance is Null. Use getJPAUtilsInstance(EntityManagerFactory emf)");
}
- public static AttributeDesignatorType createDesignator(Attribute attribute) {
+ public static AttributeDesignatorType createDesignator(Attribute attribute) {
AttributeDesignatorType designator = new AttributeDesignatorType();
designator.setAttributeId(attribute.getXacmlId());
if (attribute.getCategoryBean() != null) {
@@ -147,7 +147,7 @@ public class JPAUtils {
public Map<String, FunctionDefinition> getFunctionIDMap() {
synchronized(mapAccess) {
- if (mapID2Function == null||mapID2Function.equals("{}")) {
+ if (mapID2Function == null||mapID2Function.isEmpty()) {
try {
buildFunctionMaps();
} catch (ServletException e) {
@@ -158,7 +158,7 @@ public class JPAUtils {
return mapID2Function;
}
- private void buildFunctionMaps() throws ServletException {
+ private static void buildFunctionMaps() throws ServletException {
mapDatatype2Function = new HashMap<>();
mapID2Function = new HashMap<>();