From 9787ee755e489f3870caf0ae2c0d25f204659892 Mon Sep 17 00:00:00 2001 From: Rupinder Date: Tue, 28 Apr 2020 17:35:05 +0530 Subject: [PATCH] added appropriate annotations Issue-ID: USECASEUI-413 Change-Id: I531b95e504a96540bf30a7ee09eab3cecb596907 Signed-off-by: Rupinder --- .../usecaseui/server/controller/AlarmController.java | 13 +++++++------ .../server/controller/PerformanceController.java | 7 ++++--- .../server/controller/lcm/CustomerController.java | 19 +++++++++++-------- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java b/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java index 0cceee27..2134aa74 100755 --- a/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java +++ b/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java @@ -43,6 +43,7 @@ import org.slf4j.LoggerFactory; import org.springframework.context.annotation.EnableAspectJAutoProxy; 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.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -101,7 +102,7 @@ public class AlarmController * test commit * @throws ParseException */ - @RequestMapping(value = {"/alarm/{currentPage}/{pageSize}"}, method = RequestMethod.GET, + @GetMapping(value = {"/alarm/{currentPage}/{pageSize}"}, produces = "application/json") public String getAlarmData(@RequestParam(required = false) String sourceName, @RequestParam(required = false) String priority, @RequestParam(required = false) String startTime, @@ -129,7 +130,7 @@ public class AlarmController } } - @RequestMapping(value = {"/alarm/sourceId"},method = RequestMethod.GET) + @GetMapping(value = {"/alarm/sourceId"}) public String getSourceId() throws JsonProcessingException{ List sourceIds = new ArrayList<>(); Page page = alarmsHeaderService.queryAlarmsHeader(new AlarmsHeader(), 1, Integer.MAX_VALUE); @@ -153,7 +154,7 @@ public class AlarmController return omAlarm.writeValueAsString(sourceIds); } - @RequestMapping(value = {"/alarm/getSourceNames"},method = RequestMethod.GET,produces = "application/json") + @GetMapping(value = {"/alarm/getSourceNames"},produces = "application/json") public String getSourceNames() throws JsonProcessingException{ Set sourceNames = new HashSet<>(); Page page = alarmsHeaderService.queryAlarmsHeader(new AlarmsHeader(), 1, Integer.MAX_VALUE); @@ -174,7 +175,7 @@ public class AlarmController return omAlarm.writeValueAsString(sourceNames); } - @RequestMapping(value = {"/alarm/diagram"},method = RequestMethod.GET,produces = "application/json") + @GetMapping(value = {"/alarm/diagram"},produces = "application/json") public String diagram(@RequestParam String sourceName, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime, @RequestParam String format) { long timeInterval = 0; @@ -250,7 +251,7 @@ public class AlarmController return result; } - @RequestMapping(value = "/alarm/statusCount", method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = "/alarm/statusCount", produces = "application/json") public String getStatusCount() throws JsonProcessingException { List statusCount = new ArrayList<>(); @@ -277,7 +278,7 @@ public class AlarmController return string; } - @RequestMapping(value="/listSortMasters",method=RequestMethod.GET,produces = "application/json;charset=utf8") + @GetMapping(value="/listSortMasters",produces = "application/json;charset=utf8") public String getSortMasterInfo() throws JsonProcessingException{ Map> map = new HashMap<>(); List operationTypes = alarmsHeaderService.listSortMasters("operationType"); diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java b/server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java index 220ca464..9651a2d6 100755 --- a/server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java +++ b/server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java @@ -40,6 +40,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; 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.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -72,7 +73,7 @@ public class PerformanceController { private ObjectMapper omPerformance = new ObjectMapper(); - @RequestMapping(value = {"/performance/{currentPage}/{pageSize}"},method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = {"/performance/{currentPage}/{pageSize}"}, produces = "application/json") public String getPerformanceData(@PathVariable String currentPage, @PathVariable String pageSize, @RequestParam(required = false) String sourceName, @@ -95,7 +96,7 @@ public class PerformanceController { } } - @RequestMapping(value = {"/performance/queryAllSourceNames"},method = RequestMethod.GET) + @GetMapping(value = {"/performance/queryAllSourceNames"}) public String getSourceIds(){ try { return omPerformance.writeValueAsString(performanceHeaderService.queryAllSourceNames()); @@ -122,7 +123,7 @@ public class PerformanceController { return string; } - @RequestMapping(value = {"/performance/getSourceNames/{currentPage}/{pageSize}"},method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = {"/performance/getSourceNames/{currentPage}/{pageSize}"}, produces = "application/json") public String getPerformanceSourceNames(@PathVariable String currentPage,@PathVariable String pageSize, @RequestParam(required = false) String sourceName) throws JsonProcessingException{ PerformanceHeader performanceHeader = new PerformanceHeader.PerformanceHeaderBuilder().createPerformanceHeader(); diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java index 98bbb294..f3f938c3 100644 --- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java +++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.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.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; @@ -48,49 +51,49 @@ public class CustomerController { } @ResponseBody - @RequestMapping(value = {"/uui-lcm/customers"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/customers"} , produces = "application/json") public List getCustomers(){ return customerService.listCustomer(); } @ResponseBody - @RequestMapping(value={"/uui-lcm/customers/{customerId}"},method = RequestMethod.PUT,produces="application/json") + @PutMapping(value={"/uui-lcm/customers/{customerId}"},produces="application/json") public JSONObject createOrUpdateCustomer(HttpServletRequest request,@PathVariable String customerId){ return customerService.createOrUpdateCustomer(request, customerId); } @ResponseBody - @RequestMapping(value={"/uui-lcm/customers/{customerId}"},method = RequestMethod.GET,produces="application/json") + @GetMapping(value={"/uui-lcm/customers/{customerId}"},produces="application/json") public JSONObject getCustomerById(@PathVariable String customerId){ return customerService.getCustomerById(customerId); } @ResponseBody - @RequestMapping(value={"/uui-lcm/customers"},method = RequestMethod.DELETE,produces="application/json") + @DeleteMapping(value={"/uui-lcm/customers"},produces="application/json") public JSONObject deleteCustomer(@RequestParam String customerId,@RequestParam String resourceVersion){ return customerService.deleteCustomer(customerId,resourceVersion); } @ResponseBody - @RequestMapping(value = {"/uui-lcm/customers/{customerId}/service-subscriptions"}, method = RequestMethod.GET , produces = "application/json") + @GetMapping(value = {"/uui-lcm/customers/{customerId}/service-subscriptions"} , produces = "application/json") public List getServiceSubscriptions(@PathVariable(value="customerId") String customerId){ return customerService.listServiceSubscriptions(customerId); } @ResponseBody - @RequestMapping(value={"/uui-lcm/customers/{customerId}/service-subscriptions/{serviceType}"},method = RequestMethod.PUT,produces="application/json") + @PutMapping(value={"/uui-lcm/customers/{customerId}/service-subscriptions/{serviceType}"},produces="application/json") public JSONObject createOrUpdateServiceType(HttpServletRequest request,@PathVariable String serviceType,@PathVariable String customerId){ return customerService.createOrUpdateServiceType(request, serviceType,customerId); } @ResponseBody - @RequestMapping(value={"/uui-lcm/customers/{customerId}/service-subscriptions/{serviceType}"},method = RequestMethod.DELETE,produces="application/json") + @DeleteMapping(value={"/uui-lcm/customers/{customerId}/service-subscriptions/{serviceType}"},produces="application/json") public JSONObject deleteServiceType(@PathVariable String customerId,@PathVariable String serviceType,@RequestParam String resourceVersion){ return customerService.deleteServiceType(customerId,serviceType,resourceVersion); } @ResponseBody - @RequestMapping(value={"/uui-lcm/customers/{customerId}/service-subscriptions/{serviceType}"},method = RequestMethod.GET,produces="application/json") + @GetMapping(value={"/uui-lcm/customers/{customerId}/service-subscriptions/{serviceType}"}, produces="application/json") public JSONObject getServiceTypeById(@PathVariable String customerId,@PathVariable String serviceType){ return customerService.getServiceTypeById(customerId,serviceType); } -- 2.16.6