diff options
author | AvinashS <avinash.s@huawei.com> | 2017-09-05 15:58:22 +0530 |
---|---|---|
committer | Jorge Hernandez <jh1730@att.com> | 2017-09-06 18:59:29 +0000 |
commit | 1628052b1b8a6fd4d784b82c8266367d2c203ace (patch) | |
tree | 2edc0c6bd8d1b2150c6f436031de25f3c08da5c7 /ONAP-PAP-REST/src/main/java | |
parent | 490459f7fe922c8448e8a38b87fd48e5e71d7b4c (diff) |
Sonar fixes for Policy engine
Remaining critical and few major issues fix.
Change-Id: I5e602e377bd52877b1c791d4e00f79feceec391f
IssueId: POLICY-174
Signed-off-by: AvinashS <avinash.s@huawei.com>
Diffstat (limited to 'ONAP-PAP-REST/src/main/java')
7 files changed, 149 insertions, 152 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 eaa0bb409..75b02ab58 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 @@ -212,7 +212,7 @@ public class ActionPolicyDictionaryController { } } catch (Exception e){ - LOGGER.error(e.getMessage()); + LOGGER.error(e); response.setCharacterEncoding(utf8); request.setCharacterEncoding(utf8); PrintWriter out = response.getWriter(); @@ -242,7 +242,7 @@ public class ActionPolicyDictionaryController { return null; } catch (Exception e){ - LOGGER.error(e.getMessage()); + LOGGER.error(e); response.setCharacterEncoding(utf8); request.setCharacterEncoding(utf8); 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 beee437e4..e09c9ce50 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 @@ -130,7 +130,7 @@ public class BRMSDictionaryController{ } @RequestMapping(value={"/brms_dictionary/set_BRMSParamData"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}) - public void SetRuleData(HttpServletRequest request) throws IOException{ + public static void setRuleData(HttpServletRequest request) throws IOException{ StringWriter writer = new StringWriter(); IOUtils.copy(request.getInputStream() , writer, StandardCharsets.UTF_8); String cleanStreamBoundary = writer.toString().replaceFirst("------(.*)(?s).*octet-stream", ""); @@ -306,9 +306,8 @@ public class BRMSDictionaryController{ //check if update operation or create, get id for data to be updated if ((update).equals(request.getParameter(operation))) { List<Object> duplicateData = commonClassDao.checkDuplicateEntry(brmsDependency.getDependencyName(), dependencyName, BRMSDependency.class); - int id = 0; BRMSDependency data = (BRMSDependency) duplicateData.get(0); - id = data.getId(); + int id = data.getId(); brmsDependency.setId(id); brmsDependency.setUserCreatedBy(this.getUserInfo(userId)); } @@ -461,9 +460,8 @@ public class BRMSDictionaryController{ //check if update operation or create, get id for data to be updated if ((update).equals(request.getParameter(operation))) { List<Object> duplicateData = commonClassDao.checkDuplicateEntry(brmsController.getControllerName(), controllerName, BRMSController.class); - int id = 0; BRMSController data = (BRMSController) duplicateData.get(0); - id = data.getId(); + int id = data.getId(); brmsController.setId(id); brmsController.setUserCreatedBy(this.getUserInfo(userId)); } 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 719d8dafa..62b830d6d 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 @@ -83,10 +83,9 @@ public class DictionaryImportController { @RequestMapping(value={"/dictionary/import_dictionary"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}) - public void ImportDictionaryData(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException{ + public void ImportDictionaryData(HttpServletRequest request) throws IOException{ ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - //JsonNode root = mapper.readTree(request.getReader()); String userId = request.getParameter("userId"); String dictionaryName = request.getParameter("dictionaryName"); @@ -106,26 +105,26 @@ public class DictionaryImportController { attribute.setUserModifiedBy(userinfo); String[] rows = dictSheet.get(i); for (int j=0 ; j<rows.length; j++ ){ - if(dictSheet.get(0)[j].equalsIgnoreCase("xacml_id") || dictSheet.get(0)[j].equalsIgnoreCase("Attribute ID")){ + if(("xacml_id").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Attribute ID").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setXacmlId(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("description")){ + if(("description").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setDescription(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("priority")){ + if(("priority").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setPriority(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("datatype") || dictSheet.get(0)[j].equalsIgnoreCase("Data Type")){ + if(("datatype").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Data Type").equalsIgnoreCase(dictSheet.get(0)[j])){ Datatype dataType = new Datatype(); - if(rows[j].equalsIgnoreCase("string")){ + if(("string").equalsIgnoreCase(rows[j])){ dataType.setId(26); - }else if(rows[j].equalsIgnoreCase("integer")){ + }else if(("integer").equalsIgnoreCase(rows[j])){ dataType.setId(12); - }else if(rows[j].equalsIgnoreCase("double")){ + }else if(("double").equalsIgnoreCase(rows[j])){ dataType.setId(25); - }else if(rows[j].equalsIgnoreCase("boolean")){ + }else if(("boolean").equalsIgnoreCase(rows[j])){ dataType.setId(18); - }else if(rows[j].equalsIgnoreCase("user")){ + }else if(("user").equalsIgnoreCase(rows[j])){ dataType.setId(29); } attribute.setDatatypeBean(dataType); @@ -133,7 +132,7 @@ public class DictionaryImportController { category.setId(5); attribute.setCategoryBean(category); } - if(dictSheet.get(0)[j].equalsIgnoreCase("attribute_value") || dictSheet.get(0)[j].equalsIgnoreCase("Attribute Value")){ + if(("attribute_value").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Attribute Value").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setAttributeValue(rows[j]); } } @@ -149,25 +148,25 @@ public class DictionaryImportController { attribute.setUserModifiedBy(userinfo); String[] rows = dictSheet.get(i); for (int j=0 ; j<rows.length; j++ ){ - if(dictSheet.get(0)[j].equalsIgnoreCase("attribute_name") || dictSheet.get(0)[j].equalsIgnoreCase("Attribute Name")){ + if(("attribute_name").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Attribute Name").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setAttributeName(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("body")){ + if(("body").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setBody(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("description")){ + if(("description").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setDescription(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("headers")){ + if(("headers").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setHeader(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("method")){ + if(("method").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setMethod(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("type")){ + if(("type").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setMethod(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("url")){ + if(("url").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setMethod(rows[j]); } } @@ -183,10 +182,10 @@ public class DictionaryImportController { attribute.setUserModifiedBy(userinfo); String[] rows = dictSheet.get(i); for (int j=0 ; j<rows.length; j++ ){ - if(dictSheet.get(0)[j].equalsIgnoreCase("onap_name") || dictSheet.get(0)[j].equalsIgnoreCase("Onap Name")){ + if(("onap_name").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Onap Name").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setOnapName(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("description")){ + if(("description").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setDescription(rows[j]); } } @@ -202,10 +201,10 @@ public class DictionaryImportController { attribute.setUserModifiedBy(userinfo); String[] rows = dictSheet.get(i); for (int j=0 ; j<rows.length; j++ ){ - if(dictSheet.get(0)[j].equalsIgnoreCase("vnf_type") || dictSheet.get(0)[j].equalsIgnoreCase("VNF Type")){ + if(("vnf_type").equalsIgnoreCase(dictSheet.get(0)[j]) || ("VNF Type").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setVnftype(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("description")){ + if(("description").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setDescription(rows[j]); } } @@ -221,10 +220,10 @@ public class DictionaryImportController { attribute.setUserModifiedBy(userinfo); String[] rows = dictSheet.get(i); for (int j=0 ; j<rows.length; j++ ){ - if(dictSheet.get(0)[j].equalsIgnoreCase("vscl_action") || dictSheet.get(0)[j].equalsIgnoreCase("VSCL Action")){ + if(("vscl_action").equalsIgnoreCase(dictSheet.get(0)[j]) || ("VSCL Action").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setVsclaction(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("description")){ + if(("description").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setDescription(rows[j]); } } @@ -240,13 +239,13 @@ public class DictionaryImportController { attribute.setUserModifiedBy(userinfo); String[] rows = dictSheet.get(i); for (int j=0 ; j<rows.length; j++ ){ - if(dictSheet.get(0)[j].equalsIgnoreCase("PEP_NAME") || dictSheet.get(0)[j].equalsIgnoreCase("PEP Name")){ + if(("PEP_NAME").equalsIgnoreCase(dictSheet.get(0)[j]) || ("PEP Name").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setPepName(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("description")){ + if(("description").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setDescription(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("Actions")){ + if(("Actions").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setActions(rows[j]); } } @@ -262,13 +261,13 @@ public class DictionaryImportController { attribute.setUserModifiedBy(userinfo); String[] rows = dictSheet.get(i); for (int j=0 ; j<rows.length; j++ ){ - if(dictSheet.get(0)[j].equalsIgnoreCase("varbind_Name") || dictSheet.get(0)[j].equalsIgnoreCase("Varbind Name")){ + if(("varbind_Name").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Varbind Name").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setVarbindName(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("varbind_Description") || dictSheet.get(0)[j].equalsIgnoreCase("Varbind Description")){ + if(("varbind_Description").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Varbind Description").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setVarbindDescription(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("varbind_oid") || dictSheet.get(0)[j].equalsIgnoreCase("Varbind OID")){ + if(("varbind_oid").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Varbind OID").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setVarbindOID(rows[j]); } } @@ -283,13 +282,13 @@ public class DictionaryImportController { attribute.setUserCreatedBy(userinfo); String[] rows = dictSheet.get(i); for (int j=0 ; j<rows.length; j++ ){ - if(dictSheet.get(0)[j].equalsIgnoreCase("param_template_name") || dictSheet.get(0)[j].equalsIgnoreCase("Rule Name")){ + if(("param_template_name").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Rule Name").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setRuleName(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("DESCRIPTION") || dictSheet.get(0)[j].equalsIgnoreCase("Description")){ + if(("DESCRIPTION").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Description").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setDescription(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("rule")){ + if(("rule").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setRule(rows[j]); } } @@ -305,26 +304,26 @@ public class DictionaryImportController { attribute.setUserModifiedBy(userinfo); String[] rows = dictSheet.get(i); for (int j=0 ; j<rows.length; j++ ){ - if(dictSheet.get(0)[j].equalsIgnoreCase("xacml_id") || dictSheet.get(0)[j].equalsIgnoreCase("Settings ID")){ + if(("xacml_id").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Settings ID").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setXacmlId(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("description")){ + if(("description").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setDescription(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("priority")){ + if(("priority").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setPriority(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("datatype") || dictSheet.get(0)[j].equalsIgnoreCase("Data Type")){ + if(("datatype").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Data Type").equalsIgnoreCase(dictSheet.get(0)[j])){ Datatype dataType = new Datatype(); - if(rows[j].equalsIgnoreCase("string")){ + if(("string").equalsIgnoreCase(rows[j])){ dataType.setId(26); - }else if(rows[j].equalsIgnoreCase("integer")){ + }else if(("integer").equalsIgnoreCase(rows[j])){ dataType.setId(12); - }else if(rows[j].equalsIgnoreCase("double")){ + }else if(("double").equalsIgnoreCase(rows[j])){ dataType.setId(25); - }else if(rows[j].equalsIgnoreCase("boolean")){ + }else if(("boolean").equalsIgnoreCase(rows[j])){ dataType.setId(18); - }else if(rows[j].equalsIgnoreCase("user")){ + }else if(("user").equalsIgnoreCase(rows[j])){ dataType.setId(29); } attribute.setDatatypeBean(dataType); @@ -338,13 +337,13 @@ public class DictionaryImportController { PrefixList attribute = new PrefixList("", userId); String[] rows = dictSheet.get(i); for (int j=0 ; j<rows.length; j++ ){ - if(dictSheet.get(0)[j].equalsIgnoreCase("prefixListName") || dictSheet.get(0)[j].equalsIgnoreCase("PrefixList Name")){ + if(("prefixListName").equalsIgnoreCase(dictSheet.get(0)[j]) || ("PrefixList Name").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setPrefixListName(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("description")){ + if(("description").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setPrefixListValue(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("prefixListValue") || dictSheet.get(0)[j].equalsIgnoreCase("PrefixList Value")){ + if(("prefixListValue").equalsIgnoreCase(dictSheet.get(0)[j]) || ("PrefixList Value").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setDescription(rows[j]); } } @@ -356,10 +355,10 @@ public class DictionaryImportController { SecurityZone attribute = new SecurityZone("", userId); String[] rows = dictSheet.get(i); for (int j=0 ; j<rows.length; j++ ){ - if(dictSheet.get(0)[j].equalsIgnoreCase("zoneName") || dictSheet.get(0)[j].equalsIgnoreCase("Zone Name")){ + if(("zoneName").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Zone Name").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setZoneName(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("zoneValue") || dictSheet.get(0)[j].equalsIgnoreCase("Zone Value")){ + if(("zoneValue").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Zone Value").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setZoneValue(rows[j]); } } @@ -371,10 +370,10 @@ public class DictionaryImportController { Zone attribute = new Zone("", userId); String[] rows = dictSheet.get(i); for (int j=0 ; j<rows.length; j++ ){ - if(dictSheet.get(0)[j].equalsIgnoreCase("zoneName") || dictSheet.get(0)[j].equalsIgnoreCase("Zone Name")){ + if(("zoneName").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Zone Name").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setZoneName(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("zoneValue") || dictSheet.get(0)[j].equalsIgnoreCase("Zone Value")){ + if(("zoneValue").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Zone Value").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setZoneValue(rows[j]); } } @@ -386,22 +385,22 @@ public class DictionaryImportController { ServiceList attribute = new ServiceList("", userId); String[] rows = dictSheet.get(i); for (int j=0 ; j<rows.length; j++ ){ - if(dictSheet.get(0)[j].equalsIgnoreCase("serviceName") || dictSheet.get(0)[j].equalsIgnoreCase("Service Name")){ + if(("serviceName").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Service Name").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setServiceName(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("serviceDesc") || dictSheet.get(0)[j].equalsIgnoreCase("Description")){ + if(("serviceDesc").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Description").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setServiceDescription(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("serviceType") || dictSheet.get(0)[j].equalsIgnoreCase("Service Type")){ + if(("serviceType").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Service Type").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setServiceType(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("serviceTrasProtocol") || dictSheet.get(0)[j].equalsIgnoreCase("Transport Protocol")){ + if(("serviceTrasProtocol").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Transport Protocol").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setServiceTransProtocol(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("serviceAppProtocol") || dictSheet.get(0)[j].equalsIgnoreCase("APP Protocol")){ + if(("serviceAppProtocol").equalsIgnoreCase(dictSheet.get(0)[j]) || ("APP Protocol").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setServiceAppProtocol(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("servicePorts") || dictSheet.get(0)[j].equalsIgnoreCase("Ports")){ + if(("servicePorts").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Ports").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setServicePorts(rows[j]); } } @@ -413,10 +412,10 @@ public class DictionaryImportController { GroupServiceList attribute = new GroupServiceList("", userId); String[] rows = dictSheet.get(i); for (int j=0 ; j<rows.length; j++ ){ - if(dictSheet.get(0)[j].equalsIgnoreCase("name") || dictSheet.get(0)[j].equalsIgnoreCase("Group Name")){ + if(("name").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Group Name").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setGroupName(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("serviceList") || dictSheet.get(0)[j].equalsIgnoreCase("Service List")){ + if(("serviceList").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Service List").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setServiceList(rows[j]); } } @@ -428,13 +427,13 @@ public class DictionaryImportController { AddressGroup attribute = new AddressGroup("", userId); String[] rows = dictSheet.get(i); for (int j=0 ; j<rows.length; j++ ){ - if(dictSheet.get(0)[j].equalsIgnoreCase("name") || dictSheet.get(0)[j].equalsIgnoreCase("Group Name")){ + if(("name").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Group Name").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setGroupName(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("serviceList") || dictSheet.get(0)[j].equalsIgnoreCase("Prefix List")){ + if(("serviceList").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Prefix List").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setServiceList(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("description")){ + if(("description").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setDescription(rows[j]); } } @@ -446,10 +445,10 @@ public class DictionaryImportController { ProtocolList attribute = new ProtocolList("", userId); String[] rows = dictSheet.get(i); for (int j=0 ; j<rows.length; j++ ){ - if(dictSheet.get(0)[j].equalsIgnoreCase("protocolName") || dictSheet.get(0)[j].equalsIgnoreCase("Protocol Name")){ + if(("protocolName").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Protocol Name").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setProtocolName(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("description")){ + if(("description").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setDescription(rows[j]); } } @@ -461,10 +460,10 @@ public class DictionaryImportController { ActionList attribute = new ActionList("", userId); String[] rows = dictSheet.get(i); for (int j=0 ; j<rows.length; j++ ){ - if(dictSheet.get(0)[j].equalsIgnoreCase("actionName") || dictSheet.get(0)[j].equalsIgnoreCase("Action Name")){ + if(("actionName").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Action Name").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setActionName(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("description")){ + if(("description").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setDescription(rows[j]); } } @@ -480,31 +479,31 @@ public class DictionaryImportController { attribute.setUserModifiedBy(userinfo); String[] rows = dictSheet.get(i); for (int j=0 ; j<rows.length; j++ ){ - if(dictSheet.get(0)[j].equalsIgnoreCase("termName") || dictSheet.get(0)[j].equalsIgnoreCase("Term-Name")){ + if(("termName").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Term-Name").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setTermName(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("Term-Description") || dictSheet.get(0)[j].equalsIgnoreCase("termDescription")){ + if(("Term-Description").equalsIgnoreCase(dictSheet.get(0)[j]) || ("termDescription").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setDescription(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("fromZone") || dictSheet.get(0)[j].equalsIgnoreCase("From Zone")){ + if(("fromZone").equalsIgnoreCase(dictSheet.get(0)[j]) || ("From Zone").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setFromZones(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("toZone") || dictSheet.get(0)[j].equalsIgnoreCase("To Zone")){ + if(("toZone").equalsIgnoreCase(dictSheet.get(0)[j]) || ("To Zone").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setToZones(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("srcIPList") || dictSheet.get(0)[j].equalsIgnoreCase("Source-IP-List")){ + if(("srcIPList").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Source-IP-List").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setSrcIPList(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("destIPList") || dictSheet.get(0)[j].equalsIgnoreCase("Destination-IP-List")){ + if(("destIPList").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Destination-IP-List").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setDestIPList(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("srcPortList") || dictSheet.get(0)[j].equalsIgnoreCase("Source-Port-List")){ + if(("srcPortList").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Source-Port-List").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setSrcPortList(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("destPortList") || dictSheet.get(0)[j].equalsIgnoreCase("Destination-Port-List")){ + if(("destPortList").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Destination-Port-List").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setDestPortList(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("action") || dictSheet.get(0)[j].equalsIgnoreCase("Action List")){ + if(("action").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Action List").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setAction(rows[j]); } } @@ -520,13 +519,13 @@ public class DictionaryImportController { attribute.setUserModifiedBy(userinfo); String[] rows = dictSheet.get(i); for (int j=0 ; j<rows.length; j++ ){ - if(dictSheet.get(0)[j].equalsIgnoreCase("descriptiveScopeName") || dictSheet.get(0)[j].equalsIgnoreCase("Descriptive ScopeName")){ + if(("descriptiveScopeName").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Descriptive ScopeName").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setScopeName(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("description")){ + if(("description").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setDescription(rows[j]); } - if(dictSheet.get(0)[j].equalsIgnoreCase("search") || dictSheet.get(0)[j].equalsIgnoreCase("Search Criteria")){ + if(("search").equalsIgnoreCase(dictSheet.get(0)[j]) || ("Search Criteria").equalsIgnoreCase(dictSheet.get(0)[j])){ attribute.setSearch(rows[j]); } } 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 621d49869..1ad304cc7 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 @@ -377,7 +377,7 @@ public class SafePolicyController { return null; } catch (Exception e) { - System.out.println(e); + LOGGER.error(e); response.setCharacterEncoding(utf8); request.setCharacterEncoding(utf8); PrintWriter out = response.getWriter(); diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java index e0304d079..13eee4a3f 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java @@ -37,109 +37,109 @@ public class DictionaryHandlerImpl implements DictionaryHandler{ DictionaryService dictionary = new DictionaryService(); switch (dictionaryType) { case "OnapName": - dictionary.getOnapDictionary(request, response); + dictionary.getOnapDictionary(response); break; case "Attribute": - dictionary.getAttributeDictionary(request, response); + dictionary.getAttributeDictionary(response); break; case "Action": - dictionary.getActionPolicyDictionary(request, response); + dictionary.getActionPolicyDictionary(response); break; case "BRMSParamTemplate": - dictionary.getBRMSParamDictionary(request, response); + dictionary.getBRMSParamDictionary(response); break; case "VSCLAction": - dictionary.getVSCLAction(request, response); + dictionary.getVSCLAction(response); break; case "VNFType": - dictionary.getVnfType(request, response); + dictionary.getVnfType(response); break; case "PEPOptions": - dictionary.getPEPOptions(request, response); + dictionary.getPEPOptions(response); break; case "Varbind": - dictionary.getVarbind(request, response); + dictionary.getVarbind(response); break; case "Service": - dictionary.getServiceType(request, response); + dictionary.getServiceType(response); break; case "Site": - dictionary.getSiteType(request, response); + dictionary.getSiteType(response); break; case "Settings": - dictionary.getSettingsDictionary(request, response); + dictionary.getSettingsDictionary(response); break; case "DescriptiveScope": - dictionary.getDescriptiveDictionary(request, response); + dictionary.getDescriptiveDictionary(response); break; case "Enforcer": - dictionary.getEnforcerDictionary(request, response); + dictionary.getEnforcerDictionary(response); break; case "ActionList": - dictionary.getActionListDictionary(request, response); + dictionary.getActionListDictionary(response); break; case "ProtocolList": - dictionary.getProtocolListDictionary(request, response); + dictionary.getProtocolListDictionary(response); break; case "Zone": - dictionary.getZoneDictionary(request, response); + dictionary.getZoneDictionary(response); break; case "SecurityZone": - dictionary.getSecurityZoneDictionary(request, response); + dictionary.getSecurityZoneDictionary(response); break; case "PrefixList": - dictionary.getPrefixListDictionary(request, response); + dictionary.getPrefixListDictionary(response); break; case "AddressGroup": - dictionary.getAddressGroupDictionary(request, response); + dictionary.getAddressGroupDictionary(response); break; case "ServiceGroup": - dictionary.getServiceGroupDictionary(request, response); + dictionary.getServiceGroupDictionary(response); break; case "ServiceList": - dictionary.getServiceListDictionary(request, response); + dictionary.getServiceListDictionary(response); break; case "TermList": case "RuleList": case "FirewallRuleList": case "Term": - dictionary.getTermListDictionary(request, response); + dictionary.getTermListDictionary(response); break; case "MicroServiceLocation": - dictionary.getMicroServiceLocationDictionary(request, response); + dictionary.getMicroServiceLocationDictionary(response); break; case "MicroServiceConfigName": - dictionary.getMicroServiceConfigNameDictionary(request, response); + dictionary.getMicroServiceConfigNameDictionary(response); break; case "DCAEUUID": - dictionary.getDCAEUUIDDictionary(request, response); + dictionary.getDCAEUUIDDictionary(response); break; case "MicroServiceModels": - dictionary.getMicroServiceModelsDictionary(request, response); + dictionary.getMicroServiceModelsDictionary(response); break; case "PolicyScopeService": - dictionary.getPSServiceDictionary(request, response); + dictionary.getPSServiceDictionary(response); break; case "PolicyScopeResource": - dictionary.getPSResourceDictionary(request, response); + dictionary.getPSResourceDictionary(response); break; case "PolicyScopeType": - dictionary.getPSTypeDictionary(request, response); + dictionary.getPSTypeDictionary(response); break; case "PolicyScopeClosedLoop": - dictionary.getPSClosedLoopDictionary(request, response); + dictionary.getPSClosedLoopDictionary(response); break; case "GroupPolicyScopeList": - dictionary.getPSGroupScopeDictionary(request, response); + dictionary.getPSGroupScopeDictionary(response); break; case "RiskType": - dictionary.getRiskTypeDictionary(request, response); + dictionary.getRiskTypeDictionary(response); break; case "SafePolicyWarning": dictionary.getSafePolicyWarningDictionary(request, response); break; case "MicroServiceDictionary": - dictionary.getMicroServiceDictionary(request, response); + dictionary.getMicroServiceDictionary(response); break; default: extendedOptions(dictionaryType, request, response, true); 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 25edb2668..5b2fc4cd7 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 @@ -288,168 +288,168 @@ public class DictionaryService { /* * Methods that call the controller get methods directly to get dictionary data */ - public void getOnapDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getOnapDictionary(HttpServletResponse response){ DictionaryController dictionary = new DictionaryController(); dictionary.getOnapNameDictionaryEntityData(response); } - public void getAttributeDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getAttributeDictionary(HttpServletResponse response){ DictionaryController dictionary = new DictionaryController(); dictionary.getAttributeDictionaryEntityData(response); } - public void getActionPolicyDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getActionPolicyDictionary(HttpServletResponse response){ ActionPolicyDictionaryController action = new ActionPolicyDictionaryController(); action.getActionPolicyDictionaryEntityData(response); } - public void getBRMSParamDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getBRMSParamDictionary(HttpServletResponse response){ BRMSDictionaryController dictionary = new BRMSDictionaryController(); dictionary.getBRMSParamDictionaryEntityData(response); } - public void getVSCLAction(HttpServletRequest request, HttpServletResponse response){ + public void getVSCLAction(HttpServletResponse response){ ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController(); dictionary.getVSCLActionDictionaryEntityData(response); } - public void getVnfType(HttpServletRequest request, HttpServletResponse response){ + public void getVnfType(HttpServletResponse response){ ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController(); dictionary.getVNFTypeDictionaryEntityData(response); } - public void getPEPOptions(HttpServletRequest request, HttpServletResponse response){ + public void getPEPOptions(HttpServletResponse response){ ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController(); dictionary.getPEPOptionsDictionaryEntityData(response); } - public void getVarbind(HttpServletRequest request, HttpServletResponse response){ + public void getVarbind(HttpServletResponse response){ ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController(); dictionary.getVarbindDictionaryEntityData(response); } - public void getServiceType(HttpServletRequest request, HttpServletResponse response){ + public void getServiceType(HttpServletResponse response){ ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController(); dictionary.getClosedLoopServiceDictionaryEntityData(response); } - public void getSiteType(HttpServletRequest request, HttpServletResponse response){ + public void getSiteType(HttpServletResponse response){ ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController(); dictionary.getClosedLoopSiteDictionaryEntityData(response); } - public void getSettingsDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getSettingsDictionary(HttpServletResponse response){ DecisionPolicyDictionaryController dictionary = new DecisionPolicyDictionaryController(); dictionary.getSettingsDictionaryEntityData(response); } - public void getDescriptiveDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getDescriptiveDictionary(HttpServletResponse response){ DescriptiveDictionaryController dictionary = new DescriptiveDictionaryController(); dictionary.getDescriptiveDictionaryEntityData(response); } - public void getEnforcerDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getEnforcerDictionary(HttpServletResponse response){ EnforcerDictionaryController dictionary = new EnforcerDictionaryController(); dictionary.getEnforcerDictionaryEntityData(response); } - public void getActionListDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getActionListDictionary(HttpServletResponse response){ FirewallDictionaryController dictionary = new FirewallDictionaryController(); dictionary.getActionListDictionaryEntityData(response); } - public void getProtocolListDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getProtocolListDictionary(HttpServletResponse response){ FirewallDictionaryController dictionary = new FirewallDictionaryController(); dictionary.getProtocolListDictionaryEntityData(response); } - public void getZoneDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getZoneDictionary(HttpServletResponse response){ FirewallDictionaryController dictionary = new FirewallDictionaryController(); dictionary.getZoneDictionaryEntityData(response); } - public void getSecurityZoneDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getSecurityZoneDictionary(HttpServletResponse response){ FirewallDictionaryController dictionary = new FirewallDictionaryController(); dictionary.getSecurityZoneDictionaryEntityData(response); } - public void getPrefixListDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getPrefixListDictionary(HttpServletResponse response){ FirewallDictionaryController dictionary = new FirewallDictionaryController(); dictionary.getPrefixListDictionaryEntityData(response); } - public void getAddressGroupDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getAddressGroupDictionary(HttpServletResponse response){ FirewallDictionaryController dictionary = new FirewallDictionaryController(); dictionary.getAddressGroupDictionaryEntityData(response); } - public void getServiceGroupDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getServiceGroupDictionary(HttpServletResponse response){ FirewallDictionaryController dictionary = new FirewallDictionaryController(); dictionary.getServiceGroupDictionaryEntityData(response); } - public void getServiceListDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getServiceListDictionary(HttpServletResponse response){ FirewallDictionaryController dictionary = new FirewallDictionaryController(); dictionary.getServiceListDictionaryEntityData(response); } - public void getTermListDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getTermListDictionary(HttpServletResponse response){ FirewallDictionaryController dictionary = new FirewallDictionaryController(); dictionary.getTermListDictionaryEntityData(response); } - public void getMicroServiceLocationDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getMicroServiceLocationDictionary(HttpServletResponse response){ MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController(); dictionary.getMicroServiceLocationDictionaryEntityData(response); } - public void getMicroServiceConfigNameDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getMicroServiceConfigNameDictionary(HttpServletResponse response){ MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController(); dictionary.getMicroServiceConfigNameDictionaryEntityData(response); } - public void getDCAEUUIDDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getDCAEUUIDDictionary(HttpServletResponse response){ MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController(); dictionary.getDCAEUUIDDictionaryEntityData(response); } - public void getMicroServiceModelsDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getMicroServiceModelsDictionary(HttpServletResponse response){ MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController(); dictionary.getMicroServiceModelsDictionaryEntityData(response); } - public void getMicroServiceDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getMicroServiceDictionary(HttpServletResponse response){ MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController(); dictionary.getMicroServiceModelsDictionaryEntityData(response); } - public void getPSServiceDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getPSServiceDictionary(HttpServletResponse response){ PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController(); dictionary.getPSServiceEntityData(response); } - public void getPSResourceDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getPSResourceDictionary(HttpServletResponse response){ PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController(); dictionary.getPSResourceEntityData(response); } - public void getPSTypeDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getPSTypeDictionary(HttpServletResponse response){ PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController(); dictionary.getPSTypeEntityData(response); } - public void getPSClosedLoopDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getPSClosedLoopDictionary(HttpServletResponse response){ PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController(); dictionary.getPSClosedLoopEntityData(response); } - public void getPSGroupScopeDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getPSGroupScopeDictionary(HttpServletResponse response){ PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController(); dictionary.getGroupPolicyScopeEntityData(response); } - public void getRiskTypeDictionary(HttpServletRequest request, HttpServletResponse response){ + public void getRiskTypeDictionary(HttpServletResponse response){ SafePolicyController dictionary = new SafePolicyController(); dictionary.getOnapNameDictionaryEntityData(response); } diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/MetricService.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/MetricService.java index d239dfa1b..e33f8d5ba 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/MetricService.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/MetricService.java @@ -40,7 +40,7 @@ public class MetricService { /* * This is a private constructor * */ - public MetricService(){ + private MetricService(){ } public static void doGetPolicyMetrics(HttpServletResponse response) { |