From df2f5752481034d9c8b8ef33e6a8e559139a6e51 Mon Sep 17 00:00:00 2001 From: Rupinder Date: Tue, 5 May 2020 15:42:58 +0530 Subject: lowered code smells Issue-ID: USECASEUI-423 Change-Id: I1ff15c32358b0d6e774d974f3f89480ec5b6dc88 Signed-off-by: Rupinder --- .../controller/lcm/SotnServiceQryController.java | 5 ++- .../controller/nsmf/ResourceMgtController.java | 49 ++++++++++++---------- .../controller/nsmf/ResourceMonitorController.java | 13 +++--- 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/SotnServiceQryController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/SotnServiceQryController.java index 677e655a..9c68a65d 100644 --- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/SotnServiceQryController.java +++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/SotnServiceQryController.java @@ -24,6 +24,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @@ -50,7 +51,7 @@ public class SotnServiceQryController { } @ResponseBody - @RequestMapping(value = {"/uui-lcm/Sotnservices/ServiceInstances/{serviceType}"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/Sotnservices/ServiceInstances/{serviceType}"}, produces = "application/json") public String getSotnServiceInstances(@PathVariable(value="serviceType") String serviceType){ System.out.println("Get Service Instance called."); String response = sotnServiceQryService.getServiceInstances(serviceType); @@ -58,7 +59,7 @@ public class SotnServiceQryController { } @ResponseBody - @RequestMapping(value = {"/uui-lcm/customers/service-subscriptions"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/customers/service-subscriptions"}, produces = "application/json") public String getServiceSubscriptions(){ System.out.println("Get Service Subscription called."); String response = ccvpnCustomerService.querySubscriptionType(); diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/ResourceMgtController.java b/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/ResourceMgtController.java index 40adc9c9..4187fc1a 100644 --- a/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/ResourceMgtController.java +++ b/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/ResourceMgtController.java @@ -23,6 +23,9 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.PathVariable; 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.DeleteMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @@ -41,103 +44,103 @@ public class ResourceMgtController { } @ResponseBody - @RequestMapping(value = { - "/business/pageNo/{pageNo}/pageSize/{pageSize}"}, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/business/pageNo/{pageNo}/pageSize/{pageSize}"}, produces = "application/json") public ServiceResult querySlicingBusiness(@PathVariable int pageNo, @PathVariable int pageSize) { return resourceMgtService.querySlicingBusiness(pageNo, pageSize); } @ResponseBody - @RequestMapping(value = { - "/{businessStatus}/business/pageNo/{pageNo}/pageSize/{pageSize}"}, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/{businessStatus}/business/pageNo/{pageNo}/pageSize/{pageSize}"}, produces = "application/json") public ServiceResult querySlicingBusinessByStatus(@PathVariable String businessStatus, @PathVariable int pageNo, @PathVariable int pageSize) { return resourceMgtService.querySlicingBusinessByStatus(businessStatus, pageNo, pageSize); } @ResponseBody - @RequestMapping(value = { - "/business/{businessId}/details"}, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/business/{businessId}/details"}, produces = "application/json") public ServiceResult querySlicingBusinessDetails(@PathVariable String businessId) { return resourceMgtService.querySlicingBusinessDetails(businessId); } @ResponseBody - @RequestMapping(value = { - "/nsi/instances/pageNo/{pageNo}/pageSize/{pageSize}"}, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/nsi/instances/pageNo/{pageNo}/pageSize/{pageSize}"}, produces = "application/json") public ServiceResult queryNsiInstances(@PathVariable int pageNo, @PathVariable int pageSize) { return resourceMgtService.queryNsiInstances(pageNo, pageSize); } @ResponseBody - @RequestMapping(value = { - "/nsi/{instanceStatus}/instances/pageNo/{pageNo}/pageSize/{pageSize}"}, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/nsi/{instanceStatus}/instances/pageNo/{pageNo}/pageSize/{pageSize}"}, produces = "application/json") public ServiceResult queryNsiInstancesByStatus(@PathVariable String instanceStatus, @PathVariable int pageNo, @PathVariable int pageSize) { return resourceMgtService.queryNsiInstancesByStatus(instanceStatus, pageNo, pageSize); } @ResponseBody - @RequestMapping(value = {"/nsi/{nsiId}/details"}, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = {"/nsi/{nsiId}/details"}, produces = "application/json") public ServiceResult queryNsiDetails(@PathVariable String nsiId) { return resourceMgtService.queryNsiDetails(nsiId); } @ResponseBody - @RequestMapping(value = {"/nsi/{nsiId}/nssiInstances"}, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = {"/nsi/{nsiId}/nssiInstances"}, produces = "application/json") public ServiceResult queryNsiRelatedNssiInfo(@PathVariable String nsiId) { return resourceMgtService.queryNsiRelatedNssiInfo(nsiId); } @ResponseBody - @RequestMapping(value = { - "/nssi/instances/pageNo/{pageNo}/pageSize/{pageSize}"}, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/nssi/instances/pageNo/{pageNo}/pageSize/{pageSize}"}, produces = "application/json") public ServiceResult queryNssiInstances(@PathVariable int pageNo, @PathVariable int pageSize) { return resourceMgtService.queryNssiInstances(pageNo, pageSize); } @ResponseBody - @RequestMapping(value = { - "/nssi/instanceStatus/{instanceStatus}/instances/pageNo/{pageNo}/pageSize/{pageSize}"}, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/nssi/instanceStatus/{instanceStatus}/instances/pageNo/{pageNo}/pageSize/{pageSize}"}, produces = "application/json") public ServiceResult queryNssiInstancesByStatus(@PathVariable String instanceStatus, @PathVariable int pageNo, @PathVariable int pageSize) { return resourceMgtService.queryNssiInstancesByStatus(instanceStatus, pageNo, pageSize); } @ResponseBody - @RequestMapping(value = { - "/nssi/environmentContext/{environmentContext}/instances/pageNo/{pageNo}/pageSize/{pageSize}"}, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/nssi/environmentContext/{environmentContext}/instances/pageNo/{pageNo}/pageSize/{pageSize}"}, produces = "application/json") public ServiceResult queryNssiInstancesByEnvironment(@PathVariable String environmentContext, @PathVariable int pageNo, @PathVariable int pageSize) { return resourceMgtService.queryNssiInstancesByEnvironment(environmentContext, pageNo, pageSize); } @ResponseBody - @RequestMapping(value = {"/nssi/{nssiId}/details"}, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = {"/nssi/{nssiId}/details"}, produces = "application/json") public ServiceResult queryNssiDetails(@PathVariable String nssiId) { return resourceMgtService.queryNssiDetails(nssiId); } @ResponseBody - @RequestMapping(value = {"/{serviceId}/activate"}, method = RequestMethod.PUT, produces = "application/json") + @PutMapping(value = {"/{serviceId}/activate"}, produces = "application/json") public ServiceResult activateSlicingService(@PathVariable(value = "serviceId") String serviceId) { return resourceMgtService.activateSlicingService(serviceId); } @ResponseBody - @RequestMapping(value = {"/{serviceId}/deactivate"}, method = RequestMethod.PUT, produces = "application/json") + @PutMapping(value = {"/{serviceId}/deactivate"}, produces = "application/json") public ServiceResult deactivateSlicingService(@PathVariable(value = "serviceId") String serviceId) { return resourceMgtService.deactivateSlicingService(serviceId); } @ResponseBody - @RequestMapping(value = {"/{serviceId}"}, method = RequestMethod.DELETE, produces = "application/json") + @DeleteMapping(value = {"/{serviceId}"}, produces = "application/json") public ServiceResult terminateSlicingService(@PathVariable(value = "serviceId") String serviceId) { return resourceMgtService.terminateSlicingService(serviceId); } @ResponseBody - @RequestMapping(value = {"/{serviceId}/progress"}, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = {"/{serviceId}/progress"}, produces = "application/json") public ServiceResult queryOperationProgress(@PathVariable(value = "serviceId") String serviceId) { return resourceMgtService.queryOperationProgress(serviceId); } diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/ResourceMonitorController.java b/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/ResourceMonitorController.java index 3431412e..24ef506d 100644 --- a/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/ResourceMonitorController.java +++ b/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/ResourceMonitorController.java @@ -25,6 +25,7 @@ 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.PostMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @@ -43,8 +44,8 @@ public class ResourceMonitorController { } @ResponseBody - @RequestMapping(value = { - "/queryTimestamp/{queryTimestamp}/trafficData"}, method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = { + "/queryTimestamp/{queryTimestamp}/trafficData"}, produces = "application/json") public ServiceResult querySlicingUsageTraffic(@PathVariable(value = "queryTimestamp") String queryTimestamp, @RequestBody ServiceList serviceList) { @@ -52,8 +53,8 @@ public class ResourceMonitorController { } @ResponseBody - @RequestMapping(value = { - "/queryTimestamp/{queryTimestamp}/onlineUsers"}, method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = { + "/queryTimestamp/{queryTimestamp}/onlineUsers"}, produces = "application/json") public ServiceResult querySlicingOnlineUserNumber(@PathVariable(value = "queryTimestamp") String queryTimestamp, @RequestBody ServiceList serviceList) { @@ -61,8 +62,8 @@ public class ResourceMonitorController { } @ResponseBody - @RequestMapping(value = { - "/queryTimestamp/{queryTimestamp}/bandwidth"}, method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = { + "/queryTimestamp/{queryTimestamp}/bandwidth"}, produces = "application/json") public ServiceResult querySlicingTotalBandwidth(@PathVariable(value = "queryTimestamp") String queryTimestamp, @RequestBody ServiceList serviceList) { -- cgit 1.2.3-korg