From: Sunder Tattavarada Date: Wed, 29 Apr 2020 19:41:34 +0000 (+0000) Subject: Merge "replaced mapping annotation with appropriate one" X-Git-Tag: 3.4.0~88 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=604a021c3edf36b7e9752bb6d69f7963c0f63640;hp=d1cb88d4fe98af8663d23505a6b9e673c64c1a6b;p=portal.git Merge "replaced mapping annotation with appropriate one" --- diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java index d36cf6cb..33006c92 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java @@ -54,6 +54,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import io.swagger.annotations.ApiOperation; @@ -75,14 +77,14 @@ public class SessionCommunicationController extends EPRestrictedRESTfulBaseCont @ApiOperation(value = "Gets session slot-check interval, a duration in milliseconds.", response = Integer.class) - @RequestMapping(value={"/getSessionSlotCheckInterval"}, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value={"/getSessionSlotCheckInterval"}, produces = "application/json") public Integer getSessionSlotCheckInterval(HttpServletRequest request, HttpServletResponse response) throws Exception { return manageService.fetchSessionSlotCheckInterval(); } @ApiOperation(value = "Extends session timeout values for all on-boarded applications.", response = Boolean.class) - @RequestMapping(value={"/extendSessionTimeOuts"}, method = RequestMethod.POST) + @PostMapping(value={"/extendSessionTimeOuts"}) public Boolean extendSessionTimeOuts(HttpServletRequest request, HttpServletResponse response, @RequestParam String sessionMap) { manageService.extendSessionTimeOuts(sessionMap); diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java index 7b42d52d..12deabe3 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java @@ -4,12 +4,14 @@ * =================================================================== * Copyright © 2018 AT&T Intellectual Property. All rights reserved. * =================================================================== + * Modifications Copyright (c) 2020 IBM + * =================================================================== * * Unless otherwise specified, all software contained herein is licensed * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software @@ -42,7 +44,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.onap.music.eelf.logging.EELFLoggerDelegate; import org.onap.music.exceptions.MusicLockingException; -import org.onap.music.exceptions.MusicServiceException; import org.onap.portalapp.music.service.MusicService; import org.onap.portalapp.music.util.MusicUtil; import org.springframework.session.Session; @@ -56,12 +57,11 @@ public class MusicSessionRepositoryHandler { public Session get(String id) { if(musicCache){ - // todo need to add the clean up for "sessions" map if musicCache is enabled + // need to add the clean up for "sessions" map if musicCache is enabled return this.sessions.get(id); }else{ try { - Session session = MusicService.getMetaAttribute(id); - return session; + return MusicService.getMetaAttribute(id); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "get failed with id " + id, e); return null; @@ -73,7 +73,7 @@ public class MusicSessionRepositoryHandler { public void remove(String id) { if(musicCache){ - // todo need to add the clean up for "sessions" map if musicCache is enabled + // need to add the clean up for "sessions" map if musicCache is enabled sessions.remove(id); }else{ try { @@ -88,7 +88,7 @@ public class MusicSessionRepositoryHandler { public void put(String id, MusicSession musicSession) { if(musicCache){ - // todo need to add the clean up for "sessions" map if musicCache is enabled + //need to add the clean up for "sessions" map if musicCache is enabled sessions.put(id, musicSession); }else{ try { diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java index 557e4dc3..6ff16fc8 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java @@ -62,6 +62,9 @@ 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.RestController; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; + @RestController @org.springframework.context.annotation.Configuration @@ -90,7 +93,7 @@ public class AppCatalogController extends EPRestrictedBaseController { * @throws IOException If sendError fails * @return List of items suitable for display */ - @RequestMapping(value = { "/portalApi/appCatalog" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/portalApi/appCatalog" }, produces = "application/json") public List getAppCatalog(HttpServletRequest request, HttpServletResponse response) throws IOException { EPUser user = EPUserUtils.getUserSession(request); @@ -125,7 +128,7 @@ public class AppCatalogController extends EPRestrictedBaseController { * @return FieldsValidator * @throws IOException If sendError fails */ - @RequestMapping(value = { "/portalApi/appCatalog" }, method = RequestMethod.PUT, produces = "application/json") + @PutMapping(value = { "/portalApi/appCatalog" }, produces = "application/json") public FieldsValidator putAppCatalogSelection(HttpServletRequest request, @RequestBody AppCatalogPersonalization persRequest, HttpServletResponse response) throws IOException { FieldsValidator result = new FieldsValidator(); diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java index 8f456fde..e9119de8 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java @@ -63,6 +63,8 @@ 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.RestController; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; @RestController @RequestMapping("/portalApi/contactus") @@ -94,7 +96,7 @@ public class AppContactUsController extends EPRestrictedBaseController { * @param request HttpServletRequest * @return PortalRestResponse */ - @RequestMapping(value = "/feedback", method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = "/feedback", produces = "application/json") public PortalRestResponse getPortalDetails(HttpServletRequest request) { PortalRestResponse portalRestResponse; try { @@ -123,7 +125,7 @@ public class AppContactUsController extends EPRestrictedBaseController { * @param request HttpServletRequest * @return PortalRestResponse> */ - @RequestMapping(value = "/list", method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = "/list", produces = "application/json") public PortalRestResponse> getAppContactUsList(HttpServletRequest request) { PortalRestResponse> portalRestResponse; try { @@ -145,7 +147,7 @@ public class AppContactUsController extends EPRestrictedBaseController { * @param request HttpServletRequest * @return PortalRestResponse> */ - @RequestMapping(value = "/allapps", method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = "/allapps", produces = "application/json") public PortalRestResponse> getAppsAndContacts(HttpServletRequest request) { PortalRestResponse> portalRestResponse; try { @@ -167,7 +169,7 @@ public class AppContactUsController extends EPRestrictedBaseController { * @param request HttpServletRequest * @return PortalRestResponse> */ - @RequestMapping(value = "/functions", method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = "/functions", produces = "application/json") public PortalRestResponse> getAppCategoryFunctions(HttpServletRequest request) { PortalRestResponse> portalRestResponse; try { @@ -190,7 +192,7 @@ public class AppContactUsController extends EPRestrictedBaseController { * @param contactUs AppContactUsItem * @return PortalRestResponse */ - @RequestMapping(value = "/save", method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = "/save", produces = "application/json") public PortalRestResponse save(@RequestBody AppContactUsItem contactUs) { if (contactUs == null || contactUs.getAppName() == null) { @@ -210,7 +212,7 @@ public class AppContactUsController extends EPRestrictedBaseController { return new PortalRestResponse<>(PortalRestStatusEnum.OK, saveAppContactUs, ""); } - @RequestMapping(value = "/saveAll", method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = "/saveAll", produces = "application/json") public PortalRestResponse save(@RequestBody List contactUsList) { if (contactUsList == null) { @@ -237,7 +239,7 @@ public class AppContactUsController extends EPRestrictedBaseController { * @param id app ID * @return PortalRestResponse */ - @RequestMapping(value = "/delete/{appid}", method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = "/delete/{appid}", produces = "application/json") public PortalRestResponse delete(@PathVariable("appid") Long id) { String saveAppContactUs = FAILURE; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppsControllerExternalVersionRequest.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppsControllerExternalVersionRequest.java index 13a6811e..5af76aa5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppsControllerExternalVersionRequest.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppsControllerExternalVersionRequest.java @@ -44,16 +44,8 @@ import org.onap.portalapp.portal.domain.EPUser; import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; import org.onap.portalapp.portal.logging.aop.EPAuditLog; import org.onap.portalapp.portal.transport.OnboardingApp; -import org.onap.portalapp.portal.utils.EcompPortalUtils; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; - -import io.swagger.annotations.ApiOperation; @org.springframework.context.annotation.Configuration @EnableAspectJAutoProxy diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuxApiRequestMapperController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuxApiRequestMapperController.java index 969605ce..1f0c1f8e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuxApiRequestMapperController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuxApiRequestMapperController.java @@ -47,7 +47,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.concurrent.atomic.AtomicReference; import java.util.jar.Attributes; import java.util.regex.Matcher; import java.util.regex.Pattern; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BasicAuthAccountController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BasicAuthAccountController.java index f655d352..ab040bb0 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BasicAuthAccountController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BasicAuthAccountController.java @@ -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 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> 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 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 deleteAccount(HttpServletRequest request, HttpServletResponse response, @PathVariable("accountId") long accountId) throws Exception { diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/CommonWidgetController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/CommonWidgetController.java index ee17ac0a..417a2940 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/CommonWidgetController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/CommonWidgetController.java @@ -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 getWidgetData(HttpServletRequest request, @RequestParam String resourceType) { if (!isValidResourceType(resourceType)){ diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardController.java index 6137aec9..17a28476 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardController.java @@ -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 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 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 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 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>> 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 getActiveUsers(HttpServletRequest request) { List activeUsers; List 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> 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> 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> 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> activeUsers(HttpServletRequest request) { EPUser user = EPUserUtils.getUserSession(request); try { diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardSearchResultController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardSearchResultController.java index 04ee5e0b..2a1b9e80 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardSearchResultController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardSearchResultController.java @@ -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 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 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 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 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>> 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 getActiveUsers(HttpServletRequest request) { List activeUsers = null; List 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> activeUsers(HttpServletRequest request) { EPUser user = EPUserUtils.getUserSession(request); try { diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAccessRolesController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAccessRolesController.java index 7d9f297c..103e3386 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAccessRolesController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAccessRolesController.java @@ -4,6 +4,8 @@ * =================================================================== * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * =================================================================== + * Modification Copyright © 2020 IBM. + * =================================================================== * * Unless otherwise specified, all software contained herein is licensed * under the Apache License, Version 2.0 (the "License"); @@ -90,6 +92,10 @@ import org.springframework.http.ResponseEntity; 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; @@ -124,8 +130,8 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl private UserService userservice = new UserServiceCentalizedImpl(); @ApiOperation(value = "Gets user role for an application.", response = CentralUser.class, responseContainer="List") - @RequestMapping(value = { - "/user/{loginId}" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/user/{loginId}" }, produces = "application/json") public CentralUser getUser(HttpServletRequest request, HttpServletResponse response, @PathVariable("loginId") String loginId) throws Exception { if (!DATA_VALIDATOR.isValid(new SecureString(loginId))){ @@ -145,8 +151,8 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Gets user roles for an application which is upgraded to newer version.", response = String.class, responseContainer="List") - @RequestMapping(value = { - "/v1/user/{loginId}" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/v1/user/{loginId}" }, produces = "application/json") public String getV2UserList(HttpServletRequest request, HttpServletResponse response, @PathVariable("loginId") String loginId) throws Exception { if (!DATA_VALIDATOR.isValid(new SecureString(loginId))){ @@ -166,8 +172,8 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Gets roles for an application.", response = CentralRole.class, responseContainer="Json") - @RequestMapping(value = { - "/roles" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/roles" }, produces = "application/json") public List getRolesForApp(HttpServletRequest request, HttpServletResponse response) throws Exception { logger.debug(EELFLoggerDelegate.debugLogger, "Request received for getRolesForApp"); List v2CenRole = null; @@ -190,8 +196,8 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Gets roles for an application which is upgraded to newer version.", response = CentralV2Role.class, responseContainer="Json") - @RequestMapping(value = { - "/v1/roles" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/v1/roles" }, produces = "application/json") public List getV2RolesForApp(HttpServletRequest request, HttpServletResponse response) throws Exception { logger.debug(EELFLoggerDelegate.debugLogger, "Request received for getV2RolesForApp"); List answer = null; @@ -212,8 +218,8 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Gets all role functions for an application for older version.", response = CentralRoleFunction.class, responseContainer="Json") - @RequestMapping(value = { - "/functions" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/functions" }, produces = "application/json") public List getRoleFunctionsList(HttpServletRequest request, HttpServletResponse response) throws Exception { List answer = null; @@ -237,8 +243,8 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Gets all role functions for an application which is upgraded to newer version.", response = CentralV2RoleFunction.class, responseContainer="Json") - @RequestMapping(value = { - "/v1/functions" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/v1/functions" }, produces = "application/json") public List getV2RoleFunctionsList(HttpServletRequest request, HttpServletResponse response) throws Exception { List cenRoleFuncList = null; @@ -261,8 +267,8 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl @ApiOperation(value = "Gets role information for an application.", response = CentralRole.class, responseContainer="Json") - @RequestMapping(value = { - "/role/{role_id}" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/role/{role_id}" }, produces = "application/json") public CentralRole getRoleInfo(HttpServletRequest request, HttpServletResponse response, @PathVariable("role_id") Long roleId) throws Exception { CentralV2Role answer = null; @@ -281,8 +287,8 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Gets v2 role information for an application which is upgraded to newer version.", response = CentralV2Role.class, responseContainer="Json") - @RequestMapping(value = { - "/v1/role/{role_id}" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/v1/role/{role_id}" }, produces = "application/json") public CentralV2Role getV2RoleInfo(HttpServletRequest request, HttpServletResponse response, @PathVariable("role_id") Long roleId) throws Exception { CentralV2Role answer = null; @@ -299,7 +305,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Gets role information for an application provided by function code.", response = CentralRoleFunction.class, responseContainer = "Json") - @RequestMapping(value = { "/function/{code}" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/function/{code}" }, produces = "application/json") public CentralRoleFunction getRoleFunction(HttpServletRequest request, HttpServletResponse response, @PathVariable("code") String code) throws Exception { CentralV2RoleFunction centralV2RoleFunction = null; @@ -322,7 +328,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Gets role information for an application provided by function code.", response = CentralV2RoleFunction.class, responseContainer = "Json") - @RequestMapping(value = { "/v1/function/{code}" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/v1/function/{code}" }, produces = "application/json") public CentralV2RoleFunction getV2RoleFunction(HttpServletRequest request, HttpServletResponse response, @PathVariable("code") String code) throws Exception { CentralV2RoleFunction centralV2RoleFunction = null; @@ -344,7 +350,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Saves role function for an application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { "/roleFunction" }, method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = { "/roleFunction" }, produces = "application/json") public PortalRestResponse saveRoleFunction(HttpServletRequest request, HttpServletResponse response, @RequestBody String roleFunc) { String status = "Successfully saved!"; @@ -437,7 +443,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Deletes role function for an application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { "/roleFunction/{code}" }, method = RequestMethod.DELETE, produces = "application/json") + @DeleteMapping(value = { "/roleFunction/{code}" }, produces = "application/json") public PortalRestResponse deleteRoleFunction(HttpServletRequest request, HttpServletResponse response, @PathVariable("code") String code) { if(!DATA_VALIDATOR.isValid(new SecureString(code))){ @@ -492,7 +498,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Saves role for an application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { "/role" }, method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = { "/role" }, produces = "application/json") public PortalRestResponse saveRole(HttpServletRequest request, HttpServletResponse response, @RequestBody Role role) { try { @@ -553,7 +559,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Deletes role for an application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { "/deleteRole/{code}" }, method = RequestMethod.DELETE, produces = "application/json") + @DeleteMapping(value = { "/deleteRole/{code}" }, produces = "application/json") public PortalRestResponse deleteRole(HttpServletRequest request, HttpServletResponse response, @PathVariable String code) { if(!DATA_VALIDATOR.isValid(new SecureString(code))){ @@ -608,7 +614,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Gets active roles for an application.", response = CentralRole.class, responseContainer = "Json") - @RequestMapping(value = { "/activeRoles" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/activeRoles" }, produces = "application/json") public List getActiveRoles(HttpServletRequest request, HttpServletResponse response) throws Exception { List roles = null; try { @@ -624,7 +630,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Gets active roles for an application.", response = CentralV2Role.class, responseContainer = "Json") - @RequestMapping(value = { "/v1/activeRoles" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/v1/activeRoles" }, produces = "application/json") public List getV2ActiveRoles(HttpServletRequest request, HttpServletResponse response) throws Exception { List cenRole = null; try { @@ -639,7 +645,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "deletes user roles for an application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { "/deleteDependcyRoleRecord/{roleId}" }, method = RequestMethod.DELETE, produces = "application/json") + @DeleteMapping(value = { "/deleteDependcyRoleRecord/{roleId}" }, produces = "application/json") public PortalRestResponse deleteDependencyRoleRecord(HttpServletRequest request, HttpServletResponse response, @PathVariable("roleId") Long roleId) { ExternalRequestFieldsValidator removeResult = null; @@ -666,7 +672,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl @ApiOperation(value = "deletes roles for an application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { "/v2/deleteRole/{roleId}" }, method = RequestMethod.DELETE, produces = "application/json") + @DeleteMapping(value = { "/v2/deleteRole/{roleId}" }, produces = "application/json") public PortalRestResponse deleteRole(HttpServletRequest request, HttpServletResponse response, @PathVariable("roleId") Long roleId) { ExternalRequestFieldsValidator removeResult = null; @@ -693,7 +699,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl @ApiOperation(value = "Bulk upload functions for an application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { "/upload/portal/functions" }, method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = { "/upload/portal/functions" }, produces = "application/json") public PortalRestResponse bulkUploadFunctions(HttpServletRequest request, HttpServletResponse response) { Integer result = 0; try { @@ -707,7 +713,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Bulk upload roles for an application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { "/upload/portal/roles" }, method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = { "/upload/portal/roles" }, produces = "application/json") public PortalRestResponse bulkUploadRoles(HttpServletRequest request, HttpServletResponse response) { Integer result = 0; try { @@ -721,7 +727,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Bulk upload role functions for an application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { "/upload/portal/roleFunctions" }, method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = { "/upload/portal/roleFunctions" }, produces = "application/json") public PortalRestResponse bulkUploadRoleFunctions(HttpServletRequest request, HttpServletResponse response) { Integer result = 0; try { @@ -735,7 +741,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Bulk upload user roles for an application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { "/upload/portal/userRoles" }, method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = { "/upload/portal/userRoles" }, produces = "application/json") public PortalRestResponse bulkUploadUserRoles(HttpServletRequest request, HttpServletResponse response) { Integer result = 0; try { @@ -749,7 +755,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Bulk upload users for renamed role of an application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { "/upload/portal/userRole/{roleId}" }, method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = { "/upload/portal/userRole/{roleId}" }, produces = "application/json") public PortalRestResponse bulkUploadUsersSingleRole(HttpServletRequest request, HttpServletResponse response, @PathVariable Long roleId) { Integer result = 0; try { @@ -764,7 +770,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Bulk upload functions for an partner application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { "/upload/partner/functions" }, method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = { "/upload/partner/functions" }, produces = "application/json") public PortalRestResponse bulkUploadPartnerFunctions(HttpServletRequest request, HttpServletResponse response) { Integer addedFunctions = 0; try { @@ -779,7 +785,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Bulk upload roles for an partner application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { "/upload/partner/roles" }, method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = { "/upload/partner/roles" }, produces = "application/json") public PortalRestResponse bulkUploadPartnerRoles(HttpServletRequest request, HttpServletResponse response, @RequestBody List upload) { try { externalAccessRolesService.bulkUploadPartnerRoles(request.getHeader(UEBKEY), upload); @@ -792,7 +798,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Bulk upload role functions for an partner application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { "/upload/partner/roleFunctions" }, method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = { "/upload/partner/roleFunctions" }, produces = "application/json") public PortalRestResponse bulkUploadPartnerRoleFunctions(HttpServletRequest request, HttpServletResponse response) { Integer addedRoleFunctions = 0; try { @@ -808,7 +814,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Gets all functions along with global functions", response = List.class, responseContainer = "Json") - @RequestMapping(value = { "/menuFunctions" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/menuFunctions" }, produces = "application/json") public List getMenuFunctions(HttpServletRequest request, HttpServletResponse response) throws Exception { List functionsList = null; try { @@ -822,7 +828,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Gets all active Users of application", response = String.class, responseContainer = "Json") - @RequestMapping(value = { "/users" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/users" }, produces = "application/json") public List getUsersOfApplication(HttpServletRequest request, HttpServletResponse response) throws Exception { List users = null; try { @@ -882,7 +888,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Gets ecompUser of an application.", response = CentralUser.class, responseContainer = "List") - @RequestMapping(value = { "/v2/user/{loginId}" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/v2/user/{loginId}" }, produces = "application/json") public String getEcompUser(HttpServletRequest request, HttpServletResponse response, @PathVariable("loginId") String loginId) throws Exception { if(!DATA_VALIDATOR.isValid(new SecureString(loginId))){ @@ -913,7 +919,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } @ApiOperation(value = "Gets user ecomp role for an application.", response = CentralUser.class, responseContainer = "List") - @RequestMapping(value = { "/v2/roles" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/v2/roles" }, produces = "application/json") public List getEcompRolesOfApplication(HttpServletRequest request, HttpServletResponse response) throws Exception { List ecompRoles = null; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAppsRestfulController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAppsRestfulController.java index 5aea7f1c..bc2c19b5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAppsRestfulController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAppsRestfulController.java @@ -6,6 +6,8 @@ * =================================================================== * Modifications Copyright (c) 2019 Samsung * =================================================================== + * Modification Copyright © 2020 IBM. + * =================================================================== * * Unless otherwise specified, all software contained herein is licensed * under the Apache License, Version 2.0 (the "License"); @@ -70,7 +72,6 @@ import org.onap.portalapp.portal.utils.EPCommonSystemProperties; import org.onap.portalapp.portal.utils.EcompPortalUtils; import org.onap.portalapp.portal.utils.PortalConstants; import org.onap.portalapp.validation.DataValidator; -import org.onap.portalapp.validation.SecureString; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.onboarding.crossapi.PortalAPIResponse; import org.onap.portalsdk.core.onboarding.util.CipherUtil; @@ -83,6 +84,10 @@ import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ExceptionHandler; 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.ResponseBody; import org.springframework.web.bind.annotation.RestController; @@ -115,7 +120,7 @@ public class ExternalAppsRestfulController extends EPRestrictedRESTfulBaseContro private EPRoleService epRoleService; @ApiOperation(value = "Creates a Portal user notification for roles identified in the content from an external application.", response = PortalAPIResponse.class) - @RequestMapping(value = { "/publishNotification" }, method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = { "/publishNotification" }, produces = "application/json") @ResponseBody public PortalAPIResponse publishNotification(HttpServletRequest request, @RequestBody EpNotificationItem notificationItem) throws Exception { @@ -175,7 +180,7 @@ public class ExternalAppsRestfulController extends EPRestrictedRESTfulBaseContro } @ApiOperation(value = "Gets favorite items within the functional menu for the current user.", response = FavoritesFunctionalMenuItemJson.class, responseContainer="List") - @RequestMapping(value = { "/getFavorites" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/getFavorites" }, produces = "application/json") public List getFavoritesForUser(HttpServletRequest request, HttpServletResponse response) throws Exception { String loginId = ""; @@ -204,8 +209,8 @@ public class ExternalAppsRestfulController extends EPRestrictedRESTfulBaseContro } @ApiOperation(value = "Gets functional menu items appropriate for the current user.", response = FunctionalMenuItem.class, responseContainer="List") - @RequestMapping(value = { - "/functionalMenuItemsForUser" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/functionalMenuItemsForUser" }, produces = "application/json") public List getFunctionalMenuItemsForUser(HttpServletRequest request, HttpServletResponse response) throws Exception { String loginId = ""; @@ -247,7 +252,7 @@ public class ExternalAppsRestfulController extends EPRestrictedRESTfulBaseContro } @EPAuditLog - @RequestMapping(value = { "/validateCookie" }, method = RequestMethod.POST) + @PostMapping(value = { "/validateCookie" }) public boolean validateCookie(@RequestBody EPServiceCookie epServiceCookie, HttpServletRequest request) throws Exception { Map epServiceCookieValueMap = epServiceCookie.getValue(); if(epServiceCookieValueMap!=null) { diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/FunctionalMenuController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/FunctionalMenuController.java index 5e13127c..65abc280 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/FunctionalMenuController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/FunctionalMenuController.java @@ -4,6 +4,8 @@ * =================================================================== * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== + * Modification Copyright © 2020 IBM. + * =================================================================== * * Unless otherwise specified, all software contained herein is licensed * under the Apache License, Version 2.0 (the "License"); @@ -82,6 +84,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.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -116,7 +122,7 @@ public class FunctionalMenuController extends EPRestrictedBaseController { * HttpServletResponse * @return List of FunctionalMenuItem objects */ - @RequestMapping(value = { "/portalApi/functionalMenu" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/portalApi/functionalMenu" }, produces = "application/json") public List getMenuItems(HttpServletRequest request, HttpServletResponse response) { // TODO: should only the superuser be allowed to use this API? List menuItems = null; @@ -139,7 +145,7 @@ public class FunctionalMenuController extends EPRestrictedBaseController { * HttpServletResponse * @return PortalRestResponse of ONAP portal title */ - @RequestMapping(value = { "/portalApi/ecompTitle" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/portalApi/ecompTitle" }, produces = "application/json") public PortalRestResponse getECOMPTitle(HttpServletRequest request, HttpServletResponse response) { PortalRestResponse portalRestResponse = null; try { @@ -164,8 +170,8 @@ public class FunctionalMenuController extends EPRestrictedBaseController { * HttpServletResponse * @return List of FunctionalMenuItem objects */ - @RequestMapping(value = { - "/portalApi/functionalMenuForEditing" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/portalApi/functionalMenuForEditing" }, produces = "application/json") public List getMenuItemsForEditing(HttpServletRequest request, HttpServletResponse response) { // TODO: should only the superuser be allowed to use this API? EPUser user = EPUserUtils.getUserSession(request); @@ -194,8 +200,8 @@ public class FunctionalMenuController extends EPRestrictedBaseController { * HttpServletResponse * @return List of FunctionalMenuItem objects */ - @RequestMapping(value = { - "/portalApi/functionalMenuForNotificationTree" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/portalApi/functionalMenuForNotificationTree" }, produces = "application/json") public List getMenuItemsForNotifications(HttpServletRequest request, HttpServletResponse response) { // TODO: should only the superuser be allowed to use this API? @@ -221,8 +227,8 @@ public class FunctionalMenuController extends EPRestrictedBaseController { * application ID * @return List of FunctionalMenuItem objects */ - @RequestMapping(value = { - "/portalApi/functionalMenuForApp/{appId}" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/portalApi/functionalMenuForApp/{appId}" }, produces = "application/json") public List getMenuItemsForApp(HttpServletRequest request, @PathVariable("appId") Integer appId) { // TODO: should only the superuser be allowed to use this API? @@ -248,8 +254,8 @@ public class FunctionalMenuController extends EPRestrictedBaseController { * user ID * @return List of FunctionalMenuItem objects */ - @RequestMapping(value = { - "/portalApi/functionalMenuForUser/{orgUserId}" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/portalApi/functionalMenuForUser/{orgUserId}" }, produces = "application/json") public List getMenuItemsForUser(HttpServletRequest request, @PathVariable("orgUserId") String orgUserId) { // TODO: should only the superuser be allowed to use this API? @@ -276,8 +282,8 @@ public class FunctionalMenuController extends EPRestrictedBaseController { * HttpServletResponse * @return List of FunctionalMenuItem objects */ - @RequestMapping(value = { - "/portalApi/functionalMenuForAuthUser" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/portalApi/functionalMenuForAuthUser" }, produces = "application/json") public List getMenuItemsForAuthUser(HttpServletRequest request, HttpServletResponse response) { EPUser user = EPUserUtils.getUserSession(request); @@ -313,8 +319,8 @@ public class FunctionalMenuController extends EPRestrictedBaseController { * menu ID * @return FunctionalMenuItem object */ - @RequestMapping(value = { - "/portalApi/functionalMenuItemDetails/{menuId}" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/portalApi/functionalMenuItemDetails/{menuId}" }, produces = "application/json") public FunctionalMenuItem getFunctionalMenuItemDetails(HttpServletRequest request, @PathVariable("menuId") Long menuId, HttpServletResponse response) { // TODO: return FunctionalMenuItemJson @@ -349,7 +355,7 @@ public class FunctionalMenuController extends EPRestrictedBaseController { * FunctionalMenuItemWithRoles * @return FieldsValidator */ - @RequestMapping(value = { "/portalApi/functionalMenuItem" }, method = RequestMethod.POST) + @PostMapping(value = { "/portalApi/functionalMenuItem" }) public FieldsValidator createFunctionalMenuItem(HttpServletRequest request, @RequestBody FunctionalMenuItemWithRoles menuItemJson, HttpServletResponse response) { EPUser user = EPUserUtils.getUserSession(request); @@ -389,7 +395,7 @@ public class FunctionalMenuController extends EPRestrictedBaseController { * FunctionalMenuItemWithRoles * @return FieldsValidator */ - @RequestMapping(value = { "/portalApi/functionalMenuItem" }, method = RequestMethod.PUT) + @PutMapping(value = { "/portalApi/functionalMenuItem" }) public FieldsValidator editFunctionalMenuItem(HttpServletRequest request, @RequestBody FunctionalMenuItemWithRoles menuItemJson, HttpServletResponse response) { EPUser user = EPUserUtils.getUserSession(request); @@ -425,7 +431,7 @@ public class FunctionalMenuController extends EPRestrictedBaseController { * menu identifier * @return FieldsValidator */ - @RequestMapping(value = { "/portalApi/functionalMenuItem/{menuId}" }, method = RequestMethod.DELETE) + @DeleteMapping(value = { "/portalApi/functionalMenuItem/{menuId}" }) public FieldsValidator deleteFunctionalMenuItem(HttpServletRequest request, @PathVariable("menuId") Long menuId, HttpServletResponse response) { EPUser user = EPUserUtils.getUserSession(request); @@ -451,7 +457,7 @@ public class FunctionalMenuController extends EPRestrictedBaseController { * HttpServletResponse * @return FieldsValidator */ - @RequestMapping(value = { "/portalApi/regenerateFunctionalMenuAncestors" }, method = RequestMethod.GET) + @GetMapping(value = { "/portalApi/regenerateFunctionalMenuAncestors" }) public FieldsValidator regenerateAncestorTable(HttpServletRequest request, HttpServletResponse response) { // TODO: should only the superuser be allowed to use this API? EPUser user = EPUserUtils.getUserSession(request); @@ -480,7 +486,7 @@ public class FunctionalMenuController extends EPRestrictedBaseController { * FunctionalMenuItemWithRoles * @return FieldsValidator */ - @RequestMapping(value = { "/portalApi/setFavoriteItem" }, method = RequestMethod.POST) + @PostMapping(value = { "/portalApi/setFavoriteItem" }) public FieldsValidator addFavoriteItem(HttpServletRequest request, @RequestBody FavoritesFunctionalMenuItem menuItemJson, HttpServletResponse response) { EPUser user = EPUserUtils.getUserSession(request); @@ -504,8 +510,8 @@ public class FunctionalMenuController extends EPRestrictedBaseController { * HttpServletResponse * @return List of FavoritesFunctionalMenuItemJson */ - @RequestMapping(value = { - "/portalApi/getFavoriteItems" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/portalApi/getFavoriteItems" }, produces = "application/json") public List getFavoritesForUser(HttpServletRequest request, HttpServletResponse response) { EPUser user = EPUserUtils.getUserSession(request); @@ -529,7 +535,7 @@ public class FunctionalMenuController extends EPRestrictedBaseController { * menu identifier * @return FieldsValidator */ - @RequestMapping(value = { "/portalApi/removeFavoriteItem/{menuId}" }, method = RequestMethod.DELETE) + @DeleteMapping(value = { "/portalApi/removeFavoriteItem/{menuId}" }) public FieldsValidator deleteFavoriteItem(HttpServletRequest request, @PathVariable("menuId") Long menuId, HttpServletResponse response) { EPUser user = EPUserUtils.getUserSession(request); @@ -556,15 +562,19 @@ public class FunctionalMenuController extends EPRestrictedBaseController { * HttpServletResponse * @return JSON collection of key-value pairs shown below. */ - @RequestMapping(value = { - "/portalApi/functionalMenuStaticInfo" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/portalApi/functionalMenuStaticInfo" }, produces = "application/json") public String getFunctionalMenuStaticInfo(HttpServletRequest request, HttpServletResponse response) { // Get user details from session logger.debug(EELFLoggerDelegate.debugLogger, "getFunctionalMenuStaticInfo: getting user info"); String fnMenuStaticResponse = null; try { - String orgUserIdStr = null, firstNameStr = null, lastNameStr = null, emailStr = null, lastLogin = null; + String orgUserIdStr = null; + String firstNameStr = null; + String lastNameStr = null; + String emailStr = null; + String lastLogin = null; EPUser user = EPUserUtils.getUserSession(request); firstNameStr = user.getFirstName(); lastNameStr = user.getLastName(); @@ -586,7 +596,10 @@ public class FunctionalMenuController extends EPRestrictedBaseController { // If any item is missing from session, try the Shared Context // service. - SharedContext orgUserIdSC = null, firstNameSC = null, lastNameSC = null, emailSC = null; + SharedContext orgUserIdSC = null; + SharedContext firstNameSC = null; + SharedContext lastNameSC = null; + SharedContext emailSC = null; String sessionId = request.getSession().getId(); if (firstNameStr == null) firstNameSC = sharedContextService.getSharedContext(sessionId, @@ -641,8 +654,8 @@ public class FunctionalMenuController extends EPRestrictedBaseController { * @throws IOException * on error */ - @RequestMapping(value = { - "/portalApi/userApplicationRoles" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/portalApi/userApplicationRoles" }, produces = "application/json") public List getAppList(HttpServletRequest request, HttpServletResponse response, @RequestParam("userId") String userId) throws IOException { diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceController.java index 2e1a2b46..89e8fe75 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceController.java @@ -39,15 +39,10 @@ package org.onap.portalapp.portal.controller; import java.util.List; -import java.util.Set; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.validation.ConstraintViolation; import javax.validation.Valid; -import javax.validation.Validation; -import javax.validation.Validator; -import javax.validation.ValidatorFactory; import org.onap.portalapp.controller.EPRestrictedBaseController; import org.onap.portalapp.portal.domain.MicroserviceData; import org.onap.portalapp.portal.domain.WidgetCatalog; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RolesApprovalSystemController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RolesApprovalSystemController.java index 5562caac..487cc4d5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RolesApprovalSystemController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RolesApprovalSystemController.java @@ -219,9 +219,9 @@ public class RolesApprovalSystemController implements BasicAuthenticationControl * If any field is missing. */ private void validateExtSystemUser(ExternalSystemUser extSysUser, boolean rolesRequired) throws Exception { - if (extSysUser.getLoginId() == null || extSysUser.getLoginId() == "") + if (extSysUser.getLoginId() == null || extSysUser.getLoginId().equals("")) throw new Exception("Request has no login ID"); - if (extSysUser.getApplicationName() == null || extSysUser.getApplicationName() == "") + if (extSysUser.getApplicationName() == null || extSysUser.getApplicationName().equals("")) throw new Exception("Request has no application name"); if (extSysUser.getMyloginrequestId() == null) throw new Exception("Request has no request ID"); diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SchedulerAuxController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SchedulerAuxController.java index c99953fa..85c48b7b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SchedulerAuxController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SchedulerAuxController.java @@ -37,9 +37,6 @@ */ package org.onap.portalapp.portal.controller; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; import java.util.UUID; import javax.servlet.http.HttpServletRequest; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserRolesController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserRolesController.java index aa180b0e..b3d64dbc 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserRolesController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserRolesController.java @@ -46,7 +46,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.cxf.transport.http.HTTPException; import org.onap.portalapp.controller.EPRestrictedBaseController; -import org.onap.portalapp.portal.domain.EPApp; import org.onap.portalapp.portal.domain.EPRole; import org.onap.portalapp.portal.domain.EPUser; import org.onap.portalapp.portal.domain.EPUserAppCatalogRoles; @@ -59,7 +58,6 @@ import org.onap.portalapp.portal.logging.aop.EPEELFLoggerAdvice; import org.onap.portalapp.portal.logging.logic.EPLogUtil; import org.onap.portalapp.portal.service.AdminRolesService; import org.onap.portalapp.portal.service.ApplicationsRestClientService; -import org.onap.portalapp.portal.service.EPAppService; import org.onap.portalapp.portal.service.SearchService; import org.onap.portalapp.portal.service.UserRolesService; import org.onap.portalapp.portal.transport.AppNameIdIsAdmin; 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 015e6c46..a4037375 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 @@ -40,7 +40,6 @@ package org.onap.portalapp.portal.controller; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; -import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/FunctionalMenuItemWithAppID.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/FunctionalMenuItemWithAppID.java index 9900827f..583b43ad 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/FunctionalMenuItemWithAppID.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/FunctionalMenuItemWithAppID.java @@ -44,7 +44,6 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Transient; -import javax.validation.constraints.DecimalMax; import javax.validation.constraints.Digits; import javax.validation.constraints.Max; import javax.validation.constraints.NotNull; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/MicroserviceData.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/MicroserviceData.java index b8f79d06..6db834eb 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/MicroserviceData.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/MicroserviceData.java @@ -39,11 +39,6 @@ package org.onap.portalapp.portal.domain; import java.util.List; -import javax.persistence.Column; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; - import javax.validation.Valid; import org.hibernate.validator.constraints.SafeHtml; import org.onap.portalsdk.core.domain.support.DomainVo; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceProxyService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceProxyService.java index 3db8e5e3..ee87a629 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceProxyService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceProxyService.java @@ -3,7 +3,7 @@ * ONAP Portal * =================================================================== * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== + * =================================================================== * * Unless otherwise specified, all software contained herein is licensed * under the Apache License, Version 2.0 (the "License"); @@ -40,7 +40,6 @@ package org.onap.portalapp.portal.service; import javax.servlet.http.HttpServletRequest; import org.onap.portalapp.portal.domain.EPUser; -import org.springframework.web.client.RestClientException; public interface MicroserviceProxyService { diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralRole.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralRole.java index 6f587697..26fd63db 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralRole.java @@ -42,8 +42,6 @@ import java.util.Date; import java.util.SortedSet; import java.util.TreeSet; -import org.onap.portalsdk.core.domain.RoleFunction; - public class CentralRole implements Serializable { private static final long serialVersionUID = -9210905386086213882L; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/SessionCommunication.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/SessionCommunication.java index 805e04a4..14616b31 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/SessionCommunication.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/SessionCommunication.java @@ -57,7 +57,6 @@ import org.onap.portalapp.portal.service.AppsCacheService; import org.onap.portalapp.portal.transport.OnboardingApp; import org.onap.portalapp.portal.utils.EPCommonSystemProperties; import org.onap.portalapp.portal.utils.EcompPortalUtils; -import org.onap.portalapp.util.SystemType; import org.onap.portalsdk.core.exception.UrlAccessRestrictedException; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.onboarding.exception.CipherUtilException; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/TimeoutHandler.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/TimeoutHandler.java index c855a8dc..a60266cf 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/TimeoutHandler.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/TimeoutHandler.java @@ -57,7 +57,6 @@ import org.onap.portalapp.portal.logging.logic.EPLogUtil; import org.onap.portalapp.portal.service.AppsCacheService; import org.onap.portalapp.portal.service.EPAppService; import org.onap.portalapp.portal.transport.OnboardingApp; -import org.onap.portalapp.portal.utils.EcompPortalUtils; import org.onap.portalsdk.core.domain.sessionmgt.TimeoutVO; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.onboarding.util.PortalApiConstants; diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPServiceCookieTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPServiceCookieTest.java new file mode 100644 index 00000000..27118a4c --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPServiceCookieTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2020 IBM Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +package org.onap.portalapp.portal.domain; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; + +public class EPServiceCookieTest { + EPServiceCookie ep=new EPServiceCookie(); + + @Test + public void testGetValue() throws NullPointerException{ + Map mymap = new HashMap<>(); + mymap.put("1", "one"); + ep.setValue(mymap); + assertNotNull(ep.getValue()); + assertTrue(ep.getValue().equals(mymap)); + } + +} diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/DuplicateRecordExceptionTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/DuplicateRecordExceptionTest.java new file mode 100644 index 00000000..9154e8d0 --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/DuplicateRecordExceptionTest.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2020 IBM Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +package org.onap.portalapp.portal.exceptions; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class DuplicateRecordExceptionTest { + @Test + public void Test1() + { + String s1 = "Duplicate Record"; + DuplicateRecordException mde=new DuplicateRecordException(s1); + assertEquals(mde.getMessage(),"Duplicate Record"); + + } +} diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NonCentralizedAppExceptionTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NonCentralizedAppExceptionTest.java index 7109b2d0..d2958437 100644 --- a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NonCentralizedAppExceptionTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NonCentralizedAppExceptionTest.java @@ -39,11 +39,14 @@ package org.onap.portalapp.portal.exceptions; import org.junit.Test; +import static org.junit.Assert.assertEquals; + public class NonCentralizedAppExceptionTest { @Test public void TestException2() { String s1 = "Value1"; NonCentralizedAppException nca = new NonCentralizedAppException(s1); + assertEquals(nca.toString(),"Value1 is not Centralized Application"); } } diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NotValidDataExceptionTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NotValidDataExceptionTest.java new file mode 100644 index 00000000..889b28f2 --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NotValidDataExceptionTest.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START============================================ + * ONAP Portal + * ===================================================================== + * Copyright (C) 2020 IBM Intellectual Property. All rights reserved. + * ===================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END================================================ + * + * + */ +package org.onap.portalapp.portal.exceptions; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; + +public class NotValidDataExceptionTest { + + @Test + public void TestException2() { + String s1 = "data"; + NotValidDataException nca = new NotValidDataException(s1); + assertEquals(nca.toString(),"NotValidDataException{}: data"); + } +} diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/RoleFunctionExceptionTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/RoleFunctionExceptionTest.java new file mode 100644 index 00000000..db17e784 --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/RoleFunctionExceptionTest.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START============================================ + * ONAP Portal + * ===================================================================== + * Copyright (C) 2020 IBM Intellectual Property. All rights reserved. + * ===================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END================================================ + * + * + */ + +package org.onap.portalapp.portal.exceptions; + +import org.apache.commons.codec.DecoderException; +import org.junit.Test; +import static org.junit.Assert.assertEquals; + +public class RoleFunctionExceptionTest { + + @Test + public void TestRoleFunctionConstructor() + { + String s1 = "Rolefunction Exception Occured"; + String s2 = "value2"; + DecoderException e=new DecoderException(s2); + RoleFunctionException rfe=new RoleFunctionException(s1,e); + assertEquals(rfe.getMessage(),"Rolefunction Exception Occured"); + } +} diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/scheduler/RestObjectTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/scheduler/RestObjectTest.java new file mode 100644 index 00000000..563135c5 --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/scheduler/RestObjectTest.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2020 IBM Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +package org.onap.portalapp.portal.scheduler; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import org.junit.Test; + +public class RestObjectTest { + RestObject rs=new RestObject(); + + @Test + public void testGetMethods() { + rs.setStatusCode(200); + rs.setUUID("1234"); + assertEquals(rs.getUUID(),"1234"); + assertEquals(rs.getStatusCode(),200); +// assertNull(rs.get()); + } + +} diff --git a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/controller/AppsOSController.java b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/controller/AppsOSController.java index 8314e7b9..66237523 100644 --- a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/controller/AppsOSController.java +++ b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/controller/AppsOSController.java @@ -39,12 +39,7 @@ package org.onap.portalapp.portal.controller; import java.util.HashMap; import java.util.Map; -import java.util.Set; import javax.servlet.http.HttpServletRequest; -import javax.validation.ConstraintViolation; -import javax.validation.Validation; -import javax.validation.Validator; -import javax.validation.ValidatorFactory; import org.json.JSONObject; import org.onap.portalapp.portal.domain.EPUser; import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; diff --git a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/interceptor/SessionTimeoutInterceptor.java b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/interceptor/SessionTimeoutInterceptor.java index 689b25f2..8a3bee62 100644 --- a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/interceptor/SessionTimeoutInterceptor.java +++ b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/interceptor/SessionTimeoutInterceptor.java @@ -42,7 +42,6 @@ import javax.servlet.http.HttpServletResponse; import org.onap.portalapp.authentication.LoginStrategy; import org.onap.portalapp.portal.domain.EPUser; -import org.onap.portalapp.portal.utils.EcompPortalUtils; import org.onap.portalapp.util.EPUserUtils; import org.onap.portalapp.util.SessionCookieUtil; import org.onap.portalsdk.core.controller.FusionBaseController; diff --git a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/logging/aop/EPEELFLoggerAspect.java b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/logging/aop/EPEELFLoggerAspect.java index 9cd18453..05ad61af 100644 --- a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/logging/aop/EPEELFLoggerAspect.java +++ b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/logging/aop/EPEELFLoggerAspect.java @@ -45,7 +45,6 @@ import org.onap.portalapp.portal.logging.aop.EPAuditLog; import org.onap.portalapp.portal.logging.aop.EPEELFLoggerAdvice; import org.onap.portalapp.portal.logging.aop.EPMetricsLog; import org.onap.portalapp.portal.transport.FieldsValidator; -import org.onap.portalapp.portal.utils.EcompPortalUtils; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.util.SystemProperties.SecurityEventTypeEnum; import org.springframework.beans.factory.annotation.Autowired; diff --git a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java index 0e9932e0..479564f5 100644 --- a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java +++ b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java @@ -113,7 +113,7 @@ public class SearchServiceImpl implements SearchService { resultOfSearch.addAll(resultOfAdditionalSearch); } resultOfSearch.addAll(resultOfSearchUserId); - resultOfSearch.stream().distinct().collect(Collectors.toList()); + resultOfSearch = resultOfSearch.stream().distinct().collect(Collectors.toList()); resultOfSearch = this.cutSearchResultToMaximumSize(resultOfSearch); ObjectMapper mapper = new ObjectMapper(); String result = "[]"; diff --git a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/util/SessionCookieUtil.java b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/util/SessionCookieUtil.java index c00533b6..1a347e07 100644 --- a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/util/SessionCookieUtil.java +++ b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/util/SessionCookieUtil.java @@ -40,15 +40,10 @@ package org.onap.portalapp.util; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; import org.onap.portalapp.portal.utils.EPCommonSystemProperties; -import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.onap.portalsdk.core.onboarding.listener.PortalTimeoutHandler; import org.onap.portalsdk.core.onboarding.util.CipherUtil; -import org.onap.portalsdk.core.onboarding.util.PortalApiConstants; import org.onap.portalsdk.core.util.SystemProperties; -import org.onap.portalsdk.core.web.support.AppUtils; public class SessionCookieUtil extends CommonSessionCookieUtil{ diff --git a/ecomp-portal-BE-os/src/test/java/org/onap/portalapp/scheduler/SessionMgtRegistryTest.java b/ecomp-portal-BE-os/src/test/java/org/onap/portalapp/scheduler/SessionMgtRegistryTest.java new file mode 100644 index 00000000..dcd5881b --- /dev/null +++ b/ecomp-portal-BE-os/src/test/java/org/onap/portalapp/scheduler/SessionMgtRegistryTest.java @@ -0,0 +1,60 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : Portal + * ================================================================================ + * Copyright (C) 2020 IBM Intellectual Property. All rights reserved. + *================================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.portalapp.scheduler; + +import static org.junit.Assert.assertNotNull; +import java.text.ParseException; +import java.util.HashMap; +import java.util.Map; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.onap.portalapp.service.sessionmgt.TimeoutHandler; +import org.springframework.scheduling.quartz.JobDetailFactoryBean; + +public class SessionMgtRegistryTest { + + @Mock + JobDetailFactoryBean job; + @Mock + TimeoutHandler lj; + @InjectMocks + SessionMgtRegistry lr; + + String groupName = "AppGroup"; + String jobName = "LogJob"; + @Before + public void initialize(){ + MockitoAnnotations.initMocks(this); + } + @Test + public void jobDetailFactoryBeantest() throws ParseException{ + + Map map = new HashMap(); + map.put("units", "bytes"); + job.setJobClass(TimeoutHandler.class); + job.setJobDataAsMap(map); + job.setGroup(groupName); + job.setName(jobName); + assertNotNull(lr.jobDetailFactoryBean()); + } +} diff --git a/portal-FE-os/package-lock.json b/portal-FE-os/package-lock.json index 1c65798c..4e3f349d 100644 --- a/portal-FE-os/package-lock.json +++ b/portal-FE-os/package-lock.json @@ -816,6 +816,12 @@ "@types/sizzle": "*" } }, + "@types/mime-types": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.0.tgz", + "integrity": "sha1-nKUs2jY/aZxpRmwqbM2q2RPqenM=", + "dev": true + }, "@types/node": { "version": "8.9.5", "resolved": "https://registry.npmjs.org/@types/node/-/node-8.9.5.tgz", @@ -1920,6 +1926,12 @@ "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", "dev": true }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", + "dev": true + }, "buffer-fill": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", @@ -3620,6 +3632,35 @@ } } }, + "extract-zip": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz", + "integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==", + "dev": true, + "requires": { + "concat-stream": "^1.6.2", + "debug": "^2.6.9", + "mkdirp": "^0.5.4", + "yauzl": "^2.10.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + } + } + }, "extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", @@ -3659,6 +3700,15 @@ "websocket-driver": ">=0.5.1" } }, + "fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", + "dev": true, + "requires": { + "pend": "~1.2.0" + } + }, "figgy-pudding": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.1.tgz", @@ -3871,6 +3921,17 @@ "null-check": "^1.0.0" } }, + "fs-extra": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz", + "integrity": "sha1-zTzl9+fLYUWIP8rjGR6Yd/hYeVA=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^2.1.0", + "klaw": "^1.0.0" + } + }, "fs-write-stream-atomic": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", @@ -3930,12 +3991,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3950,17 +4013,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -4077,7 +4143,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -4089,6 +4156,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -4103,6 +4171,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -4110,12 +4179,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -4134,6 +4205,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -4214,7 +4286,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -4226,6 +4299,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -4347,6 +4421,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -4755,6 +4830,16 @@ "minimalistic-assert": "^1.0.1" } }, + "hasha": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/hasha/-/hasha-2.2.0.tgz", + "integrity": "sha1-eNfL/B5tZjA/55g3NlmEUXsvbuE=", + "dev": true, + "requires": { + "is-stream": "^1.0.1", + "pinkie-promise": "^2.0.0" + } + }, "hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", @@ -5922,6 +6007,15 @@ "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", "dev": true }, + "jsonfile": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -6030,6 +6124,16 @@ "karma-jasmine": "^1.0.2" } }, + "karma-phantomjs-launcher": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/karma-phantomjs-launcher/-/karma-phantomjs-launcher-1.0.4.tgz", + "integrity": "sha1-0jyjSAG9qYY60xjju0vUBisTrNI=", + "dev": true, + "requires": { + "lodash": "^4.0.1", + "phantomjs-prebuilt": "^2.1.7" + } + }, "karma-source-map-support": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/karma-source-map-support/-/karma-source-map-support-1.3.0.tgz", @@ -6039,6 +6143,12 @@ "source-map-support": "^0.5.5" } }, + "kew": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz", + "integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=", + "dev": true + }, "killable": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz", @@ -6051,6 +6161,15 @@ "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", "dev": true }, + "klaw": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", + "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.9" + } + }, "lcid": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", @@ -7480,12 +7599,35 @@ "sha.js": "^2.4.8" } }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "dev": true + }, "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", "dev": true }, + "phantomjs-prebuilt": { + "version": "2.1.16", + "resolved": "https://registry.npmjs.org/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.16.tgz", + "integrity": "sha1-79ISpKOWbTZHaE6ouniFSb4q7+8=", + "dev": true, + "requires": { + "es6-promise": "^4.0.3", + "extract-zip": "^1.6.5", + "fs-extra": "^1.0.0", + "hasha": "^2.2.0", + "kew": "^0.7.0", + "progress": "^1.1.8", + "request": "^2.81.0", + "request-progress": "^2.0.1", + "which": "^1.2.10" + } + }, "pify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", @@ -7616,6 +7758,12 @@ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, + "progress": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", + "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", + "dev": true + }, "promise": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", @@ -7767,6 +7915,12 @@ "ipaddr.js": "1.9.0" } }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, "prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", @@ -7826,6 +7980,93 @@ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true }, + "puppeteer": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-2.1.1.tgz", + "integrity": "sha512-LWzaDVQkk1EPiuYeTOj+CZRIjda4k2s5w4MK4xoH2+kgWV/SDlkYHmxatDdtYrciHUKSXTsGgPgPP8ILVdBsxg==", + "dev": true, + "requires": { + "@types/mime-types": "^2.1.0", + "debug": "^4.1.0", + "extract-zip": "^1.6.6", + "https-proxy-agent": "^4.0.0", + "mime": "^2.0.3", + "mime-types": "^2.1.25", + "progress": "^2.0.1", + "proxy-from-env": "^1.0.0", + "rimraf": "^2.6.1", + "ws": "^6.1.0" + }, + "dependencies": { + "agent-base": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", + "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==", + "dev": true + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "https-proxy-agent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", + "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", + "dev": true, + "requires": { + "agent-base": "5", + "debug": "4" + } + }, + "mime": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz", + "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA==", + "dev": true + }, + "mime-db": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", + "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==", + "dev": true + }, + "mime-types": { + "version": "2.1.26", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", + "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", + "dev": true, + "requires": { + "mime-db": "1.43.0" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, + "ws": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", + "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", + "dev": true, + "requires": { + "async-limiter": "~1.0.0" + } + } + } + }, "q": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/q/-/q-1.4.1.tgz", @@ -8182,6 +8423,15 @@ "uuid": "^3.3.2" } }, + "request-progress": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-2.0.1.tgz", + "integrity": "sha1-XTa7V5YcZzqlt4jbyBQf3yO0Tgg=", + "dev": true, + "requires": { + "throttleit": "^1.0.0" + } + }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -8924,6 +9174,12 @@ } } }, + "sonar-scanner": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/sonar-scanner/-/sonar-scanner-3.1.0.tgz", + "integrity": "sha1-UcHBEB9UuYq8XYVlIJsdkjKXk0M=", + "dev": true + }, "source-list-map": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz", @@ -9615,6 +9871,12 @@ } } }, + "throttleit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", + "integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=", + "dev": true + }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -10877,6 +11139,16 @@ } } }, + "yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", + "dev": true, + "requires": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, "yeast": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", diff --git a/portal-FE-os/src/app/app.component.html b/portal-FE-os/src/app/app.component.html index dea5177c..2c914c52 100644 --- a/portal-FE-os/src/app/app.component.html +++ b/portal-FE-os/src/app/app.component.html @@ -35,5 +35,7 @@ --> - +
+ {{browserCompatibilityMsg}} +
diff --git a/portal-FE-os/src/app/app.component.scss b/portal-FE-os/src/app/app.component.scss index 7a773398..e739496d 100644 --- a/portal-FE-os/src/app/app.component.scss +++ b/portal-FE-os/src/app/app.component.scss @@ -34,4 +34,14 @@ * ============LICENSE_END============================================ * * - */ \ No newline at end of file + */ + + .diaplay-banner{ + margin-top: 14px; + background-color: yellow; + font-weight: bold; + position: fixed; + z-index: 9999; + margin-left: 34em; + height: 24px; +} \ No newline at end of file diff --git a/portal-FE-os/src/app/app.component.ts b/portal-FE-os/src/app/app.component.ts index dbfb568f..389153bd 100644 --- a/portal-FE-os/src/app/app.component.ts +++ b/portal-FE-os/src/app/app.component.ts @@ -35,13 +35,49 @@ * * */ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; +import { environment } from 'src/environments/environment'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'] }) -export class AppComponent { - -} +export class AppComponent implements OnInit { + diaplayBanner : boolean = false; + api = environment.api; + browserCompatibilityMsg: string; + + ngOnInit() { + this.diaplayBanner = false; + this.browserCompatibilityMsg = this.api.browserCompatibilityMsg; + this.getBrowserName(); + } + + /** + * Identify Browser + */ + getBrowserName() { + const agent = window.navigator.userAgent.toLowerCase(); + switch (true) { + case agent.indexOf('edge') > -1: + return 'edge'; + case agent.indexOf('opr') > -1 && !!(window).opr: + this.diaplayBanner = true; + return 'opera'; + case agent.indexOf('chrome') > -1 && !!(window).chrome: + return 'chrome'; + case agent.indexOf('trident') > -1: + this.diaplayBanner = true; + return 'ie'; + case agent.indexOf('firefox') > -1: + return 'firefox'; + case agent.indexOf('safari') > -1: + this.diaplayBanner = true; + return 'safari'; + default: + this.diaplayBanner = true; + return 'other'; + } + } +} \ No newline at end of file diff --git a/portal-FE-os/src/environments/environment.prod.ts b/portal-FE-os/src/environments/environment.prod.ts index db6b5bf5..7cc34da5 100644 --- a/portal-FE-os/src/environments/environment.prod.ts +++ b/portal-FE-os/src/environments/environment.prod.ts @@ -125,7 +125,8 @@ export const environment = { "footerLogoImagePath": "", "footerLogoText": "", "intraSearcLink": "", - "extraSearcLink": "https://wiki.onap.org/dosearchsite.action?cql=siteSearch+~+searchStringPlaceHolder&queryString=searchStringPlaceHolder" + "extraSearcLink": "https://wiki.onap.org/dosearchsite.action?cql=siteSearch+~+searchStringPlaceHolder&queryString=searchStringPlaceHolder", + "browserCompatibilityMsg": "This Application is best viewed on Firefox, Chrome and Edge." }, "getAccessUrl": "", "getAccessName":"", diff --git a/portal-FE-os/src/environments/environment.ts b/portal-FE-os/src/environments/environment.ts index 0482c20c..d412522f 100644 --- a/portal-FE-os/src/environments/environment.ts +++ b/portal-FE-os/src/environments/environment.ts @@ -129,7 +129,8 @@ export const environment = { "footerLogoImagePath": "", "footerLogoText": "", "intraSearcLink": "", - "extraSearcLink": "https://wiki.onap.org/dosearchsite.action?cql=siteSearch+~+searchStringPlaceHolder&queryString=searchStringPlaceHolder" + "extraSearcLink": "https://wiki.onap.org/dosearchsite.action?cql=siteSearch+~+searchStringPlaceHolder&queryString=searchStringPlaceHolder", + "browserCompatibilityMsg": "This Application is best viewed on Firefox, Chrome and Edge." }, "getAccessUrl": "", "getAccessName": "",