Merge "removed code smells"
authorSunder Tattavarada <statta@research.att.com>
Tue, 19 May 2020 17:53:44 +0000 (17:53 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 19 May 2020 17:53:44 +0000 (17:53 +0000)
93 files changed:
3.2.1-container-portal-docker.yaml [new file with mode: 0644]
deliveries/build_portalapps_dockers.sh
ecomp-portal-BE-common/pom.xml
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppsController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppsControllerExternalRequest.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppsControllerExternalVersionRequest.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuditLogController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuxApiRequestMapperController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BEPropertyReaderController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BasicAuthAccountController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/CommonWidgetController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardSearchResultController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/EncryptAdminController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAccessRolesController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAppsRestfulController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/FunctionalMenuController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/HealthCheckController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/LanguageController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceProxyController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/PortalAdminController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RoleManageController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RolesApprovalSystemController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SchedulerAuxController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserNotificationController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserRolesController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WebAnalyticsExtAppController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/FunctionalMenuItemWithAppID.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/MicroserviceData.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/SharedContext.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/interceptor/PortalResourceInterceptor.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInterface.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxUtil.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AppsCacheServiceImple.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthenticationCredentialServiceImpl.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/LanguageService.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceProxyService.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralRole.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/SessionCommunication.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/TimeoutHandler.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/FunctionalMenuControllerTest.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPServiceCookieTest.java [new file with mode: 0644]
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/DuplicateRecordExceptionTest.java [new file with mode: 0644]
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NonCentralizedAppExceptionTest.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NotValidDataExceptionTest.java [new file with mode: 0644]
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/RoleFunctionExceptionTest.java [new file with mode: 0644]
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/scheduler/RestObjectTest.java [new file with mode: 0644]
ecomp-portal-BE-os/pom.xml
ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/controller/AppsOSController.java
ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/interceptor/SessionTimeoutInterceptor.java
ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/logging/aop/EPEELFLoggerAspect.java
ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java
ecomp-portal-BE-os/src/main/java/org/onap/portalapp/util/SessionCookieUtil.java
ecomp-portal-BE-os/src/main/webapp/WEB-INF/conf/system.properties
ecomp-portal-BE-os/src/test/java/org/onap/portalapp/scheduler/SessionMgtRegistryTest.java [new file with mode: 0644]
ecomp-portal-widget-ms/widget-ms/pom.xml
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/controller/WidgetsCatalogController.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/App.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceData.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceParameter.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/RoleApp.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/WidgetCatalog.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/hibernate/HibernateConfiguration.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/service/impl/MicroserviceServiceImpl.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/service/impl/WidgetCatalogServiceImpl.java
ecomp-portal-widget-ms/widget-ms/src/main/resources/application.properties
ecomp-portal-widget-ms/widget-ms/src/test/java/org/onap/portalapp/widget/service/impl/WidgetCatalogServiceImplTest.java
ecomp-portal-widget-ms/widget-ms/src/test/java/org/onap/portalapp/widget/test/controller/WidgetsCatalogControllerTest.java
pom.xml
portal-FE-common/src/app/layout/components/header/header.component.html
portal-FE-common/src/app/layout/components/header/header.component.ts
portal-FE-common/src/app/shared/services/users/users.service.ts
portal-FE-os/package-lock.json
portal-FE-os/src/app/.gitignore
portal-FE-os/src/app/app.component.html
portal-FE-os/src/app/app.component.scss
portal-FE-os/src/app/app.component.ts
portal-FE-os/src/app/layout/components/search-users/search-users.component.html [moved from portal-FE-common/src/app/layout/components/search-users/search-users.component.html with 94% similarity]
portal-FE-os/src/app/layout/components/search-users/search-users.component.scss [moved from portal-FE-common/src/app/layout/components/search-users/search-users.component.scss with 100% similarity]
portal-FE-os/src/app/layout/components/search-users/search-users.component.spec.ts [moved from portal-FE-common/src/app/layout/components/search-users/search-users.component.spec.ts with 100% similarity]
portal-FE-os/src/app/layout/components/search-users/search-users.component.ts [moved from portal-FE-common/src/app/layout/components/search-users/search-users.component.ts with 91% similarity]
portal-FE-os/src/app/pages/users/user-details-form/user-details-form.component.html
portal-FE-os/src/app/pages/users/user-details-form/user-details-form.component.ts
portal-FE-os/src/environments/environment.prod.ts
portal-FE-os/src/environments/environment.ts
portal-FE-os/src/favicon.ico

diff --git a/3.2.1-container-portal-docker.yaml b/3.2.1-container-portal-docker.yaml
new file mode 100644 (file)
index 0000000..8872a0a
--- /dev/null
@@ -0,0 +1,7 @@
+distribution_type: container
+container_release_tag: 3.2.1
+project: portal
+ref: b310e558488c48cadc251a3d87b1f10f044c2499
+containers:
+    - name: portal-app
+      version: 3.2.0-STAGING-latest
index fdaf9a1..d2349b8 100755 (executable)
@@ -76,7 +76,7 @@ else
         if [ "$SDK_DOCKERFILE" != "skip" ] && [ "SDK_APP_DIR" != "skip" ]; then
          echo "Build Portal-SDK app"
          cd $BASEDIR/$SDK_APP_DIR
-         ${MVN} ${MVN_EXTRA_SDK} clean package
+         ${MVN} ${MVN_EXTRA_SDK} clean package -Dskiptests=true
        fi
 
        echo "Java build complete."
index 19d3243..82e9827 100644 (file)
                <dependency>
                        <groupId>org.apache.cxf</groupId>
                        <artifactId>cxf-rt-rs-client</artifactId>
-                       <version>3.3.3</version>
+                       <version>3.3.4</version>
                </dependency>
                <!-- Mapper -->
                <dependency>
index d36cf6c..1553991 100644 (file)
@@ -51,9 +51,10 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.EnableAspectJAutoProxy;
 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 +76,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);
                
index 7b42d52..12deabe 100644 (file)
@@ -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 {
index 557e4dc..714d3ab 100644 (file)
@@ -59,9 +59,10 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.EnableAspectJAutoProxy;
 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 +91,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<AppCatalogItem> getAppCatalog(HttpServletRequest request, HttpServletResponse response)
                        throws IOException {
                EPUser user = EPUserUtils.getUserSession(request);
@@ -125,7 +126,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();
index 8f456fd..0bf75fb 100644 (file)
@@ -61,8 +61,9 @@ 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.RestController;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 
 @RestController
 @RequestMapping("/portalApi/contactus")
@@ -94,7 +95,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<String> getPortalDetails(HttpServletRequest request) {
                PortalRestResponse<String> portalRestResponse;
                try {
@@ -123,7 +124,7 @@ public class AppContactUsController extends EPRestrictedBaseController {
         * @param request HttpServletRequest
         * @return PortalRestResponse<List<AppContactUsItem>>
         */
-       @RequestMapping(value = "/list", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/list", produces = "application/json")
        public PortalRestResponse<List<AppContactUsItem>> getAppContactUsList(HttpServletRequest request) {
                PortalRestResponse<List<AppContactUsItem>> portalRestResponse;
                try {
@@ -145,7 +146,7 @@ public class AppContactUsController extends EPRestrictedBaseController {
         * @param request HttpServletRequest
         * @return PortalRestResponse<List<AppContactUsItem>>
         */
-       @RequestMapping(value = "/allapps", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/allapps", produces = "application/json")
        public PortalRestResponse<List<AppContactUsItem>> getAppsAndContacts(HttpServletRequest request) {
                PortalRestResponse<List<AppContactUsItem>> portalRestResponse;
                try {
@@ -167,7 +168,7 @@ public class AppContactUsController extends EPRestrictedBaseController {
         * @param request HttpServletRequest
         * @return PortalRestResponse<List<AppCategoryFunctionsItem>>
         */
-       @RequestMapping(value = "/functions", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/functions", produces = "application/json")
        public PortalRestResponse<List<AppCategoryFunctionsItem>> getAppCategoryFunctions(HttpServletRequest request) {
                PortalRestResponse<List<AppCategoryFunctionsItem>> portalRestResponse;
                try {
@@ -190,7 +191,7 @@ public class AppContactUsController extends EPRestrictedBaseController {
         * @param contactUs AppContactUsItem
         * @return PortalRestResponse<String>
         */
-       @RequestMapping(value = "/save", method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = "/save", produces = "application/json")
        public PortalRestResponse<String> save(@RequestBody AppContactUsItem contactUs) {
 
                if (contactUs == null || contactUs.getAppName() == null) {
@@ -210,7 +211,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<String> save(@RequestBody List<AppContactUsItem> contactUsList) {
 
                if (contactUsList == null) {
@@ -237,7 +238,7 @@ public class AppContactUsController extends EPRestrictedBaseController {
         * @param id app ID
         * @return PortalRestResponse<String>
         */
-       @RequestMapping(value = "/delete/{appid}", method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = "/delete/{appid}", produces = "application/json")
        public PortalRestResponse<String> delete(@PathVariable("appid") Long id) {
 
                String saveAppContactUs = FAILURE;
index c34311c..6a6b3a6 100644 (file)
@@ -86,6 +86,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.PutMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.client.HttpClientErrorException;
@@ -121,7 +125,7 @@ public class AppsController extends EPRestrictedBaseController {
         *            HttpServletResponse
         * @return List<EcompApp>
         */
-       @RequestMapping(value = { "/portalApi/userApps" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/portalApi/userApps" }, produces = "application/json")
        public List<EcompApp> getUserApps(HttpServletRequest request, HttpServletResponse response) {
                EPUser user = EPUserUtils.getUserSession(request);
                List<EcompApp> ecompApps = null;
@@ -152,7 +156,7 @@ public class AppsController extends EPRestrictedBaseController {
         * @throws IOException
         *             if sendError fails
         */
-       @RequestMapping(value = { "/portalApi/persUserApps" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/portalApi/persUserApps" }, produces = "application/json")
        public List<EcompApp> getPersUserApps(HttpServletRequest request, HttpServletResponse response) throws IOException {
                EPUser user = EPUserUtils.getUserSession(request);
                List<EcompApp> ecompApps = null;
@@ -185,7 +189,7 @@ public class AppsController extends EPRestrictedBaseController {
         *            HttpServletResponse
         * @return List<AppIdAndNameTransportModel>
         */
-       @RequestMapping(value = { "/portalApi/adminApps" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/portalApi/adminApps" }, produces = "application/json")
        public List<AppIdAndNameTransportModel> getAdminApps(HttpServletRequest request, HttpServletResponse response) {
                EPUser user = EPUserUtils.getUserSession(request);
                List<AppIdAndNameTransportModel> adminApps = null;
@@ -214,8 +218,8 @@ public class AppsController extends EPRestrictedBaseController {
         *            HttpServletResponse
         * @return List<AppIdAndNameTransportModel>
         */
-       @RequestMapping(value = {
-                       "/portalApi/appsForSuperAdminAndAccountAdmin" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = {
+                       "/portalApi/appsForSuperAdminAndAccountAdmin" }, produces = "application/json")
        public List<AppIdAndNameTransportModel> getAppsForSuperAdminAndAccountAdmin(HttpServletRequest request,
                        HttpServletResponse response) {
                EPUser user = EPUserUtils.getUserSession(request);
@@ -246,7 +250,7 @@ public class AppsController extends EPRestrictedBaseController {
         * @return JSON with left menu
         */
        @SuppressWarnings({ "rawtypes", "unchecked" })
-       @RequestMapping(value = { "/portalApi/leftmenuItems" }, method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
+       @GetMapping(value = { "/portalApi/leftmenuItems" }, produces = "application/json;charset=UTF-8")
        public String getLeftMenuItems(HttpServletRequest request, HttpServletResponse response) {
                String menuList = null;
                Set menuSet = (Set) AppUtils.getSession(request)
@@ -266,8 +270,8 @@ public class AppsController extends EPRestrictedBaseController {
                return menuList;
        }
 
-       @RequestMapping(value = {
-                       PORTAL_API_USER_APPS_ORDER_BY_SORT_PREF }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = {
+                       PORTAL_API_USER_APPS_ORDER_BY_SORT_PREF }, produces = "application/json")
        public List<EcompApp> getUserAppsOrderBySortPref(HttpServletRequest request, HttpServletResponse response) {
                EPUser user = EPUserUtils.getUserSession(request);
                List<EcompApp> ecompApps = null;
@@ -322,8 +326,8 @@ public class AppsController extends EPRestrictedBaseController {
         *            sort pref
         * @return FieldsValidator
         */
-       @RequestMapping(value = {
-                       "/portalApi/saveUserAppsSortingManual" }, method = RequestMethod.PUT, produces = "application/json")
+       @PutMapping(value = {
+                       "/portalApi/saveUserAppsSortingManual" }, produces = "application/json")
        public FieldsValidator putUserAppsSortingManual(HttpServletRequest request,
                        @RequestBody List<EPAppsManualPreference> epAppsManualPref, HttpServletResponse response) {
                FieldsValidator fieldsValidator = null;
@@ -346,8 +350,8 @@ public class AppsController extends EPRestrictedBaseController {
                return fieldsValidator;
        }
 
-       @RequestMapping(value = {
-                       "/portalApi/saveUserWidgetsSortManual" }, method = RequestMethod.PUT, produces = "application/json")
+       @PutMapping(value = {
+                       "/portalApi/saveUserWidgetsSortManual" }, produces = "application/json")
        public FieldsValidator putUserWidgetsSortManual(HttpServletRequest request,
                        @RequestBody List<EPWidgetsSortPreference> saveManualWidgetSData, HttpServletResponse response) {
                FieldsValidator fieldsValidator = null;
@@ -370,8 +374,8 @@ public class AppsController extends EPRestrictedBaseController {
                return fieldsValidator;
        }
 
-       @RequestMapping(value = {
-                       "/portalApi/updateWidgetsSortPref" }, method = RequestMethod.PUT, produces = "application/json")
+       @PutMapping(value = {
+                       "/portalApi/updateWidgetsSortPref" }, produces = "application/json")
        public FieldsValidator putUserWidgetsSortPref(HttpServletRequest request,
                        @RequestBody List<EPWidgetsSortPreference> delManualWidgetData, HttpServletResponse response) {
                FieldsValidator fieldsValidator = null;
@@ -406,8 +410,8 @@ public class AppsController extends EPRestrictedBaseController {
         *            data to delete
         * @return FieldsValidator
         */
-       @RequestMapping(value = {
-                       "/portalApi/UpdateUserAppsSortManual" }, method = RequestMethod.PUT, produces = "application/json")
+       @PutMapping(value = {
+                       "/portalApi/UpdateUserAppsSortManual" }, produces = "application/json")
        public FieldsValidator deleteUserAppSortManual(HttpServletRequest request,
                        @RequestBody EPDeleteAppsManualSortPref delManualAppData, HttpServletResponse response) {
                FieldsValidator fieldsValidator = null;
@@ -425,8 +429,8 @@ public class AppsController extends EPRestrictedBaseController {
                return fieldsValidator;
        }
 
-       @RequestMapping(value = {
-                       "/portalApi/saveUserAppsSortingPreference" }, method = RequestMethod.PUT, produces = "application/json")
+       @PutMapping(value = {
+                       "/portalApi/saveUserAppsSortingPreference" }, produces = "application/json")
        public FieldsValidator putUserAppsSortingPreference(HttpServletRequest request,
                        @RequestBody EPAppsSortPreference userAppsValue, HttpServletResponse response) {
                FieldsValidator fieldsValidator = null;
@@ -444,8 +448,8 @@ public class AppsController extends EPRestrictedBaseController {
                return fieldsValidator;
        }
 
-       @RequestMapping(value = {
-                       "/portalApi/userAppsSortTypePreference" }, method = RequestMethod.GET, produces = "application/String")
+       @GetMapping(value = {
+                       "/portalApi/userAppsSortTypePreference" }, produces = "application/String")
        public String getUserAppsSortTypePreference(HttpServletRequest request, HttpServletResponse response) {
                EPUser user = EPUserUtils.getUserSession(request);
                String userSortPreference = null;
@@ -476,7 +480,7 @@ public class AppsController extends EPRestrictedBaseController {
         *            HTTP servlet response
         * @return List<AdminUserApplications>
         */
-       @RequestMapping(value = { "/portalApi/accountAdmins" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/portalApi/accountAdmins" }, produces = "application/json")
        public List<AdminUserApplications> getAppsAdministrators(HttpServletRequest request, HttpServletResponse response) {
                EPUser user = EPUserUtils.getUserSession(request);
                List<AdminUserApplications> admins = null;
@@ -494,7 +498,7 @@ public class AppsController extends EPRestrictedBaseController {
                return admins;
        }
 
-       @RequestMapping(value = { "/portalApi/availableApps" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/portalApi/availableApps" }, produces = "application/json")
        public List<AppsResponse> getApps(HttpServletRequest request, HttpServletResponse response) {
                EPUser user = EPUserUtils.getUserSession(request);
                List<AppsResponse> apps = null;
@@ -522,8 +526,8 @@ public class AppsController extends EPRestrictedBaseController {
         *            HTTP servlet response
         * @return List of applications
         */
-       @RequestMapping(value = {
-                       "/portalApi/allAvailableApps" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = {
+                       "/portalApi/allAvailableApps" }, produces = "application/json")
        public List<AppsResponse> getAllApps(HttpServletRequest request, HttpServletResponse response) {
                EPUser user = EPUserUtils.getUserSession(request);
                List<AppsResponse> apps = null;
@@ -549,7 +553,7 @@ public class AppsController extends EPRestrictedBaseController {
         *            HTTP servlet response
         * @return List of applications
         */
-       @RequestMapping(value = { "/portalApi/appsFullList" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/portalApi/appsFullList" }, produces = "application/json")
        public List<EcompApp> getAppsFullList(HttpServletRequest request, HttpServletResponse response) {
                EPUser user = EPUserUtils.getUserSession(request);
                List<EcompApp> ecompApps = null;
@@ -570,7 +574,7 @@ public class AppsController extends EPRestrictedBaseController {
         *            HTTP servlet response
         * @return UserRoles
         */
-       @RequestMapping(value = { "/portalApi/userProfile" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/portalApi/userProfile" }, produces = "application/json")
        public UserRoles getUserProfile(HttpServletRequest request, HttpServletResponse response) {
                EPUser user = EPUserUtils.getUserSession(request);
                UserRoles userAndRoles = null;
@@ -597,8 +601,7 @@ public class AppsController extends EPRestrictedBaseController {
         *            application ID
         * @return List<LocalRole>
         */
-       @RequestMapping(value = { "/portalApi/appRoles/{appId}" }, method = {
-                       RequestMethod.GET }, produces = "application/json")
+       @GetMapping(value = { "/portalApi/appRoles/{appId}" }, produces = "application/json")
        public List<LocalRole> getAppRoles(HttpServletRequest request, @PathVariable("appId") Long appId,
                        HttpServletResponse response) {
                List<LocalRole> roleList = null;
@@ -627,8 +630,7 @@ public class AppsController extends EPRestrictedBaseController {
         * @param response
         * @return EPApp object
         */
-       @RequestMapping(value = { "/portalApi/singleAppInfo" }, method = {
-                       RequestMethod.GET }, produces = "application/json")
+       @GetMapping(value = { "/portalApi/singleAppInfo" }, produces = "application/json")
        public EPApp getSingleAppInfo(HttpServletRequest request, HttpServletResponse response) {
                EPApp app = null;
                EPUser user = EPUserUtils.getUserSession(request);
@@ -657,8 +659,7 @@ public class AppsController extends EPRestrictedBaseController {
         * @param response
         * @return EPApp object
         */
-       @RequestMapping(value = { "/portalApi/singleAppInfoById" }, method = {
-                       RequestMethod.GET }, produces = "application/json")
+       @GetMapping(value = { "/portalApi/singleAppInfoById" }, produces = "application/json")
        public EPApp getSingleAppInfoById(HttpServletRequest request, HttpServletResponse response) {
                EPApp app = null;
                EPUser user = EPUserUtils.getUserSession(request);
@@ -690,7 +691,7 @@ public class AppsController extends EPRestrictedBaseController {
         *            HTTP servlet response
         * @return List<OnboardingApp>
         */
-       @RequestMapping(value = { PORTAL_API_ONBOARDING_APPS }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { PORTAL_API_ONBOARDING_APPS }, produces = "application/json")
        public List<OnboardingApp> getOnboardingApps(HttpServletRequest request, HttpServletResponse response) {
                EPUser user = EPUserUtils.getUserSession(request);
                List<OnboardingApp> onboardingApps = null;
@@ -728,7 +729,7 @@ public class AppsController extends EPRestrictedBaseController {
         * @return FieldsValidator
         * @throws Exception 
         */
-       @RequestMapping(value = { PORTAL_API_ONBOARDING_APPS }, method = RequestMethod.PUT, produces = "application/json")
+       @PutMapping(value = { PORTAL_API_ONBOARDING_APPS }, produces = "application/json")
        public FieldsValidator putOnboardingApp(HttpServletRequest request,
                        @RequestBody OnboardingApp modifiedOnboardingApp, HttpServletResponse response) {
                FieldsValidator fieldsValidator = null;
@@ -784,7 +785,7 @@ public class AppsController extends EPRestrictedBaseController {
         *            app to add
         * @return FieldsValidator
         */
-       @RequestMapping(value = { PORTAL_API_ONBOARDING_APPS }, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = { PORTAL_API_ONBOARDING_APPS }, produces = "application/json")
        public FieldsValidator postOnboardingApp(HttpServletRequest request, @RequestBody OnboardingApp newOnboardingApp,
                        HttpServletResponse response) {
                FieldsValidator fieldsValidator = null;
@@ -845,8 +846,7 @@ public class AppsController extends EPRestrictedBaseController {
         *            ID of app to delete
         * @return FieldsValidator
         */
-       @RequestMapping(value = { "/portalApi/onboardingApps/{appId}" }, method = {
-                       RequestMethod.DELETE }, produces = "application/json")
+       @DeleteMapping(value = { "/portalApi/onboardingApps/{appId}" }, produces = "application/json")
        public FieldsValidator deleteOnboardingApp(HttpServletRequest request, @PathVariable("appId") Long appId,
                        HttpServletResponse response) {
                FieldsValidator fieldsValidator = null;
index d5438f4..ce29900 100644 (file)
@@ -65,7 +65,9 @@ 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.GetMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -126,7 +128,7 @@ public class AppsControllerExternalRequest implements BasicAuthenticationControl
         * @return PortalRestResponse with success or failure
         */
        @ApiOperation(value = "Creates a new user as a Portal administrator.", response = PortalRestResponse.class)
-       @RequestMapping(value = "/portalAdmin", method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = "/portalAdmin", produces = "application/json")
        @ResponseBody
        public PortalRestResponse<String> postPortalAdmin(HttpServletRequest request, HttpServletResponse response,
                @Valid @RequestBody EPUser epUser) {
@@ -200,7 +202,7 @@ public class AppsControllerExternalRequest implements BasicAuthenticationControl
         * @return OnboardingApp objects
         */
        @ApiOperation(value = "Gets the specified application that is on-boarded in Portal.", response = OnboardingApp.class)
-       @RequestMapping(value = {ONBOARD_APP + "/{appId}"}, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = {ONBOARD_APP + "/{appId}"}, produces = "application/json")
        @ResponseBody
        public OnboardingApp getOnboardAppExternal(HttpServletRequest request, HttpServletResponse response,
                @PathVariable("appId") Long appId) {
@@ -234,7 +236,7 @@ public class AppsControllerExternalRequest implements BasicAuthenticationControl
         * @return PortalRestResponse
         */
        @ApiOperation(value = "Adds a new application to Portal.", response = PortalRestResponse.class)
-       @RequestMapping(value = {ONBOARD_APP}, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = {ONBOARD_APP}, produces = "application/json")
        @ResponseBody
        public PortalRestResponse<String> postOnboardAppExternal(HttpServletRequest request, HttpServletResponse response,
                @Valid @RequestBody OnboardingApp newOnboardApp) {
@@ -322,7 +324,7 @@ public class AppsControllerExternalRequest implements BasicAuthenticationControl
         * @return PortalRestResponse
         */
        @ApiOperation(value = "Updates information about an on-boarded application in Portal.", response = PortalRestResponse.class)
-       @RequestMapping(value = {ONBOARD_APP + "/{appId}"}, method = RequestMethod.PUT, produces = "application/json")
+       @PutMapping(value = {ONBOARD_APP + "/{appId}"}, produces = "application/json")
        @ResponseBody
        public PortalRestResponse<String> putOnboardAppExternal(HttpServletRequest request, HttpServletResponse response,
                @PathVariable("appId") Long appId, @Valid @RequestBody OnboardingApp oldOnboardApp) {
index 13a6811..5af76aa 100644 (file)
@@ -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
index cff8245..dc5127c 100644 (file)
@@ -48,7 +48,7 @@ import org.onap.portalapp.validation.SecureString;
 import org.slf4j.MDC;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -91,7 +91,7 @@ public class AuditLogController extends EPRestrictedBaseController {
         * @param comment
         *            Comment
         */
-       @RequestMapping(value = "/store", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/store", produces = "application/json")
        public void auditLog(HttpServletRequest request, @RequestParam String affectedAppId, @RequestParam String type,
                        @RequestParam String comment) {
                logger.debug(EELFLoggerDelegate.debugLogger, "auditLog: appId {}, type {}, comment {}", affectedAppId, type,
index 969605c..2f4f788 100644 (file)
@@ -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;
@@ -85,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.ResponseBody;
@@ -107,7 +110,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
        private ManifestService manifestService;
 
        @ApiOperation(value = "Gets user roles for an application which is upgraded to newer version.", response = String.class, responseContainer = "List")
-       @RequestMapping(value = { "/v3/user/{loginId}" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/v3/user/{loginId}" }, produces = "application/json")
        public String getUser(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("loginId") String loginId) throws Exception {
                if (loginId!=null){
@@ -129,7 +132,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Gets roles for an application which is upgraded to newer version.", response = CentralV2Role.class, responseContainer = "Json")
-       @RequestMapping(value = { "/v3/roles" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/v3/roles" }, produces = "application/json")
        public List<CentralV2Role> getRoles(HttpServletRequest request, HttpServletResponse response) throws Exception {
                Map<String, Object> res = getMethod(request, response);
                request.getMethod();
@@ -144,7 +147,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Saves role for an application.", response = PortalRestResponse.class, responseContainer = "Json")
-       @RequestMapping(value = { "/v3/role" }, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = { "/v3/role" }, produces = "application/json")
        public PortalRestResponse<String> saveRole(HttpServletRequest request, HttpServletResponse response,
                        @RequestBody Role role) throws Exception {
                Map<String, Object> res = getMethod(request, response);
@@ -159,7 +162,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
        }
 
        @ApiOperation(value = "Gets v2 role information for an application which is upgraded to newer version.", response = CentralV2Role.class, responseContainer = "Json")
-       @RequestMapping(value = { "/v3/role/{role_id}" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/v3/role/{role_id}" }, produces = "application/json")
        public CentralV2Role getRoleInfo(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("role_id") Long roleId) throws Exception {
                Map<String, Object> res = getMethod(request, response);
@@ -175,7 +178,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Gets all active Users of application", response = String.class, responseContainer = "Json")
-       @RequestMapping(value = { "/v3/users" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/v3/users" }, produces = "application/json")
        public List<EcompUser> getUsersOfApplication(HttpServletRequest request, HttpServletResponse response)
                        throws Exception {
                Map<String, Object> res = getMethod(request, response);
@@ -190,7 +193,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Gets all role functions for an application which is upgraded to newer version.", response = CentralV2RoleFunction.class, responseContainer = "Json")
-       @RequestMapping(value = { "/v3/functions" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/v3/functions" }, produces = "application/json")
        public List<CentralV2RoleFunction> getRoleFunctionsList(HttpServletRequest request, HttpServletResponse response)
                        throws Exception {
                Map<String, Object> res = getMethod(request, response);
@@ -204,7 +207,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
        }
 
        @ApiOperation(value = "Gets role information for an application provided by function code.", response = CentralV2RoleFunction.class, responseContainer = "Json")
-       @RequestMapping(value = { "/v3/function/{code}" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/v3/function/{code}" }, produces = "application/json")
        public CentralV2RoleFunction getRoleFunction(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("code") String code) throws Exception {
                if (code!=null){
@@ -225,7 +228,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Saves role function for an application.", response = PortalRestResponse.class, responseContainer = "Json")
-       @RequestMapping(value = { "/v3/roleFunction" }, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = { "/v3/roleFunction" }, produces = "application/json")
        public PortalRestResponse<String> saveRoleFunction(HttpServletRequest request, HttpServletResponse response,
                        @RequestBody String roleFunc) throws Exception {
                if (roleFunc!=null){
@@ -250,7 +253,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Deletes role function for an application.", response = PortalRestResponse.class, responseContainer = "Json")
-       @RequestMapping(value = { "/v3/roleFunction/{code}" }, method = RequestMethod.DELETE, produces = "application/json")
+       @DeleteMapping(value = { "/v3/roleFunction/{code}" }, produces = "application/json")
        public PortalRestResponse<String> deleteRoleFunction(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("code") String code) throws Exception {
                PortalRestResponse<String> result = null;
@@ -273,7 +276,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "deletes  roles for an application.", response = PortalRestResponse.class, responseContainer = "Json")
-       @RequestMapping(value = { "/v3/deleteRole/{roleId}" }, method = RequestMethod.DELETE, produces = "application/json")
+       @DeleteMapping(value = { "/v3/deleteRole/{roleId}" }, produces = "application/json")
        public PortalRestResponse<String> deleteRole(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("roleId") Long roleId) throws Exception {
                PortalRestResponse<String> result = null;
@@ -289,7 +292,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Gets active roles for an application.", response = CentralV2Role.class, responseContainer = "Json")
-       @RequestMapping(value = { "/v3/activeRoles" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/v3/activeRoles" }, produces = "application/json")
        public List<CentralV2Role> getActiveRoles(HttpServletRequest request, HttpServletResponse response)
                        throws Exception {
                List<CentralV2Role> cenRole = null;
@@ -303,7 +306,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
        }
 
        @ApiOperation(value = "Gets ecompUser of an application.", response = CentralUser.class, responseContainer = "List")
-       @RequestMapping(value = { "/v4/user/{loginId}" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/v4/user/{loginId}" }, produces = "application/json")
        public String getEcompUser(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("loginId") String loginId) throws Exception {
                Map<String, Object> res = getMethod(request, response);
@@ -326,7 +329,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Gets user ecomp role for an application.", response = CentralUser.class, responseContainer = "List")
-       @RequestMapping(value = { "/v4/roles" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/v4/roles" }, produces = "application/json")
        public List<EcompRole> getEcompRolesOfApplication(HttpServletRequest request, HttpServletResponse response)
                        throws Exception {
                Map<String, Object> res = getMethod(request, response);
@@ -340,8 +343,8 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
        }
 
        @ApiOperation(value = "Gets session slot-check interval, a duration in milliseconds.", response = Integer.class)
-       @RequestMapping(value = {
-                       "/v3/getSessionSlotCheckInterval" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = {
+                       "/v3/getSessionSlotCheckInterval" }, produces = "application/json")
        public Integer getSessionSlotCheckInterval(HttpServletRequest request, HttpServletResponse response)
                        throws Exception {
                Map<String, Object> res = getMethod(request, response);
@@ -355,7 +358,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
        }
 
        @ApiOperation(value = "Extends session timeout values for all on-boarded applications.", response = Boolean.class)
-       @RequestMapping(value = { "/v3/extendSessionTimeOuts" }, method = RequestMethod.POST)
+       @PostMapping(value = { "/v3/extendSessionTimeOuts" })
        public Boolean extendSessionTimeOuts(HttpServletRequest request, HttpServletResponse response,
                        @RequestParam String sessionMap) throws Exception {
 
@@ -377,7 +380,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
        }
 
        @ApiOperation(value = "Gets javascript with functions that support gathering and reporting web analytics.", response = String.class)
-       @RequestMapping(value = { "/v3/analytics" }, method = RequestMethod.GET, produces = "application/javascript")
+       @GetMapping(value = { "/v3/analytics" }, produces = "application/javascript")
        public String getAnalyticsScript(HttpServletRequest request, HttpServletResponse response) throws Exception {
                Map<String, Object> res = getMethod(request, response);
                String ans = null;
@@ -389,7 +392,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
                return ans;
        }
 
-       @RequestMapping(value = { "/v3/storeAnalytics" }, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = { "/v3/storeAnalytics" }, produces = "application/json")
        @ResponseBody
        @ApiOperation(value = "Accepts data from partner applications with web analytics data.", response = PortalAPIResponse.class)
        public PortalAPIResponse storeAnalyticsScript(HttpServletRequest request, HttpServletResponse response,
@@ -413,8 +416,8 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Bulk upload functions for an application.", response = PortalRestResponse.class, responseContainer = "Json")
-       @RequestMapping(value = {
-                       "/v3/upload/portal/functions" }, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = {
+                       "/v3/upload/portal/functions" }, produces = "application/json")
        public PortalRestResponse<String> bulkUploadFunctions(HttpServletRequest request, HttpServletResponse response)
                        throws Exception {
                Optional<PortalRestResponse<String>> result = null;
@@ -434,7 +437,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Bulk upload roles for an application.", response = PortalRestResponse.class, responseContainer = "Json")
-       @RequestMapping(value = { "/v3/upload/portal/roles" }, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = { "/v3/upload/portal/roles" }, produces = "application/json")
        public PortalRestResponse<String> bulkUploadRoles(HttpServletRequest request, HttpServletResponse response)
                        throws Exception {
                Optional<PortalRestResponse<String>> result;
@@ -454,8 +457,8 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Bulk upload role functions for an application.", response = PortalRestResponse.class, responseContainer = "Json")
-       @RequestMapping(value = {
-                       "/v3/upload/portal/roleFunctions" }, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = {
+                       "/v3/upload/portal/roleFunctions" }, produces = "application/json")
        public PortalRestResponse<String> bulkUploadRoleFunctions(HttpServletRequest request, HttpServletResponse response)
                        throws Exception {
                Optional<PortalRestResponse<String>> result;
@@ -475,8 +478,8 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Bulk upload user roles for an application.", response = PortalRestResponse.class, responseContainer = "Json")
-       @RequestMapping(value = {
-                       "/v3/upload/portal/userRoles" }, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = {
+                       "/v3/upload/portal/userRoles" }, produces = "application/json")
        public PortalRestResponse<String> bulkUploadUserRoles(HttpServletRequest request, HttpServletResponse response)
                        throws Exception {
                Optional<PortalRestResponse<String>> result;
@@ -497,8 +500,8 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Bulk upload users for renamed role of an application.", response = PortalRestResponse.class, responseContainer = "Json")
-       @RequestMapping(value = {
-                       "/v3/upload/portal/userRole/{roleId}" }, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = {
+                       "/v3/upload/portal/userRole/{roleId}" }, produces = "application/json")
        public PortalRestResponse<String> bulkUploadUsersSingleRole(HttpServletRequest request,
                        HttpServletResponse response, @PathVariable Long roleId) throws Exception {
                Optional<PortalRestResponse<String>> result = null;
@@ -518,8 +521,8 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Bulk upload functions for an partner application.", response = PortalRestResponse.class, responseContainer = "Json")
-       @RequestMapping(value = {
-                       "/v3/upload/partner/functions" }, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = {
+                       "/v3/upload/partner/functions" }, produces = "application/json")
        public PortalRestResponse<String> bulkUploadPartnerFunctions(HttpServletRequest request,
                        HttpServletResponse response) throws Exception {
                Optional<PortalRestResponse<String>> result = null;
@@ -540,7 +543,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
        // not using
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Bulk upload roles for an partner application.", response = PortalRestResponse.class, responseContainer = "Json")
-       @RequestMapping(value = { "/v3/upload/partner/roles" }, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = { "/v3/upload/partner/roles" }, produces = "application/json")
        public PortalRestResponse<String> bulkUploadPartnerRoles(HttpServletRequest request, HttpServletResponse response,
                        @RequestBody List<Role> upload) throws Exception {
                Optional<PortalRestResponse<String>> result = null;
@@ -560,8 +563,8 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Bulk upload role functions for an partner application.", response = PortalRestResponse.class, responseContainer = "Json")
-       @RequestMapping(value = {
-                       "/v3/upload/partner/roleFunctions" }, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = {
+                       "/v3/upload/partner/roleFunctions" }, produces = "application/json")
        public PortalRestResponse<String> bulkUploadPartnerRoleFunctions(HttpServletRequest request,
                        HttpServletResponse response) throws Exception {
                Optional<PortalRestResponse<String>> result = null;
@@ -581,7 +584,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Gets all functions along with global functions", response = List.class, responseContainer = "Json")
-       @RequestMapping(value = { "/v3/menuFunctions" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/v3/menuFunctions" }, produces = "application/json")
        public List<String> getMenuFunctions(HttpServletRequest request, HttpServletResponse response) throws Exception {
                List<String> functionsList = null;
                Map<String, Object> res = getMethod(request, response);
@@ -796,7 +799,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Creates an application user with the specified roles.", response = PortalRestResponse.class)
-       @RequestMapping(value = { "/v3/userProfile" }, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = { "/v3/userProfile" }, produces = "application/json")
        public PortalRestResponse<String> postUserProfile(HttpServletRequest request,
                        @RequestBody ExternalSystemUser extSysUser, HttpServletResponse response) {
 
@@ -818,7 +821,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Updates an application user to have only the specified roles.", response = PortalRestResponse.class)
-       @RequestMapping(value = { "/v3/userProfile" }, method = RequestMethod.PUT, produces = "application/json")
+       @PutMapping(value = { "/v3/userProfile" }, produces = "application/json")
        public PortalRestResponse<String> putUserProfile(HttpServletRequest request,
                        @RequestBody ExternalSystemUser extSysUser, HttpServletResponse response) {
 
@@ -840,7 +843,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Processes a request to delete one or more application roles for one      specified user who has roles.", response = PortalRestResponse.class)
-       @RequestMapping(value = { "/v3/userProfile" }, method = RequestMethod.DELETE, produces = "application/json")
+       @DeleteMapping(value = { "/v3/userProfile" }, produces = "application/json")
        public PortalRestResponse<String> deleteUserProfile(HttpServletRequest request,
                        @RequestBody ExternalSystemUser extSysUser, HttpServletResponse response) {
 
@@ -862,7 +865,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Accepts messages from external ticketing systems and creates notifications for Portal users.", response = PortalRestResponse.class)
-       @RequestMapping(value = { "/v3/ticketevent" }, method = RequestMethod.POST)
+       @PostMapping(value = { "/v3/ticketevent" })
        public PortalRestResponse<String> handleRequest(HttpServletRequest request, HttpServletResponse response,
                        @RequestBody String ticketEventJson) throws Exception {
 
@@ -885,7 +888,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Creates a new user as a Portal administrator.", response = PortalRestResponse.class)
-       @RequestMapping(value = "/v3/portalAdmin", method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = "/v3/portalAdmin", produces = "application/json")
        @ResponseBody
        public PortalRestResponse<String> postPortalAdmin(HttpServletRequest request, HttpServletResponse response,
                        @RequestBody EPUser epUser) {
@@ -907,7 +910,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
        }
 
        @ApiOperation(value = "Gets the specified application that is on-boarded in Portal.", response = OnboardingApp.class)
-       @RequestMapping(value = { "/v3/onboardApp/{appId}" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/v3/onboardApp/{appId}" }, produces = "application/json")
        @ResponseBody
        public OnboardingApp getOnboardAppExternal(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("appId") Long appId) {
@@ -923,7 +926,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Adds a new application to Portal.", response = PortalRestResponse.class)
-       @RequestMapping(value = { "/v3/onboardApp" }, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = { "/v3/onboardApp" }, produces = "application/json")
        @ResponseBody
        public PortalRestResponse<String> postOnboardAppExternal(HttpServletRequest request, HttpServletResponse response,
                        @RequestBody OnboardingApp newOnboardApp) {
@@ -947,7 +950,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Updates information about an on-boarded application in Portal.", response = PortalRestResponse.class)
-       @RequestMapping(value = { "/v3/onboardApp/{appId}" }, method = RequestMethod.PUT, produces = "application/json")
+       @PutMapping(value = { "/v3/onboardApp/{appId}" }, produces = "application/json")
        @ResponseBody
        public PortalRestResponse<String> putOnboardAppExternal(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("appId") Long appId, @RequestBody OnboardingApp oldOnboardApp) {
@@ -969,7 +972,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
        }
 
        @ApiOperation(value = "Creates a Portal user notification for roles identified in the content from an external application.", response = PortalAPIResponse.class)
-       @RequestMapping(value = { "/v3/publishNotification" }, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = { "/v3/publishNotification" }, produces = "application/json")
        @ResponseBody
        public PortalAPIResponse publishNotification(HttpServletRequest request,
                        @RequestBody EpNotificationItem notificationItem, HttpServletResponse response) {
@@ -990,7 +993,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Gets favorite items within the functional menu for the current user.", response = FavoritesFunctionalMenuItemJson.class, responseContainer = "List")
-       @RequestMapping(value = { "/v3/getFavorites" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/v3/getFavorites" }, produces = "application/json")
        public List<FavoritesFunctionalMenuItemJson> getFavoritesForUser(HttpServletRequest request,
                        HttpServletResponse response) throws Exception {
                List<FavoritesFunctionalMenuItemJson> favorites = null;
@@ -1005,8 +1008,8 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        @SuppressWarnings("unchecked")
        @ApiOperation(value = "Gets functional menu items appropriate for the current user.", response = FunctionalMenuItem.class, responseContainer = "List")
-       @RequestMapping(value = {
-                       "/v3/functionalMenuItemsForUser" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = {
+                       "/v3/functionalMenuItemsForUser" }, produces = "application/json")
        public List<FunctionalMenuItem> getFunctionalMenuItemsForUser(HttpServletRequest request,
                        HttpServletResponse response) throws Exception {
                List<FunctionalMenuItem> fnMenuItems = null;
@@ -1021,7 +1024,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
 
        
        @ApiOperation(value = "Gets MechId roles", response = String.class, responseContainer = "List")
-       @RequestMapping(value = { "/v3/systemUser" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/v3/systemUser" }, produces = "application/json")
        public List<AAFPermission> getSystemUserPerms(HttpServletRequest request, HttpServletResponse response) throws Exception {
                List<AAFPermission> permsList = null;
                Map<String, Object> res = getMethod(request, response);
@@ -1034,7 +1037,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B
        }
        
        @ApiOperation(value = "Update role description in external auth system for an application.", response = PortalRestResponse.class, responseContainer = "Json")
-       @RequestMapping(value = { "/v3/update/app/roleDescription" }, method = RequestMethod.PUT, produces = "application/json")
+       @PutMapping(value = { "/v3/update/app/roleDescription" }, produces = "application/json")
        public  PortalRestResponse<String> updateAppRoleDescription(HttpServletRequest request, HttpServletResponse response) throws Exception {
                PortalRestResponse<String> result = null;
                Map<String, Object> res = getMethod(request, response);
index 51b1d48..6016496 100644 (file)
@@ -40,7 +40,7 @@ package org.onap.portalapp.portal.controller;
 import javax.servlet.http.HttpServletRequest;
 
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.onap.portalapp.portal.domain.BEProperty;
@@ -56,7 +56,7 @@ public class BEPropertyReaderController extends FusionBaseController{
 
     private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(BEPropertyReaderController.class);
 
-       @RequestMapping(value = "/readProperty", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/readProperty", produces = "application/json")
        public PortalRestResponse<BEProperty> readProperty(HttpServletRequest request, @RequestParam String key) {
                try {
                        return new PortalRestResponse<>(PortalRestStatusEnum.OK, "success", new BEProperty(key, SystemProperties.getProperty(key)));
index f655d35..24c08f3 100644 (file)
@@ -59,8 +59,10 @@ 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.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.RestController;
 
 @RestController
@@ -96,7 +98,7 @@ public class BasicAuthAccountController extends EPRestrictedBaseController {
         * @throws Exception
         *             on failure
         */
-       @RequestMapping(value = { "/portalApi/basicAuthAccount" }, method = RequestMethod.POST)
+       @PostMapping(value = { "/portalApi/basicAuthAccount" })
        public PortalRestResponse<String> createBasicAuthAccount(HttpServletRequest request, HttpServletResponse response,
                        @RequestBody BasicAuthCredentials newBasicAuthAccount) throws Exception {
 
@@ -153,7 +155,7 @@ public class BasicAuthAccountController extends EPRestrictedBaseController {
         *             on failure
         */
 
-       @RequestMapping(value = { "/portalApi/basicAuthAccount" }, method = RequestMethod.GET)
+       @GetMapping(value = { "/portalApi/basicAuthAccount" })
        public PortalRestResponse<List<BasicAuthCredentials>> getBasicAuthAccount(HttpServletRequest request,
                        HttpServletResponse response) throws Exception {
 
@@ -182,7 +184,7 @@ public class BasicAuthAccountController extends EPRestrictedBaseController {
         * @throws Exception
         *             on failure
         */
-       @RequestMapping(value = { "/portalApi/basicAuthAccount/{accountId}" }, method = RequestMethod.PUT)
+       @PutMapping(value = { "/portalApi/basicAuthAccount/{accountId}" })
        public PortalRestResponse<String> updateAccount(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("accountId") long accountId, @RequestBody BasicAuthCredentials newBasicAuthAccount)
                        throws Exception {
@@ -219,7 +221,7 @@ public class BasicAuthAccountController extends EPRestrictedBaseController {
         * @throws Exception
         *             on failure
         */
-       @RequestMapping(value = { "/portalApi/basicAuthAccount/{accountId}" }, method = RequestMethod.DELETE)
+       @DeleteMapping(value = { "/portalApi/basicAuthAccount/{accountId}" })
        public PortalRestResponse<String> deleteAccount(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("accountId") long accountId) throws Exception {
 
index ee17ac0..66b9df2 100644 (file)
@@ -47,8 +47,7 @@ import org.onap.portalapp.portal.service.DashboardSearchService;
 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.RequestMethod;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -83,7 +82,7 @@ public class CommonWidgetController extends EPRestrictedBaseController implement
         *            Request parameter.
         * @return Rest response wrapped around a CommonWidgetMeta object.
         */
-       @RequestMapping(value = "/commonWidgets", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/commonWidgets", produces = "application/json")
        public PortalRestResponse<CommonWidgetMeta> getWidgetData(HttpServletRequest request,
                        @RequestParam String resourceType) {
                if (!isValidResourceType(resourceType)){
index 6137aec..ff89bb8 100644 (file)
@@ -78,7 +78,8 @@ 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.RequestMethod;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -132,7 +133,7 @@ public class DashboardController extends EPRestrictedBaseController {
         *            Request parameter.
         * @return Rest response wrapped around a CommonWidgetMeta object.
         */
-       @RequestMapping(value = "/widgetData", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/widgetData", produces = "application/json")
        public PortalRestResponse<CommonWidgetMeta> getWidgetData(HttpServletRequest request,
                        @RequestParam String resourceType) {
                if (!isValidResourceType(resourceType)) {
@@ -154,7 +155,7 @@ public class DashboardController extends EPRestrictedBaseController {
         *            read from POST body.
         * @return Rest response wrapped around a String; e.g., "success" or "ERROR"
         */
-       @RequestMapping(value = "/widgetDataBulk", method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = "/widgetDataBulk", produces = "application/json")
        public PortalRestResponse<String> saveWidgetDataBulk(@RequestBody CommonWidgetMeta commonWidgetMeta) {
                logger.debug(EELFLoggerDelegate.debugLogger, "saveWidgetDataBulk: argument is {}", commonWidgetMeta);
                if (!DATA_VALIDATOR.isValid(commonWidgetMeta)){
@@ -183,7 +184,7 @@ public class DashboardController extends EPRestrictedBaseController {
         *            read from POST body
         * @return Rest response wrapped around a String; e.g., "success" or "ERROR"
         */
-       @RequestMapping(value = "/widgetData", method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = "/widgetData", produces = "application/json")
        public PortalRestResponse<String> saveWidgetData(@RequestBody CommonWidget commonWidget, HttpServletRequest request, HttpServletResponse response) {
                logger.debug(EELFLoggerDelegate.debugLogger, "saveWidgetData: argument is {}", commonWidget);
                EPUser user = EPUserUtils.getUserSession(request);
@@ -249,7 +250,7 @@ public class DashboardController extends EPRestrictedBaseController {
         *            read from POST body
         * @return Rest response wrapped around a String; e.g., "success" or "ERROR"
         */
-       @RequestMapping(value = "/deleteData", method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = "/deleteData", produces = "application/json")
        public PortalRestResponse<String> deleteWidgetData(@RequestBody CommonWidget commonWidget) {
                logger.debug(EELFLoggerDelegate.debugLogger, "deleteWidgetData: argument is {}", commonWidget);
                if (!DATA_VALIDATOR.isValid(commonWidget)){
@@ -269,7 +270,7 @@ public class DashboardController extends EPRestrictedBaseController {
         *         Result Item.
         */
        @EPAuditLog
-       @RequestMapping(value = "/search", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/search", produces = "application/json")
        public PortalRestResponse<Map<String, List<SearchResultItem>>> searchPortal(HttpServletRequest request,
                        @RequestParam String searchString) {
                if (!DATA_VALIDATOR.isValid(new SecureString(searchString))){
@@ -330,7 +331,7 @@ public class DashboardController extends EPRestrictedBaseController {
         * @param request
         * @return Rest response wrapped around a list of String
         */
-       @RequestMapping(value = "/activeUsers", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/activeUsers", produces = "application/json")
        public List<String> getActiveUsers(HttpServletRequest request) {
                List<String> activeUsers;
                List<String> onlineUsers = new ArrayList<>();
@@ -358,7 +359,7 @@ public class DashboardController extends EPRestrictedBaseController {
         * @param request
         * @return Rest response wrapped around a number that is the number of milliseconds.
         */
-       @RequestMapping(value = "/onlineUserUpdateRate", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/onlineUserUpdateRate", produces = "application/json")
        public PortalRestResponse<Map<String, String>> getOnlineUserUpdateRate(HttpServletRequest request) {
                try {
                        String updateRate = SystemProperties.getProperty(EPCommonSystemProperties.ONLINE_USER_UPDATE_RATE);     
@@ -381,7 +382,7 @@ public class DashboardController extends EPRestrictedBaseController {
         * @param request
         * @return Rest response wrapped around a number that is the window width threshold to collapse right menu.
         */
-       @RequestMapping(value = "/windowWidthThresholdRightMenu", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/windowWidthThresholdRightMenu", produces = "application/json")
        public PortalRestResponse<Map<String, String>> getWindowWidthThresholdForRightMenu(HttpServletRequest request) {
                try {
                        String windowWidthString = SystemProperties.getProperty(EPCommonSystemProperties.WINDOW_WIDTH_THRESHOLD_RIGHT_MENU);    
@@ -402,7 +403,7 @@ public class DashboardController extends EPRestrictedBaseController {
         * @param request
         * @return Rest response wrapped around a number that is the window width threshold to collapse the left menu.
         */
-       @RequestMapping(value = "/windowWidthThresholdLeftMenu", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/windowWidthThresholdLeftMenu", produces = "application/json")
        public PortalRestResponse<Map<String, String>> getWindowWidthThresholdForLeftMenu(HttpServletRequest request) {
                try {
                        String windowWidthString = SystemProperties.getProperty(EPCommonSystemProperties.WINDOW_WIDTH_THRESHOLD_LEFT_MENU);     
@@ -422,7 +423,7 @@ public class DashboardController extends EPRestrictedBaseController {
         * @param request
         * @return Rest response wrapped around a List of String
         */
-       @RequestMapping(value = "/relatedUsers", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/relatedUsers", produces = "application/json")
        public PortalRestResponse<List<String>> activeUsers(HttpServletRequest request) {
                EPUser user = EPUserUtils.getUserSession(request);
                try {
index 04ee5e0..6ad88ae 100644 (file)
@@ -68,7 +68,8 @@ 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.RequestMethod;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -90,7 +91,7 @@ public class DashboardSearchResultController extends EPRestrictedBaseController
         *            Request parameter.
         * @return Rest response wrapped around a CommonWidgetMeta object.
         */
-       @RequestMapping(value = "/widgetData", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/widgetData", produces = "application/json")
        public PortalRestResponse<CommonWidgetMeta> getWidgetData(HttpServletRequest request,
                        @RequestParam String resourceType) {
                if (stringIsNotSafeHtml(resourceType)) {
@@ -107,7 +108,7 @@ public class DashboardSearchResultController extends EPRestrictedBaseController
         *            read from POST body.
         * @return Rest response wrapped around a String; e.g., "success" or "ERROR"
         */
-       @RequestMapping(value = "/widgetDataBulk", method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = "/widgetDataBulk", produces = "application/json")
        public PortalRestResponse<String> saveWidgetDataBulk(@Valid @RequestBody CommonWidgetMeta commonWidgetMeta) {
                logger.debug(EELFLoggerDelegate.debugLogger, "saveWidgetDataBulk: argument is {}", commonWidgetMeta);
                if (commonWidgetMeta.getCategory() == null || commonWidgetMeta.getCategory().trim().equals("")){
@@ -137,7 +138,7 @@ public class DashboardSearchResultController extends EPRestrictedBaseController
         *            read from POST body
         * @return Rest response wrapped around a String; e.g., "success" or "ERROR"
         */
-       @RequestMapping(value = "/widgetData", method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = "/widgetData", produces = "application/json")
        public PortalRestResponse<String> saveWidgetData(@Valid @RequestBody CommonWidget commonWidget) {
                logger.debug(EELFLoggerDelegate.debugLogger, "saveWidgetData: argument is {}", commonWidget);
                if (commonWidget.getCategory() == null || commonWidget.getCategory().trim().equals("")){
@@ -186,7 +187,7 @@ public class DashboardSearchResultController extends EPRestrictedBaseController
         *            read from POST body
         * @return Rest response wrapped around a String; e.g., "success" or "ERROR"
         */
-       @RequestMapping(value = "/deleteData", method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = "/deleteData", produces = "application/json")
        public PortalRestResponse<String> deleteWidgetData(@Valid @RequestBody CommonWidget commonWidget) {
                if (commonWidget!=null){
                        Validator validator = VALIDATOR_FACTORY.getValidator();
@@ -208,7 +209,7 @@ public class DashboardSearchResultController extends EPRestrictedBaseController
         * @return Rest response wrapped around a Map of String to List of Search
         *         Result Item.
         */
-       @RequestMapping(value = "/allPortal", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/allPortal", produces = "application/json")
        public PortalRestResponse<Map<String, List<SearchResultItem>>> searchPortal(HttpServletRequest request,
                        @RequestParam String searchString) {
 
@@ -246,7 +247,7 @@ public class DashboardSearchResultController extends EPRestrictedBaseController
         * @param request
         * @return Rest response wrapped around a list of String
         */
-       @RequestMapping(value = "/activeUsers", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/activeUsers", produces = "application/json")
        public List<String> getActiveUsers(HttpServletRequest request) {
                List<String> activeUsers = null;
                List<String> onlineUsers = new ArrayList<>();
@@ -274,7 +275,7 @@ public class DashboardSearchResultController extends EPRestrictedBaseController
         * @param request
         * @return Rest response wrapped around a List of String
         */
-       @RequestMapping(value = "/relatedUsers", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/relatedUsers", produces = "application/json")
        public PortalRestResponse<List<String>> activeUsers(HttpServletRequest request) {
                EPUser user = EPUserUtils.getUserSession(request);
                try {
index 258a7fd..c57dc4f 100644 (file)
@@ -59,6 +59,7 @@ import org.onap.portalsdk.core.service.DataAccessService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.EnableAspectJAutoProxy;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -75,7 +76,7 @@ public class EncryptAdminController implements BasicAuthenticationController {
 
        EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EncryptAdminController.class);
 
-       @RequestMapping(value = { "/executeEncryptQuery" }, method = RequestMethod.POST)
+       @PostMapping(value = { "/executeEncryptQuery" })
        public Map<Long, String> executeEncrypt(HttpServletRequest request, HttpServletResponse response)
                        throws CipherUtilException {
 
index 7d9f297..83b5155 100644 (file)
@@ -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,7 +92,9 @@ 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.RequestMethod;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.fasterxml.jackson.databind.DeserializationFeature;
@@ -124,8 +128,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 +149,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 +170,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<CentralRole> getRolesForApp(HttpServletRequest request, HttpServletResponse response) throws Exception {
                logger.debug(EELFLoggerDelegate.debugLogger, "Request received for getRolesForApp");
                List<CentralV2Role> v2CenRole = null;
@@ -190,8 +194,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<CentralV2Role> getV2RolesForApp(HttpServletRequest request, HttpServletResponse response) throws Exception {
                logger.debug(EELFLoggerDelegate.debugLogger, "Request received for getV2RolesForApp");
                List<CentralV2Role> answer = null;
@@ -212,8 +216,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<CentralRoleFunction> getRoleFunctionsList(HttpServletRequest request, HttpServletResponse response)
                        throws Exception {
                List<CentralV2RoleFunction> answer = null;
@@ -237,8 +241,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<CentralV2RoleFunction> getV2RoleFunctionsList(HttpServletRequest request, HttpServletResponse response)
                        throws Exception {
                List<CentralV2RoleFunction> cenRoleFuncList = null;
@@ -261,8 +265,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 +285,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 +303,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 +326,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 +348,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<String> saveRoleFunction(HttpServletRequest request, HttpServletResponse response,
                        @RequestBody String roleFunc) {
                String status = "Successfully saved!";
@@ -437,7 +441,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<String> deleteRoleFunction(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("code") String code) {
                if(!DATA_VALIDATOR.isValid(new SecureString(code))){
@@ -492,7 +496,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<String> saveRole(HttpServletRequest request, HttpServletResponse response,
                        @RequestBody Role role) {
                try {
@@ -553,7 +557,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<String> deleteRole(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable String code) {
                if(!DATA_VALIDATOR.isValid(new SecureString(code))){
@@ -608,7 +612,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<CentralRole> getActiveRoles(HttpServletRequest request, HttpServletResponse response) throws Exception {
                List<CentralRole> roles = null;
                try {
@@ -624,7 +628,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<CentralV2Role> getV2ActiveRoles(HttpServletRequest request, HttpServletResponse response) throws Exception {
                List<CentralV2Role> cenRole = null;
                try {
@@ -639,7 +643,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<String> deleteDependencyRoleRecord(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("roleId") Long roleId) {
                ExternalRequestFieldsValidator removeResult = null;
@@ -666,7 +670,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<String> deleteRole(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("roleId") Long roleId) {
                ExternalRequestFieldsValidator removeResult = null;
@@ -693,7 +697,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<String> bulkUploadFunctions(HttpServletRequest request, HttpServletResponse response) {
                Integer result = 0;
                try {
@@ -707,7 +711,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<String> bulkUploadRoles(HttpServletRequest request, HttpServletResponse response) {
                Integer result = 0;
                try {
@@ -721,7 +725,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<String> bulkUploadRoleFunctions(HttpServletRequest request, HttpServletResponse response) {
                Integer result = 0;
                try {
@@ -735,7 +739,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<String> bulkUploadUserRoles(HttpServletRequest request, HttpServletResponse response) {
                Integer result = 0;
                try {
@@ -749,7 +753,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<String> bulkUploadUsersSingleRole(HttpServletRequest request, HttpServletResponse response, @PathVariable Long roleId) {
                Integer result = 0;
                try {
@@ -764,7 +768,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<String> bulkUploadPartnerFunctions(HttpServletRequest request, HttpServletResponse response) {
                Integer addedFunctions = 0;
                try {
@@ -779,7 +783,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<String> bulkUploadPartnerRoles(HttpServletRequest request, HttpServletResponse response, @RequestBody List<Role> upload) {
                try {
                        externalAccessRolesService.bulkUploadPartnerRoles(request.getHeader(UEBKEY), upload);
@@ -792,7 +796,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<String> bulkUploadPartnerRoleFunctions(HttpServletRequest request, HttpServletResponse response) {
                Integer addedRoleFunctions = 0;
                try {
@@ -808,7 +812,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<String> getMenuFunctions(HttpServletRequest request, HttpServletResponse response) throws Exception {
                List<String> functionsList = null;
                try {
@@ -822,7 +826,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<EcompUser> getUsersOfApplication(HttpServletRequest request, HttpServletResponse response) throws Exception {
                List<EcompUser> users = null;
                try {
@@ -882,7 +886,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 +917,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<EcompRole> getEcompRolesOfApplication(HttpServletRequest request, HttpServletResponse response)
                        throws Exception {
                List<EcompRole> ecompRoles = null;
index 5aea7f1..bc2c19b 100644 (file)
@@ -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<FavoritesFunctionalMenuItemJson> 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<FunctionalMenuItem> 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<String,String> epServiceCookieValueMap = epServiceCookie.getValue();
                if(epServiceCookieValueMap!=null) {
index 5e13127..dd5f5f4 100644 (file)
@@ -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<FunctionalMenuItem> getMenuItems(HttpServletRequest request, HttpServletResponse response) {
                // TODO: should only the superuser be allowed to use this API?
                List<FunctionalMenuItem> 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<String> getECOMPTitle(HttpServletRequest request, HttpServletResponse response) {
                PortalRestResponse<String> 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<FunctionalMenuItem> 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<FunctionalMenuItem> 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<FunctionalMenuItem> 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<FunctionalMenuItem> 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<FunctionalMenuItem> 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<FavoritesFunctionalMenuItemJson> 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,23 +562,33 @@ 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;
+            boolean isSystemUser = false;
                        EPUser user = EPUserUtils.getUserSession(request);
                        firstNameStr = user.getFirstName();
                        lastNameStr = user.getLastName();
                        orgUserIdStr = user.getOrgUserId();
+                       isSystemUser = user.isSystemUser();
                        emailStr = user.getEmail();
                        if (emailStr == null || emailStr.equals("")) {
-                               EPUser userResult = searchService.searchUserByUserId(orgUserIdStr);
-                               emailStr = userResult.getEmail();
+                               try {
+                                       EPUser userResult = searchService.searchUserByUserId(orgUserIdStr);
+                                       emailStr = userResult.getEmail();
+                               }catch(Exception ex) { 
+                                       logger.error(EELFLoggerDelegate.errorLogger, "searchUserByUserId call failed", ex); 
+                               } 
                        }
                        SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss Z a");
                        Date lastLoginDate = user.getLastLoginDate();
@@ -586,7 +602,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,
@@ -609,6 +628,7 @@ public class FunctionalMenuController extends EPRestrictedBaseController {
                        map.put("userId",
                                        orgUserIdStr != null ? orgUserIdStr : (orgUserIdSC != null ? orgUserIdSC.getCvalue() : null));
                        map.put("last_login", lastLogin);
+                       map.put("isSystemUser", String.valueOf(isSystemUser));
                        JSONObject j = new JSONObject(map);
                        fnMenuStaticResponse = j.toString();
                        // Be chatty in the log
@@ -641,8 +661,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<BusinessCardApplicationRolesList> getAppList(HttpServletRequest request, HttpServletResponse response,
                        @RequestParam("userId") String userId) throws IOException {
 
index ca66809..d78d614 100644 (file)
@@ -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");
@@ -46,6 +48,7 @@ import javax.servlet.http.HttpServletResponse;
 import org.slf4j.MDC;
 import org.springframework.context.annotation.EnableAspectJAutoProxy;
 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.RestController;
 import org.onap.music.main.MusicUtil;
@@ -118,7 +121,7 @@ public class HealthCheckController extends EPUnRestrictedBaseController {
        private final String statusDown = "DOWN";
        private final String statusOk = "OK";
 
-       @RequestMapping(value = { "/portalApi/healthCheck" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/portalApi/healthCheck" }, produces = "application/json")
        public HealthStatus healthCheck(HttpServletRequest request, HttpServletResponse response) {
                HealthStatus healthStatus = new HealthStatus(500, "");
 
@@ -229,8 +232,8 @@ public class HealthCheckController extends EPUnRestrictedBaseController {
                return healthStatus;
        }
 
-       @RequestMapping(value = {
-                       "/portalApi/healthCheckSuspend" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = {
+                       "/portalApi/healthCheckSuspend" }, produces = "application/json")
        public HealthStatus healthCheckSuspend(HttpServletRequest request, HttpServletResponse response) {
                HealthStatus healthStatus = new HealthStatus(500, "Suspended for manual failover mechanism");
 
@@ -243,8 +246,8 @@ public class HealthCheckController extends EPUnRestrictedBaseController {
                return healthStatus;
        }
 
-       @RequestMapping(value = {
-                       "/portalApi/healthCheckResume" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = {
+                       "/portalApi/healthCheckResume" }, produces = "application/json")
        public HealthStatus healthCheckResume(HttpServletRequest request, HttpServletResponse response) {
                HealthStatus healthStatus = new HealthStatus(500, "Resumed from manual failover mechanism");
 
@@ -255,7 +258,7 @@ public class HealthCheckController extends EPUnRestrictedBaseController {
                return healthStatus;
        }
 
-       @RequestMapping(value = { "/portalApi/ping" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/portalApi/ping" }, produces = "application/json")
        public HealthStatus ping(HttpServletRequest request, HttpServletResponse response) {
                HealthStatus healthStatus = new HealthStatus(200, "OK");
                EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/ping", "GET result =", response.getStatus());
index 508b1be..d371dd5 100644 (file)
@@ -1,6 +1,8 @@
 /**
  * Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.
  *
+ *  Modification Copyright Â© 2020 IBM.
+ * ===================================================================
  * 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
@@ -22,6 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 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.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 import com.alibaba.fastjson.JSONObject;
@@ -33,19 +37,19 @@ public class LanguageController {
     @Autowired
     private LanguageService languageService;
 
-    @RequestMapping(value = "/language",method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
+    @GetMapping(value = "/language", produces = "application/json;charset=UTF-8")
     public JSONObject getLanguageList() {
         return languageService.getLanguages();
     }
 
-    @RequestMapping(value = "/languageSetting/user/{loginId}",method = RequestMethod.POST)
+    @PostMapping(value = "/languageSetting/user/{loginId}")
     public void setUpUserLanguage(@RequestBody JSONObject jsonLanguageId,
                                   @PathVariable("loginId") String loginId) throws Exception {
         Integer languageId = jsonLanguageId.getInteger("languageId");
         languageService.setUpUserLanguage(languageId,loginId);
     }
 
-    @RequestMapping(value = "/languageSetting/user/{loginId}",method = RequestMethod.GET)
+    @GetMapping(value = "/languageSetting/user/{loginId}")
     public JSONObject getUserLanguage(HttpServletRequest request, HttpServletResponse response,
                                       @PathVariable("loginId") String loginId) {
         return languageService.getUserLanguage(loginId);
index 2e1a2b4..6bb5b69 100644 (file)
@@ -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");
@@ -39,15 +41,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;
@@ -69,6 +66,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;
 import org.springframework.web.client.RestTemplate;
@@ -90,7 +91,7 @@ public class MicroserviceController extends EPRestrictedBaseController {
        @Autowired
        private MicroserviceService microserviceService;
 
-       @RequestMapping(value = { "/portalApi/microservices" }, method = RequestMethod.POST)
+       @PostMapping(value = { "/portalApi/microservices" })
        public PortalRestResponse<String> createMicroservice(HttpServletRequest request, HttpServletResponse response,
                        @Valid @RequestBody MicroserviceData newServiceData) throws Exception {
                if (newServiceData == null) {
@@ -113,13 +114,13 @@ public class MicroserviceController extends EPRestrictedBaseController {
                return new PortalRestResponse<>(PortalRestStatusEnum.OK, "SUCCESS", "");
        }
 
-       @RequestMapping(value = { "/portalApi/microservices" }, method = RequestMethod.GET)
+       @GetMapping(value = { "/portalApi/microservices" })
        public List<MicroserviceData> getMicroservice(HttpServletRequest request, HttpServletResponse response)
                        throws Exception {
                return microserviceService.getMicroserviceData();
        }
 
-       @RequestMapping(value = { "/portalApi/microservices/{serviceId}" }, method = RequestMethod.PUT)
+       @PutMapping(value = { "/portalApi/microservices/{serviceId}" })
        public PortalRestResponse<String> updateMicroservice(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("serviceId") long serviceId, @Valid @RequestBody MicroserviceData newServiceData) {
 
@@ -140,7 +141,7 @@ public class MicroserviceController extends EPRestrictedBaseController {
                return new PortalRestResponse<>(PortalRestStatusEnum.OK, "SUCCESS", "");
        }
        
-       @RequestMapping(value = { "/portalApi/microservices/{serviceId}" }, method = RequestMethod.DELETE)
+       @DeleteMapping(value = { "/portalApi/microservices/{serviceId}" })
        public PortalRestResponse<String> deleteMicroservice(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("serviceId") long serviceId) {
                try {
index fed3b98..134d99e 100644 (file)
@@ -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");
@@ -52,6 +54,7 @@ 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.RequestMapping;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.client.HttpClientErrorException;
@@ -69,8 +72,7 @@ public class MicroserviceProxyController extends EPUnRestrictedBaseController {
        @Autowired
        private MicroserviceProxyService microserviceProxyService;
 
-       @RequestMapping(value = { "/portalApi/microservice/proxy/{serviceId}" }, method = {
-                       RequestMethod.GET }, produces = "application/json")
+       @GetMapping(value = { "/portalApi/microservice/proxy/{serviceId}" }, produces = "application/json")
        public String getMicroserviceProxy(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("serviceId") long serviceId) throws Exception {
                EPUser user = EPUserUtils.getUserSession(request);
@@ -83,8 +85,7 @@ public class MicroserviceProxyController extends EPUnRestrictedBaseController {
                return isValidJSON(answer) ? answer : "{\"error\":\"" + answer.replace(System.getProperty("line.separator"), "") + "\"}";
        }
 
-       @RequestMapping(value = { "/portalApi/microservice/proxy/parameter/{widgetId}" }, method = {
-                       RequestMethod.GET }, produces = "application/json")
+       @GetMapping(value = { "/portalApi/microservice/proxy/parameter/{widgetId}" }, produces = "application/json")
        public String getMicroserviceProxyByWidgetId(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("widgetId") long widgetId) throws Exception {
                EPUser user = EPUserUtils.getUserSession(request);
index 32b28c7..563a387 100644 (file)
@@ -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");
@@ -69,6 +71,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;
 
@@ -92,7 +98,7 @@ public class PortalAdminController extends EPRestrictedBaseController {
                this.auditService = auditService;
        }
 
-       @RequestMapping(value = { "/portalApi/portalAdmins" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/portalApi/portalAdmins" }, produces = "application/json")
        public List<PortalAdmin> getPortalAdmins(HttpServletRequest request, HttpServletResponse response) {
                EPUser user = EPUserUtils.getUserSession(request);
                List<PortalAdmin> portalAdmins = null;
@@ -120,7 +126,7 @@ public class PortalAdminController extends EPRestrictedBaseController {
         * @param response 
         * @return FieldsValidator 
         */
-       @RequestMapping(value = { "/portalApi/portalAdmin" }, method = RequestMethod.POST)
+       @PostMapping(value = { "/portalApi/portalAdmin" })
        public FieldsValidator createPortalAdmin(HttpServletRequest request, @RequestBody String userId,
                        HttpServletResponse response) {
                EPUser user = EPUserUtils.getUserSession(request);
@@ -167,7 +173,7 @@ public class PortalAdminController extends EPRestrictedBaseController {
                return fieldsValidator;
        }
 
-       @RequestMapping(value = { "/portalApi/portalAdmin/{userInfo}" }, method = RequestMethod.DELETE)
+       @DeleteMapping(value = { "/portalApi/portalAdmin/{userInfo}" })
        public FieldsValidator deletePortalAdmin(HttpServletRequest request, @PathVariable("userInfo") String userInfo,
                        HttpServletResponse response) {
 
@@ -225,8 +231,8 @@ public class PortalAdminController extends EPRestrictedBaseController {
                return fieldsValidator;
        }
 
-       @RequestMapping(value = {
-                       "/portalApi/adminAppsRoles/{appId}" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = {
+                       "/portalApi/adminAppsRoles/{appId}" }, produces = "application/json")
        public List<EPRole> getRolesByApp(HttpServletRequest request, @PathVariable("appId") Long appId,
                        HttpServletResponse response) {
                EPUser user = EPUserUtils.getUserSession(request);
index e2dd658..e308182 100644 (file)
@@ -4,17 +4,19 @@
  * ===================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ===================================================================
- * Modifications Copyright (c) 2019 Samsung
+ * Modifications Copyright (c) 2019 Samsung 
  * ===================================================================
- *
+ * 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
+ * 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
@@ -96,6 +98,8 @@ 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.PostMapping;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.servlet.ModelAndView;
@@ -154,7 +158,7 @@ public class RoleManageController extends EPRestrictedBaseController {
         * @throws Exception
         */
 
-       @RequestMapping(value = { "/portalApi/get_roles/{appId}" }, method = RequestMethod.GET)
+       @GetMapping(value = { "/portalApi/get_roles/{appId}" })
        public void getRoles(HttpServletRequest request, HttpServletResponse response, @PathVariable("appId") Long appId)
                        throws Exception {
                try {
@@ -183,7 +187,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                }
        }
 
-       @RequestMapping(value = { "/portalApi/role_list/toggleRole/{appId}/{roleId}" }, method = RequestMethod.POST)
+       @PostMapping(value = { "/portalApi/role_list/toggleRole/{appId}/{roleId}" })
        public Map<String, Object> toggleRole(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("appId") Long appId, @PathVariable("roleId") Long roleId) throws Exception {
                EPApp requestedApp = null;
@@ -227,7 +231,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                return responseMap;
        }
 
-       @RequestMapping(value = { "/portalApi/role_list/removeRole/{appId}/{roleId}" }, method = RequestMethod.POST)
+       @PostMapping(value = { "/portalApi/role_list/removeRole/{appId}/{roleId}" })
        public Map<String, Object> removeRole(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("appId") Long appId, @PathVariable("roleId") Long roleId) throws Exception {
 
@@ -293,7 +297,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                return responseMap;
        }
 
-       @RequestMapping(value = { "/portalApi/role/saveRole/{appId}" }, method = RequestMethod.POST)
+       @PostMapping(value = { "/portalApi/role/saveRole/{appId}" })
        public Map<String, Object> saveRole(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("appId") Long appId) throws Exception {
                EPUser user = EPUserUtils.getUserSession(request);
@@ -415,29 +419,29 @@ public class RoleManageController extends EPRestrictedBaseController {
                return responseMap;
        }
 
-       @RequestMapping(value = { "/portalApi/role/removeRoleFunction" }, method = RequestMethod.POST)
+       @PostMapping(value = { "/portalApi/role/removeRoleFunction" })
        public ModelAndView removeRoleRoleFunction(HttpServletRequest request, HttpServletResponse response)
                        throws Exception {
                return getRoleController().removeRoleFunction(request, response);
        }
 
-       @RequestMapping(value = { "/portalApi/role/addRoleFunction" }, method = RequestMethod.POST)
+       @PostMapping(value = { "/portalApi/role/addRoleFunction" })
        public ModelAndView addRoleRoRoleFunction(HttpServletRequest request, HttpServletResponse response)
                        throws Exception {
                return getRoleController().addRoleFunction(request, response);
        }
 
-       @RequestMapping(value = { "/portalApi/role/removeChildRole" }, method = RequestMethod.POST)
+       @PostMapping(value = { "/portalApi/role/removeChildRole" })
        public ModelAndView removeChildRole(HttpServletRequest request, HttpServletResponse response) throws Exception {
                return getRoleController().removeChildRole(request, response);
        }
 
-       @RequestMapping(value = { "/portalApi/role/addChildRole" }, method = RequestMethod.POST)
+       @PostMapping(value = { "/portalApi/role/addChildRole" })
        public ModelAndView addChildRole(HttpServletRequest request, HttpServletResponse response) throws Exception {
                return getRoleController().addChildRole(request, response);
        }
 
-       @RequestMapping(value = { "/portalApi/get_role/{appId}/{roleId}" }, method = RequestMethod.GET)
+       @GetMapping(value = { "/portalApi/get_role/{appId}/{roleId}" })
        public void getRole(HttpServletRequest request, HttpServletResponse response, @PathVariable("appId") Long appId,
                        @PathVariable("roleId") Long roleId) throws Exception {
                try {
@@ -471,7 +475,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                }
        }
 
-       @RequestMapping(value = { "/portalApi/get_role_functions/{appId}" }, method = RequestMethod.GET)
+       @GetMapping(value = { "/portalApi/get_role_functions/{appId}" })
        public void getRoleFunctionList(HttpServletRequest request, HttpServletResponse response,
                        @PathVariable("appId") Long appId) throws Exception {
                try {
@@ -502,7 +506,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                }
        }
 
-       @RequestMapping(value = { "/portalApi/role_function_list/saveRoleFunction/{appId}" }, method = RequestMethod.POST)
+       @PostMapping(value = { "/portalApi/role_function_list/saveRoleFunction/{appId}" })
        public PortalRestResponse<String> saveRoleFunction(HttpServletRequest request, HttpServletResponse response, @Valid @RequestBody CentralV2RoleFunction roleFunc,
                        @PathVariable("appId") Long appId) throws Exception {
                if (roleFunc!=null) {
@@ -599,7 +603,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                }
        }
 
-       @RequestMapping(value = { "/portalApi/role_function_list/removeRoleFunction/{appId}" }, method = RequestMethod.POST)
+       @PostMapping(value = { "/portalApi/role_function_list/removeRoleFunction/{appId}" })
        public PortalRestResponse<String> removeRoleFunction(HttpServletRequest request, HttpServletResponse response,
                        @RequestBody String roleFunc, @PathVariable("appId") Long appId) throws Exception {
                EPUser user = EPUserUtils.getUserSession(request);
@@ -676,7 +680,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                return new PortalRestResponse<>(PortalRestStatusEnum.OK, "Deleted Successfully!", "Success");
        }
 
-       @RequestMapping(value = { "/portalApi/centralizedApps" }, method = RequestMethod.GET)
+       @GetMapping(value = { "/portalApi/centralizedApps" })
        public List<CentralizedApp> getCentralizedAppRoles(HttpServletRequest request, HttpServletResponse response, String userId) {
                if(userId!=null) {
                        SecureString secureString = new SecureString(userId);
@@ -719,7 +723,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                this.roleController = roleController;
        }
 
-       @RequestMapping(value = { "/portalApi/syncRoles" }, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = { "/portalApi/syncRoles" }, produces = "application/json")
        public PortalRestResponse<String> syncRoles(HttpServletRequest request, HttpServletResponse response,
                        @RequestBody Long appId) {
                EPUser user = EPUserUtils.getUserSession(request);
@@ -741,7 +745,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                return new PortalRestResponse<>(PortalRestStatusEnum.OK, "Sync roles completed successfully!", "Success");
        }
 
-       @RequestMapping(value = { "/portalApi/syncFunctions" }, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = { "/portalApi/syncFunctions" }, produces = "application/json")
        public PortalRestResponse<String> syncFunctions(HttpServletRequest request, HttpServletResponse response,
                        @RequestBody Long appId) {
                EPUser user = EPUserUtils.getUserSession(request);
@@ -826,8 +830,8 @@ public class RoleManageController extends EPRestrictedBaseController {
                response.getWriter().write("Unauthorized User");
        }
 
-       @RequestMapping(value = {
-                       "/portalApi/uploadRoleFunction/{appId}" }, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = {
+                       "/portalApi/uploadRoleFunction/{appId}" }, produces = "application/json")
        public PortalRestResponse<String> bulkUploadRoleFunc(HttpServletRequest request, HttpServletResponse response,
                        @RequestBody UploadRoleFunctionExtSystem data, @PathVariable("appId") Long appId) {
                EPUser user = EPUserUtils.getUserSession(request);
index 5562caa..487cc4d 100644 (file)
@@ -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");
index 0dfccc9..cec01ba 100644 (file)
@@ -4,13 +4,15 @@
  * ===================================================================
  * Copyright (C) 2017 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
+ *             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,
@@ -50,6 +52,8 @@ 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.PostMapping;
+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;
@@ -87,8 +91,8 @@ public class UserNotificationController extends EPRestrictedBaseController {
     private static final String SUCCESS = "success";
     private static final String FAILURE = "FAILURE";
 
-    @RequestMapping(value = {
-            "/portalApi/getFunctionalMenuRole" }, method = RequestMethod.GET, produces = "application/json")
+    @GetMapping(value = {
+            "/portalApi/getFunctionalMenuRole" }, produces = "application/json")
     public List<FunctionalMenuRole> getMenuIdRoleId(HttpServletRequest request, HttpServletResponse response) {
         // EPUser user = EPUserUtils.getUserSession(request);
         List<FunctionalMenuRole> menuRoleList = null;
@@ -96,8 +100,8 @@ public class UserNotificationController extends EPRestrictedBaseController {
         return menuRoleList;
     }
 
-    @RequestMapping(value = {
-            "/portalApi/getNotifications" }, method = RequestMethod.GET, produces = "application/json")
+    @GetMapping(value = {
+            "/portalApi/getNotifications" }, produces = "application/json")
     public PortalRestResponse<List<EpNotificationItem>> getNotifications(HttpServletRequest request,
             HttpServletResponse response) {
         EPUser user = EPUserUtils.getUserSession(request);
@@ -114,8 +118,8 @@ public class UserNotificationController extends EPRestrictedBaseController {
         return portalRestResponse;
     }
 
-    @RequestMapping(value = {
-            "/portalApi/getAdminNotifications" }, method = RequestMethod.GET, produces = "application/json")
+    @GetMapping(value = {
+            "/portalApi/getAdminNotifications" }, produces = "application/json")
     public List<EpNotificationItemVO> getAdminNotifications(HttpServletRequest request, HttpServletResponse response) {
         List<EpNotificationItemVO> adminNotificationList = null;
         EPUser user = EPUserUtils.getUserSession(request);
@@ -123,7 +127,7 @@ public class UserNotificationController extends EPRestrictedBaseController {
         return adminNotificationList;
     }
 
-    @RequestMapping(value = "/portalApi/saveNotification", method = RequestMethod.POST, produces = "application/json")
+    @PostMapping(value = "/portalApi/saveNotification", produces = "application/json")
     public PortalRestResponse<String> save(HttpServletRequest request, HttpServletResponse response,
             @RequestBody EpNotificationItem notificationItem) {
 
@@ -160,8 +164,8 @@ public class UserNotificationController extends EPRestrictedBaseController {
         return new PortalRestResponse<>(PortalRestStatusEnum.OK, "SUCCESS", "");
     }
 
-    @RequestMapping(value = {
-            "/portalApi/notificationUpdateRate" }, method = RequestMethod.GET, produces = "application/json")
+    @GetMapping(value = {
+            "/portalApi/notificationUpdateRate" }, produces = "application/json")
     public PortalRestResponse<Map<String, String>> getNotificationUpdateRate(HttpServletRequest request) {
         try {
             String updateRate = SystemProperties.getProperty(EPCommonSystemProperties.NOTIFICATION_UPDATE_RATE);
@@ -178,8 +182,8 @@ public class UserNotificationController extends EPRestrictedBaseController {
         }
     }
 
-    @RequestMapping(value = {
-            "/portalApi/notificationRead" }, method = RequestMethod.GET, produces = "application/json")
+    @GetMapping(value = {
+            "/portalApi/notificationRead" }, produces = "application/json")
     public PortalRestResponse<Map<String, String>> notificationRead(
             @RequestParam("notificationId") String notificationID, HttpServletRequest request) {
         try {
@@ -191,8 +195,8 @@ public class UserNotificationController extends EPRestrictedBaseController {
         }
     }
 
-    @RequestMapping(value = {
-            "/portalApi/getNotificationHistory" }, method = RequestMethod.GET, produces = "application/json")
+    @GetMapping(value = {
+            "/portalApi/getNotificationHistory" }, produces = "application/json")
     public List<EpNotificationItemVO> getNotificationHistory(HttpServletRequest request, HttpServletResponse response) {
         EPUser user = EPUserUtils.getUserSession(request);
         List<EpNotificationItemVO> notificationList = null;
@@ -200,8 +204,7 @@ public class UserNotificationController extends EPRestrictedBaseController {
         return notificationList;
     }
 
-    @RequestMapping(value = { "/portalApi/notificationRole/{notificationId}/roles" }, method = {
-            RequestMethod.GET }, produces = "application/json")
+    @GetMapping(value = { "/portalApi/notificationRole/{notificationId}/roles" }, produces = "application/json")
     public List<Integer> testGetRoles(HttpServletRequest request, @PathVariable("notificationId") Long notificationId) {
         List<EpRoleNotificationItem> notifRoles = userNotificationService.getNotificationRoles(notificationId);
         ArrayList<Integer> rolesList = new ArrayList<>();
@@ -211,8 +214,7 @@ public class UserNotificationController extends EPRestrictedBaseController {
         return rolesList;
     }
 
-    @RequestMapping(value = { "/portalApi/getNotificationAppRoles" }, method = {
-            RequestMethod.GET }, produces = "application/json")
+    @GetMapping(value = { "/portalApi/getNotificationAppRoles" }, produces = "application/json")
     public List<EcompAppRole> getNotificationAppRoles(HttpServletRequest request, HttpServletResponse response) {
         List<EcompAppRole> epAppRoleList = null;
         try {
@@ -225,8 +227,8 @@ public class UserNotificationController extends EPRestrictedBaseController {
         return epAppRoleList;
     }
 
-    @RequestMapping(value = {
-            "/portalApi/getMessageRecipients" }, method = RequestMethod.GET, produces = "application/json")
+    @GetMapping(value = {
+            "/portalApi/getMessageRecipients" }, produces = "application/json")
     public List<String> getMessageRecipients(@RequestParam("notificationId") Long notificationID) {
         // EPUser user = EPUserUtils.getUserSession(request);
         List<String> messageUserRecipients = null;
index aa180b0..b3d64db 100644 (file)
@@ -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;
index 92449a3..a8eb1d6 100644 (file)
@@ -4,6 +4,8 @@
  * ===================================================================
  * Copyright (C) 2019 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");
@@ -77,6 +79,8 @@ import org.springframework.util.concurrent.ListenableFuture;
 import org.springframework.util.concurrent.SuccessCallback;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
@@ -117,7 +121,7 @@ public class WebAnalyticsExtAppController extends EPRestrictedRESTfulBaseControl
         * @return String
         */
        @ApiOperation(value = "Gets javascript with functions that support gathering and reporting web analytics.", response = String.class)
-       @RequestMapping(value = { "/analytics" }, method = RequestMethod.GET, produces = "application/javascript")
+       @GetMapping(value = { "/analytics" }, produces = "application/javascript")
        public String getAnalyticsScript(HttpServletRequest request) {
                String responseText = "";
                EPApp app = null;
@@ -162,7 +166,7 @@ public class WebAnalyticsExtAppController extends EPRestrictedRESTfulBaseControl
         *            Analytics
         * @return PortalAPIResponse
         */
-       @RequestMapping(value = { "/storeAnalytics" }, method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = { "/storeAnalytics" }, produces = "application/json")
        @ResponseBody
        @ApiOperation(value = "Accepts data from partner applications with web analytics data.", response = PortalAPIResponse.class)
        public PortalAPIResponse storeAnalyticsScript(HttpServletRequest request, @RequestBody Analytics analyticsMap) {
index 015e6c4..a403737 100644 (file)
@@ -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;
index 404784f..56f5040 100644 (file)
@@ -4,6 +4,8 @@
  * ===================================================================
  * Copyright Â© 2017 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");
@@ -63,6 +65,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;
 
@@ -86,7 +92,7 @@ public class WidgetsController extends EPRestrictedBaseController {
         this.persUserWidgetService = persUserWidgetService;
     }
 
-    @RequestMapping(value = { "/portalApi/widgets" }, method = RequestMethod.GET, produces = "application/json")
+    @GetMapping(value = { "/portalApi/widgets" }, produces = "application/json")
     public List<OnboardingWidget> getOnboardingWidgets(HttpServletRequest request, HttpServletResponse response) {
         EPUser user = EPUserUtils.getUserSession(request);
         List<OnboardingWidget> onboardingWidgets = null;
@@ -118,7 +124,7 @@ public class WidgetsController extends EPRestrictedBaseController {
 
     // Attention: real json has all OnboardingWidget fields except "id", we use OnboardingWidget for not
     // to create new class for parsing
-    @RequestMapping(value = { "/portalApi/widgets/{widgetId}" }, method = { RequestMethod.PUT },
+    @PutMapping(value = { "/portalApi/widgets/{widgetId}" },
             produces = "application/json")
     public FieldsValidator putOnboardingWidget(HttpServletRequest request, @PathVariable("widgetId") Long widgetId,
             @RequestBody OnboardingWidget onboardingWidget, HttpServletResponse response) {
@@ -147,7 +153,7 @@ public class WidgetsController extends EPRestrictedBaseController {
 
     // Attention: real json has all OnboardingWidget fields except "id", we use OnboardingWidget for not
     // to create new class for parsing
-    @RequestMapping(value = { "/portalApi/widgets" }, method = { RequestMethod.POST }, produces = "application/json")
+    @PostMapping(value = { "/portalApi/widgets" }, produces = "application/json")
     public FieldsValidator postOnboardingWidget(HttpServletRequest request,
             @RequestBody OnboardingWidget onboardingWidget, HttpServletResponse response) {
         EPUser user = EPUserUtils.getUserSession(request);
@@ -173,7 +179,7 @@ public class WidgetsController extends EPRestrictedBaseController {
         return fieldsValidator;
     }
 
-    @RequestMapping(value = { "/portalApi/widgets/{widgetId}" }, method = { RequestMethod.DELETE },
+    @DeleteMapping(value = { "/portalApi/widgets/{widgetId}" },
             produces = "application/json")
     public FieldsValidator deleteOnboardingWidget(HttpServletRequest request, @PathVariable("widgetId") Long widgetId,
             HttpServletResponse response) {
@@ -199,7 +205,7 @@ public class WidgetsController extends EPRestrictedBaseController {
      * @return FieldsValidator
      * @throws IOException
      */
-    @RequestMapping(value = { "portalApi/widgetCatalogSelection" }, method = RequestMethod.PUT,
+    @PutMapping(value = { "portalApi/widgetCatalogSelection" },
             produces = "application/json")
     public FieldsValidator putWidgetCatalogSelection(HttpServletRequest request,
             @RequestBody WidgetCatalogPersonalization persRequest, HttpServletResponse response) throws IOException {
index 9900827..583b43a 100644 (file)
@@ -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;
index b8f79d0..6db834e 100644 (file)
@@ -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;
index 421a2fb..14837db 100644 (file)
@@ -43,7 +43,6 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
-import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 
 import javax.validation.constraints.Digits;
index 3209f35..78b4047 100644 (file)
  */
 package org.onap.portalapp.portal.interceptor;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
 import java.util.HashMap;
 import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.mockito.internal.stubbing.answers.ThrowsException;
 import org.onap.aaf.cadi.CadiWrap;
 import org.onap.portalapp.controller.sessionmgt.SessionCommunicationController;
 import org.onap.portalapp.portal.controller.BasicAuthenticationController;
@@ -60,7 +53,6 @@ import org.onap.portalapp.portal.controller.SharedContextRestController;
 import org.onap.portalapp.portal.controller.WebAnalyticsExtAppController;
 import org.onap.portalapp.portal.domain.BasicAuthCredentials;
 import org.onap.portalapp.portal.domain.EPApp;
-import org.onap.portalapp.portal.domain.EPEndpoint;
 import org.onap.portalapp.portal.domain.EPUser;
 import org.onap.portalapp.portal.logging.aop.EPEELFLoggerAdvice;
 import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum;
@@ -68,7 +60,6 @@ import org.onap.portalapp.portal.logging.logic.EPLogUtil;
 import org.onap.portalapp.portal.service.AdminRolesService;
 import org.onap.portalapp.portal.service.AppsCacheService;
 import org.onap.portalapp.portal.service.BasicAuthenticationCredentialService;
-import org.onap.portalapp.portal.service.ExternalAccessRolesService;
 import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
 import org.onap.portalapp.portal.utils.EcompPortalUtils;
 import org.onap.portalapp.service.RemoteWebServiceCallService;
index 93310a9..6a581c1 100644 (file)
@@ -41,7 +41,6 @@ import java.util.Collections;
 import java.util.Date;
 
 import javax.security.auth.login.CredentialException;
-import javax.ws.rs.client.Entity;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedHashMap;
 
index 3a70da8..94498f6 100644 (file)
@@ -54,7 +54,6 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalapp.portal.service.AppsCacheService;
 import org.onap.portalapp.portal.service.AppsCacheServiceImple;
 import org.onap.portalapp.portal.transport.OnboardingApp;
-import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
 
 @Service("appsCacheService")
 @org.springframework.context.annotation.Configuration
index da09c17..618e9ba 100644 (file)
@@ -50,7 +50,6 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.onboarding.exception.CipherUtilException;
 import org.onap.portalsdk.core.onboarding.util.CipherUtil;
 import org.onap.portalsdk.core.service.DataAccessService;
-import org.onap.portalsdk.core.util.SystemProperties;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.EnableAspectJAutoProxy;
 import org.springframework.stereotype.Service;
index 570d1e9..ee39dd4 100644 (file)
@@ -16,9 +16,6 @@
 package org.onap.portalapp.portal.service;
 
 import com.alibaba.fastjson.JSONObject;
-import org.onap.portalapp.portal.domain.Language;
-
-import java.util.List;
 
 public interface LanguageService {
 
index 3db8e5e..ee87a62 100644 (file)
@@ -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 {
 
index 6f58769..26fd63d 100644 (file)
@@ -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;
index 805e04a..14616b3 100644 (file)
@@ -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;
index c855a8d..a60266c 100644 (file)
@@ -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;
index bee5d93..80099d5 100644 (file)
@@ -292,7 +292,7 @@ public class FunctionalMenuControllerTest extends MockitoTestSuite {
        @Test
        public void getFunctionalMenuStaticInfoTest(){
                String fnMenuStaticactualResponse = null;
-               String fnMenuStaticexpectedResponse = "{\"firstName\":\"test\",\"lastName\":\"test\",\"last_login\":\"09/08/2017 03:48:13 -0400 am\",\"userId\":\"guestT\",\"email\":\"test\"}";
+               String fnMenuStaticexpectedResponse = "{\"firstName\":\"test\",\"lastName\":\"test\",\"last_login\":\"09/08/2017 03:48:13 -0400 am\",\"userId\":\"guestT\",\"isSystemUser\":\"false\",\"email\":\"test\"}";
                String orgUserIdStr = null;
                
                EPUser user = mockUser.mockEPUser();
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 (file)
index 0000000..27118a4
--- /dev/null
@@ -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<String, String> 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 (file)
index 0000000..9154e8d
--- /dev/null
@@ -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");
+
+    }
+}
index 7109b2d..d295843 100644 (file)
@@ -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 (file)
index 0000000..889b28f
--- /dev/null
@@ -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 (file)
index 0000000..db17e78
--- /dev/null
@@ -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 (file)
index 0000000..563135c
--- /dev/null
@@ -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());
+    }
+
+}
index 4ad50df..398520c 100644 (file)
                        <artifactId>tiles-jsp</artifactId>
                        <version>3.0.5</version>
                </dependency>
-               <dependency>
-                       <groupId>org.apache.cxf</groupId>
-                       <artifactId>cxf-rt-rs-client</artifactId>
-                       <version>3.0.0-milestone1</version>
-               </dependency>
                <!-- Mapper -->
                <dependency>
                        <groupId>com.fasterxml.jackson.core</groupId>
                        <version>1.8.5</version>
                        <scope>test</scope>
                </dependency>
-               <dependency>
-                       <groupId>commons-beanutils</groupId>
-                       <artifactId>commons-beanutils</artifactId>
-                       <version>1.9.3</version>
-               </dependency>
                <!-- OpenID Connect Dependencies -->
                <dependency>
                        <groupId>org.mitre</groupId>
index 8314e7b..6623752 100644 (file)
@@ -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;
index 689b25f..8a3bee6 100644 (file)
@@ -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;
index 9cd1845..05ad61a 100644 (file)
@@ -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;
index 0e9932e..479564f 100644 (file)
@@ -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 = "[]";
index c00533b..1a347e0 100644 (file)
@@ -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{
        
index 041458d..3ca32b8 100644 (file)
@@ -151,7 +151,7 @@ ext_central_access_url = https://aaftest.test.onap.org:8095/proxy/authz/
 ext_central_access_user_domain = @csp.onap.org
 
 # External Central Auth system access
-remote_centralized_system_access = false
+remote_centralized_system_access = true
 
 #left menu with root value or non-root
 portal_left_menu = non-root
\ No newline at end of file
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 (file)
index 0000000..dcd5881
--- /dev/null
@@ -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<String, Object> map = new HashMap<String, Object>();
+        map.put("units", "bytes");
+        job.setJobClass(TimeoutHandler.class);
+        job.setJobDataAsMap(map);
+        job.setGroup(groupName);
+        job.setName(jobName);
+        assertNotNull(lr.jobDetailFactoryBean());
+    }
+}
index 4095388..f427506 100644 (file)
@@ -7,7 +7,7 @@
        <parent>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-parent</artifactId>
-               <version>1.5.11.RELEASE</version>
+               <version>2.2.5.RELEASE</version>
                <relativePath /> <!-- lookup parent from repository -->
        </parent>
 
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
                <java.version>1.8</java.version>
-               <hibernate.version>4.3.11.Final</hibernate.version>
+               <hibernate.version>5.4.14.Final</hibernate.version>
                <skipTests>false</skipTests>
                <!-- Replicate this from OParent -->
-               <jacocoVersion>0.7.6.201602180812</jacocoVersion>
+               <jacocoVersion>0.8.2</jacocoVersion>
        </properties>
 
        <dependencies>
@@ -68,7 +68,7 @@
                <dependency>
                        <groupId>org.hibernate</groupId>
                        <artifactId>hibernate-core</artifactId>
-                       <!-- <version>${hibernate.version}</version> -->
+                       <version>${hibernate.version}</version>
                </dependency>
                <dependency>
                        <groupId>org.springframework.boot</groupId>
@@ -96,7 +96,7 @@
                <dependency>
                        <groupId>com.github.ulisesbocchio</groupId>
                        <artifactId>jasypt-spring-boot-starter</artifactId>
-                       <version>1.9</version>
+                       <version>2.1.0</version>
                </dependency>
                <dependency>
                        <groupId>org.jsoup</groupId>
                <dependency>
                        <groupId>dom4j</groupId>
                        <artifactId>dom4j</artifactId>
-                       <!-- <version>1.6.1</version> -->
+                       <version>1.6.1</version>
                        <exclusions>
                                <exclusion>
                                        <groupId>jaxme</groupId>
                <dependency>
                <groupId>org.apache.tomcat.embed</groupId>
                <artifactId>tomcat-embed-core</artifactId>
-               <version>8.5.28</version>
+               <version>9.0.33</version>
                </dependency>
                <dependency>
                        <groupId>ch.qos.logback</groupId>
                <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-web</artifactId>
-               <version>4.2.13.RELEASE</version>
+               <version>5.2.3.RELEASE</version>
                </dependency>
                <dependency>
                        <groupId>org.projectlombok</groupId>
index 1460162..2bea235 100644 (file)
@@ -41,12 +41,12 @@ public class WidgetsCatalogController {
 
        @Value("${server.port}")
        String port;
-       @Value("${server.contextPath}")
+       @Value("${server.servlet.context-path}")
        String context;
        
-       @Value("${security.user.name}")
+       @Value("${spring.security.user.name}")
        String security_user;
-       @Value("${security.user.password}")
+       @Value("${spring.security.user.password}")
        String security_pass;
        
        @Autowired
index 212826c..46ee814 100644 (file)
@@ -21,7 +21,7 @@ public class App implements Serializable{
 
        @Id
        @Column(name = "APP_ID")
-       @GeneratedValue(strategy=GenerationType.AUTO)
+       @GeneratedValue(strategy=GenerationType.IDENTITY)
        @Digits(integer = 11, fraction = 0)
        private Long appId;
 
index 43e7b2b..2ed49ab 100644 (file)
@@ -26,7 +26,7 @@ public class MicroserviceData {
        @Id
        @Column(name = "id")
        @Digits(integer = 11, fraction = 0)
-       @GeneratedValue(strategy=GenerationType.AUTO)
+       @GeneratedValue(strategy=GenerationType.IDENTITY)
        private Long id;
 
        @Column(name = "name")
index 7207d0a..cd9236d 100644 (file)
@@ -24,7 +24,7 @@ public class MicroserviceParameter {
        
        @Id
        @Column(name = "id")
-       @GeneratedValue(strategy=GenerationType.AUTO)
+       @GeneratedValue(strategy=GenerationType.IDENTITY)
        @Digits(integer = 11, fraction = 0)
        private Long id;
 
index aae9bfe..173a143 100644 (file)
@@ -33,7 +33,7 @@ public class RoleApp implements Serializable{
 
        @Id
        @Column(name = "ROLE_ID")
-       @GeneratedValue(strategy=GenerationType.AUTO)
+       @GeneratedValue(strategy=GenerationType.IDENTITY)
        @Digits(integer = 11, fraction = 0)
        private Long roleId;
 
index 1dc0582..a822c5a 100644 (file)
@@ -30,7 +30,7 @@ public class WidgetCatalog{
        
        @Id
        @Column(name = "widget_id")
-       @GeneratedValue(strategy=GenerationType.AUTO)
+       @GeneratedValue(strategy=GenerationType.IDENTITY)
        @Digits(integer = 11, fraction = 0)
        private long id;
        
index b52631f..ac25077 100644 (file)
@@ -6,7 +6,7 @@ import javax.sql.DataSource;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
-import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
+import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
 import org.springframework.orm.jpa.JpaTransactionManager;
 import org.springframework.transaction.PlatformTransactionManager;
 
index fed70ad..a02667d 100644 (file)
@@ -41,7 +41,7 @@ public class MicroserviceServiceImpl implements MicroserviceService{
                        Transaction tx = session.beginTransaction();            
                        session.save(newService);
                        tx.commit();
-                       session.flush();
+//                     session.flush();
                        session.close();
                }
                catch(Exception e){
@@ -58,7 +58,7 @@ public class MicroserviceServiceImpl implements MicroserviceService{
                        Transaction tx = session.beginTransaction();            
                        session.save(newParameter);
                        tx.commit();
-                       session.flush();
+//                     session.flush();
                        session.close();
                }
                catch(Exception e){
@@ -77,7 +77,7 @@ public class MicroserviceServiceImpl implements MicroserviceService{
                
                List<MicroserviceData> services = criteria.list();
                logger.debug("MicroserviceServiceImpl.getMicroserviceByName: result={}", services);
-               session.flush();
+//             session.flush();
                session.close();
                
                return (services.size() > 0) ? services.get(0).getId() : null;
index 59180d3..f5558e2 100644 (file)
@@ -191,7 +191,7 @@ public class WidgetCatalogServiceImpl implements WidgetCatalogService {
                        Transaction tx = session.beginTransaction();            
                        session.save(newWidgetCatalog);
                        tx.commit();
-                       session.flush();
+                       //session.flush();
                        session.close();
                        updateAppId(newWidgetCatalog.getId(), newWidgetCatalog.getWidgetRoles());
                }
@@ -217,7 +217,7 @@ public class WidgetCatalogServiceImpl implements WidgetCatalogService {
                        Transaction tx = session.beginTransaction();
                        session.update(newWidgetCatalog);
                        tx.commit();
-                       session.flush();
+                       //session.flush();
                        session.close();
                        updateAppId(newWidgetCatalog.getId(), newWidgetCatalog.getWidgetRoles());
                }catch(Exception e){
@@ -268,7 +268,7 @@ public class WidgetCatalogServiceImpl implements WidgetCatalogService {
                
                List<MicroserviceData> widgets = criteria.list();
                logger.debug("WidgetCatalogServiceImpl.getWidgetIdByName: result={}", widgets);
-               session.flush();
+//             session.flush();
                session.close();
                
                return (widgets.size() > 0) ? true : false;
index 42483b7..82b26d6 100644 (file)
@@ -1,22 +1,22 @@
 ## General App Properties
-server.contextPath=/widget
+server.servlet.context-path=/widget
 server.port=9082
-spring.http.multipart.max-file-size=128MB
-spring.http.multipart.max-request-size=128MB
+spring.servlet.multipart.max-file-size=128MB
+spring.servlet.multipart.max-request-size=128MB
 microservice.widget.location=/tmp
 
 ## App DB Properties
 spring.datasource.url=jdbc:mariadb://localhost:3306/portal
 spring.datasource.username=root
-spring.datasource.password=root
+spring.datasource.password=welcome2ibm
 spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
 spring.database.driver.classname=org.mariadb.jdbc.Driver
 spring.jpa.show-sql=false
 spring.jpa.properties.hibernate.format_sql=false
 
 ## Basic Authentication Properties
-security.user.name=widget_user
-security.user.password=ENC(IjywcRnI9+nuVEh9+OFFiRWAjBT1n718)
+spring.security.user.name=widget_user
+spring.security.user.password=ENC(IjywcRnI9+nuVEh9+OFFiRWAjBT1n718)
 
 account.user.name=portal
 account.user.password=6APqvG4AU2rfLgCvMdySwQ==
index 933710d..2d1fd27 100644 (file)
@@ -59,6 +59,7 @@ import org.mockito.MockitoAnnotations;
 import org.onap.portalapp.widget.domain.App;
 import org.onap.portalapp.widget.domain.RoleApp;
 import org.onap.portalapp.widget.domain.WidgetCatalog;
+import org.hibernate.query.NativeQuery;
 
 public class WidgetCatalogServiceImplTest {
 
@@ -75,7 +76,7 @@ public class WidgetCatalogServiceImplTest {
        Criteria criteria;
 
        @Mock
-       SQLQuery query;
+       NativeQuery query;
 
        @Before
        public void init() {
index d3dc1cb..0d01ee5 100644 (file)
@@ -134,7 +134,7 @@ public class WidgetsCatalogControllerTest {
                List<WidgetCatalog> list = new ArrayList<WidgetCatalog>();
                WidgetCatalog widget = new WidgetCatalog();
                list.add(widget);
-               Mockito.when(widgetService.getWidgetCatalog()).thenReturn(list);
+               Mockito.lenient().when(widgetService.getWidgetCatalog()).thenReturn(list);
                
                mockMvc.perform(get("/microservices/widgetCatalog/"))
                .andExpect(status().isBadRequest());
@@ -148,7 +148,7 @@ public class WidgetsCatalogControllerTest {
                widget.setId(1);
                widget.setName("junit");
                list.add(widget);
-               Mockito.when(widgetService.getUserWidgetCatalog("test")).thenReturn(list);
+               Mockito.lenient().when(widgetService.getUserWidgetCatalog("test")).thenReturn(list);
                
                String security_user = "user";
                String security_pass = "password";
@@ -170,7 +170,7 @@ public class WidgetsCatalogControllerTest {
                widget.setId(1);
                widget.setName("junit");
                list.add(widget);
-               Mockito.when(widgetService.getUserWidgetCatalog("test")).thenReturn(list);
+               Mockito.lenient().when(widgetService.getUserWidgetCatalog("test")).thenReturn(list);
                
                String security_user = "user";
                String security_pass = "password";
@@ -190,7 +190,7 @@ public class WidgetsCatalogControllerTest {
        @Test
        public void saveWidgetCatalog_ValidAuthorization_NoError() throws Exception {   
                ValidationRespond respond = new ValidationRespond(true, null);
-               Mockito.when(storageService.checkZipFile(any(MultipartFile.class))).thenReturn(respond);
+               Mockito.lenient().when(storageService.checkZipFile(any(MultipartFile.class))).thenReturn(respond);
                
                String security_user = "user";
                String security_pass = "password";
@@ -211,7 +211,7 @@ public class WidgetsCatalogControllerTest {
        @Test
        public void saveWidgetCatalog_Authorization_Error() throws Exception {  
                ValidationRespond respond = new ValidationRespond(true, null);
-               Mockito.when(storageService.checkZipFile(any(MultipartFile.class))).thenReturn(respond);
+               Mockito.lenient().when(storageService.checkZipFile(any(MultipartFile.class))).thenReturn(respond);
                
                String security_user = "user";
                String security_pass = "password";
@@ -270,7 +270,7 @@ public class WidgetsCatalogControllerTest {
        @Test
        public void updateWidgetCatalogwithFiles_ValidAuthorization_NoError() throws Exception {
                ValidationRespond respond = new ValidationRespond(true, null);
-               Mockito.when(storageService.checkZipFile(any(MultipartFile.class))).thenReturn(respond);
+               Mockito.lenient().when(storageService.checkZipFile(any(MultipartFile.class))).thenReturn(respond);
                
                String security_user = "user";
                String security_pass = "password";
@@ -420,7 +420,7 @@ public class WidgetsCatalogControllerTest {
                widget.setId(1);
                widget.setName("junit");
                list.add(widget);
-               Mockito.when(widgetService.getWidgetsByServiceId(serviceId)).thenReturn(list);
+               Mockito.lenient().when(widgetService.getWidgetsByServiceId(serviceId)).thenReturn(list);
                
                String security_user = "user";
                String security_pass = "password";
@@ -462,7 +462,7 @@ public class WidgetsCatalogControllerTest {
                String wrong_pass = "wrong";
                Long widgetId = new Long(1);
                byte[] bytes="Test".getBytes();
-               Mockito.when(storageService.getWidgetCatalogContent(widgetId)).thenReturn(bytes);       
+               Mockito.lenient().when(storageService.getWidgetCatalogContent(widgetId)).thenReturn(bytes);     
                        
                ReflectionTestUtils.setField(controller, "security_user", security_user, String.class);
                ReflectionTestUtils.setField(controller, "security_pass", security_pass, String.class);
diff --git a/pom.xml b/pom.xml
index 19d8c34..7c48401 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
        <properties>
                <!-- Jenkins should invoke mvn with argument -Dbuild.number=${BUILD_NUMBER} -->
                <build.number>0</build.number>
-               <epsdk.version>2.6.0</epsdk.version>
+               <epsdk.version>3.3.0-SNAPSHOT</epsdk.version>
                <springframework.version>4.3.24.RELEASE</springframework.version>
                <springframework.security.version>4.2.13.RELEASE</springframework.security.version>
                <hibernate.version>4.3.11.Final</hibernate.version>
                          </execution>
                        </executions>
                  </plugin>
-                 
+                 <plugin>
+                     <groupId>org.apache.maven.plugins</groupId>
+                     <artifactId>maven-enforcer-plugin</artifactId>
+                     <version>3.0.0-M2</version>
+                     <executions>
+                      <execution>
+                      <id>enforce-no-snapshots</id>
+                      <goals>
+                      <goal>enforce</goal>
+                      </goals>
+                    <configuration>
+                    <rules>
+                    <requireReleaseVersion>
+                     <message>No Snapshots Allowed!</message>
+                    </requireReleaseVersion>
+                    </rules>
+                    <fail>false</fail>
+                    </configuration>
+                  </execution>
+                 </executions>
+                 </plugin>
                </plugins>
        </build>
 
index f3b3a5f..97f4a26 100644 (file)
@@ -76,7 +76,7 @@
 <li class="dropdown-item" style="font-weight: lighter">
     {{firstName}}, {{lastName}}
 </li>
-<li class="dropdown-item">
+<li class="dropdown-item" *ngIf=(!isSystemUser)>
     <span class="dropdown-item-name"> {{ 'Email'}}: </span>
     <div>
         <span class="dropdown-item-value">
@@ -85,7 +85,8 @@
     </div>
 </li>
 <li class="dropdown-item">
-    <span class="dropdown-item-name"> {{ 'User Id' }}: </span>
+    <span class="dropdown-item-name" *ngIf=(!isSystemUser)> {{ 'User Id' }}: </span>
+    <span class="dropdown-item-name" *ngIf=(isSystemUser)> {{ 'System Id' }}: </span>
     <div>
         <span class="dropdown-item-value">
             {{loginSnippetUserid}}
index 09dd4c1..429587d 100644 (file)
@@ -59,6 +59,7 @@ export class HeaderComponent implements OnInit {
     api = environment.api;
     brandName: string;
     brandLogoImagePath: string;
+    isSystemUser: boolean = false;
 
     constructor(public router: Router, private userProfileService: UserProfileService, private menusService: MenusService, private cookieService: CookieService) {
 
@@ -90,7 +91,7 @@ export class HeaderComponent implements OnInit {
 
     getUserInformation() {
         this.userProfileService.getFunctionalMenuStaticInfo().toPromise().then((res: any) => {
-            if (res == null || res.firstName == null || res.firstName == '' || res.lastName == null || res.lastName == '') {
+            if (res === null || res.firstName === null || res.firstName === '' || res.lastName === null || res.lastName === '') {
                 // $log.info('HeaderCtrl: failed to get all required data, trying user profile');
                 this.userProfileService.getUserProfile().toPromise().then((profile: any) => {
                     this.firstName = profile.firstName;
@@ -105,6 +106,9 @@ export class HeaderComponent implements OnInit {
                 this.loginSnippetUserid = res.userId;
                 this.lastLogin = Date.parse(res.last_login);
             }
+            if(res != null && res.isSystemUser === 'true'){
+                this.isSystemUser = true;
+            }
             sessionStorage.userId = res.userId;
             this.menusService.getFunctionalMenuForUser().toPromise().then((jsonHeaderMenu: any) => {
                 // $scope.menuItems = unflatten(jsonHeaderMenu);
index 38ebedd..d977f72 100644 (file)
@@ -78,8 +78,7 @@ export class UsersService {
   
   addNewUser(newUserData){
     console.log("User service : ", newUserData);
-    return this.http.post(this.api.saveNewUser, newUserData).subscribe((response)=>{
-    });
+       return this.http.post(this.api.saveNewUser, newUserData);
   }
 
 }
index 1c65798..4e3f349 100644 (file)
         "@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",
       "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",
         }
       }
     },
+    "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",
         "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",
         "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",
         "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"
         "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",
         "inherits": {
           "version": "2.0.3",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "ini": {
           "version": "1.3.5",
           "version": "1.0.0",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "number-is-nan": "^1.0.0"
           }
           "version": "3.0.4",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "brace-expansion": "^1.1.7"
           }
         "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"
           "version": "0.5.1",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "minimist": "0.0.8"
           }
         "number-is-nan": {
           "version": "1.0.1",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "object-assign": {
           "version": "4.1.1",
           "version": "1.4.0",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "wrappy": "1"
           }
           "version": "1.0.2",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "code-point-at": "^1.0.0",
             "is-fullwidth-code-point": "^1.0.0",
         "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",
       "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",
         "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",
         "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",
       "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",
         "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",
       "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",
         "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",
       "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",
         "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",
         }
       }
     },
+    "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",
         }
       }
     },
+    "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",
         }
       }
     },
+    "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",
index 75b6dda..fe6b8ee 100644 (file)
@@ -1,5 +1,6 @@
 /ng-material-module.ts
 /layout/
+!layout/components/search-users
 /modals/
 /shared/
 !shared/interceptors/
index dea5177..2c914c5 100644 (file)
@@ -35,5 +35,7 @@
  
   
   -->
-
+<div class="diaplay-banner" *ngIf="diaplayBanner">
+    <span>{{browserCompatibilityMsg}}</span>
+</div> 
 <router-outlet></router-outlet>
index 7a77339..e739496 100644 (file)
  * ============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
index dbfb568..389153b 100644 (file)
  *
  * 
  */
-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 && !!(<any>window).opr:
+        this.diaplayBanner = true;
+        return 'opera';
+      case agent.indexOf('chrome') > -1 && !!(<any>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
@@ -67,4 +67,7 @@
         <tr mat-row (click)="setSelectedUser(row)" id="table-row-{{i}}" [ngClass]="{ 'selected': row === selectedUser }"
             *matRowDef="let row; columns: displayedColumns; let i = index;"></tr>
     </table>
+</div>
+<div class="search-user-container" *ngIf="noUserFlag">
+    <p>{{message}} Or <a href="javascript:void(0);" (click)="addNewUser()"><b>Click Here</b></a> to add <b>New User!</b></p>
 </div>
\ No newline at end of file
@@ -56,6 +56,7 @@ export class SearchUsersComponent implements OnInit {
   @ViewChild(MatSort) sort: MatSort;
   @ViewChild(MatPaginator) paginator: MatPaginator;
   @Output() passBackSelectedUser: EventEmitter<any> = new EventEmitter();
+  @Output() userNotFoundFlag = new EventEmitter<boolean>();
   searchString: string;
   txtResults = 'result';
   searchUsersResults: any;
@@ -65,6 +66,8 @@ export class SearchUsersComponent implements OnInit {
   selectedUser: any;
   displayedColumns: string[] = ['firstName'];
   dataSourceMap = new MatTableDataSource(this.searchUsersResults);
+  submitted = false;
+  message = " No users found with your query. Please change your search and try again.";
 
   ngOnInit() {
     this.searchString = '';
@@ -77,6 +80,7 @@ export class SearchUsersComponent implements OnInit {
       this.passBackSelectedUser.emit(systemUser);
   }
 
+  noUserFlag: boolean = false;
   searchUsers() {
     if (!this.isSystemUser) {
       this.isLoading = true;
@@ -85,11 +89,10 @@ export class SearchUsersComponent implements OnInit {
       this.userService.searchUsers(this.searchString).subscribe((_data: PortalAdmin) => {
         this.searchUsersResults = _data;
         if (this.searchUsersResults == null || this.searchUsersResults.length == 0) {
-          const modelRef = this.ngModal.open(ConfirmationModalComponent)
-          modelRef.componentInstance.title = "Confirmation";
-          modelRef.componentInstance.message = " No users found with your query. Please change your search and try again."
+          this.noUserFlag = true;
           this.isLoading = false;
         } else {
+          this.noUserFlag = false;
           this.showUserTable = true;
           this.isLoading = false;
           this.dataSourceMap = new MatTableDataSource(this.searchUsersResults);
@@ -104,4 +107,9 @@ export class SearchUsersComponent implements OnInit {
     this.passBackSelectedUser.emit(this.selectedUser);
   }
 
+  addNewUser() {
+    console.log("Emit the value to parent");
+    this.userNotFoundFlag.emit(true);
+  }
+
 }
index 7fc35e4..bd9d69b 100644 (file)
   </form>  
 </div>
 <div class="modal-footer">
-  <button type="submit" class="btn btn-primary" (click)="addUser()" [disabled]="addNewUserForm.invalid">Next</button> &nbsp;
+  <button type="submit" class="btn btn-primary" (click)="addUser()">Next</button> &nbsp;
     <button type="button" class="btn btn-primary" aria-label="Close" (click)="activeModal.dismiss('Cross')">Close</button>
 </div>
index bea0fcd..33d2b33 100644 (file)
@@ -2,7 +2,8 @@ import { Component, OnInit } from '@angular/core';
 import { FormBuilder, FormGroup, Validators } from '@angular/forms';
 import { MustMatch } from 'src/app/shared/helpers/must-match-validator';
 import { UsersService } from 'src/app/shared/services';
-import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap';
+import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component';
 
 @Component({
   selector: 'app-user-details-form',
@@ -13,9 +14,10 @@ export class UserDetailsFormComponent implements OnInit {
   addNewUserForm: FormGroup;
   submitted = false;
 
-  constructor(private formBuilder: FormBuilder, 
+  constructor(private formBuilder: FormBuilder,
     private usersService: UsersService,
-    public activeModal: NgbActiveModal) { }
+    public activeModal: NgbActiveModal,
+    public ngbModal: NgbModal) { }
 
   ngOnInit() {
     this.addNewUserForm = this.formBuilder.group({
@@ -24,7 +26,7 @@ export class UserDetailsFormComponent implements OnInit {
       lastName: ['', Validators.required],
       email: ['', [Validators.required, Validators.email]],
       loginId: ['', Validators.required],
-      loginPwd: ['', [Validators.required, Validators.minLength(6)]],
+      loginPwd: ['', Validators.required],
       confirmPassword: ['', Validators.required]
     }, {
         validator: MustMatch('loginPwd', 'confirmPassword')
@@ -44,7 +46,17 @@ export class UserDetailsFormComponent implements OnInit {
     console.log("New user Json : " + JSON.stringify(this.addNewUserForm.value));
     console.log("Get Raw value : " + this.addNewUserForm.getRawValue());
     let newUserFormData = JSON.stringify(this.addNewUserForm.getRawValue());
-    this.usersService.addNewUser(newUserFormData);
+    this.usersService.addNewUser(newUserFormData).subscribe(result => {
+      console.log("Result : ", result);
+      const modalSuccess = this.ngbModal.open(ConfirmationModalComponent);
+      modalSuccess.componentInstance.title = "Success";
+      modalSuccess.componentInstance.message = 'User added Successfully!';
+    }, error => {
+      console.log("Error : ", error);
+      const modalErrorRef = this.ngbModal.open(ConfirmationModalComponent);
+      modalErrorRef.componentInstance.title = "Error";
+      modalErrorRef.componentInstance.message = 'Something went wrong. Error Message: ' + error.message;
+    })
     this.activeModal.close();
   }
 
index db6b5bf..7cc34da 100644 (file)
@@ -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":"",
index 0482c20..d412522 100644 (file)
@@ -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": "",
index d2c5e0f..cb712eb 100644 (file)
Binary files a/portal-FE-os/src/favicon.ico and b/portal-FE-os/src/favicon.ico differ