Merge "added proper annotation"
authorLorraine Welch <lb2391@att.com>
Tue, 21 Apr 2020 15:24:52 +0000 (15:24 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 21 Apr 2020 15:24:52 +0000 (15:24 +0000)
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BasicAuthAccountController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/CommonWidgetController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardSearchResultController.java

index f655d35..ab040bb 100644 (file)
@@ -60,6 +60,10 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
 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.PostMapping;
+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.RestController;
 
@@ -96,7 +100,7 @@ public class BasicAuthAccountController extends EPRestrictedBaseController {
         * @throws Exception
         *             on failure
         */
-       @RequestMapping(value = { "/portalApi/basicAuthAccount" }, method = RequestMethod.POST)
+       @PostMapping(value = { "/portalApi/basicAuthAccount" })
        public PortalRestResponse<String> createBasicAuthAccount(HttpServletRequest request, HttpServletResponse response,
                        @RequestBody BasicAuthCredentials newBasicAuthAccount) throws Exception {
 
@@ -153,7 +157,7 @@ public class BasicAuthAccountController extends EPRestrictedBaseController {
         *             on failure
         */
 
-       @RequestMapping(value = { "/portalApi/basicAuthAccount" }, method = RequestMethod.GET)
+       @GetMapping(value = { "/portalApi/basicAuthAccount" })
        public PortalRestResponse<List<BasicAuthCredentials>> getBasicAuthAccount(HttpServletRequest request,
                        HttpServletResponse response) throws Exception {
 
@@ -182,7 +186,7 @@ public class BasicAuthAccountController extends EPRestrictedBaseController {
         * @throws Exception
         *             on failure
         */
-       @RequestMapping(value = { "/portalApi/basicAuthAccount/{accountId}" }, method = RequestMethod.PUT)
+       @PutMapping(value = { "/portalApi/basicAuthAccount/{accountId}" })
        public PortalRestResponse<String> updateAccount(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("accountId") long accountId, @RequestBody BasicAuthCredentials newBasicAuthAccount)
                        throws Exception {
@@ -219,7 +223,7 @@ public class BasicAuthAccountController extends EPRestrictedBaseController {
         * @throws Exception
         *             on failure
         */
-       @RequestMapping(value = { "/portalApi/basicAuthAccount/{accountId}" }, method = RequestMethod.DELETE)
+       @DeleteMapping(value = { "/portalApi/basicAuthAccount/{accountId}" })
        public PortalRestResponse<String> deleteAccount(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("accountId") long accountId) throws Exception {
 
index ee17ac0..417a294 100644 (file)
@@ -48,6 +48,7 @@ import org.onap.portalapp.portal.transport.CommonWidgetMeta;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.springframework.beans.factory.annotation.Autowired;
 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;
@@ -83,7 +84,7 @@ public class CommonWidgetController extends EPRestrictedBaseController implement
         *            Request parameter.
         * @return Rest response wrapped around a CommonWidgetMeta object.
         */
-       @RequestMapping(value = "/commonWidgets", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/commonWidgets", produces = "application/json")
        public PortalRestResponse<CommonWidgetMeta> getWidgetData(HttpServletRequest request,
                        @RequestParam String resourceType) {
                if (!isValidResourceType(resourceType)){
index 6137aec..17a2847 100644 (file)
@@ -78,6 +78,10 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
 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.PostMapping;
+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.RestController;
@@ -132,7 +136,7 @@ public class DashboardController extends EPRestrictedBaseController {
         *            Request parameter.
         * @return Rest response wrapped around a CommonWidgetMeta object.
         */
-       @RequestMapping(value = "/widgetData", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/widgetData", produces = "application/json")
        public PortalRestResponse<CommonWidgetMeta> getWidgetData(HttpServletRequest request,
                        @RequestParam String resourceType) {
                if (!isValidResourceType(resourceType)) {
@@ -154,7 +158,7 @@ public class DashboardController extends EPRestrictedBaseController {
         *            read from POST body.
         * @return Rest response wrapped around a String; e.g., "success" or "ERROR"
         */
-       @RequestMapping(value = "/widgetDataBulk", method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = "/widgetDataBulk", produces = "application/json")
        public PortalRestResponse<String> saveWidgetDataBulk(@RequestBody CommonWidgetMeta commonWidgetMeta) {
                logger.debug(EELFLoggerDelegate.debugLogger, "saveWidgetDataBulk: argument is {}", commonWidgetMeta);
                if (!DATA_VALIDATOR.isValid(commonWidgetMeta)){
@@ -183,7 +187,7 @@ public class DashboardController extends EPRestrictedBaseController {
         *            read from POST body
         * @return Rest response wrapped around a String; e.g., "success" or "ERROR"
         */
-       @RequestMapping(value = "/widgetData", method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = "/widgetData", produces = "application/json")
        public PortalRestResponse<String> saveWidgetData(@RequestBody CommonWidget commonWidget, HttpServletRequest request, HttpServletResponse response) {
                logger.debug(EELFLoggerDelegate.debugLogger, "saveWidgetData: argument is {}", commonWidget);
                EPUser user = EPUserUtils.getUserSession(request);
@@ -249,7 +253,7 @@ public class DashboardController extends EPRestrictedBaseController {
         *            read from POST body
         * @return Rest response wrapped around a String; e.g., "success" or "ERROR"
         */
-       @RequestMapping(value = "/deleteData", method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = "/deleteData", produces = "application/json")
        public PortalRestResponse<String> deleteWidgetData(@RequestBody CommonWidget commonWidget) {
                logger.debug(EELFLoggerDelegate.debugLogger, "deleteWidgetData: argument is {}", commonWidget);
                if (!DATA_VALIDATOR.isValid(commonWidget)){
@@ -269,7 +273,7 @@ public class DashboardController extends EPRestrictedBaseController {
         *         Result Item.
         */
        @EPAuditLog
-       @RequestMapping(value = "/search", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/search", produces = "application/json")
        public PortalRestResponse<Map<String, List<SearchResultItem>>> searchPortal(HttpServletRequest request,
                        @RequestParam String searchString) {
                if (!DATA_VALIDATOR.isValid(new SecureString(searchString))){
@@ -330,7 +334,7 @@ public class DashboardController extends EPRestrictedBaseController {
         * @param request
         * @return Rest response wrapped around a list of String
         */
-       @RequestMapping(value = "/activeUsers", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/activeUsers", produces = "application/json")
        public List<String> getActiveUsers(HttpServletRequest request) {
                List<String> activeUsers;
                List<String> onlineUsers = new ArrayList<>();
@@ -358,7 +362,7 @@ public class DashboardController extends EPRestrictedBaseController {
         * @param request
         * @return Rest response wrapped around a number that is the number of milliseconds.
         */
-       @RequestMapping(value = "/onlineUserUpdateRate", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/onlineUserUpdateRate", produces = "application/json")
        public PortalRestResponse<Map<String, String>> getOnlineUserUpdateRate(HttpServletRequest request) {
                try {
                        String updateRate = SystemProperties.getProperty(EPCommonSystemProperties.ONLINE_USER_UPDATE_RATE);     
@@ -381,7 +385,7 @@ public class DashboardController extends EPRestrictedBaseController {
         * @param request
         * @return Rest response wrapped around a number that is the window width threshold to collapse right menu.
         */
-       @RequestMapping(value = "/windowWidthThresholdRightMenu", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/windowWidthThresholdRightMenu", produces = "application/json")
        public PortalRestResponse<Map<String, String>> getWindowWidthThresholdForRightMenu(HttpServletRequest request) {
                try {
                        String windowWidthString = SystemProperties.getProperty(EPCommonSystemProperties.WINDOW_WIDTH_THRESHOLD_RIGHT_MENU);    
@@ -402,7 +406,7 @@ public class DashboardController extends EPRestrictedBaseController {
         * @param request
         * @return Rest response wrapped around a number that is the window width threshold to collapse the left menu.
         */
-       @RequestMapping(value = "/windowWidthThresholdLeftMenu", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/windowWidthThresholdLeftMenu", produces = "application/json")
        public PortalRestResponse<Map<String, String>> getWindowWidthThresholdForLeftMenu(HttpServletRequest request) {
                try {
                        String windowWidthString = SystemProperties.getProperty(EPCommonSystemProperties.WINDOW_WIDTH_THRESHOLD_LEFT_MENU);     
@@ -422,7 +426,7 @@ public class DashboardController extends EPRestrictedBaseController {
         * @param request
         * @return Rest response wrapped around a List of String
         */
-       @RequestMapping(value = "/relatedUsers", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/relatedUsers", produces = "application/json")
        public PortalRestResponse<List<String>> activeUsers(HttpServletRequest request) {
                EPUser user = EPUserUtils.getUserSession(request);
                try {
index 04ee5e0..2a1b9e8 100644 (file)
@@ -68,6 +68,10 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.springframework.beans.factory.annotation.Autowired;
 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.PostMapping;
+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.RestController;
@@ -90,7 +94,7 @@ public class DashboardSearchResultController extends EPRestrictedBaseController
         *            Request parameter.
         * @return Rest response wrapped around a CommonWidgetMeta object.
         */
-       @RequestMapping(value = "/widgetData", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/widgetData", produces = "application/json")
        public PortalRestResponse<CommonWidgetMeta> getWidgetData(HttpServletRequest request,
                        @RequestParam String resourceType) {
                if (stringIsNotSafeHtml(resourceType)) {
@@ -107,7 +111,7 @@ public class DashboardSearchResultController extends EPRestrictedBaseController
         *            read from POST body.
         * @return Rest response wrapped around a String; e.g., "success" or "ERROR"
         */
-       @RequestMapping(value = "/widgetDataBulk", method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = "/widgetDataBulk", produces = "application/json")
        public PortalRestResponse<String> saveWidgetDataBulk(@Valid @RequestBody CommonWidgetMeta commonWidgetMeta) {
                logger.debug(EELFLoggerDelegate.debugLogger, "saveWidgetDataBulk: argument is {}", commonWidgetMeta);
                if (commonWidgetMeta.getCategory() == null || commonWidgetMeta.getCategory().trim().equals("")){
@@ -137,7 +141,7 @@ public class DashboardSearchResultController extends EPRestrictedBaseController
         *            read from POST body
         * @return Rest response wrapped around a String; e.g., "success" or "ERROR"
         */
-       @RequestMapping(value = "/widgetData", method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = "/widgetData", produces = "application/json")
        public PortalRestResponse<String> saveWidgetData(@Valid @RequestBody CommonWidget commonWidget) {
                logger.debug(EELFLoggerDelegate.debugLogger, "saveWidgetData: argument is {}", commonWidget);
                if (commonWidget.getCategory() == null || commonWidget.getCategory().trim().equals("")){
@@ -186,7 +190,7 @@ public class DashboardSearchResultController extends EPRestrictedBaseController
         *            read from POST body
         * @return Rest response wrapped around a String; e.g., "success" or "ERROR"
         */
-       @RequestMapping(value = "/deleteData", method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = "/deleteData", produces = "application/json")
        public PortalRestResponse<String> deleteWidgetData(@Valid @RequestBody CommonWidget commonWidget) {
                if (commonWidget!=null){
                        Validator validator = VALIDATOR_FACTORY.getValidator();
@@ -208,7 +212,7 @@ public class DashboardSearchResultController extends EPRestrictedBaseController
         * @return Rest response wrapped around a Map of String to List of Search
         *         Result Item.
         */
-       @RequestMapping(value = "/allPortal", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/allPortal", produces = "application/json")
        public PortalRestResponse<Map<String, List<SearchResultItem>>> searchPortal(HttpServletRequest request,
                        @RequestParam String searchString) {
 
@@ -246,7 +250,7 @@ public class DashboardSearchResultController extends EPRestrictedBaseController
         * @param request
         * @return Rest response wrapped around a list of String
         */
-       @RequestMapping(value = "/activeUsers", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/activeUsers", produces = "application/json")
        public List<String> getActiveUsers(HttpServletRequest request) {
                List<String> activeUsers = null;
                List<String> onlineUsers = new ArrayList<>();
@@ -274,7 +278,7 @@ public class DashboardSearchResultController extends EPRestrictedBaseController
         * @param request
         * @return Rest response wrapped around a List of String
         */
-       @RequestMapping(value = "/relatedUsers", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/relatedUsers", produces = "application/json")
        public PortalRestResponse<List<String>> activeUsers(HttpServletRequest request) {
                EPUser user = EPUserUtils.getUserSession(request);
                try {