diff options
author | Chuyi Guo <guochuyi@chinamobile.com> | 2020-04-29 06:06:17 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-04-29 06:06:17 +0000 |
commit | e73fadea6f43487b7f8195ac3688f1d73c81b5a8 (patch) | |
tree | e3bd5fedc0ead6d90290adf60221061ed9259506 | |
parent | 3d0de25495ec04a6bba108ada5ac85c15fbb85b7 (diff) | |
parent | 3700d670df754637fbd5e419b2f38421ceacc0c3 (diff) |
Merge "removed code smells"
-rw-r--r-- | server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java | 74 |
1 files changed, 39 insertions, 35 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java index 70e796af..47ff54ef 100644 --- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java +++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java @@ -42,6 +42,10 @@ import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; @@ -72,50 +76,50 @@ public class PackageDistributionController { } @ResponseBody - @RequestMapping(value = {"/uui-lcm/vf-ns-packages"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/vf-ns-packages"}, produces = "application/json") public VfNsPackageInfo retrievePackageInfo(){ return packageDistributionService.retrievePackageInfo(); } @ResponseBody - @RequestMapping(value = {"/uui-lcm/sdc-ns-packages"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/sdc-ns-packages"}, produces = "application/json") public List<SDCServiceTemplate> sdcNsPackageInfo(){ return packageDistributionService.sdcNsPackageInfo(); } @ResponseBody - @RequestMapping(value = {"/uui-lcm/sdc-vf-packages"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/sdc-vf-packages"}, produces = "application/json") public List<Vnf> sdcVfPackageInfo(){ return packageDistributionService.sdcVfPackageInfo(); } @ResponseBody - @RequestMapping(value = {"/uui-lcm/ns-packages"}, method = RequestMethod.POST , produces = "application/json") + @PostMapping(value = {"/uui-lcm/ns-packages"}, produces = "application/json") public DistributionResult distributeNsPackage(@RequestBody Csar csar){ return packageDistributionService.postNsPackage(csar); } @ResponseBody - @RequestMapping(value = {"/uui-lcm/vf-packages"}, method = RequestMethod.POST , produces = "application/json") + @PostMapping(value = {"/uui-lcm/vf-packages"}, produces = "application/json") public Job distributeVfPackage(@RequestBody Csar csar){ return packageDistributionService.postVfPackage(csar); } @ResponseBody - @RequestMapping(value = {"/uui-lcm/jobs/{jobId}"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/jobs/{jobId}"}, produces = "application/json") public JobStatus getJobStatus(@PathVariable(value="jobId") String jobId, HttpServletRequest request){ String responseId = request.getParameter("responseId"); return packageDistributionService.getJobStatus(jobId, responseId); } @ResponseBody - @RequestMapping(value = {"/uui-lcm/ns-packages/{casrId}"}, method = RequestMethod.DELETE , produces = "application/json") + @DeleteMapping(value = {"/uui-lcm/ns-packages/{casrId}"}, produces = "application/json") public DistributionResult deleteNsPackage(@PathVariable("casrId") String casrId){ return packageDistributionService.deleteNsPackage(casrId); } @ResponseBody - @RequestMapping(value = {"/uui-lcm/jobs/getNsLcmJobStatus/{jobId}"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/jobs/getNsLcmJobStatus/{jobId}"}, produces = "application/json") public JobStatus getNsLcmJobStatus(@PathVariable(value="jobId") String jobId, HttpServletRequest request){ String responseId = request.getParameter("responseId"); String serviceInstanceId = request.getParameter("serviceInstanceId"); @@ -136,117 +140,117 @@ public class PackageDistributionController { } @ResponseBody - @RequestMapping(value = {"/uui-lcm/vf-packages/{casrId}"}, method = RequestMethod.DELETE , produces = "application/json") + @DeleteMapping(value = {"/uui-lcm/vf-packages/{casrId}"}, produces = "application/json") public Job deleteVfPackage(@PathVariable("casrId") String casrId){ return packageDistributionService.deleteVfPackage(casrId); } - @RequestMapping(value = {"/uui-lcm/fetchNsTemplateData"}, method = RequestMethod.POST , produces = "application/json") + @PostMapping(value = {"/uui-lcm/fetchNsTemplateData"}, produces = "application/json") public String fetchNsTemplateData(HttpServletRequest request){ return packageDistributionService.fetchNsTemplateData(request); } - @RequestMapping(value={"/uui-lcm/fetchCCVPNTemplateData/{csarId}"},method = RequestMethod.POST,produces="application/json") + @PostMapping(value={"/uui-lcm/fetchCCVPNTemplateData/{csarId}"},produces="application/json") public JSONObject fetchCCVPNTemplateData(HttpServletRequest request, @PathVariable String csarId){ JSONObject model = (JSONObject) packageDistributionService.fetchCCVPNTemplateData(request, csarId).get("result"); return model; } - @RequestMapping(value = {"/uui-lcm/listNsTemplates"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/listNsTemplates"}, produces = "application/json") public String listNsTemplates(){ return packageDistributionService.listNsTemplates(); } - @RequestMapping(value = {"/uui-lcm/ns-packages"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/ns-packages"}, produces = "application/json") public String getNsPackages(){ return packageDistributionService.getNetworkServicePackages(); } - @RequestMapping(value = {"/uui-lcm/vnf-packages"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/vnf-packages"}, produces = "application/json") public String getVnfPackages(){ return packageDistributionService.getVnfPackages(); } - @RequestMapping(value = {"/uui-lcm/pnf-packages"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/pnf-packages"}, produces = "application/json") public String getPnfPackages(){ return packageDistributionService.getPnfPackages(); } - @RequestMapping(value = {"/uui-lcm/createNetworkServiceData"}, method = RequestMethod.POST , produces = "application/json") + @PostMapping(value = {"/uui-lcm/createNetworkServiceData"}, produces = "application/json") public String createNetworkServiceData(HttpServletRequest request){ return packageDistributionService.createNetworkServiceData(request); } - @RequestMapping(value = {"/uui-lcm/createVnfData"}, method = RequestMethod.POST , produces = "application/json") + @PostMapping(value = {"/uui-lcm/createVnfData"}, produces = "application/json") public String createVnfData(HttpServletRequest request){ return packageDistributionService.createVnfData(request); } - @RequestMapping(value = {"/uui-lcm/createPnfData"}, method = RequestMethod.POST , produces = "application/json") + @PostMapping(value = {"/uui-lcm/createPnfData"}, produces = "application/json") public String createPnfData(HttpServletRequest request){ return packageDistributionService.createPnfData(request); } - @RequestMapping(value = {"/uui-lcm/getNsdInfo"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/getNsdInfo"}, produces = "application/json") public String getNsdInfo(@RequestParam String nsdInfoId){ return packageDistributionService.getNsdInfo(nsdInfoId); } - @RequestMapping(value = {"/uui-lcm/getVnfInfo"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/getVnfInfo"}, produces = "application/json") public String getVnfInfo(@RequestParam String vnfPkgId){ return packageDistributionService.getVnfInfo(vnfPkgId); } - @RequestMapping(value = {"/uui-lcm/getPnfInfo"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/getPnfInfo"}, produces = "application/json") public String getPnfInfo(@RequestParam String pnfdInfoId){ return packageDistributionService.getPnfInfo(pnfdInfoId); } - @RequestMapping(value = {"/uui-lcm/downLoadNsPackage"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/downLoadNsPackage"}, produces = "application/json") public String downLoadNsPackage(@RequestParam String nsdInfoId){ return packageDistributionService.downLoadNsPackage(nsdInfoId); } - @RequestMapping(value = {"/uui-lcm/downLoadPnfPackage"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/downLoadPnfPackage"}, produces = "application/json") public String downLoadPnfPackage(@RequestParam String pnfdInfoId){ return packageDistributionService.downLoadPnfPackage(pnfdInfoId); } - @RequestMapping(value = {"/uui-lcm/downLoadVnfPackage"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/downLoadVnfPackage"}, produces = "application/json") public String downLoadVnfPackage(@RequestParam String vnfPkgId){ return packageDistributionService.downLoadVnfPackage(vnfPkgId); } - @RequestMapping(value = {"/uui-lcm/deleteNsdPackage"}, method = RequestMethod.DELETE , produces = "application/json") + @DeleteMapping(value = {"/uui-lcm/deleteNsdPackage"}, produces = "application/json") public String deleteNsdPackage(@RequestParam String nsdInfoId){ return packageDistributionService.deleteNsdPackage(nsdInfoId); } - @RequestMapping(value = {"/uui-lcm/deleteVnfPackage"}, method = RequestMethod.DELETE , produces = "application/json") + @DeleteMapping(value = {"/uui-lcm/deleteVnfPackage"}, produces = "application/json") public String deleteVnfPackage(@RequestParam String vnfPkgId){ return packageDistributionService.deleteVnfPackage(vnfPkgId); } - @RequestMapping(value = {"/uui-lcm/deletePnfPackage"}, method = RequestMethod.DELETE , produces = "application/json") + @DeleteMapping(value = {"/uui-lcm/deletePnfPackage"} , produces = "application/json") public String deletePnfPackage(@RequestParam String pnfdInfoId){ return packageDistributionService.deletePnfPackage(pnfdInfoId); } - @RequestMapping(value = {"/uui-lcm/getNetworkServiceInfo"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/getNetworkServiceInfo"} , produces = "application/json") public List<String> getNetworkServiceInfo(){ return packageDistributionService.getNetworkServiceInfo(); } - @RequestMapping(value = {"/uui-lcm/createNetworkServiceInstance"}, method = RequestMethod.POST , produces = "application/json") + @PostMapping(value = {"/uui-lcm/createNetworkServiceInstance"}, produces = "application/json") public String createNetworkServiceInstance(HttpServletRequest request){ return packageDistributionService.createNetworkServiceInstance(request); } - @RequestMapping(value = {"/uui-lcm/deleteNetworkServiceInstance"}, method = RequestMethod.DELETE , produces = "application/json") + @DeleteMapping(value = {"/uui-lcm/deleteNetworkServiceInstance"}, produces = "application/json") public String deleteNetworkServiceInstance(@RequestParam String ns_instance_id){ return packageDistributionService.deleteNetworkServiceInstance(ns_instance_id); } - @RequestMapping(value = {"/uui-lcm/instantiateNetworkServiceInstance"}, method = RequestMethod.POST , produces = "application/json") + @PostMapping(value = {"/uui-lcm/instantiateNetworkServiceInstance"} , produces = "application/json") public String instantiateNetworkServiceInstance(HttpServletRequest request) throws ParseException{ String customerId = request.getParameter("customerId"); String serviceType = request.getParameter("serviceType"); @@ -262,7 +266,7 @@ public class PackageDistributionController { return object; } - @RequestMapping(value = {"/uui-lcm/terminateNetworkServiceInstance"}, method = RequestMethod.POST , produces = "application/json") + @PostMapping(value = {"/uui-lcm/terminateNetworkServiceInstance"} , produces = "application/json") public String terminateNetworkServiceInstance(HttpServletRequest request,@RequestParam String ns_instance_id) throws ParseException{ String result = packageDistributionService.terminateNetworkServiceInstance(request,ns_instance_id); String jobId = ""; @@ -275,7 +279,7 @@ public class PackageDistributionController { return result; } - @RequestMapping(value = {"/uui-lcm/healNetworkServiceInstance"}, method = RequestMethod.POST , produces = "application/json") + @PostMapping(value = {"/uui-lcm/healNetworkServiceInstance"} , produces = "application/json") public String healNetworkServiceInstance(HttpServletRequest request,@RequestParam String ns_instance_id) throws ParseException{ String result= packageDistributionService.healNetworkServiceInstance(request,ns_instance_id); String jobId = ""; @@ -288,12 +292,12 @@ public class PackageDistributionController { return result; } - @RequestMapping(value = {"/uui-lcm/scaleNetworkServiceInstance"}, method = RequestMethod.POST , produces = "application/json") + @PostMapping(value = {"/uui-lcm/scaleNetworkServiceInstance"} , produces = "application/json") public String scaleNetworkServiceInstance(HttpServletRequest request,@RequestParam String ns_instance_id){ return packageDistributionService.scaleNetworkServiceInstance(request,ns_instance_id); } - @RequestMapping(value = {"/uui-lcm/VnfInfo/{vnfinstid}"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/VnfInfo/{vnfinstid}"} , produces = "application/json") public String getVnfInfoById(@PathVariable String vnfinstid){ return packageDistributionService.getVnfInfoById(vnfinstid); } |