diff options
author | Liam Fallon <liam.fallon@est.tech> | 2019-11-18 10:24:15 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-11-18 10:24:15 +0000 |
commit | a2ab61f0ad39970ad35c3e47ff8429f59850c469 (patch) | |
tree | 7da1288def6d3ced3596cd58fd3b6a6c341c9553 /ONAP-PAP-REST/src/main/java/org | |
parent | 0154925df97446afa15ab60d59c57237dfa7b2e9 (diff) | |
parent | d4e3a1b394715c6386f963130e4e081d421ecd1b (diff) |
Merge "Unit/SONAR/Checkstyle in ONAP-REST"
Diffstat (limited to 'ONAP-PAP-REST/src/main/java/org')
6 files changed, 59 insertions, 59 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicy.java index 01c211cdb..e153ea834 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicy.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicy.java @@ -610,16 +610,16 @@ public class FirewallConfigPolicy extends Policy { TermList termEntry = new TermList(); termEntry.setTermName(ruleName); - termEntry.setSrcIPList(srcListInsert); - termEntry.setDestIPList(destListInsert); + termEntry.setSrcIpList(srcListInsert); + termEntry.setDestIpList(destListInsert); termEntry.setProtocolList("null"); termEntry.setPortList("null"); termEntry.setSrcPortList("null"); termEntry.setDestPortList(destPortListInsert); termEntry.setAction(action); termEntry.setDescription(description); - termEntry.setFromZones(fromZoneInsert); - termEntry.setToZones(toZoneInsert); + termEntry.setFromZone(fromZoneInsert); + termEntry.setToZone(toZoneInsert); termEntry.setUserCreatedBy(userInfo); dbConnection.save(termEntry); @@ -962,16 +962,16 @@ public class FirewallConfigPolicy extends Policy { TermList termEntry = new TermList(); termEntry.setTermName(ruleName); - termEntry.setSrcIPList(srcListInsert); - termEntry.setDestIPList(destListInsert); + termEntry.setSrcIpList(srcListInsert); + termEntry.setDestIpList(destListInsert); termEntry.setProtocolList("null"); termEntry.setPortList("null"); termEntry.setSrcPortList("null"); termEntry.setDestPortList(destPortListInsert); termEntry.setAction(action); termEntry.setDescription(description); - termEntry.setFromZones(fromZoneInsert); - termEntry.setToZones(toZoneInsert); + termEntry.setFromZone(fromZoneInsert); + termEntry.setToZone(toZoneInsert); termEntry.setUserCreatedBy(userInfo); dbConnection.save(termEntry); @@ -1144,7 +1144,7 @@ public class FirewallConfigPolicy extends Policy { serviceListEntry.setServiceName(groupName); serviceListEntry.setServiceDescription(description); serviceListEntry.setServiceType(type); - serviceListEntry.setServiceTransProtocol(transportProtocol); + serviceListEntry.setServiceTransportProtocol(transportProtocol); serviceListEntry.setServiceAppProtocol("null"); serviceListEntry.setServicePorts(ports); dbConnection.save(serviceListEntry); 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 16e8e2e2c..9ea956aa7 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 @@ -40,8 +40,8 @@ import org.onap.policy.rest.jpa.ClosedLoopSite; import org.onap.policy.rest.jpa.OnapName; import org.onap.policy.rest.jpa.PepOptions; import org.onap.policy.rest.jpa.UserInfo; -import org.onap.policy.rest.jpa.VNFType; -import org.onap.policy.rest.jpa.VSCLAction; +import org.onap.policy.rest.jpa.VnfType; +import org.onap.policy.rest.jpa.VsclAction; import org.onap.policy.rest.jpa.VarbindDictionary; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; @@ -54,9 +54,9 @@ import org.springframework.web.servlet.ModelAndView; public class ClosedLoopDictionaryController { private static CommonClassDao commonClassDao; - private static String vsclaction = "vsclaction"; + private static String vsclaction = "action"; private static String operation = "operation"; - private static String vnftype = "vnftype"; + private static String vnftype = "type"; private static String pepName = "pepName"; private static String varbindName = "varbindName"; private static String serviceName = "serviceName"; @@ -98,7 +98,7 @@ public class ClosedLoopDictionaryController { produces = MediaType.APPLICATION_JSON_VALUE) public void getVSCLActionDictionaryByNameEntityData(HttpServletResponse response) { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.getDataByEntity(response, vsclActionDatas, vsclaction, VSCLAction.class); + utils.getDataByEntity(response, vsclActionDatas, vsclaction, VsclAction.class); } @RequestMapping( @@ -107,7 +107,7 @@ public class ClosedLoopDictionaryController { produces = MediaType.APPLICATION_JSON_VALUE) public void getVSCLActionDictionaryEntityData(HttpServletResponse response) { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.getData(response, vsclActionDatas, VSCLAction.class); + utils.getData(response, vsclActionDatas, VsclAction.class); } @RequestMapping( @@ -116,7 +116,7 @@ public class ClosedLoopDictionaryController { produces = MediaType.APPLICATION_JSON_VALUE) public void getVNFTypeDictionaryByNameEntityData(HttpServletResponse response) { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.getDataByEntity(response, vnfTypeDatas, vnftype, VNFType.class); + utils.getDataByEntity(response, vnfTypeDatas, vnftype, VnfType.class); } @RequestMapping( @@ -125,7 +125,7 @@ public class ClosedLoopDictionaryController { produces = MediaType.APPLICATION_JSON_VALUE) public void getVNFTypeDictionaryEntityData(HttpServletResponse response) { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.getData(response, vnfTypeDatas, VNFType.class); + utils.getData(response, vnfTypeDatas, VnfType.class); } @RequestMapping( @@ -208,22 +208,22 @@ public class ClosedLoopDictionaryController { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); JsonNode root = mapper.readTree(request.getReader()); - VSCLAction vSCLAction; + VsclAction vSCLAction; String userId = null; if (fromAPI) { - vSCLAction = mapper.readValue(root.get(dictionaryFields).toString(), VSCLAction.class); + vSCLAction = mapper.readValue(root.get(dictionaryFields).toString(), VsclAction.class); userId = "API"; } else { - vSCLAction = mapper.readValue(root.get("vsclActionDictionaryData").toString(), VSCLAction.class); + vSCLAction = mapper.readValue(root.get("vsclActionDictionaryData").toString(), VsclAction.class); userId = root.get(userid).textValue(); } UserInfo userInfo = utils.getUserInfo(userId); List<Object> duplicateData = - commonClassDao.checkDuplicateEntry(vSCLAction.getVsclaction(), vsclaction, VSCLAction.class); + commonClassDao.checkDuplicateEntry(vSCLAction.getAction(), vsclaction, VsclAction.class); boolean duplicateflag = false; if (!duplicateData.isEmpty()) { - VSCLAction data = (VSCLAction) duplicateData.get(0); + VsclAction data = (VsclAction) duplicateData.get(0); if (request.getParameter(operation) != null && "update".equals(request.getParameter(operation))) { vSCLAction.setId(data.getId()); } else if ((request.getParameter(operation) != null @@ -242,7 +242,7 @@ public class ClosedLoopDictionaryController { vSCLAction.setModifiedDate(new Date()); commonClassDao.update(vSCLAction); } - responseString = mapper.writeValueAsString(commonClassDao.getData(VSCLAction.class)); + responseString = mapper.writeValueAsString(commonClassDao.getData(VsclAction.class)); } else { responseString = duplicateResponseString; } @@ -272,22 +272,22 @@ public class ClosedLoopDictionaryController { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); JsonNode root = mapper.readTree(request.getReader()); - VNFType vNFType; + VnfType vNFType; String userId = null; if (fromAPI) { - vNFType = mapper.readValue(root.get(dictionaryFields).toString(), VNFType.class); + vNFType = mapper.readValue(root.get(dictionaryFields).toString(), VnfType.class); userId = "API"; } else { - vNFType = mapper.readValue(root.get("vnfTypeDictionaryData").toString(), VNFType.class); + vNFType = mapper.readValue(root.get("vnfTypeDictionaryData").toString(), VnfType.class); userId = root.get(userid).textValue(); } UserInfo userInfo = utils.getUserInfo(userId); List<Object> duplicateData = - commonClassDao.checkDuplicateEntry(vNFType.getVnftype(), vnftype, VNFType.class); + commonClassDao.checkDuplicateEntry(vNFType.getType(), vnftype, VnfType.class); boolean duplicateflag = false; if (!duplicateData.isEmpty()) { - VNFType data = (VNFType) duplicateData.get(0); + VnfType data = (VnfType) duplicateData.get(0); if (request.getParameter(operation) != null && "update".equals(request.getParameter(operation))) { vNFType.setId(data.getId()); } else if ((request.getParameter(operation) != null @@ -306,7 +306,7 @@ public class ClosedLoopDictionaryController { vNFType.setModifiedDate(new Date()); commonClassDao.update(vNFType); } - responseString = mapper.writeValueAsString(commonClassDao.getData(VNFType.class)); + responseString = mapper.writeValueAsString(commonClassDao.getData(VnfType.class)); } else { responseString = duplicateResponseString; } @@ -325,7 +325,7 @@ public class ClosedLoopDictionaryController { @RequestMapping(value = {"/cl_dictionary/remove_vnfType"}, method = {RequestMethod.POST}) public void removeVnfType(HttpServletRequest request, HttpServletResponse response) throws IOException { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.removeData(request, response, vnfTypeDatas, VNFType.class); + utils.removeData(request, response, vnfTypeDatas, VnfType.class); } @RequestMapping(value = {"/cl_dictionary/save_pepOptions"}, method = {RequestMethod.POST}) @@ -396,7 +396,7 @@ public class ClosedLoopDictionaryController { @RequestMapping(value = {"/cl_dictionary/remove_pepOptions"}, method = {RequestMethod.POST}) public void removePEPOptions(HttpServletRequest request, HttpServletResponse response) throws IOException { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.removeData(request, response, pepOptionDatas, VNFType.class); + utils.removeData(request, response, pepOptionDatas, VnfType.class); } @RequestMapping(value = {"/cl_dictionary/save_service"}, method = {RequestMethod.POST}) @@ -460,7 +460,7 @@ public class ClosedLoopDictionaryController { @RequestMapping(value = {"/cl_dictionary/remove_Service"}, method = {RequestMethod.POST}) public void removeServiceType(HttpServletRequest request, HttpServletResponse response) throws IOException { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.removeData(request, response, closedLoopDatas, VNFType.class); + utils.removeData(request, response, closedLoopDatas, VnfType.class); } @RequestMapping(value = {"/cl_dictionary/save_siteName"}, method = {RequestMethod.POST}) @@ -523,7 +523,7 @@ public class ClosedLoopDictionaryController { @RequestMapping(value = {"/cl_dictionary/remove_site"}, method = {RequestMethod.POST}) public void removeSiteType(HttpServletRequest request, HttpServletResponse response) throws IOException { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.removeData(request, response, closedLoopSiteDatas, VNFType.class); + utils.removeData(request, response, closedLoopSiteDatas, VnfType.class); } @RequestMapping(value = {"/cl_dictionary/save_varbind"}, method = {RequestMethod.POST}) @@ -588,6 +588,6 @@ public class ClosedLoopDictionaryController { @RequestMapping(value = {"/cl_dictionary/remove_varbindDict"}, method = {RequestMethod.POST}) public void removeVarbind(HttpServletRequest request, HttpServletResponse response) throws IOException { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.removeData(request, response, varbindDatas, VNFType.class); + utils.removeData(request, response, varbindDatas, VnfType.class); } } 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 ef475039d..029582213 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 @@ -63,8 +63,8 @@ import org.onap.policy.rest.jpa.SecurityZone; import org.onap.policy.rest.jpa.ServiceList; import org.onap.policy.rest.jpa.TermList; import org.onap.policy.rest.jpa.UserInfo; -import org.onap.policy.rest.jpa.VNFType; -import org.onap.policy.rest.jpa.VSCLAction; +import org.onap.policy.rest.jpa.VnfType; +import org.onap.policy.rest.jpa.VsclAction; import org.onap.policy.rest.jpa.VarbindDictionary; import org.onap.policy.rest.jpa.Zone; import org.springframework.beans.factory.annotation.Autowired; @@ -311,7 +311,7 @@ public class DictionaryImportController { if (dictionaryName.startsWith("VNFType")) { for (int i = 1; i < dictSheet.size(); i++) { - VNFType attribute = new VNFType(); + VnfType attribute = new VnfType(); UserInfo userinfo = new UserInfo(); userinfo.setUserLoginId(userId); attribute.setUserCreatedBy(userinfo); @@ -320,7 +320,7 @@ public class DictionaryImportController { for (int j = 0; j < rows.length; j++) { if ("vnf_type".equalsIgnoreCase(dictSheet.get(0)[j]) || "VNF Type".equalsIgnoreCase(dictSheet.get(0)[j])) { - attribute.setVnftype(rows[j]); + attribute.setType(rows[j]); } if (DESCRIPTION.equalsIgnoreCase(dictSheet.get(0)[j])) { attribute.setDescription(rows[j]); @@ -331,7 +331,7 @@ public class DictionaryImportController { } if (dictionaryName.startsWith("VSCLAction")) { for (int i = 1; i < dictSheet.size(); i++) { - VSCLAction attribute = new VSCLAction(); + VsclAction attribute = new VsclAction(); UserInfo userinfo = new UserInfo(); userinfo.setUserLoginId(userId); attribute.setUserCreatedBy(userinfo); @@ -340,7 +340,7 @@ public class DictionaryImportController { for (int j = 0; j < rows.length; j++) { if ("vscl_action".equalsIgnoreCase(dictSheet.get(0)[j]) || "VSCL Action".equalsIgnoreCase(dictSheet.get(0)[j])) { - attribute.setVsclaction(rows[j]); + attribute.setAction(rows[j]); } if (DESCRIPTION.equalsIgnoreCase(dictSheet.get(0)[j])) { attribute.setDescription(rows[j]); @@ -431,7 +431,7 @@ public class DictionaryImportController { } if ("varbind_oid".equalsIgnoreCase(dictSheet.get(0)[j]) || "Varbind OID".equalsIgnoreCase(dictSheet.get(0)[j])) { - attribute.setVarbindOID(rows[j]); + attribute.setVarbindOid(rows[j]); } } commonClassDao.save(attribute); @@ -615,7 +615,7 @@ public class DictionaryImportController { } if ("serviceTrasProtocol".equalsIgnoreCase(dictSheet.get(0)[j]) || "Transport Protocol".equalsIgnoreCase(dictSheet.get(0)[j])) { - attribute.setServiceTransProtocol(rows[j]); + attribute.setServiceTransportProtocol(rows[j]); } if ("serviceAppProtocol".equalsIgnoreCase(dictSheet.get(0)[j]) || "APP Protocol".equalsIgnoreCase(dictSheet.get(0)[j])) { @@ -717,19 +717,19 @@ public class DictionaryImportController { } if ("fromZone".equalsIgnoreCase(dictSheet.get(0)[j]) || "From Zone".equalsIgnoreCase(dictSheet.get(0)[j])) { - attribute.setFromZones(rows[j]); + attribute.setFromZone(rows[j]); } if ("toZone".equalsIgnoreCase(dictSheet.get(0)[j]) || "To Zone".equalsIgnoreCase(dictSheet.get(0)[j])) { - attribute.setToZones(rows[j]); + attribute.setToZone(rows[j]); } if ("srcIPList".equalsIgnoreCase(dictSheet.get(0)[j]) || "Source-IP-List".equalsIgnoreCase(dictSheet.get(0)[j])) { - attribute.setSrcIPList(rows[j]); + attribute.setSrcIpList(rows[j]); } if ("destIPList".equalsIgnoreCase(dictSheet.get(0)[j]) || "Destination-IP-List".equalsIgnoreCase(dictSheet.get(0)[j])) { - attribute.setDestIPList(rows[j]); + attribute.setDestIpList(rows[j]); } if ("srcPortList".equalsIgnoreCase(dictSheet.get(0)[j]) || "Source-Port-List".equalsIgnoreCase(dictSheet.get(0)[j])) { 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 39a12c81a..3c3cbac30 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 @@ -713,7 +713,7 @@ public class FirewallDictionaryController { mapper.readValue(root.get("serviceListDictionaryData").toString(), GridData.class); } serviceList - .setServiceTransProtocol(utils.appendKey(serviceListGridData.getTransportProtocols(), option, ",")); + .setServiceTransportProtocol(utils.appendKey(serviceListGridData.getTransportProtocols(), option, ",")); serviceList.setServiceAppProtocol(utils.appendKey(serviceListGridData.getAppProtocols(), option, ",")); serviceList.setServiceType("SERVICE"); List<Object> duplicateData = @@ -871,10 +871,10 @@ public class FirewallDictionaryController { userId = root.get(userid).textValue(); } - termList.setFromZones(utils.appendKey(termListDatas.getFromZoneDatas(), option, ",")); - termList.setToZones(utils.appendKey(termListDatas.getToZoneDatas(), option, ",")); - termList.setSrcIPList(utils.appendKey(termListDatas.getSourceListDatas(), option, ",")); - termList.setDestIPList(utils.appendKey(termListDatas.getDestinationListDatas(), option, ",")); + termList.setFromZone(utils.appendKey(termListDatas.getFromZoneDatas(), option, ",")); + termList.setToZone(utils.appendKey(termListDatas.getToZoneDatas(), option, ",")); + termList.setSrcIpList(utils.appendKey(termListDatas.getSourceListDatas(), option, ",")); + termList.setDestIpList(utils.appendKey(termListDatas.getDestinationListDatas(), option, ",")); termList.setSrcPortList(utils.appendKey(termListDatas.getSourceServiceDatas(), option, ",")); termList.setDestPortList(utils.appendKey(termListDatas.getDestinationServiceDatas(), option, ",")); termList.setAction(utils.appendKey(termListDatas.getActionListDatas(), option, ",")); 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 d7683fa0b..577870c70 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 @@ -107,7 +107,7 @@ public class SafePolicyController { } UserInfo userInfo = utils.getUserInfo(userId); List<Object> duplicateData = - commonClassDao.checkDuplicateEntry(riskTypeData.getRiskName(), "name", RiskType.class); + commonClassDao.checkDuplicateEntry(riskTypeData.getName(), "name", RiskType.class); boolean duplicateflag = false; if (!duplicateData.isEmpty()) { RiskType data = (RiskType) duplicateData.get(0); 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 f21ac60c8..48dc46c1b 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 @@ -62,8 +62,8 @@ import org.onap.policy.rest.jpa.PepOptions; import org.onap.policy.rest.jpa.RiskType; import org.onap.policy.rest.jpa.SafePolicyWarning; import org.onap.policy.rest.jpa.TermList; -import org.onap.policy.rest.jpa.VNFType; -import org.onap.policy.rest.jpa.VSCLAction; +import org.onap.policy.rest.jpa.VnfType; +import org.onap.policy.rest.jpa.VsclAction; import org.onap.policy.rest.jpa.VarbindDictionary; import org.onap.policy.utils.PolicyUtils; import org.onap.policy.xacml.api.XACMLErrorConstants; @@ -378,13 +378,13 @@ public class PolicyElasticSearchController { policyList = searchElkDatabase(closedloop, jsonBodyData, "*" + value + "*"); break; case clVnf: - VNFType vNFType = mapper.readValue(root.get("data").toString(), VNFType.class); - value = vNFType.getVnftype(); + VnfType vNFType = mapper.readValue(root.get("data").toString(), VnfType.class); + value = vNFType.getType(); policyList = searchElkDatabase(closedloop, jsonBodyData, "*" + value + "*"); break; case clVSCL: - VSCLAction vsclAction = mapper.readValue(root.get("data").toString(), VSCLAction.class); - value = vsclAction.getVsclaction(); + VsclAction vsclAction = mapper.readValue(root.get("data").toString(), VsclAction.class); + value = vsclAction.getAction(); policyList = searchElkDatabase(closedloop, jsonBodyData, "*" + value + "*"); break; case decision: @@ -423,7 +423,7 @@ public class PolicyElasticSearchController { break; case safeRisk: RiskType riskType = mapper.readValue(root.get("data").toString(), RiskType.class); - value = riskType.getRiskName(); + value = riskType.getName(); policyList = searchElkDatabase(config, "riskType", value); break; case safePolicyWarning: |