Sonar code Smell 50/103650/1
authorArindam Mondal <arind.mondal@samsung.com>
Fri, 13 Mar 2020 02:30:25 +0000 (11:30 +0900)
committer몬달아린담/Network Automation그룹(네트워크)/Staff Engineer/삼성전자 <arind.mondal@samsung.com>
Fri, 13 Mar 2020 02:30:56 +0000 (11:30 +0900)
Issue-ID: USECASEUI-407

Spring framework 4.3 introduced variants of the @RequestMapping
annotation to better represent the semantics of the annotated methods.
The use of @GetMapping, @PostMapping, @PutMapping, @PatchMapping and
@DeleteMapping should be preferred to the use of the raw
@RequestMapping(method = RequestMethod.XYZ).

Change-Id: Ic86eaf183919976d60bd0e581be2c8b13da20baf
Signed-off-by: Arindam Mondal <arind.mondal@samsung.com>
server/src/main/java/org/onap/usecaseui/server/controller/csmf/SlicingController.java
server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceTemplateController.java
server/src/main/java/org/onap/usecaseui/server/service/customer/CcvpnCustomerService.java

index 89ee912..97226ba 100644 (file)
@@ -22,10 +22,11 @@ import org.onap.usecaseui.server.service.csmf.SlicingService;
 import org.springframework.context.annotation.EnableAspectJAutoProxy;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.ResponseBody;
 
 @Controller
@@ -43,18 +44,16 @@ public class SlicingController {
     }
 
     @ResponseBody
-    @RequestMapping(
+    @PostMapping(
         value = {"/5gSlicing"},
-        method = RequestMethod.POST,
         produces = "application/json")
     public ServiceResult createSlicingService(@RequestBody SlicingOrder slicingOrder) {
         return slicingService.createSlicingService(slicingOrder);
     }
 
     @ResponseBody
-    @RequestMapping(
+    @GetMapping(
         value = {"/5gSlicing/orders/status/{status}/pageNo/{pageNo}/pageSize/{pageSize}"},
-        method = RequestMethod.GET,
         produces = "application/json")
     public ServiceResult querySlicingServiceOrder(
         @PathVariable(value="status") String status,
index 7591c39..3a87412 100644 (file)
  */
 package org.onap.usecaseui.server.controller.lcm;
 
+import java.util.List;
+import javax.annotation.Resource;
 import org.onap.usecaseui.server.bean.lcm.ServiceTemplateInput;
-import org.onap.usecaseui.server.bean.lcm.TemplateInput;
-import org.onap.usecaseui.server.service.lcm.ServiceTemplateService;
 import org.onap.usecaseui.server.service.lcm.CustomerService;
+import org.onap.usecaseui.server.service.lcm.ServiceTemplateService;
 import org.onap.usecaseui.server.service.lcm.domain.aai.bean.SDNCController;
 import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo;
 import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate;
@@ -26,11 +27,10 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.annotation.EnableAspectJAutoProxy;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.*;
-
-import javax.annotation.Resource;
-import java.util.List;
-import java.util.ArrayList;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
 
 @Controller
 @org.springframework.context.annotation.Configuration
@@ -50,26 +50,26 @@ public class ServiceTemplateController {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/uui-lcm/service-templates"}, method = RequestMethod.GET , produces = "application/json")
+    @GetMapping(value = {"/uui-lcm/service-templates"} , produces = "application/json")
     public List<SDCServiceTemplate> getServiceTemplates(){
         return serviceTemplateService.listDistributedServiceTemplate();
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/uui-lcm/service-templates/{uuid}"}, method = RequestMethod.GET , produces = "application/json")
+    @GetMapping(value = {"/uui-lcm/service-templates/{uuid}"}, produces = "application/json")
     public ServiceTemplateInput getServiceTemplateInput(@PathVariable("uuid") String uuid, @RequestParam("toscaModelPath") String toscaModelPath){
        ServiceTemplateInput serviceTemplateInput = serviceTemplateService.fetchServiceTemplateInput(uuid, "/api"+toscaModelPath);
         return serviceTemplateInput;
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/uui-lcm/locations/"}, method = RequestMethod.GET , produces = "application/json")
+    @GetMapping(value = {"/uui-lcm/locations/"}, produces = "application/json")
     public List<VimInfo> getLocations(){
         return serviceTemplateService.listVim();
     }
 
      @ResponseBody
-         @RequestMapping(value = {"/uui-lcm/getAllNI/{networkId}"}, method = RequestMethod.GET , produces = "application/json")
+         @GetMapping(value = {"/uui-lcm/getAllNI/{networkId}"}, produces = "application/json")
             public List<String> getAllNetworkInterface(@PathVariable("networkId") String networkId){
                                List<String> nIList = customerService.fetchNIList(networkId);
                                        
@@ -77,7 +77,7 @@ public class ServiceTemplateController {
        }
 
     @ResponseBody
-    @RequestMapping(value = {"/uui-lcm/sdnc-controllers/"}, method = RequestMethod.GET , produces = "application/json")
+    @GetMapping(value = {"/uui-lcm/sdnc-controllers/"}, produces = "application/json")
     public List<SDNCController> getSDNCControllers(){
         return serviceTemplateService.listSDNCControllers();
     }
index ca1e9f7..02e8582 100644 (file)
  */
 package org.onap.usecaseui.server.service.customer;
 
-import org.onap.usecaseui.server.bean.customer.ServiceInstance;
 import org.onap.usecaseui.server.bean.customer.ServiceInstances;
 
-import java.util.List;
-
 public interface CcvpnCustomerService {
 
     public ServiceInstances getServiceInstances(String customerId, String serviceType);
-    //public String getServiceInformation(String serviceInstanceId) throws Exception;
     public String querySubscriptionType(String customerId);
 }