From 9c41a567108b8b35936f6198f312b4ee8740325b Mon Sep 17 00:00:00 2001 From: Rupinder Date: Fri, 5 Jun 2020 10:36:04 +0530 Subject: [PATCH] put proper annotations Issue-ID: PORTAL-865 Change-Id: I70a0485ce6bbb30bd613fb9527ed96802444d01b Signed-off-by: Rupinder --- .../portal/controller/WidgetMSController.java | 4 +-- .../controller/WidgetsCatalogController.java | 38 ++++++++++++---------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetMSController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetMSController.java index eab811ab..9ba56224 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetMSController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetMSController.java @@ -48,7 +48,7 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController @@ -60,7 +60,7 @@ public class WidgetMSController extends EPRestrictedBaseController { private WidgetMService widgetMService; // Get location of a healthy node running our service - @RequestMapping(value = { "/service/{service}" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/service/{service}" }, produces = "application/json") public PortalRestResponse getServiceLocation(HttpServletRequest request, HttpServletResponse response, @PathVariable("service") String service) { diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogController.java index a4037375..4b68a01e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogController.java @@ -80,8 +80,10 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; 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.RequestMethod; +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.RestController; import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestTemplate; @@ -135,7 +137,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { }); } - @RequestMapping(value = { "/portalApi/microservices/widgetCatalog/{loginName}" }, method = RequestMethod.GET) + @GetMapping(value = { "/portalApi/microservices/widgetCatalog/{loginName}" }) public List getUserWidgetCatalog(@PathVariable("loginName") String loginName) { List widgets = new ArrayList<>(); try { @@ -155,7 +157,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { return widgets; } - @RequestMapping(value = { "/portalApi/microservices/widgetCatalog" }, method = RequestMethod.GET) + @GetMapping(value = { "/portalApi/microservices/widgetCatalog" }) public List getWidgetCatalog() { List widgets = new ArrayList<>(); try { @@ -175,8 +177,8 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { return widgets; } - @RequestMapping(value = { - "/portalApi/microservices/widgetCatalog/{widgetId}" }, method = RequestMethod.PUT, produces = "application/json") + @PutMapping(value = { + "/portalApi/microservices/widgetCatalog/{widgetId}" }, produces = "application/json") public void updateWidgetCatalog(@RequestBody WidgetCatalog newWidgetCatalog, @PathVariable("widgetId") long widgetId) throws Exception { template.exchange( EcompPortalUtils.widgetMsProtocol() + "://" @@ -186,7 +188,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { HttpMethod.PUT, new HttpEntity<>(newWidgetCatalog, WidgetServiceHeaders.getInstance()), String.class); } - @RequestMapping(value = { "/portalApi/microservices/widgetCatalog/{widgetId}" }, method = RequestMethod.DELETE) + @DeleteMapping(value = { "/portalApi/microservices/widgetCatalog/{widgetId}" }) public void deleteOnboardingWidget(@PathVariable("widgetId") long widgetId) throws Exception { template.exchange( EcompPortalUtils.widgetMsProtocol() + "://" @@ -196,7 +198,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { HttpMethod.DELETE, new HttpEntity<>(WidgetServiceHeaders.getInstance()), String.class); } - @RequestMapping(value = { "/portalApi/microservices/widgetCatalog/{widgetId}" }, method = RequestMethod.POST) + @PostMapping(value = { "/portalApi/microservices/widgetCatalog/{widgetId}" }) public String updateWidgetCatalogWithFiles(HttpServletRequest request, @PathVariable("widgetId") long widgetId) throws RestClientException, Exception { MultipartHttpServletRequest mRequest; @@ -230,7 +232,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { return respond; } - @RequestMapping(value = { "/portalApi/microservices/widgetCatalog" }, method = RequestMethod.POST) + @PostMapping(value = { "/portalApi/microservices/widgetCatalog" }) public String createWidgetCatalog(HttpServletRequest request) throws Exception { @@ -272,7 +274,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { return respond; } - @RequestMapping(value = "/portalApi/microservices/{widgetId}/framework.js", method = RequestMethod.GET) + @GetMapping(value = "/portalApi/microservices/{widgetId}/framework.js") public String getWidgetFramework(@PathVariable("widgetId") long widgetId) throws Exception { return template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://" + widgetMService.getServiceLocation(whatService, @@ -281,7 +283,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { WidgetServiceHeaders.getInstance()); } - @RequestMapping(value = "/portalApi/microservices/{widgetId}/controller.js", method = RequestMethod.GET) + @GetMapping(value = "/portalApi/microservices/{widgetId}/controller.js") public String getWidgetController(@PathVariable("widgetId") long widgetId) throws Exception { return template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://" + widgetMService.getServiceLocation(whatService, @@ -290,7 +292,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { WidgetServiceHeaders.getInstance()); } - @RequestMapping(value = "/portalApi/microservices/{widgetId}/style.css", method = RequestMethod.GET) + @GetMapping(value = "/portalApi/microservices/{widgetId}/style.css") public String getWidgetCSS(@PathVariable("widgetId") long widgetId) throws Exception { return template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://" + widgetMService.getServiceLocation(whatService, @@ -299,7 +301,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { WidgetServiceHeaders.getInstance()); } - @RequestMapping(value = { "/portalApi/microservices/parameters/{widgetId}" }, method = RequestMethod.GET) + @GetMapping(value = { "/portalApi/microservices/parameters/{widgetId}" }) public PortalRestResponse> getWidgetParameterResult(HttpServletRequest request, @PathVariable("widgetId") long widgetId) throws Exception { EPUser user = EPUserUtils.getUserSession(request); @@ -335,17 +337,17 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { return new PortalRestResponse<>(PortalRestStatusEnum.OK, "SUCCESS", list); } - @RequestMapping(value = { "/portalApi/microservices/services/{paramId}" }, method = RequestMethod.GET) + @GetMapping(value = { "/portalApi/microservices/services/{paramId}" }) public List getUserParameterById( @PathVariable("paramId") long paramId) { return widgetParameterService.getUserParameterById(paramId); } - @RequestMapping(value = { "/portalApi/microservices/services/{paramId}" }, method = RequestMethod.DELETE) + @DeleteMapping(value = { "/portalApi/microservices/services/{paramId}" }) public void deleteUserParameterById(@PathVariable("paramId") long paramId) { widgetParameterService.deleteUserParameterById(paramId); } - @RequestMapping(value = { "/portalApi/microservices/download/{widgetId}" }, method = RequestMethod.GET) + @GetMapping(value = { "/portalApi/microservices/download/{widgetId}" }) public void doDownload(HttpServletRequest request, HttpServletResponse response, @PathVariable("widgetId") long widgetId) throws Exception { @@ -394,7 +396,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { } } - @RequestMapping(value = { "/portalApi/microservices/parameters" }, method = RequestMethod.POST) + @PostMapping(value = { "/portalApi/microservices/parameters" }) public PortalRestResponse saveWidgetParameter(HttpServletRequest request, @RequestBody WidgetCatalogParameter widgetParameters) { EPUser user = EPUserUtils.getUserSession(request); @@ -414,7 +416,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { return new PortalRestResponse<>(PortalRestStatusEnum.OK, "SUCCESS", ""); } - @RequestMapping(value = { "/portalApi/microservices/uploadFlag" }, method = RequestMethod.GET) + @GetMapping(value = { "/portalApi/microservices/uploadFlag" }) public String getUploadFlag() { String uplaodFlag=""; try { -- 2.16.6