Merge "Changed app to redirect when the session expires."
authorManoop Talasila <talasila@research.att.com>
Thu, 31 May 2018 20:10:00 +0000 (20:10 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 31 May 2018 20:10:00 +0000 (20:10 +0000)
118 files changed:
LICENSE.txt
deliveries/.env
deliveries/Apps_Users_OnBoarding_Script.sql
deliveries/os_docker_release.sh
deliveries/portal.cql
deliveries/portalsdk.cql
deliveries/properties_simpledemo/ONAPPORTAL/music.properties
deliveries/properties_simpledemo/ONAPPORTAL/system.properties
deliveries/properties_simpledemo/ONAPPORTALSDK/music.properties
docs/release-notes.rst
ecomp-portal-BE-common/pom.xml
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/annotation/ApiVersion.java [moved from ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/ueb/EPUebMsgTypes.java with 77% similarity]
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/ExternalSecurityConfig.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationVersionController.java [new file with mode: 0644]
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 [new file with mode: 0644]
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuxApiRequestMapperController.java [new file with mode: 0644]
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/ExternalAppsRestfulVersionController.java [new file with mode: 0644]
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/RoleManageController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RolesApprovalSystemVersionController.java [new file with mode: 0644]
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RolesController.java [new file with mode: 0644]
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/TicketEventVersionController.java [new file with mode: 0644]
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WebAnalyticsExtAppVersionController.java [new file with mode: 0644]
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/domain/EPUserApp.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/UploadRoleFunctionExtSystem.java [new file with mode: 0644]
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/listener/HealthMonitor.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/format/EPAppMessagesEnum.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/format/EPErrorCodesEnum.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/SchedulerAuxRestInterface.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ApplicationsRestClientServiceImpl.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthAccountService.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthAccountServiceImpl.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAppCommonServiceImpl.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesService.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceServiceImpl.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserRolesCommonServiceImpl.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserServiceImpl.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralV2Role.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralizedAppRoles.java [new file with mode: 0644]
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAccessUserRoleDetail.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/RemoteRoleV1.java [new file with mode: 0644]
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ueb/EPUebHelper.java [deleted file]
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EPCommonSystemProperties.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/MusicCookieCsrfTokenRepository.java [new file with mode: 0644]
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/TimeoutHandler.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/uebhandler/FunctionalMenuHandler.java [moved from ecomp-portal-BE-os/src/main/java/org/onap/portalapp/uebhandler/FunctionalMenuHandler.java with 95% similarity]
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/uebhandler/InitUebHandler.java [moved from ecomp-portal-BE-os/src/main/java/org/onap/portalapp/uebhandler/InitUebHandler.java with 78% similarity]
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/uebhandler/MainUebHandler.java [moved from ecomp-portal-BE-os/src/main/java/org/onap/portalapp/uebhandler/MainUebHandler.java with 96% similarity]
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/uebhandler/WidgetNotificationHandler.java [moved from ecomp-portal-BE-os/src/main/java/org/onap/portalapp/uebhandler/WidgetNotificationHandler.java with 95% similarity]
ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AppsControllerExternalVersionRequestTest.java [new file with mode: 0644]
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AuxApiRequestMapperControllerTest.java [new file with mode: 0644]
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ExternalAccessRolesControllerTest.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ExternalAppsRestfulVersionControllerTest.java [new file with mode: 0644]
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/HealthCheckControllerTest.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/RoleManageControllerTest.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/RolesApprovalSystemVersionControllerTest.java [new file with mode: 0644]
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/RolesControllerTest.java [new file with mode: 0644]
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/SessionCommunicationControllerTest.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/SharedContextRestClient.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/TicketEventVersionControllerTest.java [new file with mode: 0644]
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WebAnalyticsExtAppVersionControllerTest.java [new file with mode: 0644]
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/listener/HealthMonitorTest.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/EPAppCommonServiceImplTest.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImplTest.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/UserRolesCommonServiceImplTest.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/UserServiceImplTest.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/CentralRoleTest.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/ueb/EPUebHelperTest.java [deleted file]
ecomp-portal-BE-os/README.md
ecomp-portal-BE-os/pom.xml
ecomp-portal-BE-os/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java
ecomp-portal-BE-os/src/main/java/org/onap/portalapp/controller/ONAPWelcomeController.java
ecomp-portal-BE-os/src/main/java/org/onap/portalapp/controller/PeerBroadcastSocket.java
ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/controller/ExternalAppsRestfulVersionController.java [new file with mode: 0644]
ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/EPAppServiceImpl.java
ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/UserServiceImpl.java
ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/ueb/EPUebHelper.java [deleted file]
ecomp-portal-BE-os/src/main/resources/music.properties
ecomp-portal-BE-os/src/main/webapp/WEB-INF/conf/system.properties
ecomp-portal-BE-os/src/main/webapp/WEB-INF/web.xml
ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/controller/LoginControllerTest.java
ecomp-portal-DB-common/portal.cql
ecomp-portal-FE-common/client/app/services/functionalMenu/functionalMenu.service.js
ecomp-portal-FE-common/client/app/services/widgets-catalog/widgets-catalog.service.js
ecomp-portal-FE-common/client/app/views/account-onboarding/account-add-details/account-add-details.html
ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-functions-confirm.html [new file with mode: 0644]
ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-global-role-functions-confirm.html [new file with mode: 0644]
ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-confirm.html [new file with mode: 0644]
ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-controller.js [new file with mode: 0644]
ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-modal.html [new file with mode: 0644]
ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-modal.less [new file with mode: 0644]
ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-roles-confirm.html [new file with mode: 0644]
ecomp-portal-FE-common/client/app/views/role/role-create-edit-popup-controller.js
ecomp-portal-FE-common/client/app/views/role/role-list-controller.js
ecomp-portal-FE-common/client/app/views/role/role_list.html
ecomp-portal-FE-common/client/app/views/users/users.controller.js
ecomp-portal-FE-common/client/app/views/users/users.tpl.html
ecomp-portal-FE-common/client/app/views/widget-onboarding/widget-details-dialog/widget-details.controller.js
ecomp-portal-FE-common/client/app/views/widget-onboarding/widget-details-dialog/widget-details.modal.html
ecomp-portal-FE-os/client/configurations/dev.json
ecomp-portal-FE-os/client/configurations/integ.json
ecomp-portal-FE-os/client/src/views/footer/footer.tpl.html
ecomp-portal-FE-os/client/src/views/header/header-extension.tpl.html
ecomp-portal-FE-os/client/src/views/header/header-logo.html
ecomp-portal-FE-os/client/src/views/search/search.tpl.html
ecomp-portal-FE-os/pom.xml
ecomp-portal-widget-ms/common-widgets/pom.xml
ecomp-portal-widget-ms/pom.xml
ecomp-portal-widget-ms/widget-ms/pom.xml
pom.xml

index 585f12d..73eab27 100644 (file)
@@ -1,7 +1,7 @@
 ============LICENSE_START==========================================
 ONAP Portal
 ===================================================================
-Copyright (c) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
 ===================================================================
 
 Unless otherwise specified, all software contained herein is licensed
index d701b02..7325959 100644 (file)
@@ -14,7 +14,7 @@ CLI_IMG_NAME=onap/cli
 
 # This is the first portion of the Docker image tag
 # that is published to the ONAP registry.
-PORTAL_VERSION=v2.2.0
+PORTAL_VERSION=v2.3.0
 
 # This is used during builds and in docker-compose;
 # it is never published to the ONAP registry.
index 0232a1f..34dbe89 100644 (file)
@@ -12,7 +12,7 @@ INSERT INTO `fn_app` (`app_id`, `app_name`, `app_image_url`, `app_description`,
 (5, 'Policy', 'images/cache/portal1470452815_67021.png', NULL, NULL, 'http://policy.api.simpledemo.onap.org:8443/onap/policy', NULL, 'http://policy.api.simpledemo.onap.org:8443/onap/api/v2', '', '', NULL, 'okYTaDrhzibcbGVq5mjkVQ==', 'N', 'Y', NULL, 'Default', 'ueb_key', 'ueb_secret', 'ECOMP-PORTAL-OUTBOX', 1,'N',NULL),
 (6, 'Virtual Infrastructure Deployment', 'images/cache/portal-345993588_92550.png', NULL, NULL, 'http://vid.api.simpledemo.onap.org:8080/vid/welcome.htm', NULL, 'http://vid.api.simpledemo.onap.org:8080/vid/api/v2', '', '', NULL, 'okYTaDrhzibcbGVq5mjkVQ==', 'N', 'Y', NULL, 'Default', '2Re7Pvdkgw5aeAUD', 'S31PrbOzGgL4hg4owgtx47Da', 'ECOMP-PORTAL-OUTBOX-90', 1,'N',NULL),
 (7, 'A&AI UI', 'images/cache/portal-345993588_92550.png', NULL, NULL, 'http://aai.api.simpledemo.onap.org:9517/services/aai/webapp/index.html#/viewInspect', NULL, 'http://aai.api.simpledemo.onap.org:9517/api/v2', '', '', NULL, 't1oqm6wCXrGUXUSL8mS7pQ==', 'N', 'Y', NULL, 'aaiui', 'ueb_key', 'ueb_secret', 'ECOMP-PORTAL-OUTBOX', 1,'N',NULL),
-(8, 'CLI', 'images/cache/portal-345993588_92550.png', NULL, NULL, 'http://portal.api.simpledemo.onap.org:8080/', NULL, NULL, '', '', NULL, '', 'Y', 'Y', NULL, '', '', '', '', 1,'N',NULL),
+(8, 'CLI', 'images/cache/portal-345993588_92550.png', NULL, NULL, 'http://portal.api.simpledemo.onap.org:8080/', NULL, NULL, '', '', NULL, '', 'Y', 'Y', NULL, '', '', '', '', 2,'N',NULL),
 (9, 'MSB', 'images/cache/portal-345993588_92550.png', NULL, NULL, 'http://msb-discovery:8080/iui/microservices/default.html', NULL, NULL, '', '', NULL, '', 'Y', 'Y', NULL, '', '', '', '', 2,'N',NULL);
 
 -- insert SDC users user id2-8
index 3ff88b2..2a22fef 100755 (executable)
@@ -13,7 +13,7 @@ if [ -z "$PORTAL_VERSION" ]; then
 fi
 
 TIMESTAMP=$(date +%C%y%m%dT%H%M%S)
-export VERSION="${PORTAL_VERSION}-${TIMESTAMP}"
-export LATEST="${PORTAL_VERSION}"
+export VERSION="${PORTAL_VERSION}-STAGING-${TIMESTAMP}"
+export LATEST="${PORTAL_VERSION}-STAGING-latest"
 
 exec ./os_docker_base.sh
index 6cb6271..b871ab9 100644 (file)
@@ -52,3 +52,5 @@ CREATE TABLE portal.spring_session_attributes (
     AND min_index_interval = 128
     AND read_repair_chance = 0.0
     AND speculative_retry = '99PERCENTILE';  
+
+CREATE TABLE portal.healthcheck (id uuid PRIMARY KEY);
\ No newline at end of file
index 62da5dd..bf4e71a 100644 (file)
@@ -52,3 +52,5 @@ CREATE TABLE portalsdk.spring_session_attributes (
     AND min_index_interval = 128
     AND read_repair_chance = 0.0
     AND speculative_retry = '99PERCENTILE';  
+    
+CREATE TABLE portalsdk.healthcheck (id uuid PRIMARY KEY);
index 8909044..b33ca26 100644 (file)
@@ -1,12 +1,14 @@
-music.version = v2
-music.keyspace = keyspaces
+# For API calls
+#music.version = v2
+#music.keyspace = keyspaces
+#music.tables = tables
+#music.consistency.info = type
+#music.consistency.info.value = eventual
+music.cache = false
+
 music.session.keyspace = portal
-music.tables = tables
 music.session.attr.tables = spring_session_attributes
 music.session.meta.tables = spring_session
-music.consistency.info = type
-music.consistency.info.value = eventual
-music.cache = false
 music.session.max.inactive.interval.seconds = 1800
 music.serialize.compress = true
 
@@ -17,4 +19,11 @@ music.atomic.put = true
 cassandra.host=portal-cassandra
 zookeeper.host=portal-zk
 cassandra.user=root
-cassandra.password=Aa123456
\ No newline at end of file
+cassandra.password=Aa123456
+
+music.exclude.api = /portalApi/healthCheck,/portalApi/healthCheckSuspend,/portalApi/healthCheckResume
+
+#how often the session clean up would happen (hour)
+music.cleanup.frequency = 6
+#how old of session need to be cleaned up (hour)
+music.cleanup.threshold = 10
\ No newline at end of file
index c16c490..928605c 100644 (file)
@@ -90,6 +90,8 @@ microservices.widget.local.port = 8082
 microservices.m-learn.local.port = 8083
 #HALO API enable flag
 external_access_enable = false
+#Widgets upload flag
+microservices.widget.upload.flag=true
 
 #delete auditlog from number of days ago
 auditlog_del_day_from = 365
index d78e30e..a28efe6 100644 (file)
@@ -1,12 +1,14 @@
-music.version = v2
-music.keyspace = keyspaces
+# For API calls
+#music.version = v2
+#music.keyspace = keyspaces
+#music.tables = tables
+#music.consistency.info = type
+#music.consistency.info.value = eventual
+music.cache = false
+
 music.session.keyspace = portalsdk
-music.tables = tables
 music.session.attr.tables = spring_session_attributes
 music.session.meta.tables = spring_session
-music.consistency.info = type
-music.consistency.info.value = eventual
-music.cache = false
 music.session.max.inactive.interval.seconds = 1800
 music.serialize.compress = true
 
@@ -17,4 +19,11 @@ music.atomic.put = true
 cassandra.host=portal-cassandra
 zookeeper.host=portal-zk
 cassandra.user=root
-cassandra.password=Aa123456
\ No newline at end of file
+cassandra.password=Aa123456
+
+music.exclude.api = /portalApi/healthCheck,/portalApi/healthCheckSuspend,/portalApi/healthCheckResume
+
+#how often the session clean up would happen (hour)
+music.cleanup.frequency = 6
+#how old of session need to be cleaned up (hour)
+music.cleanup.threshold = 10
\ No newline at end of file
index 2ef460b..1a4697b 100644 (file)
@@ -6,10 +6,10 @@
 Portal Platform Release Notes
 =============================
 
-Version: 2.1.0
+Version: 2.2.0
 --------------
 
-:Release Date: 24 May 2018
+:Release Date: 7 June 2018
 
 .. toctree::
     :maxdepth: 1
@@ -38,7 +38,7 @@ We worked on hardening the ONAP Portal platform by improving code quality and ad
         * Not able to delete portal admin user
         * Add support to connect with AAF Runtime
         * Portal's SDK UI documentation in ONAP wiki needs samples
-        * The Portal/SDK fn_user table has encrypted passwords that need to hange to using a hash algorithm
+        * The Portal/SDK fn_user table has encrypted passwords that need to be changed to use a hash algorithm
         * UI cleanup needed: on adding entries to News Widget and display on Application Onboarding page
 
 **Security Issues**
@@ -52,11 +52,12 @@ We worked on hardening the ONAP Portal platform by improving code quality and ad
 
 **Other**
         * Below are the docker images released as part of Portal Platform project:
-        * onap/portal-db:v2.1.0
-        * onap/portal-apps:v2.1.0
-        * onap/portal-wms:v2.1.0
+        * onap/portal-db:v2.2.0
+        * onap/portal-apps:v2.2.0
+        * onap/portal-wms:v2.2.0
         * onap//music/music-cassandra:v3.0
         * zookeeper:v3.4.0
+        * portal/sdk - (Release branch: "release-2.2.0")
 
 Version: 1.3.0
 --------------
index 5ae097d..fd6a93d 100644 (file)
@@ -5,7 +5,7 @@
        <parent>
                <groupId>org.onap.portal</groupId>
                <artifactId>onap-portal-parent</artifactId>
-               <version>2.2.0</version>
+               <version>2.3.0</version>
        </parent>
 
        <artifactId>portal-be-common</artifactId>
                <artifactId>xstream</artifactId>
                <version>1.4.10</version>
                </dependency>
-               <dependency>
-               <groupId>org.apache.wicket</groupId>
-               <artifactId>wicket-core</artifactId>
-               <version>1.5.16</version>
-               </dependency>
                <dependency>
                        <groupId>ch.qos.logback</groupId>
                        <artifactId>logback-core</artifactId>
                <artifactId>xalan</artifactId>
                <version>2.7.2</version>
                </dependency>
-               
-               
-       </dependencies>
-       
+                       <!-- Music -->
+           <dependency>
+                   <groupId>org.onap.music</groupId>
+                   <artifactId>MUSIC</artifactId>
+                   <version>2.5.5</version>
+                   <exclusions> 
+                               <exclusion> 
+                                         <groupId>com.sun.jersey</groupId> 
+                                 <artifactId>jersey-client</artifactId> 
+                               </exclusion> 
+                               <exclusion> 
+                                        <groupId>com.sun.jersey</groupId> 
+                                <artifactId>jersey-server</artifactId> 
+                               </exclusion> 
+                               <exclusion> 
+                                        <groupId>com.sun.jersey</groupId> 
+                                <artifactId>jersey-json</artifactId> 
+                               </exclusion><exclusion> 
+                                       <groupId>com.sun.jersey</groupId> 
+                               <artifactId>jersey-servlet</artifactId> 
+                               </exclusion> 
+                       </exclusions> 
+           </dependency>
+           
+               <dependency>
+                       <groupId>org.onap.portal.sdk</groupId>
+                       <artifactId>epsdk-music</artifactId>
+                       <version>${epsdk.version}</version>
+                               
+               <exclusions> 
+                               <exclusion> 
+                                         <groupId>com.sun.jersey</groupId> 
+                                 <artifactId>jersey-client</artifactId> 
+                               </exclusion> 
+                               <exclusion> 
+                                        <groupId>com.sun.jersey</groupId> 
+                                <artifactId>jersey-server</artifactId> 
+                               </exclusion> 
+                               <exclusion> 
+                                        <groupId>com.sun.jersey</groupId> 
+                                <artifactId>jersey-json</artifactId> 
+                               </exclusion><exclusion> 
+                                       <groupId>com.sun.jersey</groupId> 
+                               <artifactId>jersey-servlet</artifactId> 
+                               </exclusion> 
+                       </exclusions> 
        
+                       
+               </dependency>
+       </dependencies>
 
 </project>
@@ -1,3 +1,4 @@
+
 /*-
  * ============LICENSE_START==========================================
  * ONAP Portal
  *
  * 
  */
-package org.onap.portalapp.portal.ueb;
+package org.onap.portalapp.annotation;
 
-import org.onap.portalsdk.core.onboarding.ueb.UebMsgTypes;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 
-public interface EPUebMsgTypes extends UebMsgTypes {
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE, ElementType.ANNOTATION_TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ApiVersion {
+       
+       String service() default "";
+       String max()  default "";
+       int min()  default 0;   
+       String method() default "";
 
-       public static final String UEB_MSG_TYPE_HEALTH_CHECK = "uebHealthCheckPing";
 }
index 9f561b0..5354fa3 100644 (file)
@@ -41,11 +41,11 @@ import java.util.regex.Pattern;
 
 import javax.servlet.http.HttpServletRequest;
 
+import org.onap.portalapp.portal.utils.MusicCookieCsrfTokenRepository;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.security.config.annotation.web.builders.HttpSecurity;
 import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
 import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
-import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
 import org.springframework.security.web.util.matcher.RegexRequestMatcher;
 import org.springframework.security.web.util.matcher.RequestMatcher;
 
@@ -61,14 +61,12 @@ public class ExternalSecurityConfig extends WebSecurityConfigurerAdapter {
                        @Override
                        public boolean matches(HttpServletRequest request) {
                                if(allowedMethods.matcher(request.getMethod()).matches())
-                           return false;
-                       
+                           return false;   
                                if(requestMatcher.matches(request))
-                                       return true;
-                               
+                                       return true;                    
                                return false;
                        }
                };
-               http.csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()).requireCsrfProtectionMatcher(csrfRequestMatcher);
+               http.csrf().csrfTokenRepository(MusicCookieCsrfTokenRepository.withHttpOnlyFalse()).requireCsrfProtectionMatcher(csrfRequestMatcher);
        }
 }
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationVersionController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationVersionController.java
new file mode 100644 (file)
index 0000000..f78b14b
--- /dev/null
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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.controller.sessionmgt;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.onap.portalapp.annotation.ApiVersion;
+import org.onap.portalapp.portal.logging.aop.EPAuditLog;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
+@EPAuditLog
+@ApiVersion
+public class SessionCommunicationVersionController {
+
+       @Autowired
+       SessionCommunicationController sessionCommunicationController;
+
+       @ApiVersion(max = "v3", service = "/v3/getSessionSlotCheckInterval", min = 0,method = "GET")
+       public Integer getSessionSlotCheckInterval(HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+               return sessionCommunicationController.getSessionSlotCheckInterval(request, response);
+       }
+       
+       
+       @ApiVersion(max = "v3", service = "/v3/extendSessionTimeOuts", min = 0,method = "POST")
+       public Boolean extendSessionTimeOuts(HttpServletRequest request, HttpServletResponse response, String sessionMap) throws Exception {
+               return sessionCommunicationController.extendSessionTimeOuts(request, response, sessionMap);
+       }
+
+}
index 483d76e..cef5fa7 100644 (file)
@@ -53,6 +53,7 @@ import org.onap.portalapp.portal.service.PortalAdminService;
 import org.onap.portalapp.portal.service.UserService;
 import org.onap.portalapp.portal.transport.FieldsValidator;
 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.portal.utils.PortalConstants;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
@@ -212,6 +213,7 @@ public class AppsControllerExternalRequest implements BasicAuthenticationControl
                        @PathVariable("appId") Long appId) {
                EPApp epApp = appService.getApp(appId);
                OnboardingApp obApp = new OnboardingApp();
+               epApp.setAppPassword(EPCommonSystemProperties.APP_DISPLAY_PASSWORD); //to hide password from get request
                appService.createOnboardingFromApp(epApp, obApp);
                EcompPortalUtils.logAndSerializeObject(logger, "getOnboardAppExternal", "response", obApp);
                return obApp;
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppsControllerExternalVersionRequest.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppsControllerExternalVersionRequest.java
new file mode 100644 (file)
index 0000000..13a6811
--- /dev/null
@@ -0,0 +1,89 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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.controller;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.onap.portalapp.annotation.ApiVersion;
+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
+@EPAuditLog
+@ApiVersion
+public class AppsControllerExternalVersionRequest implements BasicAuthenticationController {
+
+       @Autowired
+       AppsControllerExternalRequest appsControllerExternalRequest;
+
+       @ApiVersion(max = "v3", service = "/v3/portalAdmin", min = 0, method = "POST")
+       public PortalRestResponse<String> postPortalAdmin(HttpServletRequest request, HttpServletResponse response,
+                       EPUser epUser) {
+               return appsControllerExternalRequest.postPortalAdmin(request, response, epUser);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/onboardApp/[0-9]{1,25}$", min = 0, method = "GET")
+       public OnboardingApp getOnboardAppExternal(HttpServletRequest request, HttpServletResponse response, Long appId) {
+               return appsControllerExternalRequest.getOnboardAppExternal(request, response, appId);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/onboardApp", min = 0, method = "POST")
+       public PortalRestResponse<String> postOnboardAppExternal(HttpServletRequest request, HttpServletResponse response,
+                       OnboardingApp newOnboardApp) {
+               return appsControllerExternalRequest.postOnboardAppExternal(request, response, newOnboardApp);
+
+       }
+       @ApiVersion(max = "v3", service = "/v3/onboardApp/[0-9]{1,25}$", min = 0, method = "PUT")
+       public PortalRestResponse<String> putOnboardAppExternal(HttpServletRequest request, HttpServletResponse response,
+                       Long appId, OnboardingApp oldOnboardApp) {
+               return appsControllerExternalRequest.putOnboardAppExternal(request, response, appId, oldOnboardApp);
+       }
+}
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuxApiRequestMapperController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuxApiRequestMapperController.java
new file mode 100644 (file)
index 0000000..60c25c6
--- /dev/null
@@ -0,0 +1,890 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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.controller;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.jar.Attributes;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.onap.portalapp.annotation.ApiVersion;
+import org.onap.portalapp.externalsystemapproval.model.ExternalSystemUser;
+import org.onap.portalapp.portal.domain.CentralV2RoleFunction;
+import org.onap.portalapp.portal.domain.EPUser;
+import org.onap.portalapp.portal.ecomp.model.PortalRestResponse;
+import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum;
+import org.onap.portalapp.portal.logging.aop.EPAuditLog;
+import org.onap.portalapp.portal.service.ManifestService;
+import org.onap.portalapp.portal.transport.Analytics;
+import org.onap.portalapp.portal.transport.CentralUser;
+import org.onap.portalapp.portal.transport.CentralV2Role;
+import org.onap.portalapp.portal.transport.EpNotificationItem;
+import org.onap.portalapp.portal.transport.FavoritesFunctionalMenuItemJson;
+import org.onap.portalapp.portal.transport.FunctionalMenuItem;
+import org.onap.portalapp.portal.transport.OnboardingApp;
+import org.onap.portalsdk.core.domain.Role;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.portalsdk.core.onboarding.crossapi.PortalAPIResponse;
+import org.onap.portalsdk.core.restful.domain.EcompRole;
+import org.onap.portalsdk.core.restful.domain.EcompUser;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+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.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import io.swagger.annotations.ApiOperation;
+
+@RestController
+@RequestMapping("/auxapi")
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
+@EPAuditLog
+public class AuxApiRequestMapperController implements ApplicationContextAware, BasicAuthenticationController {
+
+       private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AuxApiRequestMapperController.class);
+
+       ApplicationContext context = null;
+       int minorVersion = 0;
+
+       @Autowired
+       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")
+       public String getUser(HttpServletRequest request, HttpServletResponse response,
+                       @PathVariable("loginId") String loginId) throws Exception {
+               Map<String, Object> res = getMethod(request, response);
+               String answer = null;
+               try {
+                       answer = (String) invokeMethod(res, request, response, loginId);
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "getUser failed", e);
+               }
+               return answer;
+       }
+
+       @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")
+       public List<CentralV2Role> getRoles(HttpServletRequest request, HttpServletResponse response) throws Exception {
+               Map<String, Object> res = getMethod(request, response);
+               request.getMethod();
+               List<CentralV2Role> answer = null;
+               try {
+                       answer = (List<CentralV2Role>) invokeMethod(res, request, response);
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "getRoles failed", e);
+               }
+               return answer;
+       }
+
+       @SuppressWarnings("unchecked")
+       @ApiOperation(value = "Saves role for an application.", response = PortalRestResponse.class, responseContainer = "Json")
+       @RequestMapping(value = { "/v3/role" }, method = RequestMethod.POST, produces = "application/json")
+       public PortalRestResponse<String> saveRole(HttpServletRequest request, HttpServletResponse response,
+                       @RequestBody Role role) throws Exception {
+               Map<String, Object> res = getMethod(request, response);
+               PortalRestResponse<String> out = null;
+               try {
+                       out = (PortalRestResponse<String>) invokeMethod(res, request, response, role);
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "saveRole failed", e);
+                       return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+               return out;
+       }
+
+       @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")
+       public CentralV2Role getRoleInfo(HttpServletRequest request, HttpServletResponse response,
+                       @PathVariable("role_id") Long roleId) throws Exception {
+               Map<String, Object> res = getMethod(request, response);
+               CentralV2Role role = null;
+               try {
+                       role = (CentralV2Role) invokeMethod(res, request, response, roleId);
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "getRoleInfo failed", e);
+               }
+               return role;
+
+       }
+
+       @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")
+       public List<EcompUser> getUsersOfApplication(HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+               Map<String, Object> res = getMethod(request, response);
+               List<EcompUser> users = null;
+               try {
+                       users = (List<EcompUser>) invokeMethod(res, request, response);
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "getUsersOfApplication failed", e);
+               }
+               return users;
+       }
+
+       @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")
+       public List<CentralV2RoleFunction> getRoleFunctionsList(HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+               Map<String, Object> res = getMethod(request, response);
+               List<CentralV2RoleFunction> roleFunctionsList = null;
+               try {
+                       roleFunctionsList = (List<CentralV2RoleFunction>) invokeMethod(res, request, response);
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "getRoleFunctionsList failed", e);
+               }
+               return roleFunctionsList;
+       }
+
+       @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")
+       public CentralV2RoleFunction getRoleFunction(HttpServletRequest request, HttpServletResponse response,
+                       @PathVariable("code") String code) throws Exception {
+               Map<String, Object> res = getMethod(request, response);
+               CentralV2RoleFunction roleFunction = null;
+               try {
+                       roleFunction = (CentralV2RoleFunction) invokeMethod(res, request, response, code);
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "getRoleFunction failed", e);
+               }
+               return roleFunction;
+       }
+
+       @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")
+       public PortalRestResponse<String> saveRoleFunction(HttpServletRequest request, HttpServletResponse response,
+                       @RequestBody String roleFunc) throws Exception {
+               PortalRestResponse<String> result = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (PortalRestResponse<String>) invokeMethod(res, request, response, roleFunc);
+                       return result;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "saveRoleFunction failed", e);
+                       return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+       }
+
+       @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")
+       public PortalRestResponse<String> deleteRoleFunction(HttpServletRequest request, HttpServletResponse response,
+                       @PathVariable("code") String code) throws Exception {
+               PortalRestResponse<String> result = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (PortalRestResponse<String>) invokeMethod(res, request, response, code);
+                       return result;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "deleteRoleFunction failed", e);
+                       return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+       }
+
+       @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")
+       public PortalRestResponse<String> deleteRole(HttpServletRequest request, HttpServletResponse response,
+                       @PathVariable("roleId") Long roleId) throws Exception {
+               PortalRestResponse<String> result = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (PortalRestResponse<String>) invokeMethod(res, request, response, roleId);
+                       return result;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "deleteRole failed", e);
+                       return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+       }
+
+       @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")
+       public List<CentralV2Role> getActiveRoles(HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+               List<CentralV2Role> cenRole = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       cenRole = (List<CentralV2Role>) invokeMethod(res, request, response);
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "getActiveRoles failed", e);
+               }
+               return cenRole;
+       }
+
+       @ApiOperation(value = "Gets ecompUser of an application.", response = CentralUser.class, responseContainer = "List")
+       @RequestMapping(value = { "/v4/user/{loginId}" }, method = RequestMethod.GET, produces = "application/json")
+       public String getEcompUser(HttpServletRequest request, HttpServletResponse response,
+                       @PathVariable("loginId") String loginId) throws Exception {
+               Map<String, Object> res = getMethod(request, response);
+               String answer = null;
+               try {
+                       answer = (String) invokeMethod(res, request, response, loginId);
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "getEcompUser failed", e);
+               }
+               return answer;
+       }
+
+       @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")
+       public List<EcompRole> getEcompRolesOfApplication(HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+               Map<String, Object> res = getMethod(request, response);
+               List<EcompRole> answer = null;
+               try {
+                       answer = (List<EcompRole>) invokeMethod(res, request, response);
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "getEcompRolesOfApplication failed", e);
+               }
+               return answer;
+       }
+
+       @ApiOperation(value = "Gets session slot-check interval, a duration in milliseconds.", response = Integer.class)
+       @RequestMapping(value = {
+                       "/v3/getSessionSlotCheckInterval" }, method = RequestMethod.GET, produces = "application/json")
+       public Integer getSessionSlotCheckInterval(HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+               Map<String, Object> res = getMethod(request, response);
+               Integer ans = null;
+               try {
+                       ans = (Integer) invokeMethod(res, request, response);
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "getSessionSlotCheckInterval failed", e);
+               }
+               return ans;
+       }
+
+       @ApiOperation(value = "Extends session timeout values for all on-boarded applications.", response = Boolean.class)
+       @RequestMapping(value = { "/v3/extendSessionTimeOuts" }, method = RequestMethod.POST)
+       public Boolean extendSessionTimeOuts(HttpServletRequest request, HttpServletResponse response,
+                       @RequestParam String sessionMap) throws Exception {
+               Map<String, Object> res = getMethod(request, response);
+               Boolean ans = null;
+               try {
+                       ans = (Boolean) invokeMethod(res, request, response, sessionMap);
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "extendSessionTimeOuts failed", e);
+               }
+               return ans;
+       }
+
+       @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")
+       public String getAnalyticsScript(HttpServletRequest request, HttpServletResponse response) throws Exception {
+               Map<String, Object> res = getMethod(request, response);
+               String ans = null;
+               try {
+                       ans = (String) invokeMethod(res, request, response);
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "getAnalyticsScript failed", e);
+               }
+               return ans;
+       }
+
+       @RequestMapping(value = { "/v3/storeAnalytics" }, method = RequestMethod.POST, 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,
+                       @RequestBody Analytics analyticsMap) throws Exception {
+               Map<String, Object> res = getMethod(request, response);
+               PortalAPIResponse ans = new PortalAPIResponse(true, "error");
+               try {
+                       ans = (PortalAPIResponse) invokeMethod(res, request, response, analyticsMap);
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "storeAnalyticsScript failed", e);
+               }
+               return ans;
+
+       }
+
+       @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")
+       public PortalRestResponse<String> bulkUploadFunctions(HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+               PortalRestResponse<String> result = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (PortalRestResponse<String>) invokeMethod(res, request, response);
+                       return result;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadFunctions failed", e);
+                       return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+
+       }
+
+       @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")
+       public PortalRestResponse<String> bulkUploadRoles(HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+               PortalRestResponse<String> result = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (PortalRestResponse<String>) invokeMethod(res, request, response);
+                       return result;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRoles failed", e);
+                       return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+       }
+
+       @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")
+       public PortalRestResponse<String> bulkUploadRoleFunctions(HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+               PortalRestResponse<String> result = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (PortalRestResponse<String>) invokeMethod(res, request, response);
+                       return result;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRoleFunctions failed", e);
+                       return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+       }
+
+       @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")
+       public PortalRestResponse<String> bulkUploadUserRoles(HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+               PortalRestResponse<String> result = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (PortalRestResponse<String>) invokeMethod(res, request, response);
+                       return result;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadUserRoles failed", e);
+                       return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+
+       }
+
+       @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")
+       public PortalRestResponse<String> bulkUploadUsersSingleRole(HttpServletRequest request,
+                       HttpServletResponse response, @PathVariable Long roleId) throws Exception {
+               PortalRestResponse<String> result = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (PortalRestResponse<String>) invokeMethod(res, request, response, roleId);
+                       return result;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadUsersSingleRole failed", e);
+                       return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+       }
+
+       @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")
+       public PortalRestResponse<String> bulkUploadPartnerFunctions(HttpServletRequest request,
+                       HttpServletResponse response) throws Exception {
+               PortalRestResponse<String> result = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (PortalRestResponse<String>) invokeMethod(res, request, response);
+                       return result;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadPartnerFunctions failed", e);
+                       return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+       }
+
+       // 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")
+       public PortalRestResponse<String> bulkUploadPartnerRoles(HttpServletRequest request, HttpServletResponse response,
+                       @RequestBody List<Role> upload) throws Exception {
+               PortalRestResponse<String> result = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (PortalRestResponse<String>) invokeMethod(res, request, response, upload);
+                       return result;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadPartnerRoles failed", e);
+                       return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+       }
+
+       @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")
+       public PortalRestResponse<String> bulkUploadPartnerRoleFunctions(HttpServletRequest request,
+                       HttpServletResponse response) throws Exception {
+               PortalRestResponse<String> result = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (PortalRestResponse<String>) invokeMethod(res, request, response);
+                       return result;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadPartnerRoleFunctions failed", e);
+                       return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+       }
+
+       @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")
+       public List<String> getMenuFunctions(HttpServletRequest request, HttpServletResponse response) throws Exception {
+               List<String> functionsList = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       functionsList = (List<String>) invokeMethod(res, request, response);
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "getMenuFunctions failed", e);
+               }
+               return functionsList;
+       }
+
+       private String getPatchNumber() {
+               String response = "0";
+               try {
+                       Attributes attributes = manifestService.getWebappManifest();
+                       response = attributes.getValue("Build-Number");
+               } catch (Exception ex) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "getPatchNumber failed", ex);
+               }
+               return response;
+       }
+
+       @SuppressWarnings("rawtypes")
+       private List<Object> getObject(HttpServletRequest request, HttpServletResponse response) {
+               Map<String, Object> beans = context.getBeansWithAnnotation(ApiVersion.class);
+               @SuppressWarnings("unchecked")
+               List<Object> beansList = new ArrayList(beans.values());
+               return beansList;
+
+       }
+
+       private Map<String, Object> getMethod(HttpServletRequest request, HttpServletResponse response) {
+               Method finalmethod = null;
+               String url = request.getRequestURI();
+               String version = "";
+               String service = "";
+               Object currentObject = null;
+               Map<String, Object> res = new HashMap<String, Object>();
+               String[] uriArray = url.split("/auxapi");
+               List<Integer> minorversionList = new ArrayList<>();
+               if (uriArray.length > 1) {
+                       service = uriArray[1];
+               }
+               int first = service.indexOf("/");
+               int second = service.indexOf("/", first + 1);
+               version = service.substring(first + 1, second);
+               int min = minorVersion;
+               if (request.getHeader("MinorVersion") != null) {
+                       min = Integer.parseInt(request.getHeader("MinorVersion"));
+               }
+               res.put("min", version+"."+min);
+               res.put("service", service);
+               List<Object> objList = getObject(request, response);
+               String requestedApiMethodType = request.getMethod();
+               String majorVersion = latestMajorVersionOfService(objList, service, version, requestedApiMethodType);
+               int latestMinorVersion = latestMinorVersionOfService(objList, service, version, requestedApiMethodType);
+               res.put("majorVersion", majorVersion);
+               res.put("latestMinorVersion", String.valueOf(latestMinorVersion));
+               outerloop: for (Object obj : objList) {
+                       final List<Method> allMethods = getAllMethodsOfClass(obj);
+                       for (final Method method : allMethods) {
+                               if (method.isAnnotationPresent(ApiVersion.class)) {
+                                       ApiVersion annotInstance = method.getAnnotation(ApiVersion.class);
+                                       Pattern p = Pattern.compile(annotInstance.service(),
+                                                       Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
+                                       Matcher matcher = p.matcher(service);
+                                       boolean b = matcher.matches();
+                                       logger.debug(EELFLoggerDelegate.debugLogger, "Requested Servie is:" + service
+                                                       + "Requested MinVersion is:" + min + "Requested MajorVersion is: " + version);
+                                       if (annotInstance.max().equals(version) && b && annotInstance.min() == min
+                                                       && annotInstance.method().equals(request.getMethod())) {
+                                               finalmethod = method;
+                                               currentObject = obj;
+                                               res.put("method", method);
+                                               res.put("Obj", obj);
+                                               break outerloop;
+                                       }
+                               }
+                       }
+               }
+               return res;
+       }
+
+       private String latestMajorVersionOfService(List<Object> objList, String service, String reuqestedVersion,
+                       String requestedApiMethodType) {
+               Integer majorVersion = 0;
+               String serviceEndPoint = service;
+               int firstindex = serviceEndPoint.indexOf("/");
+               int secondindex = serviceEndPoint.indexOf("/", firstindex + 1);
+               serviceEndPoint = serviceEndPoint.substring(secondindex + 1);
+
+               List<Integer> latestMajorVersionList = new ArrayList<>();
+               for (Object obj : objList) {
+                       final List<Method> allMethods = getAllMethodsOfClass(obj);
+                       for (final Method method : allMethods) {
+                               if (method.isAnnotationPresent(ApiVersion.class)) {
+                                       ApiVersion annotInstance = method.getAnnotation(ApiVersion.class);
+                                       String endpoint = annotInstance.service();
+                                       int first = endpoint.indexOf("/");
+                                       int second = endpoint.indexOf("/", first + 1);
+                                       endpoint = endpoint.substring(second + 1);
+                                       Pattern p = Pattern.compile(endpoint,
+                                                       Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
+                                       Matcher matcher = p.matcher(serviceEndPoint);
+                                       boolean b = matcher.matches();
+                                       if (b && annotInstance.method().equals(requestedApiMethodType)) {
+                                               int index1 = annotInstance.service().indexOf("/");
+                                               int index2 = annotInstance.service().indexOf("/", index1 + 1);
+                                               String majorversion = annotInstance.service().substring(index1 + 2, index2);
+                                               latestMajorVersionList.add(Integer.parseInt(majorversion));
+                                       }
+                               }
+                       }
+               }
+               majorVersion = Collections.max(latestMajorVersionList);
+               String majorVersionWithLastestMin = "/v"+String.valueOf(majorVersion)+"/"+serviceEndPoint;
+               int latestMinorVersion = latestMinorVersionOfService(objList, majorVersionWithLastestMin, "v"+String.valueOf(majorVersion), requestedApiMethodType);
+               return majorVersion+"."+latestMinorVersion;
+       }
+
+       private List<Method> getAllMethodsOfClass(Object obj) {
+               List<Method> allMethods = new ArrayList<>();
+               Class<?> objClz = obj.getClass();
+               if (org.springframework.aop.support.AopUtils.isAopProxy(obj)) {
+                       objClz = org.springframework.aop.support.AopUtils.getTargetClass(obj);
+               }
+               allMethods = new ArrayList<Method>(Arrays.asList(objClz.getMethods()));
+               allMethods.removeIf(s -> !(s.isAnnotationPresent(ApiVersion.class)));
+               return allMethods;
+       }
+
+       private Integer latestMinorVersionOfService(List<Object> objList, String service, String reuqestedVersion,
+                       String requestedApiMethodType) {
+               Integer minVersion = 0;
+               String serviceEndPoint = service;
+               List<Integer> latestMinorVersionList = new ArrayList<>();
+               for (Object obj : objList) {
+                       final List<Method> allMethods = getAllMethodsOfClass(obj);
+                       for (final Method method : allMethods) {
+                               if (method.isAnnotationPresent(ApiVersion.class)) {
+                                       ApiVersion annotInstance = method.getAnnotation(ApiVersion.class);
+                                       String endpoint = annotInstance.service();
+
+                                       Pattern p = Pattern.compile(endpoint,
+                                                       Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
+                                       Matcher matcher = p.matcher(serviceEndPoint);
+                                       boolean b = matcher.matches();
+                                       if (annotInstance.max().equals(reuqestedVersion) && b
+                                                       && annotInstance.method().equals(requestedApiMethodType)) {
+                                               int minorversion = annotInstance.min();
+                                               latestMinorVersionList.add(minorversion);
+                                       }
+                               }
+                       }
+               }
+               minVersion = Collections.max(latestMinorVersionList);
+               return minVersion;
+       }
+
+       private HttpServletResponse setResponse(HttpServletResponse response, String requestedMinVersion,
+                       String majorVersion, String latestMinorVersion, String service) {
+               response.setHeader("X-MinorVersion", requestedMinVersion.toUpperCase());
+               response.setHeader("X-PatchVersion", getPatchNumber());
+               response.setHeader("X-LatestVersion", "V"+majorVersion);
+               return response;
+       }
+
+       /**
+        * 
+        * @param res
+        * @param args
+        *            method parameters(Maintain HttpServletRequest at 0th position
+        *            and HttpServletResponse at 1th position in args array)
+        * @return
+        * @throws Exception
+        */
+       private Object invokeMethod(Map<String, Object> res, Object... args) throws Exception {
+               Method method = (Method) res.get("method");
+               Object obj = res.get("Obj");
+               Object responseObj = null;
+               String min = res.get("min").toString();
+               String majorVersion = res.get("majorVersion").toString();
+               String latestMinorVersion = res.get("latestMinorVersion").toString();
+               String service = res.get("service").toString();
+               HttpServletRequest request = (HttpServletRequest) args[0];
+               HttpServletResponse response = (HttpServletResponse) args[1];
+               setResponse(response, min, majorVersion, latestMinorVersion, service);
+               final Map<String, String> errorMap = new HashMap<>();
+               ObjectMapper mapper = new ObjectMapper();
+               String reason = "";
+               try {
+                       if (method != null && obj != null) {
+                               responseObj = method.invoke(obj, args);
+                       } else {
+                               errorMap.put("error", "Requested api is not available");
+                               reason = mapper.writeValueAsString(errorMap);
+                               response.getWriter().write(reason);
+                               logger.debug(EELFLoggerDelegate.debugLogger, "Requested api " + request.getRequestURI()
+                                               + "is not available with minorVersion " + request.getHeader("MinorVersion"));
+                               response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+                       }
+               } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "Method :" + method + "invocation failed", e);
+               }
+               return responseObj;
+       }
+
+       @Override
+       public void setApplicationContext(ApplicationContext context) throws BeansException {
+               this.context = context;
+       }
+
+       @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")
+       public PortalRestResponse<String> postUserProfile(HttpServletRequest request,
+                       @RequestBody ExternalSystemUser extSysUser, HttpServletResponse response) {
+               PortalRestResponse<String> result = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (PortalRestResponse<String>) invokeMethod(res, request, response, extSysUser);
+                       return result;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "postUserProfile failed", e);
+                       return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+       }
+
+       @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")
+       public PortalRestResponse<String> putUserProfile(HttpServletRequest request,
+                       @RequestBody ExternalSystemUser extSysUser, HttpServletResponse response) {
+               PortalRestResponse<String> result = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (PortalRestResponse<String>) invokeMethod(res, request, response, extSysUser);
+                       return result;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "putUserProfile failed", e);
+                       return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+       }
+
+       @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")
+       public PortalRestResponse<String> deleteUserProfile(HttpServletRequest request,
+                       @RequestBody ExternalSystemUser extSysUser, HttpServletResponse response) {
+               PortalRestResponse<String> result = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (PortalRestResponse<String>) invokeMethod(res, request, response, extSysUser);
+                       return result;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "deleteUserProfile failed", e);
+                       return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+       }
+
+       @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)
+       public PortalRestResponse<String> handleRequest(HttpServletRequest request, HttpServletResponse response,
+                       @RequestBody String ticketEventJson) throws Exception {
+               PortalRestResponse<String> result = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (PortalRestResponse<String>) invokeMethod(res, request, response, ticketEventJson);
+                       return result;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "handleRequest failed", e);
+                       return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+       }
+
+       @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")
+       @ResponseBody
+       public PortalRestResponse<String> postPortalAdmin(HttpServletRequest request, HttpServletResponse response,
+                       @RequestBody EPUser epUser) {
+               PortalRestResponse<String> result = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (PortalRestResponse<String>) invokeMethod(res, request, response, epUser);
+                       return result;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "postPortalAdmin failed", e);
+                       return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+       }
+
+       @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")
+       @ResponseBody
+       public OnboardingApp getOnboardAppExternal(HttpServletRequest request, HttpServletResponse response,
+                       @PathVariable("appId") Long appId) {
+               OnboardingApp result = new OnboardingApp();
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (OnboardingApp) invokeMethod(res, request, response, appId);
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "getOnboardAppExternal failed", e);
+               }
+               return result;
+       }
+
+       @SuppressWarnings("unchecked")
+       @ApiOperation(value = "Adds a new application to Portal.", response = PortalRestResponse.class)
+       @RequestMapping(value = { "/v3/onboardApp" }, method = RequestMethod.POST, produces = "application/json")
+       @ResponseBody
+       public PortalRestResponse<String> postOnboardAppExternal(HttpServletRequest request, HttpServletResponse response,
+                       @RequestBody OnboardingApp newOnboardApp) {
+               PortalRestResponse<String> result = new PortalRestResponse<>();
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (PortalRestResponse<String>) invokeMethod(res, request, response, newOnboardApp);
+                       return result;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "postOnboardAppExternal failed", e);
+                       return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+
+       }
+
+       @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")
+       @ResponseBody
+       public PortalRestResponse<String> putOnboardAppExternal(HttpServletRequest request, HttpServletResponse response,
+                       @PathVariable("appId") Long appId, @RequestBody OnboardingApp oldOnboardApp) {
+               PortalRestResponse<String> result = new PortalRestResponse<>();
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (PortalRestResponse<String>) invokeMethod(res, request, response, appId, oldOnboardApp);
+                       return result;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "putOnboardAppExternal failed", e);
+                       return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+       }
+
+       @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")
+       @ResponseBody
+       public PortalAPIResponse publishNotification(HttpServletRequest request,
+                       @RequestBody EpNotificationItem notificationItem, HttpServletResponse response) throws Exception {
+               PortalAPIResponse result = new PortalAPIResponse(true, "success");
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       result = (PortalAPIResponse) invokeMethod(res, request, response, notificationItem);
+                       return result;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "publishNotification failed", e);
+                       return new PortalAPIResponse(false, e.getMessage());
+               }
+       }
+
+       @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")
+       public List<FavoritesFunctionalMenuItemJson> getFavoritesForUser(HttpServletRequest request,
+                       HttpServletResponse response) throws Exception {
+               List<FavoritesFunctionalMenuItemJson> favorites = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       favorites = (List<FavoritesFunctionalMenuItemJson>) invokeMethod(res, request, response);
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "getFavoritesForUser failed", e);
+               }
+               return favorites;
+       }
+
+       @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")
+       public List<FunctionalMenuItem> getFunctionalMenuItemsForUser(HttpServletRequest request,
+                       HttpServletResponse response) throws Exception {
+               List<FunctionalMenuItem> fnMenuItems = null;
+               Map<String, Object> res = getMethod(request, response);
+               try {
+                       fnMenuItems = (List<FunctionalMenuItem>) invokeMethod(res, request, response);
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "getFunctionalMenuItemsForUser failed", e);
+               }
+               return fnMenuItems;
+       }
+
+}
index de6ae3c..e0bf7b0 100644 (file)
@@ -69,7 +69,6 @@ import org.onap.portalapp.portal.utils.EcompPortalUtils;
 import org.onap.portalapp.portal.utils.PortalConstants;
 import org.onap.portalsdk.core.domain.AuditLog;
 import org.onap.portalsdk.core.domain.Role;
-import org.onap.portalsdk.core.domain.RoleFunction;
 import org.onap.portalsdk.core.domain.User;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.restful.domain.EcompRole;
@@ -334,6 +333,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
        @RequestMapping(value = { "/roleFunction" }, method = RequestMethod.POST, produces = "application/json")
        public PortalRestResponse<String> saveRoleFunction(HttpServletRequest request, HttpServletResponse response,
                        @RequestBody String roleFunc) throws Exception {
+               String status = "Successfully saved!";
                try {
                        fieldsValidation(request);
                        String data = roleFunc;
@@ -343,7 +343,11 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
                        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
                        CentralV2RoleFunction availableRoleFunction = mapper.readValue(data, CentralV2RoleFunction.class);
                        CentralV2RoleFunction domainRoleFunction = null;
+                       boolean isCentralV2Version = false;
                        if(availableRoleFunction.getType()!=null && availableRoleFunction.getAction()!= null) {
+                               isCentralV2Version = true;
+                       }
+                       if(isCentralV2Version) {
                                String code = availableRoleFunction.getType()+"|"+availableRoleFunction.getCode()+"|"+availableRoleFunction.getAction();
                                domainRoleFunction = externalAccessRolesService.getRoleFunction(code,
                                                requestedApp.getUebKey());
@@ -353,7 +357,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
                        }
        
                        boolean saveOrUpdateResponse = false;
-                       if (domainRoleFunction != null && domainRoleFunction.getCode().equals(availableRoleFunction.getCode())
+                       if (domainRoleFunction != null && isCentralV2Version && domainRoleFunction.getCode().equals(availableRoleFunction.getCode())
                                        && domainRoleFunction.getType().equals(availableRoleFunction.getType())
                                        && domainRoleFunction.getAction().equals(availableRoleFunction.getAction())) {
                                domainRoleFunction.setName(availableRoleFunction.getName());
@@ -363,13 +367,15 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
                                availableRoleFunction.setAppId(requestedApp.getId());
                                saveOrUpdateResponse = externalAccessRolesService.saveCentralRoleFunction(availableRoleFunction,
                                                requestedApp);
-                       }                       
+                       }               
+               
+                       if(domainRoleFunction != null) {
+                               status = "Successfully updated!";
+                       }
                        if (saveOrUpdateResponse) {
                                EPUser user = externalAccessRolesService.getUser(request.getHeader(LOGIN_ID)).get(0);
                                EPApp app = externalAccessRolesService.getApp(request.getHeader(UEBKEY)).get(0);
-                               CentralV2RoleFunction function = externalAccessRolesService
-                                               .getRoleFunction(availableRoleFunction.getCode(), request.getHeader(UEBKEY));
-                               String activityCode = (function.getCode() == null)
+                               String activityCode = (!status.equals("Successfully updated!"))
                                                ? EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_ADD_FUNCTION
                                                : EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_UPDATE_FUNCTION;
                                logger.info(EELFLoggerDelegate.applicationLogger, "saveRoleFunction: succeeded for app {}, function {}",
@@ -401,7 +407,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
                                                "Failed to saveRoleFunction for '" + availableRoleFunction.getCode() + "'", "Failed");
                        }
                } catch (Exception e) {
-                       if (e.getMessage().contains(INVALID_UEB_KEY)) {
+                       if (e.getMessage() == null ||e.getMessage().contains(INVALID_UEB_KEY)) {
                                response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
                        }else {
                                response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
@@ -409,7 +415,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
                        logger.error(EELFLoggerDelegate.errorLogger, "saveRoleFunction failed", e);
                        return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
                }
-               return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully Saved", "Success");
+               return new PortalRestResponse<String>(PortalRestStatusEnum.OK, status, "Success");
        }
        
        @ApiOperation(value = "Deletes role function for an application.", response = PortalRestResponse.class, responseContainer = "Json")
@@ -731,15 +737,16 @@ 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")
-       public  PortalRestResponse<String> bulkUploadPartnerFunctions(HttpServletRequest request, HttpServletResponse response, @RequestBody List<RoleFunction> upload) throws Exception {
+       public  PortalRestResponse<String> bulkUploadPartnerFunctions(HttpServletRequest request, HttpServletResponse response) throws Exception {
+               Integer addedFunctions = 0;
                try {
-                       externalAccessRolesService.bulkUploadPartnerFunctions(request.getHeader(UEBKEY), upload);
+                       addedFunctions = externalAccessRolesService.bulkUploadPartnerFunctions(request.getHeader(UEBKEY));
                } catch (Exception e) {
                        response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                        logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadFunctions failed", e);
                        return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadFunctions", "Failed");
                }
-               return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added", "Success");
+               return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: '"+addedFunctions+"' functions", "Success");
        }
        
        @ApiOperation(value = "Bulk upload roles for an partner application.", response = PortalRestResponse.class, responseContainer = "Json")
@@ -757,15 +764,16 @@ 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")
-       public  PortalRestResponse<String> bulkUploadPartnerRoleFunctions(HttpServletRequest request, HttpServletResponse response, @RequestBody List<Role> upload) throws Exception {
+       public  PortalRestResponse<String> bulkUploadPartnerRoleFunctions(HttpServletRequest request, HttpServletResponse response) throws Exception {
+               Integer addedRoleFunctions = 0;
                try {
-                       externalAccessRolesService.bulkUploadPartnerRoleFunctions(request.getHeader(UEBKEY), upload);
+                       addedRoleFunctions = externalAccessRolesService.bulkUploadPartnerRoleFunctions(request.getHeader(UEBKEY));
                } catch (Exception e) {
                        response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                        logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRoles failed", e);
                        return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadPartnerRoleFunctions", "Failed");
                }
-               return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added", "Success");
+               return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: '"+addedRoleFunctions + "' role functions", "Success");
        }
        
        @ApiOperation(value = "Gets all functions along with global functions", response = List.class, responseContainer = "Json")
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAppsRestfulVersionController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAppsRestfulVersionController.java
new file mode 100644 (file)
index 0000000..588a888
--- /dev/null
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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.controller;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.onap.portalapp.annotation.ApiVersion;
+import org.onap.portalapp.portal.logging.aop.EPAuditLog;
+import org.onap.portalapp.portal.transport.EpNotificationItem;
+import org.onap.portalapp.portal.transport.FavoritesFunctionalMenuItemJson;
+import org.onap.portalapp.portal.transport.FunctionalMenuItem;
+import org.onap.portalsdk.core.onboarding.crossapi.PortalAPIResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
+@EPAuditLog
+@ApiVersion
+public class ExternalAppsRestfulVersionController implements BasicAuthenticationController {
+       
+    @Autowired
+       ExternalAppsRestfulController externalAppsRestfulController = new ExternalAppsRestfulController();
+
+       @ApiVersion(max = "v3", service = "/v3/publishNotification", min = 0,method = "POST")
+       public PortalAPIResponse publishNotification(HttpServletRequest request,HttpServletResponse response, EpNotificationItem notificationItem)
+                       throws Exception {
+               return externalAppsRestfulController.publishNotification(request, notificationItem);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/getFavorites", min = 0,method = "GET")
+       public List<FavoritesFunctionalMenuItemJson> getFavoritesForUser(HttpServletRequest request,
+                       HttpServletResponse response) throws Exception {
+               return externalAppsRestfulController.getFavoritesForUser(request, response);
+       }
+       
+       @ApiVersion(max = "v3", service = "/v3/functionalMenuItemsForUser", min = 0,method = "GET")
+       public List<FunctionalMenuItem> getFunctionalMenuItemsForUser(HttpServletRequest request,
+                       HttpServletResponse response) throws Exception {
+               return externalAppsRestfulController.getFunctionalMenuItemsForUser(request, response);
+       }
+
+}
index afb5de1..f1628e0 100644 (file)
@@ -48,6 +48,7 @@ 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.RestController;
+import org.onap.music.main.MusicUtil;
 import org.onap.portalapp.controller.EPUnRestrictedBaseController;
 import org.onap.portalapp.portal.listener.HealthMonitor;
 import org.onap.portalapp.portal.logging.aop.EPAuditLog;
@@ -177,17 +178,29 @@ public class HealthCheckController extends EPUnRestrictedBaseController {
                                dbInfo.dbPermissions = statusOk;
                        }
                        statusCollection.add(dbInfo);
+                       
+                       HealthStatusInfo CassandraStatusInfo = new HealthStatusInfo("Music-Cassandra");
+                       //CassandraStatusInfo.hostName = EcompPortalUtils.getMyHostName();
+                       CassandraStatusInfo.ipAddress = MusicUtil.getMyCassaHost();
+                       
+                       if (!HealthMonitor.isCassandraStatusOk()) {
+                               overallStatus = false;
+                               CassandraStatusInfo.healthCheckStatus = statusDown;
+                               CassandraStatusInfo.description = "Check the logs for more details";
+                               EPLogUtil.logEcompError(logger, EPAppMessagesEnum.MusicHealthCheckCassandraError);
+                       }
+                       statusCollection.add(CassandraStatusInfo);
 
-                       HealthStatusInfo uebInfo = new HealthStatusInfo("UEB");
-                       if (!HealthMonitor.isUebUp()) {
-                               // As per test case review meeting, UEB is considered as
-                               // critical as DB. Hence commenting
-                               // overallStatus = false;
-                               uebInfo.healthCheckStatus = statusDown;
-                               uebInfo.description = "Check the logs for more details";
-                               EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeUebConnectionError);
+                       HealthStatusInfo zookeeperStatusInfo = new HealthStatusInfo("Music-zookeeper");
+                       //zookeeperStatusInfo.hostName = EcompPortalUtils.getMyHostName();
+                       zookeeperStatusInfo.ipAddress = MusicUtil.getMyZkHost();
+                       if (!HealthMonitor.isZookeeperStatusOk()) {
+                               overallStatus = false;
+                               zookeeperStatusInfo.healthCheckStatus = statusDown;
+                               zookeeperStatusInfo.description = "Check the logs for more details";
+                               EPLogUtil.logEcompError(logger, EPAppMessagesEnum.MusicHealthCheckZookeeperError);
                        }
-                       statusCollection.add(uebInfo);
+                       statusCollection.add(zookeeperStatusInfo);
 
                        String json = "";
                        try {
index a9f523b..4956e3f 100644 (file)
@@ -60,6 +60,7 @@ import org.onap.portalapp.portal.domain.EPUser;
 import org.onap.portalapp.portal.domain.EcompAuditLog;
 import org.onap.portalapp.portal.ecomp.model.PortalRestResponse;
 import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum;
+import org.onap.portalapp.portal.ecomp.model.UploadRoleFunctionExtSystem;
 import org.onap.portalapp.portal.exceptions.DuplicateRecordException;
 import org.onap.portalapp.portal.exceptions.InvalidApplicationException;
 import org.onap.portalapp.portal.exceptions.InvalidRoleException;
@@ -78,7 +79,6 @@ import org.onap.portalapp.portal.utils.PortalConstants;
 import org.onap.portalapp.util.EPUserUtils;
 import org.onap.portalsdk.core.domain.AuditLog;
 import org.onap.portalsdk.core.domain.Role;
-import org.onap.portalsdk.core.domain.RoleFunction;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.service.AuditService;
 import org.onap.portalsdk.core.util.SystemProperties;
@@ -194,7 +194,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                                mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
                                CentralV2Role domainRole = externalAccessRolesService.getRoleInfo(roleId, requestedApp.getUebKey());
                                // role. toggle active ind
-                               boolean active = domainRole.isActive();
+                               boolean active = domainRole.getActive();
                                domainRole.setActive(!active);
 
                                String result = mapper.writeValueAsString(domainRole);
@@ -329,6 +329,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                                                domainRole = new CentralV2Role();
                                                domainRole.setName(role.getName());
                                                domainRole.setPriority(role.getPriority());
+                                               domainRole.setActive(role.getActive());
                                                if (role.getChildRoles() != null && role.getChildRoles().size() > 0) {
                                                        for (Object childRole : childRoles) {
                                                                domainRole.addChildRole((CentralV2Role) childRole);
@@ -528,27 +529,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                                                String activityCode = (isSave)
                                                                ? EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_ADD_FUNCTION
                                                                : EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_UPDATE_FUNCTION;
-                                               logger.info(EELFLoggerDelegate.applicationLogger,
-                                                               "saveRoleFunction: succeeded for app {}, function {}", app.getId(), code);
-                                               AuditLog auditLog = getAuditInfo(requestedUser, activityCode);
-                                               auditLog.setComments(EcompPortalUtils.truncateString("saveRoleFunction role for app:"
-                                                               + app.getId() + " and function:'" + code + "'",
-                                                               PortalConstants.AUDIT_LOG_COMMENT_SIZE));
-                                               auditService.logActivity(auditLog, null);
-                                               MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP,
-                                                               EPEELFLoggerAdvice.getCurrentDateTimeUTC());
-                                               MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP,
-                                                               EPEELFLoggerAdvice.getCurrentDateTimeUTC());
-                                               EcompPortalUtils.calculateDateTimeDifferenceForLog(
-                                                               MDC.get(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP),
-                                                               MDC.get(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP));
-                                               logger.info(EELFLoggerDelegate.auditLogger,
-                                                               EPLogUtil.formatAuditLogMessage("RoleManageController.saveRoleFunction", activityCode,
-                                                                               String.valueOf(requestedUser.getId()), requestedUser.getOrgUserId(),
-                                                                               code));
-                                               MDC.remove(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP);
-                                               MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP);
-                                               MDC.remove(SystemProperties.MDC_TIMER);
+                                               logExterlaAuthRoleFunctionActivity(code, requestedUser, app, activityCode);
                                        }
                                } else
                                        throw new NonCentralizedAppException(requestedApp.getName() + " is not Centralized Application");
@@ -564,6 +545,30 @@ public class RoleManageController extends EPRestrictedBaseController {
                }
                return new PortalRestResponse<>(PortalRestStatusEnum.OK, "Saved Successfully!", "Success");
        }
+       
+       private void logExterlaAuthRoleFunctionActivity(String code, EPUser requestedUser, EPApp app, String activityCode) {
+               logger.info(EELFLoggerDelegate.applicationLogger,
+                               "saveRoleFunction: succeeded for app {}, function {}", app.getId(), code);
+               AuditLog auditLog = getAuditInfo(requestedUser, activityCode);
+               auditLog.setComments(EcompPortalUtils.truncateString("saveRoleFunction role for app:"
+                               + app.getId() + " and function:'" + code + "'",
+                               PortalConstants.AUDIT_LOG_COMMENT_SIZE));
+               auditService.logActivity(auditLog, null);
+               MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP,
+                               EPEELFLoggerAdvice.getCurrentDateTimeUTC());
+               MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP,
+                               EPEELFLoggerAdvice.getCurrentDateTimeUTC());
+               EcompPortalUtils.calculateDateTimeDifferenceForLog(
+                               MDC.get(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP),
+                               MDC.get(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP));
+               logger.info(EELFLoggerDelegate.auditLogger,
+                               EPLogUtil.formatAuditLogMessage("RoleManageController.saveRoleFunction", activityCode,
+                                               String.valueOf(requestedUser.getId()), requestedUser.getOrgUserId(),
+                                               code));
+               MDC.remove(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP);
+               MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP);
+               MDC.remove(SystemProperties.MDC_TIMER);
+       }
 
 
 
@@ -733,7 +738,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                Iterator<CentralV2Role> availableChildRolesIterator = availableChildRoles.iterator();
                while (availableChildRolesIterator.hasNext()) {
                        CentralV2Role role = availableChildRolesIterator.next();
-                       if (!role.isActive() || allParentRoles.contains(role) || role.getId().equals(roleId)) {
+                       if (!role.getActive() || allParentRoles.contains(role) || role.getId().equals(roleId)) {
                                availableChildRolesIterator.remove();
                        }
                }
@@ -784,4 +789,29 @@ public class RoleManageController extends EPRestrictedBaseController {
                EcompPortalUtils.setBadPermissions(user, response, "createAdmin");
                response.getWriter().write("Unauthorized User");
        }
+       
+       @RequestMapping(value = { "/portalApi/uploadRoleFunction/{appId}" }, method = RequestMethod.POST, produces = "application/json")
+       public PortalRestResponse<String> bulkUploadRoleFunc(HttpServletRequest request, HttpServletResponse response,
+                       @RequestBody UploadRoleFunctionExtSystem data, @PathVariable("appId") Long appId) {
+               EPUser user = EPUserUtils.getUserSession(request);
+               try {
+                       EPApp app = appService.getApp(appId);
+                       if (isAuthorizedUser(user, app)) {
+                               fieldsValidation(app);
+                               externalAccessRolesService.bulkUploadRoleFunc(data, app);
+                               String activityCode =  EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_UPDATE_ROLE_AND_FUNCTION;
+                               String code = data.getName()+","+data.getType()+ PIPE + data.getInstance() + PIPE + data.getAction();
+                               logExterlaAuthRoleFunctionActivity(code , user, app, activityCode);
+                       } else {
+                               logger.info(EELFLoggerDelegate.auditLogger,
+                                               "RoleManageController.syncRoles, Unauthorized user:" + user.getOrgUserId());
+                               EcompPortalUtils.setBadPermissions(user, response, "createAdmin");
+                               return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, "Unauthorized User", "Failure");
+                       }
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "Failed bulkUploadRoleFunc!", e);
+                       return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed");
+               }
+               return new PortalRestResponse<>(PortalRestStatusEnum.OK, "Uploaded Role Function successfully!", "Success");
+       }
 }
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RolesApprovalSystemVersionController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RolesApprovalSystemVersionController.java
new file mode 100644 (file)
index 0000000..404fb31
--- /dev/null
@@ -0,0 +1,75 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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.controller;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.onap.portalapp.annotation.ApiVersion;
+import org.onap.portalapp.externalsystemapproval.model.ExternalSystemUser;
+import org.onap.portalapp.portal.ecomp.model.PortalRestResponse;
+import org.onap.portalapp.portal.logging.aop.EPAuditLog;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
+@EPAuditLog
+@ApiVersion
+public class RolesApprovalSystemVersionController implements BasicAuthenticationController {
+       
+       @Autowired
+       RolesApprovalSystemController rolesApprovalSystemController;
+       
+       @ApiVersion(max = "v3", service = "/v3/userProfile", min = 0, method = "POST")
+       public PortalRestResponse<String> postUserProfile(HttpServletRequest request,
+                       HttpServletResponse response, ExternalSystemUser extSysUser) {
+               return rolesApprovalSystemController.postUserProfile(request, extSysUser, response);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/userProfile", min = 0, method = "PUT")
+       public PortalRestResponse<String> putUserProfile(HttpServletRequest request,
+                         HttpServletResponse response,  ExternalSystemUser extSysUser) {
+               return rolesApprovalSystemController.putUserProfile(request, extSysUser, response);
+       }
+       
+       @ApiVersion(max = "v3", service = "/v3/userProfile", min = 0, method = "DELETE")
+       public PortalRestResponse<String> deleteUserProfile(HttpServletRequest request,
+                         HttpServletResponse response ,ExternalSystemUser extSysUser) {
+               return rolesApprovalSystemController.deleteUserProfile(request, extSysUser, response);
+       }
+}
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RolesController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RolesController.java
new file mode 100644 (file)
index 0000000..c61fb43
--- /dev/null
@@ -0,0 +1,207 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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.controller;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.onap.portalapp.annotation.ApiVersion;
+import org.onap.portalapp.portal.domain.CentralV2RoleFunction;
+import org.onap.portalapp.portal.ecomp.model.PortalRestResponse;
+import org.onap.portalapp.portal.logging.aop.EPAuditLog;
+import org.onap.portalapp.portal.transport.CentralUser;
+import org.onap.portalapp.portal.transport.CentralV2Role;
+import org.onap.portalsdk.core.domain.Role;
+import org.onap.portalsdk.core.domain.RoleFunction;
+import org.onap.portalsdk.core.restful.domain.EcompRole;
+import org.onap.portalsdk.core.restful.domain.EcompUser;
+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.RequestMethod;
+
+import io.swagger.annotations.ApiOperation;
+
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
+@EPAuditLog
+@ApiVersion
+public class RolesController implements BasicAuthenticationController {
+
+       final String LOGINID_PATTERN = "/v3/user/[a-zA-Z0-9]{1,25}$";
+       final String FUNCTION_CD_PATTERN = "/v3/function/[a-zA-Z0-9_-]{1,75}$";
+
+       final String DELETE_ROLEFUNCTION = "/v3/roleFunction/[a-zA-Z0-9_-]{1,75}$";
+
+       @Autowired
+       ExternalAccessRolesController externalAccessRolesController = new ExternalAccessRolesController();
+
+       @ApiOperation(value = "Gets roles for an application which is upgraded to newer version.", response = CentralV2Role.class, responseContainer = "Json")
+       @ApiVersion(max = "v3", service = "/v3/roles", min = 0, method = "GET")
+       public List<CentralV2Role> getV2RolesForApp(HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+               return externalAccessRolesController.getV2RolesForApp(request, response);
+       }
+
+       @ApiVersion(max = "v3", service = LOGINID_PATTERN, min = 0, method = "GET")
+       public String getV2UserList(HttpServletRequest request, HttpServletResponse response, String loginId)
+                       throws Exception {
+               return externalAccessRolesController.getV2UserList(request, response, loginId);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/role", min = 0, method = "POST")
+       public PortalRestResponse<String> saveRole(HttpServletRequest request, HttpServletResponse response, Role role)
+                       throws Exception {
+               return externalAccessRolesController.saveRole(request, response, role);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/role/[0-9]{1,25}$", min = 0, method = "GET")
+       public CentralV2Role getV2RoleInfo(HttpServletRequest request, HttpServletResponse response, Long roleId)
+                       throws Exception {
+               return externalAccessRolesController.getV2RoleInfo(request, response, roleId);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/users", min = 0, method = "GET")
+       public List<EcompUser> getUsersOfApplication(HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+               return externalAccessRolesController.getUsersOfApplication(request, response);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/functions", min = 0, method = "GET")
+       public List<CentralV2RoleFunction> getRoleFunctionsList(HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+               return externalAccessRolesController.getV2RoleFunctionsList(request, response);
+       }
+
+       @ApiVersion(max = "v3", service = FUNCTION_CD_PATTERN, min = 0, method = "GET")
+       public CentralV2RoleFunction getRoleFunction(HttpServletRequest request, HttpServletResponse response, String code)
+                       throws Exception {
+               return externalAccessRolesController.getV2RoleFunction(request, response, code);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/roleFunction", min = 0, method = "POST")
+       public PortalRestResponse<String> saveRoleFunction(HttpServletRequest request, HttpServletResponse response,
+                       String roleFunc) throws Exception {
+               return externalAccessRolesController.saveRoleFunction(request, response, roleFunc);
+       }
+
+       @ApiVersion(max = "v3", service = DELETE_ROLEFUNCTION, min = 0, method = "DELETE")
+       public PortalRestResponse<String> deleteRoleFunction(HttpServletRequest request, HttpServletResponse response,
+                       String code) throws Exception {
+               return externalAccessRolesController.deleteRoleFunction(request, response, code);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/deleteRole/[0-9]{1,25}$", min = 0, method = "DELETE")
+       public PortalRestResponse<String> deleteRole(HttpServletRequest request, HttpServletResponse response, Long roleId)
+                       throws Exception {
+               return externalAccessRolesController.deleteRole(request, response, roleId);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/activeRoles", min = 0, method = "GET")
+       public List<CentralV2Role> getV2ActiveRoles(HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+               return externalAccessRolesController.getV2ActiveRoles(request, response);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/upload/portal/functions", min = 0, method = "POST")
+       public PortalRestResponse<String> bulkUploadFunctions(HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+               return externalAccessRolesController.bulkUploadFunctions(request, response);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/upload/portal/roles", min = 0, method = "POST")
+       public PortalRestResponse<String> bulkUploadRoles(HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+               return externalAccessRolesController.bulkUploadRoles(request, response);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/upload/portal/roleFunctions", min = 0, method = "POST")
+       public PortalRestResponse<String> bulkUploadRoleFunctions(HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+               return externalAccessRolesController.bulkUploadRoleFunctions(request, response);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/upload/portal/userRoles", min = 0, method = "POST")
+       public PortalRestResponse<String> bulkUploadUserRoles(HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+               return externalAccessRolesController.bulkUploadUserRoles(request, response);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/upload/portal/userRole/[0-9]{1,25}$", min = 0, method = "POST")
+       public PortalRestResponse<String> bulkUploadUsersSingleRole(HttpServletRequest request,
+                       HttpServletResponse response, Long roleId) throws Exception {
+               return externalAccessRolesController.bulkUploadUsersSingleRole(request, response, roleId);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/upload/partner/functions", min = 0, method = "POST")
+       public PortalRestResponse<String> bulkUploadPartnerFunctions(HttpServletRequest request,
+                       HttpServletResponse response) throws Exception {
+               return externalAccessRolesController.bulkUploadPartnerFunctions(request, response);
+       }
+//not using this
+       @ApiVersion(max = "v3", service = "/v3/upload/partner/roles", min = 0, method = "POST")
+       public PortalRestResponse<String> bulkUploadPartnerRoles(HttpServletRequest request, HttpServletResponse response,
+                       List<Role> upload) throws Exception {
+               return externalAccessRolesController.bulkUploadPartnerRoles(request, response, upload);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/upload/partner/roleFunctions", min = 0, method = "POST")
+       public PortalRestResponse<String> bulkUploadPartnerRoleFunctions(HttpServletRequest request,
+                       HttpServletResponse response) throws Exception {
+               return externalAccessRolesController.bulkUploadPartnerRoleFunctions(request, response);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/menuFunctions", min = 0, method = "GET")
+       public List<String> getMenuFunctions(HttpServletRequest request, HttpServletResponse response) throws Exception {
+               return externalAccessRolesController.getMenuFunctions(request, response);
+       }
+
+       @ApiVersion(max = "v4", service = "/v4/user/[a-zA-Z0-9]{1,25}$", min = 0, method = "GET")
+       public String getEcompUser(HttpServletRequest request, HttpServletResponse response, String loginId)
+                       throws Exception {
+               return externalAccessRolesController.getEcompUser(request, response, loginId);
+       }
+
+       @ApiVersion(max = "v4", service = "/v4/roles", min = 0, method = "GET")
+       public List<EcompRole> getEcompRolesOfApplication(HttpServletRequest request, HttpServletResponse response)
+                       throws Exception {
+               return externalAccessRolesController.getEcompRolesOfApplication(request, response);
+       }
+}
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/TicketEventVersionController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/TicketEventVersionController.java
new file mode 100644 (file)
index 0000000..cd87507
--- /dev/null
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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.controller;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.onap.portalapp.annotation.ApiVersion;
+import org.onap.portalapp.portal.ecomp.model.PortalRestResponse;
+import org.onap.portalapp.portal.logging.aop.EPAuditLog;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
+@EPAuditLog
+@ApiVersion
+public class TicketEventVersionController implements BasicAuthenticationController {
+
+       @Autowired
+       TicketEventController ticketEventController;
+
+       @ApiVersion(max = "v3", service = "/v3/ticketevent", min = 0, method = "POST")
+       public PortalRestResponse<String> handleRequest(HttpServletRequest request, HttpServletResponse response,
+                       String ticketEventJson) throws Exception {
+               return ticketEventController.handleRequest(request, response, ticketEventJson);
+       }
+
+}
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WebAnalyticsExtAppVersionController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WebAnalyticsExtAppVersionController.java
new file mode 100644 (file)
index 0000000..952ca75
--- /dev/null
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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.controller;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.onap.portalapp.annotation.ApiVersion;
+import org.onap.portalapp.portal.logging.aop.EPAuditLog;
+import org.onap.portalapp.portal.transport.Analytics;
+import org.onap.portalsdk.core.onboarding.crossapi.PortalAPIResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
+@EPAuditLog
+@ApiVersion
+public class WebAnalyticsExtAppVersionController {
+
+       @Autowired
+       WebAnalyticsExtAppController webAnalyticsExtAppController;
+
+       @ApiVersion(max = "v3", service = "/v3/analytics", min = 0,method = "GET")
+       public String getAnalyticsScript(HttpServletRequest request, HttpServletResponse response) throws Exception {
+               return webAnalyticsExtAppController.getAnalyticsScript(request);
+       }
+
+       @ApiVersion(max = "v3", service = "/v3/storeAnalytics", min = 0,method = "POST")
+       public PortalAPIResponse storeAnalyticsScript(HttpServletRequest request, HttpServletResponse response, Analytics analyticsMap) throws Exception {
+               return webAnalyticsExtAppController.storeAnalyticsScript(request, analyticsMap);
+       }
+
+}
index f43930f..d05fe01 100644 (file)
@@ -49,6 +49,7 @@ import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.commons.lang.StringUtils;
 import org.onap.portalapp.controller.EPRestrictedBaseController;
 import org.onap.portalapp.portal.domain.EPUser;
 import org.onap.portalapp.portal.domain.MicroserviceParameter;
@@ -62,6 +63,7 @@ import org.onap.portalapp.portal.logging.aop.EPAuditLog;
 import org.onap.portalapp.portal.service.ConsulHealthService;
 import org.onap.portalapp.portal.service.MicroserviceService;
 import org.onap.portalapp.portal.service.WidgetParameterService;
+import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
 import org.onap.portalapp.portal.utils.EcompPortalUtils;
 import org.onap.portalapp.util.EPUserUtils;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
@@ -98,6 +100,8 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
        private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetsCatalogController.class);
 
        private static final String MS_WIDGET_LOCAL_PORT = "microservices.widget.local.port";
+       
+       private static final String UNAUTHORIZED_OR_FORBIDDEN_FOR_A_DISABLED_USER = "Unauthorized or  Forbidden for a disabled user";
 
        private RestTemplate template = new RestTemplate();
 
@@ -135,7 +139,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
                        ResponseEntity<List> ans = template.exchange(
                                        EcompPortalUtils.widgetMsProtocol() + "://"
                                                        + consulHealthService.getServiceLocation(whatService,
-                                                                       SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT))
+                                                                       SystemProperties.getProperty(EPCommonSystemProperties.MS_WIDGET_LOCAL_PORT))
                                                        + "/widget/microservices/widgetCatalog/" + loginName,
                                        HttpMethod.GET, new HttpEntity<>(WidgetServiceHeaders.getInstance()), List.class);
                        widgets = ans.getBody();
@@ -155,7 +159,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
                        ResponseEntity<List> ans = template.exchange(
                                        EcompPortalUtils.widgetMsProtocol() + "://"
                                                        + consulHealthService.getServiceLocation(whatService,
-                                                                       SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT))
+                                                                       SystemProperties.getProperty(EPCommonSystemProperties.MS_WIDGET_LOCAL_PORT))
                                                        + "/widget/microservices/widgetCatalog",
                                        HttpMethod.GET, new HttpEntity<>(WidgetServiceHeaders.getInstance()), List.class);
                        widgets = ans.getBody();
@@ -215,7 +219,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
                        respond = template.postForObject(
                                        EcompPortalUtils.widgetMsProtocol() + "://"
                                                        + consulHealthService.getServiceLocation(whatService,
-                                                                       SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT))
+                                                                       SystemProperties.getProperty(EPCommonSystemProperties.MS_WIDGET_LOCAL_PORT))
                                                        + "/widget/microservices/widgetCatalog/" + widgetId,
                                        new HttpEntity<>(multipartRequest, WidgetServiceHeaders.getInstance()), String.class);
                        File f = new File(tmpFolderName + fileName);
@@ -236,6 +240,12 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
        @RequestMapping(value = { "/portalApi/microservices/widgetCatalog" }, method = RequestMethod.POST)
        public String createWidgetCatalog(HttpServletRequest request)
                        throws Exception {
+               
+               if (StringUtils.isNotBlank(SystemProperties.getProperty(EPCommonSystemProperties.MS_WIDGET_UPLOAD_FLAG))
+                               && SystemProperties.getProperty(EPCommonSystemProperties.MS_WIDGET_UPLOAD_FLAG).equalsIgnoreCase("false")) {
+                       return UNAUTHORIZED_OR_FORBIDDEN_FOR_A_DISABLED_USER;
+               }
+               
                MultipartHttpServletRequest mRequest;
                MultiValueMap<String, Object> multipartRequest = new LinkedMultiValueMap<>();
                String fileName;
@@ -260,7 +270,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
                        respond = template.postForObject(
                                        EcompPortalUtils.widgetMsProtocol() + "://"
                                                        + consulHealthService.getServiceLocation(whatService,
-                                                                       SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT))
+                                                                       SystemProperties.getProperty(EPCommonSystemProperties.MS_WIDGET_LOCAL_PORT))
                                                        + "/widget/microservices/widgetCatalog",
                                        new HttpEntity<>(multipartRequest, WidgetServiceHeaders.getInstance()), String.class);
                        File f = new File(tmpFolderName + fileName);
@@ -314,7 +324,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
                Long serviceId = template.exchange(
                                EcompPortalUtils.widgetMsProtocol() + "://"
                                                + consulHealthService.getServiceLocation(whatService,
-                                                               SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT))
+                                                               SystemProperties.getProperty(EPCommonSystemProperties.MS_WIDGET_LOCAL_PORT))
                                                + "/widget/microservices/widgetCatalog/parameters/" + widgetId,
                                HttpMethod.GET, new HttpEntity<>(WidgetServiceHeaders.getInstance()), Long.class).getBody();
                if (serviceId == null) {
@@ -361,7 +371,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
                                .exchange(
                                                EcompPortalUtils.widgetMsProtocol() + "://"
                                                                + consulHealthService.getServiceLocation(whatService,
-                                                                               SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT))
+                                                                               SystemProperties.getProperty(EPCommonSystemProperties.MS_WIDGET_LOCAL_PORT))
                                                                + "/widget/microservices/download/" + widgetId,
                                                HttpMethod.GET, new HttpEntity<>(WidgetServiceHeaders.getInstance()), byte[].class)
                                .getBody();
@@ -414,4 +424,16 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
                }
                return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "SUCCESS", "");
        }
+       
+       @RequestMapping(value = { "/portalApi/microservices/uploadFlag" }, method = RequestMethod.GET)
+       public String getUploadFlag() {
+            String uplaodFlag="";
+               try {
+                       uplaodFlag = SystemProperties.getProperty(EPCommonSystemProperties.MS_WIDGET_UPLOAD_FLAG);
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "uploadFlag failed", e);
+                       return null;
+               }
+               return uplaodFlag;
+       }
 }
index 64ed4ac..f0dd7b2 100644 (file)
  */
 package org.onap.portalapp.portal.domain;
 
+import org.onap.portalsdk.core.domain.support.DomainVo;
 
 @SuppressWarnings("rawtypes")
-public class EPUserApp implements java.io.Serializable, Comparable {
+public class EPUserApp extends DomainVo implements java.io.Serializable, Comparable {
 
        private static final long serialVersionUID = 1L;
        
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/UploadRoleFunctionExtSystem.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/UploadRoleFunctionExtSystem.java
new file mode 100644 (file)
index 0000000..d7f86e1
--- /dev/null
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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.ecomp.model;
+
+import java.io.Serializable;
+
+public class UploadRoleFunctionExtSystem implements Serializable{
+       
+       private static final long serialVersionUID = -5543202387278296091L;
+       private String roleName;
+       private String type;
+       private String instance;
+       private String action;
+       private String name;
+       private boolean isGlobalRolePartnerFunc;
+       
+       public String getRoleName() {
+               return roleName;
+       }
+       public void setRoleName(String roleName) {
+               this.roleName = roleName;
+       }
+       public String getType() {
+               return type;
+       }
+       public void setType(String type) {
+               this.type = type;
+       }
+       public String getInstance() {
+               return instance;
+       }
+       public void setInstance(String instance) {
+               this.instance = instance;
+       }
+       public String getAction() {
+               return action;
+       }
+       public void setAction(String action) {
+               this.action = action;
+       }
+       public String getName() {
+               return name;
+       }
+       public void setName(String name) {
+               this.name = name;
+       }
+       public boolean getIsGlobalRolePartnerFunc() {
+               return isGlobalRolePartnerFunc;
+       }
+       public void setIsGlobalRolePartnerFunc(boolean isGlobalRolePartnerFunc) {
+               this.isGlobalRolePartnerFunc = isGlobalRolePartnerFunc;
+       }
+       
+       @Override
+       public String toString() {
+               return "UploadRoleFunctionExtSystem [roleName=" + roleName + ", type=" + type + ", instance=" + instance
+                               + ", action=" + action + ", name=" + name + ", isGlobalRolePartnerFunc=" + isGlobalRolePartnerFunc
+                               + "]";
+       }
+       
+       
+       
+}
index fcd1763..25ca5e6 100644 (file)
@@ -49,20 +49,20 @@ import java.util.stream.Collectors;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.commons.codec.binary.Hex;
 import org.onap.portalapp.controller.sessionmgt.SessionCommunicationController;
 import org.onap.portalapp.portal.controller.BasicAuthenticationController;
 import org.onap.portalapp.portal.controller.ExternalAppsRestfulController;
 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.EPRole;
 import org.onap.portalapp.portal.domain.EPUser;
 import org.onap.portalapp.portal.logging.aop.EPEELFLoggerAdvice;
 import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum;
 import org.onap.portalapp.portal.logging.logic.EPLogUtil;
 import org.onap.portalapp.portal.service.BasicAuthenticationCredentialService;
+import org.onap.portalapp.portal.service.ExternalAccessRolesService;
 import org.onap.portalapp.portal.utils.EcompPortalUtils;
 import org.onap.portalapp.service.RemoteWebServiceCallService;
 import org.onap.portalapp.service.sessionmgt.ManageService;
@@ -94,6 +94,8 @@ public class PortalResourceInterceptor extends ResourceInterceptor {
 
        @Autowired
        private BasicAuthenticationCredentialService basicAuthService;
+       @Autowired
+       private ExternalAccessRolesService externalAccessRolesService;
 
        @SuppressWarnings("unchecked")
        @Override
@@ -225,7 +227,8 @@ public class PortalResourceInterceptor extends ResourceInterceptor {
                uri = uri.substring(uri.indexOf("/", 1));
 
                final String authHeader = request.getHeader("Authorization");
-
+               final String uebkey = request.getHeader("uebkey");
+               
                // Unauthorized access due to missing HTTP Authorization request header
                if (authHeader == null) {
                        final String msg = "no authorization found";
@@ -242,6 +245,26 @@ public class PortalResourceInterceptor extends ResourceInterceptor {
                        return false;
                }
 
+               if(uebkey !=null && !uebkey.isEmpty())
+               {
+                       List<EPApp> app = externalAccessRolesService.getApp(uebkey);
+                       EPApp application = null;
+                       if (app.isEmpty()) {
+                               throw new Exception("Invalid uebkey!");
+                       }
+                       if (app.size() != 0 && !app.isEmpty()) {
+                               application = app.get(0);
+                       }
+                       if (application != null) {
+                               final String appUsername = application.getUsername();
+                               final String dbDecryptedPwd = CipherUtil.decryptPKC(application.getAppPassword());
+                               if (appUsername.equals(accountNamePassword[0]) && dbDecryptedPwd.equals(accountNamePassword[1])) {
+                                       return true;
+                               }
+                       }
+               }
+
+               
                BasicAuthCredentials creds;
                try {
                        creds = basicAuthService.getBasicAuthCredentialByUsernameAndPassword(accountNamePassword[0],
index 6c5810a..6f934e9 100644 (file)
  */
 package org.onap.portalapp.portal.listener;
 
+import java.io.IOException;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
+import java.util.UUID;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 
+import org.apache.commons.lang3.StringUtils;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.client.FourLetterWordMain;
 import org.hibernate.Query;
 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
+import org.onap.music.datastore.PreparedQueryObject;
+import org.onap.music.exceptions.MusicServiceException;
+import org.onap.music.main.MusicCore;
+import org.onap.music.main.MusicUtil;
+import org.onap.portalapp.music.util.MusicProperties;
 import org.onap.portalapp.portal.logging.aop.EPMetricsLog;
 import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum;
 import org.onap.portalapp.portal.logging.logic.EPLogUtil;
-import org.onap.portalapp.portal.ueb.EPUebHelper;
 import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.util.SystemProperties;
@@ -56,19 +67,23 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.EnableAspectJAutoProxy;
 import org.springframework.transaction.annotation.Transactional;
 
+
+
+
 @Transactional
 @org.springframework.context.annotation.Configuration
 @EnableAspectJAutoProxy
 @EPMetricsLog
 public class HealthMonitor {
 
-       private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HealthMonitor.class);
+       
+       ZooKeeper zookeeper = null;
+
+       private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HealthMonitor.class);
 
        @Autowired
        private SessionFactory sessionFactory;
 
-       @Autowired
-       private EPUebHelper epUebHelper;
 
        private static boolean databaseUp;
        private static boolean uebUp;
@@ -76,7 +91,9 @@ public class HealthMonitor {
        private static boolean backEndUp;
        private static boolean dbClusterStatusOk;
        private static boolean dbPermissionsOk;
-
+       private static boolean zookeeperStatusOk;
+       private static boolean cassandraStatusOk;
+       
        /**
         * Read directly by external classes.
         */
@@ -110,13 +127,22 @@ public class HealthMonitor {
        public static boolean isBackEndUp() {
                return backEndUp;
        }
+       
+       public static boolean isZookeeperStatusOk() {
+               return zookeeperStatusOk;
+       }
+
+       public static boolean isCassandraStatusOk() {
+               return cassandraStatusOk;
+       }
 
        private void monitorEPHealth() throws InterruptedException {
 
                int numIntervalsDatabaseHasBeenDown = 0;
                int numIntervalsClusterNotHealthy = 0;
                int numIntervalsDatabasePermissionsIncorrect = 0;
-               int numIntervalsUebHasBeenDown = 0;
+               int numIntervalsZookeeperNotHealthy = 0;
+               int numIntervalsCassandraNotHealthy = 0;
 
                logger.debug(EELFLoggerDelegate.debugLogger, "monitorEPHealth thread started");
 
@@ -168,26 +194,47 @@ public class HealthMonitor {
                                        numIntervalsDatabasePermissionsIncorrect = 0;
                                }
                        }
+                       
+                       zookeeperStatusOk = this.checkZookeeperStatus();
+                       if (zookeeperStatusOk == false) {
+                               if ((numIntervalsZookeeperNotHealthy % numIntervalsBetweenAlerts) == 0) {
+                                       logger.debug(EELFLoggerDelegate.debugLogger,
+                                                       "monitorEPHealth: cluster nodes down, logging to error log to trigger alert.");
+                                       EPLogUtil.logEcompError(logger, EPAppMessagesEnum.MusicHealthCheckZookeeperError);
+                                       numIntervalsZookeeperNotHealthy++;
+                               } else {
+                                       numIntervalsZookeeperNotHealthy = 0;
+                               }
+                       }
 
+                       cassandraStatusOk = this.checkCassandraStatus();
+                       if (cassandraStatusOk == false) {
+                               if ((numIntervalsCassandraNotHealthy % numIntervalsBetweenAlerts) == 0) {
+                                       logger.debug(EELFLoggerDelegate.debugLogger,
+                                                       "monitorEPHealth: cluster nodes down, logging to error log to trigger alert.");
+                                       EPLogUtil.logEcompError(logger, EPAppMessagesEnum.MusicHealthCheckCassandraError);
+                                       numIntervalsCassandraNotHealthy++;
+                               } else {
+                                       numIntervalsCassandraNotHealthy = 0;
+                               }
+                       }
+                       
                        //
                        // Get UEB status. Publish a bogus message to EP inbox, if 200 OK
                        // returned, status is Up.
                        // If down, signal alert once every X intervals.
                        // EP will ignore this bogus message.
-                       //
-                       uebUp = this.checkIfUebUp();
-                       if (uebUp == false) {
-
-                               if ((numIntervalsUebHasBeenDown % numIntervalsBetweenAlerts) == 0) {
-                                       logger.debug(EELFLoggerDelegate.debugLogger,
-                                                       "monitorEPHealth: UEB down, logging to error log to trigger alert");
-                                       // Write a Log entry that will generate an alert
-                                       EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeHealthCheckUebClusterError);
-                                       numIntervalsUebHasBeenDown++;
-                               } else {
-                                       numIntervalsUebHasBeenDown = 0;
-                               }
-                       }
+                       // Commenting this out as Dependency on UEB is being deprecated
+                       /*
+                        * uebUp = this.checkIfUebUp(); if (uebUp == false) {
+                        * 
+                        * if ((numIntervalsUebHasBeenDown % numIntervalsBetweenAlerts) == 0) {
+                        * logger.debug(EELFLoggerDelegate.debugLogger,
+                        * "monitorEPHealth: UEB down, logging to error log to trigger alert"); // Write
+                        * a Log entry that will generate an alert EPLogUtil.logEcompError(logger,
+                        * EPAppMessagesEnum.BeHealthCheckUebClusterError);
+                        * numIntervalsUebHasBeenDown++; } else { numIntervalsUebHasBeenDown = 0; } }
+                        */
 
                        // The front end should be up because the API is called through
                        // proxy front end server.
@@ -309,6 +356,71 @@ public class HealthMonitor {
                return isUp;
        }
 
+       private boolean checkZookeeperStatus() {
+
+               String[] zookeeperNodes = MusicUtil.getMyZkHost().split(",");
+               logger.info(EELFLoggerDelegate.applicationLogger, "MusicUtil.getMyZkHost()---- :" + MusicUtil.getMyZkHost());
+               for (int i = 0; i < zookeeperNodes.length; i++) {
+                       try {
+                               logger.info(EELFLoggerDelegate.applicationLogger, "server ip--zookeeper  :" + zookeeperNodes[i].trim());
+                               String[] iport = zookeeperNodes[i].split(":");
+                               String zkNodeStatistics = FourLetterWordMain.send4LetterWord(iport[0].trim(),
+                                               Integer.parseInt(iport[1].trim()), "stat");
+                               logger.info(EELFLoggerDelegate.applicationLogger,
+                                               "Getting Status for Zookeeper zkNodeStatistics :" + zkNodeStatistics);
+                               if (StringUtils.isNotBlank(zkNodeStatistics)) {
+                                       String state = zkNodeStatistics.substring(zkNodeStatistics.indexOf("Mode:"),
+                                                       zkNodeStatistics.indexOf("Node"));
+                                       logger.info(EELFLoggerDelegate.applicationLogger,
+                                                       "Getting Status for zookeeper :" + zookeeperNodes[i].trim() + ":------:" + state);
+                                       if (state.contains("leader"))
+                                               return true;
+                               }
+                       } catch (Exception e) {
+                               logger.error(EELFLoggerDelegate.errorLogger, "ZookeeperStatus Service is not responding", e.getCause());
+                       }
+               }
+
+               return false;
+       }
+
+
+       public boolean checkCassandraStatus() {
+               logger.info(EELFLoggerDelegate.applicationLogger, "Getting Status for Cassandra");
+               if (this.getAdminKeySpace()) {
+                       return true;
+               } else {
+                       logger.error(EELFLoggerDelegate.errorLogger, "Cassandra Service is not responding");
+                       return false;
+               }
+       }
+       
+       private Boolean getAdminKeySpace() {
+               String musicKeySpace = MusicProperties.getProperty(MusicProperties.MUSIC_SESSION_KEYSPACE );
+               //deletePortalHealthcheck(musicKeySpace);
+               PreparedQueryObject pQuery = new PreparedQueryObject();
+               pQuery.appendQueryString("insert into  "+musicKeySpace+".healthcheck (id) values (?)");
+               pQuery.addValue(UUID.randomUUID());
+               try {
+                        MusicCore.nonKeyRelatedPut(pQuery, MusicUtil.EVENTUAL);
+               } catch (MusicServiceException e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "getAdminKeySpace() failed", e.getCause());
+                       return Boolean.FALSE;
+               }
+                       return Boolean.TRUE;
+       }
+
+       
+       private void  deletePortalHealthcheck(String musicKeySpace) {
+               PreparedQueryObject pQuery = new PreparedQueryObject();
+               pQuery.appendQueryString("TRUNCATE  "+musicKeySpace+".healthcheck");
+               try {
+                       MusicCore.nonKeyRelatedPut(pQuery, MusicUtil.EVENTUAL);
+               } catch (MusicServiceException e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "deletePortalHealthcheck() failed", e.getCause());
+               }
+       }
+       
        private boolean checkDatabasePermissions() {
                boolean isUp = false;
                Session localSession = null;
@@ -348,17 +460,5 @@ public class HealthMonitor {
                }
                return isUp;
        }
-
-       private boolean checkIfUebUp() {
-               boolean uebUp = false;
-               try {
-                       boolean isAvailable = epUebHelper.checkAvailability();
-                       boolean messageCanBeSent = epUebHelper.MessageCanBeSentToTopic();
-                       uebUp = (isAvailable && messageCanBeSent);
-               } catch (Exception e) {
-                       logger.error(EELFLoggerDelegate.errorLogger, "checkIfUebUp failed", e);
-               }
-               return uebUp;
-       }
-
+       
 }
index 6274696..8062926 100644 (file)
@@ -83,7 +83,7 @@ public enum EPAppMessagesEnum {
        
        BeRestApiAuthenticationError(EPErrorCodesEnum.BERESTAPIAUTHENTICATIONERROR, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
                                                                "ERR101E", "Rejected an incoming REST API request due to invalid credentials", "", "Please check application credentials defined in Database or properties files."),
-       
+
        InternalAuthenticationInfo(EPErrorCodesEnum.INTERNALAUTHENTICATIONINFO_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO,
                                                                "ERR199I", "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."),
        
@@ -132,6 +132,11 @@ public enum EPAppMessagesEnum {
     BeHttpConnectionError(EPErrorCodesEnum.BEHTTPCONNECTIONERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
                                                                "ERR213E", "It could be that communication to an external application might resulted an exception or failed to reach the external application", 
                                                                "Details: {0}.", "Please check logs for more information."),
+       MusicHealthCheckZookeeperError(EPErrorCodesEnum.MUSICHEALTHCHECKZOOKEEPERERROR_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
+                                "ERR214E", "Connectivity to Music Cluster -zookeeper server", "Details: {0}.", "Please check zookeeper server list and check the logs for more information"),
+       
+    MusicHealthCheckCassandraError(EPErrorCodesEnum.MUSICHEALTHCHECKCASSANDRAERROR_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
+                                "ERR215E", "Connectivity to Music Cluster -Cassandra server", "Details: {0}.", "Please check Cassandra server list and check the logs for more information"),
     
     InternalConnectionInfo(EPErrorCodesEnum.INTERNALCONNECTIONINFO_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO,
                                                                "ERR299I", "Internal Connection problem", "Details: {0}.", "Please check logs for more information."),
index d672921..a93f772 100644 (file)
@@ -109,6 +109,8 @@ public enum EPErrorCodesEnum implements EELFResolvableErrorEnum {
        SCHEDULERAUX_ACCESS_AUTHENTICATIONERROR,
        SCHEDULER_ACCESS_GENERALERROR,
        SCHEDULER_INVALID_ATTRIBUTEERROR,
+       MUSICHEALTHCHECKZOOKEEPERERROR_ONE_ARGUMENT,
+       MUSICHEALTHCHECKCASSANDRAERROR_ONE_ARGUMENT,
        ;
        
        /**
index ac1f435..0522b39 100644 (file)
@@ -48,7 +48,6 @@ import javax.ws.rs.core.Response;
 
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.lang.StringUtils;
-import org.drools.compiler.lang.DRL5Expressions.neg_operator_key_return;
 import org.eclipse.jetty.util.security.Password;
 import org.json.simple.JSONObject;
 import org.onap.portalapp.portal.logging.logic.EPLogUtil;
index 599ada5..e0a2fe5 100644 (file)
  */
 package org.onap.portalapp.portal.scheduleraux;
 
+import java.lang.reflect.Type;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Collections;
 import java.util.Date;
 
+import javax.annotation.PostConstruct;
 import javax.ws.rs.client.Client;
 import javax.ws.rs.client.Entity;
 import javax.ws.rs.core.MediaType;
@@ -49,8 +51,10 @@ import javax.ws.rs.core.MultivaluedHashMap;
 import javax.ws.rs.core.Response;
 
 import org.apache.commons.codec.binary.Base64;
+import org.apache.cxf.jaxrs.impl.ResponseImpl;
 import org.eclipse.jetty.util.security.Password;
 import org.json.simple.JSONObject;
+import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum;
 import org.onap.portalapp.portal.logging.logic.EPLogUtil;
 import org.onap.portalapp.portal.scheduler.SchedulerProperties;
 import org.onap.portalapp.portal.scheduler.client.HttpBasicClient;
@@ -59,6 +63,14 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.client.HttpClientErrorException;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParseException;
+
 public class SchedulerAuxRestInterface extends SchedulerAuxRestInt implements SchedulerAuxRestInterfaceIfc {
 
        /** The logger. */
@@ -77,7 +89,27 @@ public class SchedulerAuxRestInterface extends SchedulerAuxRestInt implements Sc
                super();
        }
 
+       Gson gson = null;
+
+       private final ObjectMapper mapper = new ObjectMapper();
+
+       private void init() {
+               logger.debug(EELFLoggerDelegate.debugLogger, "initializing");
+               GsonBuilder builder = new GsonBuilder();
+
+               // Register an adapter to manage the date types as long values
+               builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
+                       public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
+                                       throws JsonParseException {
+                               return new Date(json.getAsJsonPrimitive().getAsLong());
+                       }
+               });
+
+               gson = builder.create();
+       }
+       
        public void initRestClient() {
+               init();
                final String methodname = "initRestClient()";
                final String mechId = SchedulerProperties.getProperty(SchedulerProperties.SCHEDULERAUX_CLIENT_MECHID_VAL);
                final String clientPassword = SchedulerProperties
@@ -234,7 +266,24 @@ public class SchedulerAuxRestInterface extends SchedulerAuxRestInt implements Sc
                                        // .header("X-FromAppId", sourceID)
                                        .post(Entity.entity(requestDetails, MediaType.APPLICATION_JSON));
 
-                       t = (T) cres.readEntity(t.getClass());
+                       /* It is not recommendable to use the implementation class org.apache.cxf.jaxrs.impl.ResponseImpl in the code, 
+                       but had to force this in-order to prevent conflict with the ResponseImpl class of Jersey Client which 
+                       doesn't work as expected. Created Portal-253 for tracking */
+                       String str = ((ResponseImpl)cres).readEntity(String.class);
+                       
+                       try {
+                               if(t.getClass().getName().equals(String.class.getName())){
+                                       t=(T) str;
+                                       
+                               }else{
+                                       t = (T) gson.fromJson(str, t.getClass());
+                               }
+                               
+                       } catch (Exception e) {
+                               EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeInvalidJsonInput, e);
+                       }
+                       
+                       //t = (T) cres.readEntity(t.getClass());
                        if (t.equals("")) {
                                restObject.set(null);
                        } else {
index e7ea662..c9f2c6e 100644 (file)
@@ -130,14 +130,14 @@ public class ApplicationsRestClientServiceImpl implements ApplicationsRestClient
                logger.debug(EELFLoggerDelegate.debugLogger, "http response status=" + status);
                MDC.put(EPCommonSystemProperties.EXTERNAL_API_RESPONSE_CODE, Integer.toString(status));
                if (!isHttpSuccess(status)) {
-                       String errMsg = "Failed. Status=" + status + "; [" + response.getStatusInfo().getReasonPhrase().toString()
+                       String errMsg = "Failed. Status=" + status + "; [" + ((ResponseImpl)response).getStatusInfo().getReasonPhrase().toString()
                                        + "]";
                        URL url = null;
                        try {
                                // must not be null to avoid NPE in HTTPException constructor
                                url = new URL("http://null");
-                               if (response.getLocation() != null)
-                                       url = response.getLocation().toURL();
+                               if (((ResponseImpl)response).getLocation() != null)
+                                       url = ((ResponseImpl)response).getLocation().toURL();
                        } catch (MalformedURLException e) {
                                // never mind. it is only for the debug message.
                                logger.warn(EELFLoggerDelegate.errorLogger, "Failed to build URL", e);
@@ -248,7 +248,7 @@ public class ApplicationsRestClientServiceImpl implements ApplicationsRestClient
                        
                        /* It is not recommendable to use the implementation class org.apache.cxf.jaxrs.impl.ResponseImpl in the code, 
                        but had to force this in-order to prevent conflict with the ResponseImpl class of Jersey Client which 
-                       doesn't work as expected. Created Portal-253 for tracking */
+                       doesn't work as expected. Created Portal-253 for tracking  */
                        String incomingJson = ((ResponseImpl)response).readEntity(String.class);
                        return incomingJson;
                }
index 1131308..d32229d 100644 (file)
@@ -98,4 +98,14 @@ public interface BasicAuthAccountService {
         * @throws Exception
         */
        void updateBasicAuthAccount(Long accountId, BasicAuthCredentials newCredential) throws Exception;
+       
+       /**
+        * Returns  BasicAuthenticationAccount 
+        * 
+        * @param accountId
+        * @return BasicAuthCredentials
+        * @throws Exception
+        */
+       
+       BasicAuthCredentials getBasicAuthCredentialsById(long id) throws Exception;
 }
index c83b0d9..a2ff314 100644 (file)
@@ -48,6 +48,7 @@ import org.onap.portalapp.portal.domain.BasicAuthCredentials;
 import org.onap.portalapp.portal.domain.EPEndpoint;
 import org.onap.portalapp.portal.domain.EPEndpointAccount;
 import org.onap.portalapp.portal.logging.aop.EPMetricsLog;
+import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.onboarding.util.CipherUtil;
 import org.onap.portalsdk.core.service.DataAccessService;
@@ -117,8 +118,13 @@ public class BasicAuthAccountServiceImpl implements BasicAuthAccountService{
        public void updateBasicAuthAccount(Long accountId, BasicAuthCredentials newCredential) throws Exception {
                try {
                        newCredential.setId(accountId);
-                       if (newCredential.getPassword() != null)
-                               newCredential.setPassword(encryptedPassword(newCredential.getPassword()));
+                       if (newCredential.getPassword() != null){
+                               if(newCredential.getPassword().equals(EPCommonSystemProperties.APP_DISPLAY_PASSWORD)){
+                                       BasicAuthCredentials oldMS = getBasicAuthCredentialsById(accountId);
+                                       newCredential.setPassword(oldMS.getPassword()); // keep the old password
+                               }else
+                                       newCredential.setPassword(encryptedPassword(newCredential.getPassword())); //new password
+                       }
                        getDataAccessService().saveDomainObject(newCredential, null);
                        
                        List<EPEndpoint> endpoints = newCredential.getEndpoints();
@@ -174,7 +180,7 @@ public class BasicAuthAccountServiceImpl implements BasicAuthAccountService{
                List<BasicAuthCredentials> list = (List<BasicAuthCredentials>) dataAccessService.getList(BasicAuthCredentials.class, null);
                for (int i = 0; i < list.size(); i++) {
                        if (list.get(i).getPassword() != null)
-                               list.get(i).setPassword(decryptedPassword(list.get(i).getPassword()));
+                               list.get(i).setPassword(EPCommonSystemProperties.APP_DISPLAY_PASSWORD);
                        list.get(i).setEndpoints(getEPEndpoints(list.get(i).getId()));
                }
                return list;
@@ -244,4 +250,22 @@ public class BasicAuthAccountServiceImpl implements BasicAuthAccountService{
        public DataAccessService getDataAccessService() {
                return dataAccessService;
        }
+       
+       @Override
+       public BasicAuthCredentials getBasicAuthCredentialsById(long id) throws Exception {
+               try {
+                       @SuppressWarnings("unchecked")
+                       List<BasicAuthCredentials> list = (List<BasicAuthCredentials>) dataAccessService
+                                       .getList(BasicAuthCredentials.class, null);
+                       for (BasicAuthCredentials auth : list) {
+                               if (auth != null && auth.getId() == id)
+                                       return auth;
+                       }
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "getBasicAuthCredentialsDataById failed", e);
+                       throw e;
+               }
+               return null;
+
+       }
 }
index 7f4b2ce..24572fb 100644 (file)
@@ -47,6 +47,7 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.UUID;
 
 import javax.annotation.PostConstruct;
 import javax.servlet.http.HttpServletResponse;
@@ -82,7 +83,6 @@ import org.onap.portalapp.portal.transport.FieldsValidator;
 import org.onap.portalapp.portal.transport.FunctionalMenuItem;
 import org.onap.portalapp.portal.transport.LocalRole;
 import org.onap.portalapp.portal.transport.OnboardingApp;
-import org.onap.portalapp.portal.ueb.EPUebHelper;
 import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
 import org.onap.portalapp.portal.utils.EcompPortalUtils;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
@@ -118,9 +118,7 @@ public class EPAppCommonServiceImpl implements EPAppService {
        @Autowired
        protected SessionFactory sessionFactory;
        @Autowired
-       private DataAccessService dataAccessService;
-       @Autowired
-       private EPUebHelper epUebHelper;        
+       private DataAccessService dataAccessService;    
 
        @PostConstruct
        private void init() {
@@ -666,6 +664,7 @@ public class EPAppCommonServiceImpl implements EPAppService {
                List<OnboardingApp> onboardingAppsList = new ArrayList<OnboardingApp>();
                for (EPApp app : apps) {
                        OnboardingApp onboardingApp = new OnboardingApp();
+                       app.setAppPassword(EPCommonSystemProperties.APP_DISPLAY_PASSWORD);//to hide password from get request
                        createOnboardingFromApp(app, onboardingApp);
                        onboardingAppsList.add(onboardingApp);
                }
@@ -680,6 +679,7 @@ public class EPAppCommonServiceImpl implements EPAppService {
                List<OnboardingApp> onboardingAppsList = new ArrayList<OnboardingApp>();
                for (EPApp app : apps) {
                        OnboardingApp onboardingApp = new OnboardingApp();
+                       app.setAppPassword(EPCommonSystemProperties.APP_DISPLAY_PASSWORD); //to hide password from get request
                        createOnboardingFromApp(app, onboardingApp);
                        onboardingAppsList.add(onboardingApp);
                }
@@ -1065,9 +1065,79 @@ public class EPAppCommonServiceImpl implements EPAppService {
                        
                }
        }
+       
 
        protected void updateRestrictedApp(Long appId, OnboardingApp onboardingApp, FieldsValidator fieldsValidator,
                        EPUser user) {
+               synchronized (syncRests) {
+                       boolean result = false;
+                       Session localSession = null;
+                       Transaction transaction = null;
+                       try {
+                               localSession = sessionFactory.openSession();
+                               transaction = localSession.beginTransaction();
+                               EPApp app;
+                               if (appId == null) {
+                                       app = new EPApp();
+                                       /*
+                                        * In the parent class, the UEB code is responsible for generating the
+                                        * keys/secret/mailbox but UEB Messaging is not actually being used currently;
+                                        * may be used in future at which point we can just remove this method and
+                                        * depend on parent class's method So, using UUID generator to generate the
+                                        * unique key instead.
+                                        */
+                                       String uuidStr = UUID.randomUUID().toString();
+                                       String appKey = uuidStr;
+                                       String appSecret = uuidStr;
+                                       String appMailboxName = "ECOMP-PORTAL-OUTBOX";
+                                       onboardingApp.setUebTopicName(appMailboxName);
+                                       onboardingApp.setUebKey(appKey);
+                                       onboardingApp.setUebSecret(appSecret);
+                               } else {
+                                       app = (EPApp) localSession.get(EPApp.class, appId);
+                                       if (app == null || app.getId() == null) {
+                                               // App is already deleted!
+                                               transaction.commit();
+                                               localSession.close();
+                                               fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_NOT_FOUND);
+                                               return;
+                                       }
+                               }
+                               logger.debug(EELFLoggerDelegate.debugLogger,
+                                               "updateRestrictedApp: about to call createAppFromOnboarding");
+                               createAppFromOnboarding(app, onboardingApp, localSession);
+                               logger.debug(EELFLoggerDelegate.debugLogger,
+                                               "updateRestrictedApp: finished calling createAppFromOnboarding");
+                               localSession.saveOrUpdate(app);
+                               logger.debug(EELFLoggerDelegate.debugLogger,
+                                               "updateRestrictedApp: finished calling localSession.saveOrUpdate");
+                               // Enable or disable all menu items associated with this app
+                               setFunctionalMenuItemsEnabled(localSession, onboardingApp.isEnabled, appId);
+                               logger.debug(EELFLoggerDelegate.debugLogger,
+                                               "updateRestrictedApp: finished calling setFunctionalMenuItemsEnabled");
+                               transaction.commit();
+                               logger.debug(EELFLoggerDelegate.debugLogger,
+                                               "updateRestrictedApp: finished calling transaction.commit");
+                               result = true;
+                       } catch (Exception e) {
+                               logger.error(EELFLoggerDelegate.errorLogger, "updateRestrictedApp failed", e);
+                               EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeUebRegisterOnboardingAppError, e);
+                               EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e);
+                               EcompPortalUtils.rollbackTransaction(transaction,
+                                               "updateRestrictedApp rollback, exception = " + e.toString());
+                       } finally {
+                               EcompPortalUtils.closeLocalSession(localSession, "updateRestrictedApp");
+                       }
+                       if (!result) {
+                               fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+                       }
+               }
+
+       }
+
+       @Deprecated
+       protected void updateRestrictedAppUeb(Long appId, OnboardingApp onboardingApp, FieldsValidator fieldsValidator,
+                       EPUser user) {
                synchronized (syncRests) {
                        boolean result = false;
                        Session localSession = null;
@@ -1234,7 +1304,6 @@ public class EPAppCommonServiceImpl implements EPAppService {
                                                "LR: updateApp: finished calling setFunctionalMenuItemsEnabled");
                                transaction.commit();
                                logger.debug(EELFLoggerDelegate.debugLogger, "LR: updateApp: finished calling transaction.commit");
-                               epUebHelper.addPublisher(app);
                                logger.debug(EELFLoggerDelegate.debugLogger,
                                                "LR: updateApp: finished calling epUebHelper.addPublisher");
                                result = true;
@@ -1282,7 +1351,7 @@ public class EPAppCommonServiceImpl implements EPAppService {
                onboardingApp.isOpen = app.getOpen();
                onboardingApp.isEnabled = app.getEnabled();
                onboardingApp.username = app.getUsername();
-               onboardingApp.appPassword = decryptedPassword(app.getAppPassword(), app);
+               onboardingApp.appPassword = (app.getAppPassword().equals(EPCommonSystemProperties.APP_DISPLAY_PASSWORD)) ? EPCommonSystemProperties.APP_DISPLAY_PASSWORD :decryptedPassword(app.getAppPassword(), app);
                onboardingApp.uebTopicName = app.getUebTopicName();
                onboardingApp.uebKey = app.getUebKey();
                onboardingApp.uebSecret = app.getUebSecret();
@@ -1313,8 +1382,9 @@ public class EPAppCommonServiceImpl implements EPAppService {
                app.setOpen(onboardingApp.isOpen);
                app.setEnabled(onboardingApp.isEnabled);
                app.setUsername(onboardingApp.username);
+               if(!onboardingApp.appPassword.equals(EPCommonSystemProperties.APP_DISPLAY_PASSWORD))
                app.setAppPassword(this.encryptedPassword(onboardingApp.appPassword, app));
-               app.setUebTopicName(onboardingApp.uebTopicName);
+               //app.setUebTopicName(onboardingApp.uebTopicName);
                app.setUebKey(onboardingApp.uebKey);
                app.setUebSecret(onboardingApp.uebSecret);
                app.setCentralAuth(onboardingApp.isCentralAuth);
@@ -1662,4 +1732,4 @@ public class EPAppCommonServiceImpl implements EPAppService {
                return userAndRoles;
                
        }
-}
+}
\ No newline at end of file
index 09c7cc4..170d432 100644 (file)
@@ -49,6 +49,7 @@ 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.ExternalRoleDetails;
+import org.onap.portalapp.portal.ecomp.model.UploadRoleFunctionExtSystem;
 import org.onap.portalapp.portal.exceptions.InvalidUserException;
 import org.onap.portalapp.portal.transport.CentralRole;
 import org.onap.portalapp.portal.transport.CentralRoleFunction;
@@ -56,8 +57,8 @@ import org.onap.portalapp.portal.transport.CentralUser;
 import org.onap.portalapp.portal.transport.CentralV2Role;
 import org.onap.portalapp.portal.transport.ExternalRequestFieldsValidator;
 import org.onap.portalsdk.core.domain.Role;
-import org.onap.portalsdk.core.domain.RoleFunction;
 import org.onap.portalsdk.core.restful.domain.EcompUser;
+import org.springframework.http.HttpEntity;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.client.HttpClientErrorException;
 
@@ -240,7 +241,7 @@ public interface ExternalAccessRolesService {
         * @param upload
         * @throws Exception
         */
-       public void bulkUploadPartnerFunctions(String uebkey, List<RoleFunction> upload) throws Exception;
+       public Integer bulkUploadPartnerFunctions(String uebkey) throws Exception;
 
        /** 
         * It uploads partner application role functions into external auth system
@@ -282,7 +283,7 @@ public interface ExternalAccessRolesService {
         * @param roleList
         * @throws Exception
         */
-       void bulkUploadPartnerRoleFunctions(String uebkey, List<Role> roleList) throws Exception;
+       Integer bulkUploadPartnerRoleFunctions(String uebkey) throws Exception;
 
        /**
         * it deletes all dependency role records 
@@ -452,5 +453,33 @@ public interface ExternalAccessRolesService {
         * @return String action
         */
        String getFunctionCodeAction(String roleFuncItem);
+       
+       /**
+        * 
+        * Adds function to role in external auth system
+        * 
+        * @param data
+        * @param app
+        */
+       void bulkUploadRoleFunc(UploadRoleFunctionExtSystem data, EPApp app) throws Exception;
+
+       /**
+        * 
+        * Syncs user roles from external auth system to ecomp portal 
+        * 
+        * @param orgUserId
+        * @throws Exception 
+        */
+       public void syncApplicationUserRolesFromExtAuthSystem(String orgUserId) throws Exception;
+
+       /**
+        * 
+        * Gets all user roles from external auth system
+        * 
+        * @param orgUserId
+        * @param getUserRolesEntity
+        * @return user roles from external auth system 
+        */
+       ResponseEntity<String> getUserRolesFromExtAuthSystem(String orgUserId, HttpEntity<String> getUserRolesEntity) throws Exception;
 
 }
index eb6d730..4c68fc9 100644 (file)
@@ -70,6 +70,7 @@ import org.onap.portalapp.portal.domain.EPRole;
 import org.onap.portalapp.portal.domain.EPUser;
 import org.onap.portalapp.portal.domain.EPUserApp;
 import org.onap.portalapp.portal.domain.ExternalRoleDetails;
+import org.onap.portalapp.portal.ecomp.model.UploadRoleFunctionExtSystem;
 import org.onap.portalapp.portal.exceptions.DeleteDomainObjectFailedException;
 import org.onap.portalapp.portal.exceptions.ExternalAuthSystemException;
 import org.onap.portalapp.portal.exceptions.InactiveApplicationException;
@@ -89,12 +90,14 @@ import org.onap.portalapp.portal.transport.CentralUserApp;
 import org.onap.portalapp.portal.transport.CentralV2Role;
 import org.onap.portalapp.portal.transport.CentralV2User;
 import org.onap.portalapp.portal.transport.CentralV2UserApp;
+import org.onap.portalapp.portal.transport.CentralizedAppRoles;
 import org.onap.portalapp.portal.transport.EcompUserRoles;
 import org.onap.portalapp.portal.transport.ExternalAccessPerms;
 import org.onap.portalapp.portal.transport.ExternalAccessPermsDetail;
 import org.onap.portalapp.portal.transport.ExternalAccessRole;
 import org.onap.portalapp.portal.transport.ExternalAccessRolePerms;
 import org.onap.portalapp.portal.transport.ExternalAccessUser;
+import org.onap.portalapp.portal.transport.ExternalAccessUserRoleDetail;
 import org.onap.portalapp.portal.transport.ExternalRequestFieldsValidator;
 import org.onap.portalapp.portal.transport.ExternalRoleDescription;
 import org.onap.portalapp.portal.transport.GlobalRoleWithApplicationRoleFunction;
@@ -2418,6 +2421,35 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                                addRoleInExternalSystem(role, app.get(0));
                                rolesListAdded++;
                        }
+                       if (!app.get(0).getId().equals(PortalConstants.PORTAL_APP_ID)) {
+                               // Add Account Admin role in External AUTH System
+                               try {
+                                       String addAccountAdminRole = "";
+                                       ExternalAccessRole extRole = new ExternalAccessRole();
+                                       extRole.setName(app.get(0).getNameSpace() + "." + PortalConstants.ADMIN_ROLE
+                                                       .replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"));
+                                       addAccountAdminRole = mapper.writeValueAsString(extRole);
+                                       HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth();
+                                       HttpEntity<String> entity = new HttpEntity<>(addAccountAdminRole, headers);
+                                       template.exchange(
+                                                       SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role",
+                                                       HttpMethod.POST, entity, String.class);
+                                       rolesListAdded++;
+                               } catch (HttpClientErrorException e) {
+                                       logger.error(EELFLoggerDelegate.errorLogger,
+                                                       "HttpClientErrorException - Failed to create Account Admin role", e);
+                                       EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode());
+                               } catch (Exception e) {
+                                       if (e.getMessage().equalsIgnoreCase("409 Conflict")) {
+                                               logger.error(EELFLoggerDelegate.errorLogger,
+                                                               "bulkUploadRoles: Account Admin Role already exits but does not break functionality",
+                                                               e);
+                                       } else {
+                                               logger.error(EELFLoggerDelegate.errorLogger,
+                                                               "bulkUploadRoles: Failed to create Account Admin role", e.getMessage());
+                                       }
+                               }
+                       }
                } catch (Exception e) {
                        logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRoles: failed", e);
                        throw e;
@@ -2488,14 +2520,24 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
         * @param app
         */
        private void addRoleFunctionsInExternalSystem(BulkUploadRoleFunction addRoleFunc, EPRole role, EPApp app) {
-               String checkType = addRoleFunc.getFunctionCd().contains("menu") ? "menu" : "url";
+               String type = "";
+               String instance = "";
+               String action = "";
+               if(addRoleFunc.getFunctionCd().contains(FUNCTION_PIPE)){
+                       type = EcompPortalUtils.getFunctionType(addRoleFunc.getFunctionCd()); 
+                       instance = EcompPortalUtils.getFunctionCode(addRoleFunc.getFunctionCd());
+                       action = EcompPortalUtils.getFunctionAction(addRoleFunc.getFunctionCd());
+               } else{
+                       type = addRoleFunc.getFunctionCd().contains("menu") ? "menu" : "url";
+                       instance = addRoleFunc.getFunctionCd();
+                       action = "*"; 
+               }
                ExternalAccessRolePerms extRolePerms = null;
                ExternalAccessPerms extPerms = null;
                ObjectMapper mapper = new ObjectMapper();
                try {
                        HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth();
-
-                       extPerms = new ExternalAccessPerms(app.getNameSpace() + "." + checkType, addRoleFunc.getFunctionCd(), "*",
+                       extPerms = new ExternalAccessPerms(app.getNameSpace() + "." + type, instance, action,
                                        addRoleFunc.getFunctionName());
                        extRolePerms = new ExternalAccessRolePerms(extPerms,
                                        app.getNameSpace() + "." + role.getName().replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"));
@@ -2515,16 +2557,73 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                }
        }
 
+       @SuppressWarnings("unchecked")
        @Override
-       public void bulkUploadPartnerFunctions(String uebkey, List<RoleFunction> roleFunctionsList) throws Exception {
+       public Integer bulkUploadPartnerFunctions(String uebkey) throws Exception {
                EPApp app = getApp(uebkey).get(0);
-               CentralV2RoleFunction cenRoleFunc = null;
-               for (RoleFunction roleFunction : roleFunctionsList) {
-                       cenRoleFunc = new CentralV2RoleFunction(roleFunction.getCode(), roleFunction.getName());
-                       addRoleFunctionInExternalSystem(cenRoleFunc, app);
+               final Map<String, Long> params = new HashMap<>();
+               params.put("appId", app.getId());
+               List<CentralV2RoleFunction> roleFuncList = dataAccessService.executeNamedQuery("getPartnerAppFunctions", params,
+                               null);
+               Integer functionsAdded = 0;
+               try {
+                       for (CentralV2RoleFunction roleFunc : roleFuncList) {
+                               addFunctionInExternalSystem(roleFunc, app);
+                               functionsAdded++;
+                       }
+               } catch (HttpClientErrorException e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - bulkUploadPartnerFunctions failed", e);
+                       EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode());
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadPartnerFunctions: failed", e.getMessage(), e);
                }
+               return functionsAdded;
        }
 
+       private void addFunctionInExternalSystem(CentralV2RoleFunction roleFunc, EPApp app) throws Exception {
+               ObjectMapper mapper = new ObjectMapper();
+               ExternalAccessPerms extPerms = new ExternalAccessPerms();
+               HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth();
+               String type = "";
+               String instance = "";
+               String action = "";
+               if ((roleFunc.getCode().contains(FUNCTION_PIPE))
+                               || (roleFunc.getType() != null && roleFunc.getAction() != null)) {
+                       type = EcompPortalUtils.getFunctionType(roleFunc.getCode());
+                       instance = EcompPortalUtils.getFunctionCode(roleFunc.getCode());
+                       action = EcompPortalUtils.getFunctionAction(roleFunc.getCode());
+               } else {
+                       type = roleFunc.getCode().contains("menu") ? "menu" : "url";
+                       instance = roleFunc.getCode();
+                       action = "*";
+               }
+               try {
+                       extPerms.setAction(action);
+                       extPerms.setInstance(instance);
+                       extPerms.setType(app.getNameSpace() + "." + type);
+                       extPerms.setDescription(roleFunc.getName());
+                       String addFunction = mapper.writeValueAsString(extPerms);
+                       HttpEntity<String> entity = new HttpEntity<>(addFunction, headers);
+                       logger.debug(EELFLoggerDelegate.debugLogger, "addFunctionInExternalSystem: {} for POST: {}",
+                                       CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE, addFunction);
+                       ResponseEntity<String> addPermResponse = template.exchange(
+                                       SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "perm",
+                                       HttpMethod.POST, entity, String.class);
+                       logger.debug(EELFLoggerDelegate.debugLogger,
+                                       "addFunctionInExternalSystem: Finished adding permission for POST: {} and status code: {} ",
+                                       addPermResponse.getStatusCode().value(), addFunction);
+               } catch (HttpClientErrorException e) {
+                       logger.error(EELFLoggerDelegate.errorLogger,
+                                       "HttpClientErrorException - Failed to add function in external central auth system", e);
+                       EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode());
+                       throw e;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger,
+                                       "addFunctionInExternalSystem: Failed to add fucntion in external central auth system", e);
+                       throw e;
+               }
+       } 
+
        @Override
        public void bulkUploadPartnerRoles(String uebkey, List<Role> roleList) throws Exception {
                EPApp app = getApp(uebkey).get(0);
@@ -2535,47 +2634,80 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
 
        @SuppressWarnings("unchecked")
        @Override
-       public void bulkUploadPartnerRoleFunctions(String uebkey, List<Role> roleList) throws Exception {
+       public Integer bulkUploadPartnerRoleFunctions(String uebkey) throws Exception {
                EPApp app = getApp(uebkey).get(0);
-               HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth();
-               for (Role role : roleList) {
-                       try {
-                               Set<RoleFunction> roleFunctionList = role.getRoleFunctions();
-                               List<RoleFunction> roleFunctionListNew = new ArrayList<>();
-                               ObjectMapper roleFunctionsMapper = new ObjectMapper();
-                               Iterator<RoleFunction> itetaror = roleFunctionList.iterator();
-                               while (itetaror.hasNext()) {
-                                       Object nextValue = itetaror.next();
-                                       RoleFunction roleFunction = roleFunctionsMapper.convertValue(nextValue, RoleFunction.class);
-                                       roleFunctionListNew.add(roleFunction);
-                               }
-                               List<RoleFunction> listWithoutDuplicates = roleFunctionListNew.stream().distinct()
-                                               .collect(Collectors.toList());
-                               for (RoleFunction roleFunction : listWithoutDuplicates) {
-                                       String checkType = roleFunction.getCode().contains("menu") ? "menu" : "url";
-                                       ExternalAccessRolePerms extRolePerms = null;
-                                       ExternalAccessPerms extPerms = null;
-                                       ObjectMapper mapper = new ObjectMapper();
-                                       extPerms = new ExternalAccessPerms(app.getNameSpace() + "." + checkType, roleFunction.getCode(),
-                                                       "*");
-                                       extRolePerms = new ExternalAccessRolePerms(extPerms,
-                                                       app.getNameSpace() + "." + role.getName().replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"));
-                                       String updateRolePerms = mapper.writeValueAsString(extRolePerms);
-                                       HttpEntity<String> entity = new HttpEntity<>(updateRolePerms, headers);
-                                       template.exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL)
-                                                       + "role/perm", HttpMethod.PUT, entity, String.class);
+               List<EPRole> roles = getAppRoles(app.getId());
+               final Map<String, Long> params = new HashMap<>();
+               Integer roleFunctions = 0;
+               try {
+                       for (EPRole role : roles) {
+                               params.put("roleId", role.getId());
+                               List<BulkUploadRoleFunction> appRoleFunc = dataAccessService.executeNamedQuery("uploadPartnerRoleFunctions",
+                                               params, null);
+                               if (!appRoleFunc.isEmpty()) {
+                                       for (BulkUploadRoleFunction addRoleFunc : appRoleFunc) {
+                                               addRoleFunctionsInExternalSystem(addRoleFunc, role, app);
+                                               roleFunctions++;
+                                       }
                                }
-                       } catch (Exception e) {
-                               if (e.getMessage().equalsIgnoreCase("409 Conflict")) {
-                                       logger.error(EELFLoggerDelegate.errorLogger,
-                                                       "bulkUploadPartnerRoleFunctions: RoleFunction already exits but does not break functionality");
+                       }
+                       // upload global role functions to ext auth system
+                       if(!app.getId().equals(PortalConstants.PORTAL_APP_ID)) {
+                               roleFunctions = bulkUploadGlobalRoleFunctions(app, roleFunctions);
+                       }
+               } catch(HttpClientErrorException e){
+                       logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to bulkUploadRolesFunctions", e);
+                       EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode());
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRolesFunctions: failed", e);
+               }
+               return roleFunctions;
+       }
+
+       @SuppressWarnings("unchecked")
+       private Integer bulkUploadGlobalRoleFunctions(EPApp app, Integer roleFunctions) throws Exception {
+               try {
+                       EPApp portalApp = epAppService.getApp(1l);
+                       final Map<String, Long> params = new HashMap<>();
+                       params.put("appId", app.getId());
+                       List<GlobalRoleWithApplicationRoleFunction> globalRoleFuncs = dataAccessService
+                                       .executeNamedQuery("getBulkUploadPartnerGlobalRoleFunctions", params, null);
+                       ObjectMapper mapper = new ObjectMapper();
+                       HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth();
+                       for (GlobalRoleWithApplicationRoleFunction globalRoleFunc : globalRoleFuncs) {
+                               ExternalAccessRolePerms extRolePerms;
+                               ExternalAccessPerms extPerms;
+                               String type = "";
+                               String instance = "";
+                               String action = "";
+                               if (globalRoleFunc.getFunctionCd().contains(FUNCTION_PIPE)) {
+                                       type = EcompPortalUtils.getFunctionType(globalRoleFunc.getFunctionCd());
+                                       instance = EcompPortalUtils.getFunctionCode(globalRoleFunc.getFunctionCd());
+                                       action = EcompPortalUtils.getFunctionAction(globalRoleFunc.getFunctionCd());
                                } else {
-                                       logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadPartnerRoleFunctions: Failed to addRoleFunctionsInExternalSystem",
-                                                       e);
+                                       type = globalRoleFunc.getFunctionCd().contains("menu") ? "menu" : "url";
+                                       instance = globalRoleFunc.getFunctionCd();
+                                       action = "*";
                                }
+                               extPerms = new ExternalAccessPerms(app.getNameSpace() + "." + type, instance, action);
+                               extRolePerms = new ExternalAccessRolePerms(extPerms, portalApp.getNameSpace() + "." + globalRoleFunc.getRoleName()
+                                               .replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"));
+                               String updateRolePerms = mapper.writeValueAsString(extRolePerms);
+                               HttpEntity<String> entity = new HttpEntity<>(updateRolePerms, headers);
+                               updateRoleFunctionInExternalSystem(updateRolePerms, entity);
+                               roleFunctions++;
                        }
-
+               } catch (HttpClientErrorException e) {
+                       logger.error(EELFLoggerDelegate.errorLogger,
+                                       "HttpClientErrorException - Failed to add role function in external central auth system", e);
+                       EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode());
+                       throw e;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger,
+                                       "bulkUploadGlobalRoleFunctions: Failed to add role fucntion in external central auth system", e);
+                       throw e;
                }
+               return roleFunctions;
        }
 
        @Override
@@ -3413,7 +3545,7 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                                        CentralRoleFunction cenRoleFunc = new CentralRoleFunction(cenV2RoleFunc.getCode(), cenV2RoleFunc.getName());                                                            
                                        cenRoleFunction.add(cenRoleFunc);
                                }
-                               CentralRole role = new CentralRole(userApp.getRole().getId(), userApp.getRole().getName(), userApp.getRole().isActive(), userApp.getRole().getPriority(),
+                               CentralRole role = new CentralRole(userApp.getRole().getId(), userApp.getRole().getName(), userApp.getRole().getActive(), userApp.getRole().getPriority(),
                                                cenRoleFunction);
                                cua.setRole(role);
                                userApps.add(cua);
@@ -3445,7 +3577,7 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                                        CentralRoleFunction roleFunc = new CentralRoleFunction(v2CenRoleFunc.getCode(), v2CenRoleFunc.getName());
                                        cenRoleFuncList.add(roleFunc);
                                }
-                               CentralRole role = new CentralRole(v2CenRole.getId(), v2CenRole.getName(), v2CenRole.isActive(), v2CenRole.getPriority(), cenRoleFuncList);
+                               CentralRole role = new CentralRole(v2CenRole.getId(), v2CenRole.getName(), v2CenRole.getActive(), v2CenRole.getPriority(), cenRoleFuncList);
                                cenRoleList.add(role);
                        }               
                return cenRoleList;
@@ -3481,7 +3613,7 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                        CentralRoleFunction roleFunc = new CentralRoleFunction(v2CenRoleFunc.getCode(), v2CenRoleFunc.getName());
                        cenRoleFuncList.add(roleFunc);
                }
-               return new CentralRole(v2CenRole.getId(), v2CenRole.getName(), v2CenRole.isActive(), v2CenRole.getPriority(),
+               return new CentralRole(v2CenRole.getId(), v2CenRole.getName(), v2CenRole.getActive(), v2CenRole.getPriority(),
                                cenRoleFuncList);
        }
 
@@ -3520,4 +3652,207 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                encodedString = encodedString.replaceAll("\\*", "%"+ Hex.encodeHexString("*".getBytes()));
                return encodedString;
        }
+       
+       @Override
+       public void bulkUploadRoleFunc(UploadRoleFunctionExtSystem data, EPApp app) throws Exception {
+               ObjectMapper mapper = new ObjectMapper();
+               HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth();
+               try {
+                       ExternalAccessRolePerms extRolePerms;
+                       ExternalAccessPerms extPerms;
+                       extPerms = new ExternalAccessPerms(app.getNameSpace() + "." + data.getType(), encodeFunctionCode(data.getInstance()), data.getAction());
+                       String appNameSpace = "";
+                       if(data.getIsGlobalRolePartnerFunc()) {
+                               appNameSpace =  epAppService.getApp(1l).getNameSpace();
+                       } else {
+                               appNameSpace =  app.getNameSpace();
+                       }
+                       extRolePerms = new ExternalAccessRolePerms(extPerms,
+                                       appNameSpace + "."
+                                                       + data.getRoleName().replaceAll(
+                                                                       EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS,
+                                                                       "_"));
+                       String updateRolePerms = mapper.writeValueAsString(extRolePerms);
+                       HttpEntity<String> entity = new HttpEntity<>(updateRolePerms, headers);
+                       updateRoleFunctionInExternalSystem(updateRolePerms, entity);
+               } catch (HttpClientErrorException e) {
+                       logger.error(EELFLoggerDelegate.errorLogger,
+                                       "HttpClientErrorException - Failed to add role function in external central auth system", e);
+                       EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode());
+                       throw e;
+               } catch (Exception e) {
+                       logger.error(EELFLoggerDelegate.errorLogger,
+                                       "addFunctionInExternalSystem: Failed to add role fucntion in external central auth system", e);
+                       throw e;
+               }
+               
+       }
+
+       private void updateRoleFunctionInExternalSystem(String updateRolePerms, HttpEntity<String> entity) {
+               logger.debug(EELFLoggerDelegate.debugLogger, "bulkUploadRoleFunc: {} for POST: {}",
+                               CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE, updateRolePerms);
+               ResponseEntity<String> addPermResponse = template.exchange(
+                               SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role/perm",
+                               HttpMethod.POST, entity, String.class);
+               logger.debug(EELFLoggerDelegate.debugLogger,
+                               "bulkUploadRoleFunc: Finished adding permission for POST: {} and status code: {} ",
+                               addPermResponse.getStatusCode().value(), updateRolePerms);
+       }
+       
+       @Override
+       public void syncApplicationUserRolesFromExtAuthSystem(String loginId) throws Exception {
+               String name = "";
+               if (EPCommonSystemProperties.containsProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN)) {
+                       name = loginId + SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN);
+               }
+               HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth();
+               HttpEntity<String> getUserRolesEntity = new HttpEntity<>(headers);
+               ResponseEntity<String> getResponse = getUserRolesFromExtAuthSystem(name, getUserRolesEntity);
+               List<ExternalAccessUserRoleDetail> userRoleDetailList = new ArrayList<>();
+               String res = getResponse.getBody();
+               JSONObject jsonObj = null;
+               JSONArray extRoles = null;
+               if (!res.equals("{}")) {
+                       jsonObj = new JSONObject(res);
+                       extRoles = jsonObj.getJSONArray("role");
+               }
+               updateUserRolesInLocal(userRoleDetailList, extRoles, loginId);
+       }
+
+       @SuppressWarnings("unchecked")
+       private void updateUserRolesInLocal(List<ExternalAccessUserRoleDetail> userRoleDetailList, JSONArray extRoles,
+                       String loginId) throws InvalidUserException {
+               HashMap<String, String> userParams = new HashMap<>();
+               userParams.put("orgUserId", loginId);
+               // Get all centralized applications existing user roles from local
+               List<CentralizedAppRoles> currentUserAppRoles = dataAccessService
+                               .executeNamedQuery("getUserCentralizedAppRoles", userParams, null);
+               EPUser user = getUser(loginId).get(0);
+               // Get all centralized applications roles from local
+               HashMap<String, CentralizedAppRoles> cenAppRolesMap = getCentralizedAppRoleList();
+               HashMap<String, CentralizedAppRoles> currentCentralizedUserAppRolesMap = getCurrentUserCentralizedAppRoles(
+                               currentUserAppRoles);
+               // Get all centralized applications + admin role from local
+               HashMap<String, EPApp> centralisedAppsMap = getCentralizedAdminAppsInfo();
+               if (extRoles != null) {
+                       ExternalAccessUserRoleDetail userRoleDetail = null;
+                       for (int i = 0; i < extRoles.length(); i++) {
+                               if (!extRoles.getJSONObject(i).getString("name").endsWith(ADMIN)
+                                               && !extRoles.getJSONObject(i).getString("name").endsWith(OWNER)) {
+                                       userRoleDetail = new ExternalAccessUserRoleDetail(extRoles.getJSONObject(i).getString("name"),
+                                                       null);
+                                       userRoleDetailList.add(userRoleDetail);
+                               }
+                       }
+                       addUserRolesInLocal(userRoleDetailList, user, cenAppRolesMap, currentCentralizedUserAppRolesMap,
+                                       centralisedAppsMap);
+               }
+       }
+
+       private void addUserRolesInLocal(List<ExternalAccessUserRoleDetail> userRoleDetailList, EPUser user,
+                       HashMap<String, CentralizedAppRoles> cenAppRolesMap,
+                       HashMap<String, CentralizedAppRoles> currentCentralizedUserAppRolesMap,
+                       HashMap<String, EPApp> centralisedAppsMap) {
+               for (ExternalAccessUserRoleDetail extUserRoleDetail : userRoleDetailList) {
+                       try {
+                               // check if user already has role in local
+                               if (!currentCentralizedUserAppRolesMap.containsKey(extUserRoleDetail.getName())) {
+                                       CentralizedAppRoles getCenAppRole = cenAppRolesMap.get(extUserRoleDetail.getName());
+                                       if (getCenAppRole != null) {
+                                               logger.debug(EELFLoggerDelegate.debugLogger, "addUserRolesInLocal: Adding user role from external auth system  {}",
+                                                               extUserRoleDetail.toString());
+                                               EPUserApp userApp = new EPUserApp();
+                                               EPApp app = new EPApp();
+                                               app.setId(getCenAppRole.getAppId());
+                                               EPRole epRole = new EPRole();
+                                               epRole.setId(getCenAppRole.getRoleId());
+                                               userApp.setApp(app);
+                                               userApp.setUserId(user.getId());
+                                               userApp.setRole(epRole);
+                                               dataAccessService.saveDomainObject(userApp, null);
+                                               logger.debug(EELFLoggerDelegate.debugLogger, "addUserRolesInLocal: Finished user role from external auth system  {}",
+                                                               extUserRoleDetail.toString());
+                                       } else if (getCenAppRole == null // check if user has app account admin role
+                                                       && extUserRoleDetail.getName().endsWith(PortalConstants.ADMIN_ROLE.replaceAll(
+                                                                       EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"))) {
+                                               EPApp app = centralisedAppsMap.get(extUserRoleDetail.getName());
+                                               if (app != null) {
+                                                       logger.debug(EELFLoggerDelegate.debugLogger, "addUserRolesInLocal: Adding user role from external auth system  {}",
+                                                                       extUserRoleDetail.toString());
+                                                       EPUserApp userApp = new EPUserApp();
+                                                       EPRole epRole = new EPRole();
+                                                       epRole.setId(PortalConstants.ACCOUNT_ADMIN_ROLE_ID);
+                                                       userApp.setApp(app);
+                                                       userApp.setUserId(user.getId());
+                                                       userApp.setRole(epRole);
+                                                       dataAccessService.saveDomainObject(userApp, null);
+                                                       logger.debug(EELFLoggerDelegate.debugLogger, "addUserRolesInLocal: Finished user role from external auth system  {}",
+                                                                       extUserRoleDetail.toString());
+                                               }
+                                       }
+                               }
+                       } catch (Exception e) {
+                               logger.error(EELFLoggerDelegate.errorLogger,
+                                               "addUserRolesInLocal - Failed to update user role in local from external auth system {} ",
+                                               extUserRoleDetail.toString(), e);
+                       }
+               }
+       }
+
+       @SuppressWarnings("unchecked")
+       private HashMap<String, EPApp> getCentralizedAdminAppsInfo() {
+               List<EPApp> centralizedApps = dataAccessService
+                               .executeNamedQuery("getCentralizedApps", null, null);
+               HashMap<String, EPApp> centralisedAppsMap = new HashMap<>();
+               for (EPApp cenApp : centralizedApps) {
+                       centralisedAppsMap.put(cenApp.getNameSpace()+ "." +
+                                       PortalConstants.ADMIN_ROLE.replaceAll(
+                                                       EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"), cenApp);
+               }
+               return centralisedAppsMap;
+       }
+
+       private HashMap<String, CentralizedAppRoles> getCurrentUserCentralizedAppRoles(
+                       List<CentralizedAppRoles> currentUserAppRoles) {
+               HashMap<String, CentralizedAppRoles> currentCentralizedUserAppRolesMap = new HashMap<>();
+               for (CentralizedAppRoles cenAppUserRole : currentUserAppRoles) {
+                       currentCentralizedUserAppRolesMap.put(
+                                       cenAppUserRole.getAppNameSpace() + "." + cenAppUserRole.getRoleName()
+                                                       .replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"),
+                                                       cenAppUserRole);
+               }
+               return currentCentralizedUserAppRolesMap;
+       }
+
+       @SuppressWarnings("unchecked")
+       private HashMap<String, CentralizedAppRoles> getCentralizedAppRoleList() {
+               List<CentralizedAppRoles> centralizedAppRoles = dataAccessService
+                               .executeNamedQuery("getAllCentralizedAppsRoles", null, null);
+               HashMap<String, CentralizedAppRoles> cenAppRolesMap = new HashMap<>();
+               for (CentralizedAppRoles CentralizedAppRole : centralizedAppRoles) {
+                       cenAppRolesMap.put(
+                                       CentralizedAppRole.getAppNameSpace() + "." + CentralizedAppRole.getRoleName()
+                                                       .replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"),
+                                       CentralizedAppRole);
+               }
+               return cenAppRolesMap;
+       }
+       
+       @Override
+       public ResponseEntity<String> getUserRolesFromExtAuthSystem(String name, HttpEntity<String> getUserRolesEntity) {
+               logger.debug(EELFLoggerDelegate.debugLogger, "Connecting to external system to get current user roles");
+               ResponseEntity<String> getResponse = template
+                               .exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL)
+                                               + "roles/user/" + name, HttpMethod.GET, getUserRolesEntity, String.class);
+               if (getResponse.getStatusCode().value() == 200) {
+                       logger.debug(EELFLoggerDelegate.debugLogger, "getAllUserRoleFromExtAuthSystem: Finished GET user roles from external system and received user roles {}",
+                                       getResponse.getBody());
+
+               }else{
+                       logger.error(EELFLoggerDelegate.errorLogger, "getAllUserRoleFromExtAuthSystem: Failed GET user roles from external system and received user roles {}",getResponse.getBody() );
+                       EPLogUtil.logExternalAuthAccessAlarm(logger, getResponse.getStatusCode());
+               }
+               return getResponse;
+       }
+
 }
index 90e33bf..e90aeb7 100644 (file)
@@ -49,6 +49,7 @@ import org.hibernate.criterion.Restrictions;
 import org.onap.portalapp.portal.domain.MicroserviceData;
 import org.onap.portalapp.portal.domain.MicroserviceParameter;
 import org.onap.portalapp.portal.logging.aop.EPMetricsLog;
+import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.onboarding.util.CipherUtil;
 import org.onap.portalsdk.core.service.DataAccessService;
@@ -105,11 +106,7 @@ public class MicroserviceServiceImpl implements MicroserviceService {
                List<MicroserviceData> list = (List<MicroserviceData>) dataAccessService.getList(MicroserviceData.class, null);
                for (int i = 0; i < list.size(); i++) {
                        if (list.get(i).getPassword() != null)
-                               try{
-                                       list.get(i).setPassword(decryptedPassword(list.get(i).getPassword()));
-                               } catch(BadPaddingException bpe){
-                                       logger.error(EELFLoggerDelegate.errorLogger, "Couldn't decrypt - Check decryption key in system.properties - looks wrong. Still going ahead with list population though", bpe);
-                               }
+                               list.get(i).setPassword(EPCommonSystemProperties.APP_DISPLAY_PASSWORD);  //to hide password from get request
                        list.get(i).setParameterList(getServiceParameters(list.get(i).getId()));
                }
                return list;
@@ -149,8 +146,13 @@ public class MicroserviceServiceImpl implements MicroserviceService {
        public void updateMicroservice(long serviceId, MicroserviceData newService) throws Exception {
                try {
                        newService.setId(serviceId);
-                       if (newService.getPassword() != null)
-                               newService.setPassword(encryptedPassword(newService.getPassword()));
+                       if (newService.getPassword() != null){
+                               if(newService.getPassword().equals(EPCommonSystemProperties.APP_DISPLAY_PASSWORD)){
+                                       MicroserviceData oldMS = getMicroserviceDataById(serviceId);
+                                       newService.setPassword(oldMS.getPassword()); // keep the old password
+                               }else
+                                       newService.setPassword(encryptedPassword(newService.getPassword())); //new password
+                       }
                        getDataAccessService().saveDomainObject(newService, null);
                        List<MicroserviceParameter> oldService = getServiceParameters(serviceId);
                        boolean foundParam;
index 80411f9..1811f8d 100644 (file)
@@ -90,6 +90,7 @@ import org.onap.portalapp.portal.transport.FieldsValidator;
 import org.onap.portalapp.portal.transport.FunctionalMenuItem;
 import org.onap.portalapp.portal.transport.FunctionalMenuRole;
 import org.onap.portalapp.portal.transport.RemoteRole;
+import org.onap.portalapp.portal.transport.RemoteRoleV1;
 import org.onap.portalapp.portal.transport.RemoteUserWithRoles;
 import org.onap.portalapp.portal.transport.RoleInAppForUser;
 import org.onap.portalapp.portal.transport.RolesInAppForUser;
@@ -97,6 +98,7 @@ import org.onap.portalapp.portal.transport.UserApplicationRoles;
 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.util.SystemType;
 import org.onap.portalsdk.core.domain.Role;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.restful.domain.EcompRole;
@@ -140,6 +142,9 @@ public class UserRolesCommonServiceImpl  {
        @Autowired
        private ExternalAccessRolesService externalAccessRolesService;
        
+       @Autowired
+       private AppsCacheService appsCacheService;
+       
        RestTemplate template = new RestTemplate();
        
        /**
@@ -646,6 +651,24 @@ public class UserRolesCommonServiceImpl  {
                Set<EcompRole> updatedUserRolesinRemote = constructUsersRemoteAppRoles(roleInAppForUserList);
                Set<EcompRole> updateUserRolesInEcomp = constructUsersEcompRoles(roleInAppForUserList);
                String userRolesAsString = mapper.writeValueAsString(updatedUserRolesinRemote);
+        EPApp externalApp = null;
+        SystemType type = SystemType.APPLICATION;
+               externalApp = appsCacheService.getApp(appId);
+               String appBaseUri = null;
+               Set<RemoteRoleV1> updatedUserRolesinRemoteV1 = new TreeSet<>();
+               if (externalApp != null) {
+                        appBaseUri = (type == SystemType.APPLICATION) ? externalApp.getAppRestEndpoint() : "";
+               }
+               if(appBaseUri != null && appBaseUri.endsWith("/api")){
+                       for(EcompRole eprole :updatedUserRolesinRemote)
+                       {
+                               RemoteRoleV1 role = new RemoteRoleV1();
+                               role.setId(eprole.getId());
+                               role.setName(eprole.getName());
+                               updatedUserRolesinRemoteV1.add(role);
+                       }
+                       userRolesAsString = mapper.writeValueAsString(updatedUserRolesinRemoteV1);
+               }
                applicationsRestClientService.post(EcompRole.class, appId, userRolesAsString,
                                String.format("/user/%s/roles", userId));
                // TODO: We should add code that verifies that the post operation did
@@ -962,18 +985,7 @@ public class UserRolesCommonServiceImpl  {
                        ObjectMapper mapper = new ObjectMapper();
                        HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth();
                        HttpEntity<String> getUserRolesEntity = new HttpEntity<>(headers);
-                       logger.debug(EELFLoggerDelegate.debugLogger, "Connecting to external system to get current user roles");
-                       ResponseEntity<String> getResponse = template
-                                       .exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL)
-                                                       + "roles/user/" + name, HttpMethod.GET, getUserRolesEntity, String.class);
-                       if (getResponse.getStatusCode().value() == 200) {
-                               logger.debug(EELFLoggerDelegate.debugLogger, "updateUserRolesInExternalSystem: Finished GET user roles from external system and received user roles {}",
-                                               getResponse.getBody());
-
-                       }else{
-                               logger.error(EELFLoggerDelegate.errorLogger, "updateUserRolesInExternalSystem: Failed GET user roles from external system and received user roles {}",getResponse.getBody() );
-                               EPLogUtil.logExternalAuthAccessAlarm(logger, getResponse.getStatusCode());
-                       }
+                       ResponseEntity<String> getResponse = externalAccessRolesService.getUserRolesFromExtAuthSystem(name, getUserRolesEntity);
                        List<ExternalAccessUserRoleDetail> userRoleDetailList = new ArrayList<>();
                        String res = getResponse.getBody();
                        JSONObject jsonObj = null;
@@ -1581,7 +1593,7 @@ public class UserRolesCommonServiceImpl  {
                                        List<CentralV2Role> cenRoleList = externalAccessRolesService.getRolesForApp(app.getUebKey());
                                        for(CentralV2Role cenRole : cenRoleList){
                                                Role role = new Role();
-                                               role.setActive(cenRole.isActive());
+                                               role.setActive(cenRole.getActive());
                                                role.setId(cenRole.getId());
                                                role.setName(cenRole.getName());
                                                role.setPriority(cenRole.getPriority());
@@ -1832,6 +1844,7 @@ public class UserRolesCommonServiceImpl  {
         * @see org.onap.portalapp.portal.service.UserRolesService#
         * getCachedAppRolesForUser(java.lang.Long, java.lang.Long)
         */
+       @SuppressWarnings("deprecation")
        public List<EPUserApp> getCachedAppRolesForUser(Long appId, Long userId) {
                // Find the records for this user-app combo, if any
                String filter = " where user_id = " + Long.toString(userId) + " and app_id = " + Long.toString(appId);
index d750f14..755de79 100644 (file)
@@ -49,11 +49,9 @@ import org.hibernate.criterion.Criterion;
 import org.hibernate.criterion.Restrictions;
 import org.json.JSONArray;
 import org.json.JSONObject;
-import org.onap.portalapp.portal.service.UserService;
-import org.onap.portalapp.portal.service.UserServiceImpl;
 import org.onap.portalapp.portal.domain.EPUser;
 import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
-import org.onap.portalsdk.core.FusionObject.Utilities;
+import org.onap.portalsdk.core.domain.FusionObject.Utilities;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.onboarding.util.CipherUtil;
 import org.onap.portalsdk.core.service.DataAccessService;
index 4b758dc..54ce4f3 100644 (file)
@@ -150,7 +150,7 @@ public class CentralV2Role implements Serializable, Comparable{
                        this.name = name;
                }
 
-               public boolean isActive() {
+               public boolean getActive() {
                        return active;
                }
 
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralizedAppRoles.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralizedAppRoles.java
new file mode 100644 (file)
index 0000000..507320f
--- /dev/null
@@ -0,0 +1,111 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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.transport;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity
+public class CentralizedAppRoles implements Serializable{
+       
+       private static final long serialVersionUID = 6670280863269352495L;
+       @Id
+       @Column(name = "app_id")
+       private Long appId;
+       @Column(name = "auth_namespace")
+       private String appNameSpace;
+       @Column(name = "role_name")
+       private String roleName;
+       @Id
+       @Column(name = "role_id")
+       private Long roleId;
+       
+       
+       /**
+        * @return the appId
+        */
+       public Long getAppId() {
+               return appId;
+       }
+       /**
+        * @param appId the appId to set
+        */
+       public void setAppId(Long appId) {
+               this.appId = appId;
+       }
+       /**
+        * @return the appNameSpace
+        */
+       public String getAppNameSpace() {
+               return appNameSpace;
+       }
+       /**
+        * @param appNameSpace the appNameSpace to set
+        */
+       public void setAppNameSpace(String appNameSpace) {
+               this.appNameSpace = appNameSpace;
+       }
+       /**
+        * @return the roleName
+        */
+       public String getRoleName() {
+               return roleName;
+       }
+       /**
+        * @param roleName the roleName to set
+        */
+       public void setRoleName(String roleName) {
+               this.roleName = roleName;
+       }
+       /**
+        * @return the roleId
+        */
+       public Long getRoleId() {
+               return roleId;
+       }
+       /**
+        * @param roleId the roleId to set
+        */
+       public void setRoleId(Long roleId) {
+               this.roleId = roleId;
+       }
+       
+}
\ No newline at end of file
index d47c584..36ac951 100644 (file)
@@ -43,9 +43,6 @@ public class ExternalAccessUserRoleDetail {
        private ExternalRoleDescription description;
        
        
-       /**
-        * 
-        */
        public ExternalAccessUserRoleDetail() {
                super();
        }
@@ -100,5 +97,12 @@ public class ExternalAccessUserRoleDetail {
                return true;
        }
        
+       /* (non-Javadoc)
+        * @see java.lang.Object#toString()
+        */
+       @Override
+       public String toString() {
+               return "ExternalAccessUserRoleDetail [name=" + name + ", description=" + description + "]";
+       }
        
 }
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/RemoteRoleV1.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/RemoteRoleV1.java
new file mode 100644 (file)
index 0000000..724c275
--- /dev/null
@@ -0,0 +1,96 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalapp.portal.transport;
+
+public class RemoteRoleV1 implements Comparable<RemoteRoleV1> {
+       private Long id;
+       private String name;
+
+       public Long getId() {
+               return id;
+       }
+
+       public void setId(Long id) {
+               this.id = id;
+       }
+
+       public String getName() {
+               return name;
+       }
+
+       public void setName(String name) {
+               this.name = name;
+       }
+
+       @Override
+       public int hashCode() {
+               final int prime = 31;
+               int result = 1;
+               result = prime * result + ((id == null) ? 0 : id.hashCode());
+               result = prime * result + ((name == null) ? 0 : name.hashCode());
+               return result;
+       }
+
+       @Override
+       public boolean equals(Object obj) {
+               if (this == obj)
+                       return true;
+               if (obj == null)
+                       return false;
+               if (getClass() != obj.getClass())
+                       return false;
+               RemoteRoleV1 other = (RemoteRoleV1) obj;
+               if (id == null) {
+                       if (other.id != null)
+                               return false;
+               } else if (!id.equals(other.id))
+                       return false;
+               if (name == null) {
+                       if (other.name != null)
+                               return false;
+               } else if (!name.equals(other.name))
+                       return false;
+               return true;
+       }
+
+       @Override
+       public int compareTo(RemoteRoleV1 arg0) {
+               return this.id.compareTo(arg0.id);
+       }
+
+}
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ueb/EPUebHelper.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ueb/EPUebHelper.java
deleted file mode 100644 (file)
index 400fb7f..0000000
+++ /dev/null
@@ -1,229 +0,0 @@
-/*-
- * ============LICENSE_START==========================================
- * 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");
- * 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.ueb;
-
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.annotation.PostConstruct;
-
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.onap.portalapp.portal.domain.EPApp;
-import org.onap.portalapp.portal.domain.EcompApp;
-import org.onap.portalapp.portal.logging.aop.EPMetricsLog;
-import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum;
-import org.onap.portalapp.portal.logging.logic.EPLogUtil;
-import org.onap.portalapp.portal.service.EPAppService;
-import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.onap.portalsdk.core.onboarding.ueb.Helper;
-import org.onap.portalsdk.core.onboarding.ueb.Publisher;
-import org.onap.portalsdk.core.onboarding.ueb.UebException;
-import org.onap.portalsdk.core.onboarding.ueb.UebManager;
-import org.onap.portalsdk.core.onboarding.ueb.UebMsg;
-import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
-import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
-import org.onap.portalapp.portal.ueb.EPUebHelper;
-import org.onap.portalapp.portal.ueb.EPUebMsgTypes;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.EnableAspectJAutoProxy;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-
-@Component
-@Transactional
-@org.springframework.context.annotation.Configuration
-@EnableAspectJAutoProxy
-public class EPUebHelper {
-       private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EPUebHelper.class);
-       
-       @Autowired
-       private EPAppService appsService;
-       
-       @Autowired
-       private SessionFactory sessionFactory;
-       
-       @SuppressWarnings("unused")
-       private Publisher epPublisher;
-       
-       public EPUebHelper() {
-               
-       }
-       //
-       // This should only be called by the ONAP Portal App, other Apps have just one publisher and use appPublisher
-       //
-       @SuppressWarnings("unused")
-       @EPMetricsLog
-       public void refreshPublisherList()
-       {
-               Session localSession = null;
-           boolean addedPublisher = false;
-           
-               try {
-                       localSession = sessionFactory.openSession();
-               
-                       List<EcompApp> apps = appsService.getEcompAppAppsFullList();
-                       for (int i = 0; i < apps.size(); i++) 
-                       {
-                               if ((apps.get(i).isEnabled()) &&
-                                       (apps.get(i).getUebTopicName() != null) &&
-                                       !(apps.get(i).getUebTopicName().toUpperCase().contains("ECOMP-PORTAL-INBOX")))
-                               {
-                                       logger.debug(EELFLoggerDelegate.debugLogger, "UEBManager adding publisher for " + apps.get(i).getUebTopicName());
-                                       UebManager.getInstance().addPublisher(apps.get(i).getUebTopicName());
-                       addedPublisher = true;
-                           }
-                               else if ((apps.get(i).getId() != 1) && // App may have been disabled, remove the publisher
-                                                !(apps.get(i).isEnabled()))
-                               {
-                                       if(apps.get(i).getUebTopicName()!=null){
-                                               UebManager.getInstance().removePublisher(apps.get(i).getUebTopicName());
-                                       }
-                               }
-                       }
-               }
-               catch (Exception e)
-               {
-                       EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeUebSystemError, e, "add/remove Publisher");
-                       logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while refreshing the publisher list", e);
-               }
-               
-               //publisherList.print();
-               
-               if (addedPublisher == true) // Give publishers time to initialize
-               {
-                       Helper.sleep(400);
-               }
-       }
-       
-       @PostConstruct
-       @EPMetricsLog
-       public void initUeb() {
-               try {
-                       epPublisher = new Publisher(PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY), 
-                                                           PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_SECRET), 
-                                                           PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME));
-               } catch (Exception e) {
-                       logger.error(EELFLoggerDelegate.errorLogger, "initUeb failed", e);
-                       EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeUebConnectionError, e);
-               }
-               
-               Thread thread = new Thread("EPUebManager: postConstructMethod - refreshPublisherList") {
-                   public void run(){
-                       refreshPublisherList();
-                   }
-               };
-               thread.start();
-               
-       }
-
-       @EPMetricsLog
-       public void addPublisher(EPApp app) {
-               // TODO Auto-generated method stub
-               try {
-                       UebManager.getInstance().addPublisher(app.getUebTopicName());
-               } catch (UebException e) {
-                       logger.error(EELFLoggerDelegate.errorLogger, "addPublisher failed", e);
-               }
-       }
-       
-       public boolean checkAvailability() {
-               //
-               //  Test existence of topic at UEB url
-               //
-               //  (ie http://uebsb91kcdc.it.com:3904/topics/ECOMP-PORTAL-INBOX)
-               //
-               boolean available = true;
-               LinkedList<String> urlList = (LinkedList<String>) Helper.uebUrlList();
-               if (!urlList.isEmpty()) {
-                   String url = "http://" + urlList.getFirst() + ":3904/topics/" + PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME);
-                   if (!url.isEmpty()) {
-                       try {
-                           URL siteURL = new URL(url);
-                           HttpURLConnection connection = (HttpURLConnection) siteURL.openConnection();
-                           connection.setRequestMethod("GET");
-                           connection.connect();
-                    
-                           int code = connection.getResponseCode();
-                           if (code == 200) {
-                               available = true;
-                           }
-                           else {
-                               EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeUebConnectionError, url);
-                               available = false;
-                               logger.warn(EELFLoggerDelegate.errorLogger, "Warning! UEB topic existence check failed, topic = " + url );
-                               logger.debug(EELFLoggerDelegate.debugLogger, "Warning! UEB topic existence check failed, topic = " + url );
-                           }
-                       }
-                       catch (Exception e) {
-                           available = false;
-                                       logger.error(EELFLoggerDelegate.errorLogger, "checkAvailability failed", e);
-                       }
-                   }
-               }
-               return available;
-       }
-       
-    public boolean MessageCanBeSentToTopic() {
-    
-       boolean sentMsgSuccessfully = false;
-       
-           UebMsg msg = new UebMsg();
-           msg.putSourceTopicName(PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME));
-           msg.putPayload("Pinging topic for health check");
-           msg.putMsgType(EPUebMsgTypes.UEB_MSG_TYPE_HEALTH_CHECK);
-       
-           try {
-                  // epPublisher.send(msg);
-                   sentMsgSuccessfully = true;
-           } 
-           catch (Exception e) {
-               EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeHealthCheckUebClusterError, e);
-                   sentMsgSuccessfully = false;
-                   logger.warn(EELFLoggerDelegate.errorLogger, "Warning! could not successfully publish a UEB msg to " 
-                                    + PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME), e); 
-           } 
-           
-           return sentMsgSuccessfully;
-    }
-    
-}
-
-
index 0087638..53f6a3e 100644 (file)
@@ -91,5 +91,10 @@ public class EPCommonSystemProperties extends SystemProperties {
        public static final String WIDGET_MS_HOSTNAME                                   = "microservices.widget.hostname";
        
        public static final String REMOTE_CENTRALIZED_SYSTEM_ACCESS             = "remote_centralized_system_access";
+       
+       public static final String APP_DISPLAY_PASSWORD                                 = "*******";
+       
+       public static final String MS_WIDGET_LOCAL_PORT                 = "microservices.widget.local.port";
+       public static final String MS_WIDGET_UPLOAD_FLAG                = "microservices.widget.upload.flag";
 
 }
index dd73277..53b69d7 100644 (file)
@@ -513,7 +513,7 @@ public class EcompPortalUtils {
        
        /**
         * 
-        * It check whether the external auth namespace is matching with current namepsace exists in local DB
+        * It check whether the external auth namespace is matching with current namespace exists in local DB
         * 
         * @param permTypeVal
         * @param appNamespaceVal
@@ -523,9 +523,13 @@ public class EcompPortalUtils {
                String[] typeNamespace = permTypeVal.split("\\.");
                String[] appNamespace = appNamespaceVal.split("\\.");
                boolean isNamespaceMatching = true;
-               for (int k = 0; k < appNamespace.length; k++) {
-                       if (!appNamespace[k].equals(typeNamespace[k]))
-                               isNamespaceMatching = false;
+               if (appNamespace.length <= typeNamespace.length) {
+                       for (int k = 0; k < appNamespace.length; k++) {
+                               if (!appNamespace[k].equals(typeNamespace[k]))
+                                       isNamespaceMatching = false;
+                       }
+               } else {
+                       isNamespaceMatching = false;
                }
                return isNamespaceMatching;
        }
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/MusicCookieCsrfTokenRepository.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/MusicCookieCsrfTokenRepository.java
new file mode 100644 (file)
index 0000000..75c6616
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2012-2016 the original author or authors.
+ *
+ * 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.
+ */
+
+package org.onap.portalapp.portal.utils;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.onap.music.eelf.logging.EELFLoggerDelegate;
+import org.onap.portalapp.music.service.MusicService;
+import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
+import org.springframework.security.web.csrf.CsrfToken;
+import org.springframework.security.web.csrf.CsrfTokenRepository;
+import org.springframework.security.web.csrf.DefaultCsrfToken;
+import org.springframework.util.StringUtils;
+
+
+public final class MusicCookieCsrfTokenRepository implements CsrfTokenRepository {
+       static final String CSRF_COOKIE_NAME = "XSRF-TOKEN";
+       static final String CSRF_HEADER_NAME = "X-XSRF-TOKEN";
+       static final String CSRF_PARAMETER_NAME = "_csrf";
+       static final String EP_SERVICE = "EPService";
+       CookieCsrfTokenRepository cookieRepo = null;
+       private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicService.class);
+
+       public MusicCookieCsrfTokenRepository() {
+       }
+       
+       public MusicCookieCsrfTokenRepository(CookieCsrfTokenRepository _cookieRepo) {
+               this();
+               cookieRepo = _cookieRepo;
+       }
+
+       @Override
+       public CsrfToken generateToken(HttpServletRequest request) {
+               return cookieRepo.generateToken(request) ;
+       }
+
+       @Override
+       public void saveToken(CsrfToken token, HttpServletRequest request,
+                       HttpServletResponse response) {
+               logger.debug(EELFLoggerDelegate.debugLogger, "initialize save csrf token ...");
+               cookieRepo.saveToken(token, request, response);
+       }
+
+       @Override
+       public CsrfToken loadToken(HttpServletRequest request) {
+               logger.debug(EELFLoggerDelegate.debugLogger, "initialize load csrf token ...");
+               CsrfToken cookieRepoToken = cookieRepo.loadToken(request);
+               if(cookieRepoToken==null){ // if cookieRepo does not has the token, check the cassandra for the values stored by other tomcats
+                       try { // todo this part of the code needs to be replaced with out depending on EPService cookie
+                               String sessionId = getSessionIdFromCookie(request);
+                               String token = MusicService.getAttribute(CSRF_COOKIE_NAME, sessionId);
+                               if (token==null || !StringUtils.hasLength(token)) 
+                                       return null;
+                               cookieRepoToken = new DefaultCsrfToken(CSRF_HEADER_NAME, CSRF_PARAMETER_NAME , token); 
+                       } catch (Exception e) {
+                               logger.error(EELFLoggerDelegate.errorLogger, "Error while calling csrf saveToken" , e);
+                       }
+               }
+               return cookieRepoToken;
+       }
+
+       /**
+        * Factory method to conveniently create an instance that has
+        * {@link #setCookieHttpOnly(boolean)} set to false.
+        *
+        * @return an instance of CookieCsrfTokenRepository with
+        * {@link #setCookieHttpOnly(boolean)} set to false
+        */
+       public static MusicCookieCsrfTokenRepository withHttpOnlyFalse() {
+               CookieCsrfTokenRepository result = new CookieCsrfTokenRepository();
+               result.setCookieHttpOnly(false);
+               return new MusicCookieCsrfTokenRepository(result);
+       }
+       
+       private String getSessionIdFromCookie (HttpServletRequest request){
+               Cookie cookies[] = request.getCookies();
+               if (cookies != null) {
+                       for (Cookie cookie : cookies) {
+                               if (EP_SERVICE.equals(cookie.getName())) {
+                                       return cookie.getValue();
+                               }
+                       }
+               }
+               return null;
+       }
+}
index fb324c2..fe1d29d 100644 (file)
@@ -245,6 +245,7 @@ public class TimeoutHandler extends QuartzJobBean {
                        return "";
                String jSessionKey = (String) attribute;
                return jSessionKey.split("-")[0];
+               //return jSessionKey;
        }
 
        private static ApplicationContext applicationContext;
@@ -49,7 +49,6 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.onboarding.ueb.UebException;
 import org.onap.portalsdk.core.onboarding.ueb.UebManager;
 import org.onap.portalsdk.core.onboarding.ueb.UebMsg;
-import org.onap.portalsdk.core.service.DataAccessService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.EnableAspectJAutoProxy;
 import org.springframework.scheduling.annotation.Async;
@@ -124,11 +123,9 @@ public class FunctionalMenuHandler {
                try {
                        UebManager.getInstance().publishReplyEP(returnMsg, requestMsg.getSourceTopicName());
                } catch (UebException e) {
-                       logger.error(EELFLoggerDelegate.errorLogger,
-                                       "getFunctionalMenu failed to publish reply", e);
+                       logger.error(EELFLoggerDelegate.errorLogger, "getFunctionalMenu failed on UEB exception", e);
                } catch (Exception e) {
-                       logger.error(EELFLoggerDelegate.errorLogger,
-                                       "getFunctionalMenu failed", e);
+                       logger.error(EELFLoggerDelegate.errorLogger, "getFunctionalMenu failed", e);
                }
 
                return true;
@@ -33,6 +33,7 @@
  *
  * ============LICENSE_END============================================
  *
+ *
  * 
  */
 package org.onap.portalapp.uebhandler;
@@ -58,9 +59,9 @@ public class InitUebHandler {
 
        // @Autowired
        private MainUebHandler mainUebHandler;
-
-       public InitUebHandler() {
-
+       
+       public InitUebHandler() {
+       
        }
 
        // @PostConstruct
@@ -68,19 +69,17 @@ public class InitUebHandler {
                try {
                        String enableListenerThread = PortalApiProperties.getProperty(PortalApiConstants.UEB_LISTENERS_ENABLE);
                        if (enableListenerThread.equalsIgnoreCase("true")) {
-                               ConcurrentLinkedQueue<UebMsg> inboxQueue = new ConcurrentLinkedQueue<UebMsg>();
-                               UebManager.getInstance().initListener(inboxQueue);
-                               mainUebHandler.runHandler(inboxQueue);
-                               logger.info(EELFLoggerDelegate.errorLogger, "Returned from initiating mainUebHandler...");
-                       } else {
-                               logger.info(EELFLoggerDelegate.errorLogger,
-                                               "Not starting UEB listening thread because ueb_listeners_enable is not set to true in the properties file.");
-                       }
-               } catch (Exception e) {
-                       logger.error(EELFLoggerDelegate.errorLogger, "initUeb failed", e);
-                       logger.info(EELFLoggerDelegate.errorLogger,
-                                       "Not starting UEB listening thread because property could not be read "
-                                                       + PortalApiConstants.UEB_LISTENERS_ENABLE + e.getMessage());
+                ConcurrentLinkedQueue<UebMsg> inboxQueue = new ConcurrentLinkedQueue<UebMsg>();
+                   UebManager.getInstance().initListener(inboxQueue);
+                       mainUebHandler.runHandler(inboxQueue);
+                   logger.info(EELFLoggerDelegate.errorLogger, "Returned from initiating mainUebHandler...");
+               }
+                   else {
+                       logger.info(EELFLoggerDelegate.errorLogger, "Not starting UEB listening thread because ueb_listeners_enable is not set to true in the properties file.");
+                   }
+               }
+               catch (Exception e) {
+                       logger.info(EELFLoggerDelegate.errorLogger, "Not starting UEB listening thread because property could not be read " + PortalApiConstants.UEB_LISTENERS_ENABLE);
                }
        }
 }
@@ -33,7 +33,7 @@
  *
  * ============LICENSE_END============================================
  *
- * 
+ *
  */
 package org.onap.portalapp.uebhandler;
 
@@ -43,7 +43,7 @@ import java.util.Date;
 import java.util.concurrent.ConcurrentLinkedQueue;
 
 import org.onap.portalapp.portal.ueb.EPUebMsgTypes;
-import org.onap.portalapp.portal.utils.EPSystemProperties;
+import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.onboarding.ueb.UebMsg;
 import org.onap.portalsdk.core.onboarding.ueb.UebMsgTypes;
@@ -88,7 +88,7 @@ public class MainUebHandler {
                                                        dateFormat.format(new Date()) + "<== Received UEB message : " + msg.toString());
                                        logger.info(EELFLoggerDelegate.debugLogger,
                                                        dateFormat.format(new Date()) + "<== Received UEB message : " + msg.toString());
-                                       MDC.put(EPSystemProperties.PARTNER_NAME, msg.getSourceTopicName());
+                                       MDC.put(EPCommonSystemProperties.PARTNER_NAME, msg.getSourceTopicName());
                                        MDC.put(Configuration.MDC_SERVICE_NAME, msg.getMsgType().toString());
                                        switch (msg.getMsgType()) {
                                        case UebMsgTypes.UEB_MSG_TYPE_GET_FUNC_MENU: {
@@ -116,7 +116,7 @@ public class MainUebHandler {
                        try {
                                Thread.sleep(10);
                        } catch (InterruptedException e) {
-                               logger.error(EELFLoggerDelegate.errorLogger, "runHandler interrupted during sleep", e);
+                               logger.error(EELFLoggerDelegate.errorLogger, "runHandler interrupted", e);
                        } catch (Exception e) {
                                logger.error(EELFLoggerDelegate.errorLogger, "runHandler failed", e);
                        }
@@ -39,7 +39,6 @@ package org.onap.portalapp.uebhandler;
 
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
-import java.util.Date;
 import java.util.List;
 
 import org.onap.portalapp.portal.domain.EPApp;
@@ -100,8 +99,8 @@ public class WidgetNotificationHandler {
                                }
                        } else {
                                logger.error(EELFLoggerDelegate.errorLogger,
-                                               dateFormat.format(new Date()) + "handleWidgetNotification: user " + requestMsg.getUserId()
-                                                               + " not found" + " source = " + requestMsg.getSourceTopicName()
+                                               "handleWidgetNotification: user " + requestMsg.getUserId() + " not found, source = "
+                                                               + requestMsg.getSourceTopicName()
                                                                + ". This widget notification cannot be posted to other widgets");
                        }
                }
index 5984710..34bd66a 100644 (file)
@@ -1958,7 +1958,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                        ]]>
        </sql-query>
        
-       <!-- Gets the current user app roles records and requires two parameters  -->
+       <!-- Gets all functions of portal app -->
        <sql-query name="getAllFunctions">
                <return alias="allFunctions"
                        class="org.onap.portalsdk.core.domain.RoleFunction" />
@@ -1967,7 +1967,17 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                        ;               
                        ]]>
        </sql-query>
-
+       
+       <!-- Gets the current user app roles records and requires two parameters  -->
+       <sql-query name="getPartnerAppFunctions">
+               <return alias="partnerAppFunctions"
+                       class="org.onap.portalapp.portal.domain.CentralV2RoleFunction" />
+                       <![CDATA[       
+                       select * from ep_app_function where app_id =:appId
+                       ;               
+                       ]]>
+       </sql-query>
+       
        <!-- Gets the  all role functions and requires one parameters -->
        <sql-query name="uploadAllRoleFunctions">
                <return alias="allRoleFunctions"
@@ -1977,6 +1987,16 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                ;               
                        ]]>
        </sql-query>
+       
+               <!-- Gets the  all application role functions from ep_app_function table and requires one parameters -->
+       <sql-query name="uploadPartnerRoleFunctions">
+               <return alias="partnerRoleFunctions"
+                       class="org.onap.portalapp.portal.transport.BulkUploadRoleFunction" />
+                       <![CDATA[       
+                               select distinct eprf.function_cd, epfn.function_name from ep_app_role_function eprf left outer join ep_app_function epfn on eprf.function_cd = epfn.function_cd where eprf.role_id =:roleId
+                               ;       
+                       ]]>
+       </sql-query>
 
        <sql-query name="getRoletoUpdateInExternalAuthSystem">
                <return alias="roletoUpdateInExternalAuthSystem" class="org.onap.portalapp.portal.domain.EPRole" />
@@ -2020,7 +2040,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
        <sql-query name="getCentralizedApps">
                <return alias="centralizedApps" class="org.onap.portalapp.portal.domain.EPApp" />
                        <![CDATA[
-                       select * from fn_app where auth_central = 'Y' and open = 'N';
+                       select * from fn_app where auth_central = 'Y' and open = 'N' and auth_namespace is not null
                        ;       
                        ]]>
        </sql-query>
@@ -2164,12 +2184,10 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
     <sql-query name="getGlobalRoleWithApplicationRoleFunctions">       
                <return alias="getGlobalRoleWithApplicationRoleFunctions" class="org.onap.portalapp.portal.transport.GlobalRoleWithApplicationRoleFunction" />          
                <![CDATA[
-               
                select distinct  d.role_id, d.role_name , c.function_cd , e.function_name , d.active_yn , d.priority , c.app_id, c.role_app_id
                from fn_user_role a, fn_app b, ep_app_role_function c , fn_role d , ep_app_function e
                where b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and e.function_cd = c.function_cd and c.app_id= :appId and e.app_id=c.app_id
                ;
                ]]>
        </sql-query>
        
@@ -2200,15 +2218,23 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
        <sql-query name="getGlobalRoleForRequestedApp"> 
                <return alias="getGlobalRoleForRequestedApp" class="org.onap.portalapp.portal.transport.GlobalRoleWithApplicationRoleFunction" />       
                <![CDATA[
-               
                select distinct  d.role_id, d.role_name , c.function_cd , e.function_name , d.active_yn , d.priority , c.app_id, c.role_app_id
         from fn_user_role a, fn_app b, ep_app_role_function c , fn_role d , ep_app_function e
         where b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and e.function_cd = c.function_cd and c.app_id=:requestedAppId and c.role_id =:roleId and e.app_id = c.app_id
         ;
                ]]>
        </sql-query>
        
+       <sql-query name="getBulkUploadPartnerGlobalRoleFunctions">      
+               <return alias="bulkUploadPartnerGlobalRoleFunctions" class="org.onap.portalapp.portal.transport.GlobalRoleWithApplicationRoleFunction" />       
+               <![CDATA[
+               select distinct fr.role_id, fr.role_name, fr.active_yn, fr.priority, epr.function_cd, ep.function_name, ep.app_id, epr.role_app_id
+               from fn_role fr, ep_app_function ep, ep_app_role_function epr
+               where fr.role_id = epr.role_id and ep.function_cd = epr.function_cd and ep.app_id = epr.app_id and  epr.app_id = :appId and epr.role_app_id = 1 
+               ;
+               ]]>
+       </sql-query>
+       
        <sql-query name="updateMenuFunctionalAndRoles"> 
                <![CDATA[
                  UPDATE fn_menu_functional m, fn_menu_functional_roles mr SET m.url='' WHERE m.menu_id=mr.menu_id AND mr.app_id=:app_id        
@@ -2341,23 +2367,46 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
        <sql-query name="getUserRoleOnUserIdAndRoleIdAndAppId"> 
                <return alias="getUserRoleOnUserIdAndRoleIdAndAppId" class="org.onap.portalapp.portal.domain.EPUserApp" />      
                <![CDATA[
-               
                select * from fn_user_role where user_id= :userId 
                and role_id= :roleId 
                and app_id= :appId
                ; 
                ]]>
        </sql-query>
-    
-    <sql-query name="userAppGlobalRoles">
-      <return alias="userAppGlobalRoles" class="org.onap.portalapp.portal.domain.EPRole" />
+
+       <sql-query name="userAppGlobalRoles">
+               <return alias="userAppGlobalRoles"
+                       class="org.onap.portalapp.portal.domain.EPRole" />
        <![CDATA[ 
         select fr.role_id , fr.role_name ,fr.active_yn, fr.priority, fr.app_id, fr.app_role_id 
         from fn_user_role a, fn_role fr, fn_user fu 
         where a.role_id in (select b.role_id from ep_app_role_function b where b.role_app_id = 1 and b.app_id =:appId) and a.user_id =fu.user_id and a.role_id = fr.role_id and fr.active_yn='Y' and fu.active_yn='Y' and fu.user_id =:userId
         ;             
-         ]]>
-       </sql-query>
-    
+       ]]>
+       </sql-query>
+
+       <sql-query name="getAllCentralizedAppsRoles">
+               <return alias="allCentralizedAppsRoles"
+                       class="org.onap.portalapp.portal.transport.CentralizedAppRoles" />
+       <![CDATA[ 
+        select distinct fa.app_id, fa.auth_namespace, fr.role_name, fr.role_id from fn_app fa,  fn_role fr where fa.auth_central = 'Y' and fa.auth_namespace is not null
+               and (fa.app_id = fr.app_id or COALESCE(fr.app_id,1) = fa.app_id) and fr.active_yn = 'Y' order by fa.app_id ;          
+       ]]>
+       </sql-query>
+
+       <sql-query name="getUserCentralizedAppRoles">
+               <return alias="userCentralizedAppRoles"
+                       class="org.onap.portalapp.portal.transport.CentralizedAppRoles" />
+       <![CDATA[ 
+               select distinct fur.app_id, fa.auth_namespace, fr.role_name, fur.role_id from fn_user_role fur, fn_app fa, fn_role fr, fn_user fu 
+               where fa.app_id = fur.app_id 
+               and fr.role_id = fur.role_id
+               and fu.user_id = fur.user_id 
+               and fu.ORG_USER_ID = :orgUserId
+               and fa.auth_namespace is not null
+               and fr.active_yn = 'Y'
+               order by role_id;
+               ]]>
+       </sql-query>
+       
 </hibernate-mapping>
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AppsControllerExternalVersionRequestTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AppsControllerExternalVersionRequestTest.java
new file mode 100644 (file)
index 0000000..92b82fe
--- /dev/null
@@ -0,0 +1,108 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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.controller;
+
+import static org.junit.Assert.assertNull;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.portal.core.MockEPUser;
+import org.onap.portalapp.portal.domain.EPUser;
+import org.onap.portalapp.portal.framework.MockitoTestSuite;
+import org.onap.portalapp.portal.transport.OnboardingApp;
+
+public class AppsControllerExternalVersionRequestTest {
+
+       @InjectMocks
+       AppsControllerExternalVersionRequest appsControllerExternalVersionRequest = new AppsControllerExternalVersionRequest();
+
+       @Before
+       public void setup() {
+               MockitoAnnotations.initMocks(this);
+       }
+
+       @Mock
+       AppsControllerExternalRequest appsControllerExternalRequest;
+
+       MockEPUser mockUser = new MockEPUser();
+       MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+
+       HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+       HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+       NullPointerException nullPointerException = new NullPointerException();
+
+       @Test
+       public void postPortalAdminTest() throws Exception {
+               EPUser user = new EPUser();
+               Mockito.when(appsControllerExternalRequest.postPortalAdmin(mockedRequest, mockedResponse, user))
+                               .thenReturn(null);
+               assertNull(appsControllerExternalVersionRequest.postPortalAdmin(mockedRequest, mockedResponse, user));
+       }
+
+       @Test
+       public void getOnboardAppExternalTest() throws Exception {
+               Mockito.when(appsControllerExternalRequest.getOnboardAppExternal(mockedRequest, mockedResponse, (long) 1))
+                               .thenReturn(null);
+               assertNull(appsControllerExternalVersionRequest.getOnboardAppExternal(mockedRequest, mockedResponse, (long) 1));
+       }
+
+       @Test
+       public void postOnboardAppExternalTest() throws Exception {
+               OnboardingApp newOnboardApp = new OnboardingApp();
+               Mockito.when(appsControllerExternalRequest.postOnboardAppExternal(mockedRequest, mockedResponse, newOnboardApp))
+                               .thenReturn(null);
+               assertNull(appsControllerExternalVersionRequest.postOnboardAppExternal(mockedRequest, mockedResponse,
+                               newOnboardApp));
+       }
+
+       @Test
+       public void putOnboardAppExternalTest() throws Exception {
+               OnboardingApp newOnboardApp = new OnboardingApp();
+               Mockito.when(appsControllerExternalRequest.putOnboardAppExternal(mockedRequest, mockedResponse, (long) 1,
+                               newOnboardApp)).thenReturn(null);
+               assertNull(appsControllerExternalVersionRequest.putOnboardAppExternal(mockedRequest, mockedResponse, (long) 1,
+                               newOnboardApp));
+       }
+
+}
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AuxApiRequestMapperControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AuxApiRequestMapperControllerTest.java
new file mode 100644 (file)
index 0000000..62e9372
--- /dev/null
@@ -0,0 +1,656 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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.controller;
+
+import static org.junit.Assert.*;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.annotation.ApiVersion;
+import org.onap.portalapp.controller.sessionmgt.SessionCommunicationController;
+import org.onap.portalapp.controller.sessionmgt.SessionCommunicationVersionController;
+import org.onap.portalapp.externalsystemapproval.model.ExternalSystemUser;
+import org.onap.portalapp.portal.domain.EPUser;
+import org.onap.portalapp.portal.ecomp.model.PortalRestResponse;
+import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum;
+import org.onap.portalapp.portal.framework.MockitoTestSuite;
+import org.onap.portalapp.portal.transport.Analytics;
+import org.onap.portalapp.portal.transport.EpNotificationItem;
+import org.onap.portalapp.portal.transport.OnboardingApp;
+import org.onap.portalsdk.core.domain.Role;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.springframework.aop.support.AopUtils;
+import org.springframework.context.ApplicationContext;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest(AopUtils.class)
+public class AuxApiRequestMapperControllerTest {
+       @InjectMocks
+       AuxApiRequestMapperController auxApiRequestMapperController = new AuxApiRequestMapperController();
+
+       @Before
+       public void setup() {
+               MockitoAnnotations.initMocks(this);
+       }
+
+       RolesController rolesController = new RolesController();
+       SessionCommunicationVersionController sessionCommunicationController = new SessionCommunicationVersionController();
+       WebAnalyticsExtAppVersionController webAnalyticsExtAppController = new WebAnalyticsExtAppVersionController();
+       RolesApprovalSystemVersionController rolesApprovalSystemController = new RolesApprovalSystemVersionController();
+       TicketEventVersionController ticketEventVersionController = new TicketEventVersionController();
+       AppsControllerExternalVersionRequest appsControllerExternalVersionRequest = new AppsControllerExternalVersionRequest();
+       ExternalAppsRestfulVersionController externalAppsRestfulVersionController = new ExternalAppsRestfulVersionController();
+
+       @Mock
+       ApplicationContext context;
+       Method method;
+
+       MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+       HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+       HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+       NullPointerException nullPointerException = new NullPointerException();
+
+       @Test
+       public void getUserTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/roles");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("GET");
+               assertNull(auxApiRequestMapperController.getUser(mockedRequest, mockedResponse, "test12"));
+       }
+
+       @Test
+       public void getRolesTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/roles");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("GET");
+               assertNull(auxApiRequestMapperController.getRoles(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void saveRoleTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/role");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("POST");
+               Role role = new Role();
+               assertNull(auxApiRequestMapperController.saveRole(mockedRequest, mockedResponse, role));
+       }
+
+       @Test
+       public void getEPRolesTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v4/roles");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("GET");
+               assertNull(auxApiRequestMapperController.getRoles(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void getUser1Test() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/user/test12");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("GET");
+               assertNull(auxApiRequestMapperController.getUser(mockedRequest, mockedResponse, "test12"));
+       }
+
+       @Test
+       public void getRoleTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/role/1");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("GET");
+               assertNull(auxApiRequestMapperController.getRoleInfo(mockedRequest, mockedResponse, (long) 1));
+       }
+
+       @Test
+       public void getUsersOfApplicationTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/users");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("GET");
+               assertNull(auxApiRequestMapperController.getUsersOfApplication(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void getRoleFunctionsListTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/functions");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("GET");
+               assertNull(auxApiRequestMapperController.getRoleFunctionsList(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void getRoleFunctionTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/function/test");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("GET");
+               assertNull(auxApiRequestMapperController.getRoleFunction(mockedRequest, mockedResponse, "test"));
+       }
+
+       @Test
+       public void saveRoleFunctionTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/roleFunction");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("POST");
+               PortalRestResponse<String> response = auxApiRequestMapperController.saveRoleFunction(mockedRequest, mockedResponse, "test");
+               assertNotNull(response);
+       }
+
+       @Test
+       public void deleteRoleFunctionTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/roleFunction/test");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("DELETE");
+               assertNull(auxApiRequestMapperController.deleteRoleFunction(mockedRequest, mockedResponse, "test"));
+       }
+
+       @Test
+       public void deleteRoleTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/deleteRole/1");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("DELETE");
+               assertNull(auxApiRequestMapperController.deleteRole(mockedRequest, mockedResponse, (long) 1));
+       }
+
+       @Test
+       public void getActiveRolesTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/activeRoles");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("GET");
+               assertNull(auxApiRequestMapperController.getActiveRoles(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void getEcompUserTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v4/user/test");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("GET");
+               assertNull(auxApiRequestMapperController.getEcompUser(mockedRequest, mockedResponse, "test"));
+       }
+
+       @Test
+       public void getEcompRolesOfApplicationTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v4/roles");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("GET");
+               assertNull(auxApiRequestMapperController.getEcompRolesOfApplication(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void getSessionSlotCheckIntervalTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/getSessionSlotCheckInterval");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", sessionCommunicationController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("GET");
+               assertNull(auxApiRequestMapperController.getSessionSlotCheckInterval(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void extendSessionTimeOutsTest() throws Exception {
+               String sessionMap = "test";
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/extendSessionTimeOuts");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", sessionCommunicationController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("POST");
+               assertNull(auxApiRequestMapperController.extendSessionTimeOuts(mockedRequest, mockedResponse, sessionMap));
+       }
+
+       @Test
+       public void getAnalyticsScriptTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/analytics");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", webAnalyticsExtAppController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("GET");
+               assertNull(auxApiRequestMapperController.getAnalyticsScript(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void storeAnalyticsScriptTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/storeAnalytics");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", webAnalyticsExtAppController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("POST");
+               Analytics analyticsMap = new Analytics();
+               assertNull(auxApiRequestMapperController.storeAnalyticsScript(mockedRequest, mockedResponse, analyticsMap));
+       }
+
+       @Test
+       public void bulkUploadFunctionsTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/upload/portal/functions");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("POST");
+               PortalRestResponse res = new PortalRestResponse();
+               res.setStatus(PortalRestStatusEnum.ERROR);
+               res.setMessage("Failed to bulkUploadFunctions");
+               res.setResponse("Failed");
+               assertEquals(res, auxApiRequestMapperController.bulkUploadFunctions(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void bulkUploadRolesTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/upload/portal/roles");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("POST");
+               PortalRestResponse res = new PortalRestResponse();
+               res.setStatus(PortalRestStatusEnum.ERROR);
+               res.setMessage("Failed to bulkUploadRoles");
+               res.setResponse("Failed");
+               assertEquals(res, auxApiRequestMapperController.bulkUploadRoles(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void bulkUploadRoleFunctionsTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/upload/portal/roleFunctions");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("POST");
+               PortalRestResponse res = new PortalRestResponse();
+               res.setStatus(PortalRestStatusEnum.ERROR);
+               res.setMessage("Failed to bulkUploadRoleFunctions");
+               res.setResponse("Failed");
+               assertEquals(res, auxApiRequestMapperController.bulkUploadRoleFunctions(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void bulkUploadUserRolesTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/upload/portal/userRoles");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("POST");
+               PortalRestResponse res = new PortalRestResponse();
+               res.setStatus(PortalRestStatusEnum.ERROR);
+               res.setMessage("Failed to bulkUploadUserRoles");
+               res.setResponse("Failed");
+               assertEquals(res, auxApiRequestMapperController.bulkUploadUserRoles(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void bulkUploadUsersSingleRoleTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/upload/portal/userRole/1");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("POST");
+               PortalRestResponse res = new PortalRestResponse();
+               res.setStatus(PortalRestStatusEnum.ERROR);
+               res.setMessage("Failed to bulkUploadUsersSingleRole");
+               res.setResponse("Failed");
+               assertEquals(res,
+                               auxApiRequestMapperController.bulkUploadUsersSingleRole(mockedRequest, mockedResponse, (long) 1));
+       }
+
+       @Test
+       public void bulkUploadPartnerFunctionsTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/upload/partner/roleFunctions");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("POST");
+               PortalRestResponse res = new PortalRestResponse();
+               res.setStatus(PortalRestStatusEnum.ERROR);
+               res.setMessage("Failed to bulkUploadPartnerRoleFunctions");
+               res.setResponse("Failed");
+               assertEquals(res, auxApiRequestMapperController.bulkUploadPartnerFunctions(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void bulkUploadPartnerRolesTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/upload/partner/roles");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("POST");
+               List<Role> upload = new ArrayList<>();
+               PortalRestResponse res = new PortalRestResponse();
+               res.setStatus(PortalRestStatusEnum.ERROR);
+               res.setMessage("Failed to bulkUploadRoles");
+               res.setResponse("Failed");
+               assertEquals(res, auxApiRequestMapperController.bulkUploadPartnerRoles(mockedRequest, mockedResponse, upload));
+       }
+
+       @Test
+       public void bulkUploadPartnerRoleFunctionsTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/upload/partner/roleFunctions");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("POST");
+               PortalRestResponse res = new PortalRestResponse();
+               res.setStatus(PortalRestStatusEnum.ERROR);
+               res.setMessage("Failed to bulkUploadPartnerRoleFunctions");
+               res.setResponse("Failed");
+               assertEquals(res, auxApiRequestMapperController.bulkUploadPartnerRoleFunctions(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void getMenuFunctionsTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/menuFunctions");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("GET");
+               assertNull(auxApiRequestMapperController.getMenuFunctions(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void postUserProfileTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/userProfile");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesApprovalSystemController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("POST");
+               ExternalSystemUser extSysUser = new ExternalSystemUser();
+               assertNull(auxApiRequestMapperController.postUserProfile(mockedRequest, extSysUser, mockedResponse));
+       }
+
+       @Test
+       public void putUserProfileTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/userProfile");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesApprovalSystemController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("PUT");
+               ExternalSystemUser extSysUser = new ExternalSystemUser();
+               assertNull(auxApiRequestMapperController.putUserProfile(mockedRequest, extSysUser, mockedResponse));
+       }
+
+       @Test
+       public void deleteUserProfileTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/userProfile");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", rolesApprovalSystemController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("DELETE");
+               ExternalSystemUser extSysUser = new ExternalSystemUser();
+               assertNull(auxApiRequestMapperController.deleteUserProfile(mockedRequest, extSysUser, mockedResponse));
+       }
+
+       @Test
+       public void handleRequestTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/ticketevent");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", ticketEventVersionController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("POST");
+               assertNull(auxApiRequestMapperController.handleRequest(mockedRequest, mockedResponse, "test"));
+       }
+
+       @Test
+       public void postPortalAdminTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/portalAdmin");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", appsControllerExternalVersionRequest);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("POST");
+               EPUser epUser = new EPUser();
+               assertNull(auxApiRequestMapperController.postPortalAdmin(mockedRequest, mockedResponse, epUser));
+       }
+
+       @Test
+       public void getOnboardAppExternalTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/onboardApp/1");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", appsControllerExternalVersionRequest);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("GET");
+               assertNull(auxApiRequestMapperController.getOnboardAppExternal(mockedRequest, mockedResponse, (long) 1));
+       }
+
+       @Test
+       public void postOnboardAppExternalTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/onboardApp");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", appsControllerExternalVersionRequest);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("POST");
+               OnboardingApp newOnboardApp = new OnboardingApp();
+               assertNull(auxApiRequestMapperController.postOnboardAppExternal(mockedRequest, mockedResponse, newOnboardApp));
+       }
+
+       @Test
+       public void putOnboardAppExternalTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/onboardApp/1");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", appsControllerExternalVersionRequest);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("PUT");
+               OnboardingApp newOnboardApp = new OnboardingApp();
+               assertNull(auxApiRequestMapperController.putOnboardAppExternal(mockedRequest, mockedResponse, (long) 1,
+                               newOnboardApp));
+       }
+
+       @Test
+       public void publishNotificationTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/publishNotification");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", externalAppsRestfulVersionController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("POST");
+               EpNotificationItem notificationItem = new EpNotificationItem();
+               assertNull(auxApiRequestMapperController.publishNotification(mockedRequest, notificationItem, mockedResponse));
+       }
+
+       @Test
+       public void getFavoritesForUserTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/getFavorites");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", externalAppsRestfulVersionController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("GET");
+               assertNull(auxApiRequestMapperController.getFavoritesForUser(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void functionalMenuItemsForUserTest() throws Exception {
+               Mockito.when(mockedRequest.getRequestURI()).thenReturn("/auxapi/v3/functionalMenuItemsForUser");
+               Mockito.when(mockedRequest.getHeader("MinorVersion")).thenReturn("0");
+               Map<String, Object> beans = new HashMap<>();
+               beans.put("bean1", externalAppsRestfulVersionController);
+               Mockito.when(context.getBeansWithAnnotation(ApiVersion.class)).thenReturn(beans);
+               PowerMockito.mockStatic(AopUtils.class);
+               Mockito.when(AopUtils.isAopProxy(Matchers.anyObject())).thenReturn(false);
+               Mockito.when(mockedRequest.getMethod()).thenReturn("GET");
+               assertNull(auxApiRequestMapperController.getFunctionalMenuItemsForUser(mockedRequest, mockedResponse));
+       }
+}
index 95d9a90..6518320 100644 (file)
@@ -51,6 +51,7 @@ import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.json.JSONObject;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -89,9 +90,11 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
+import org.springframework.test.util.MatcherAssertionErrors;
 import org.springframework.web.client.HttpClientErrorException;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
 
 @RunWith(PowerMockRunner.class)
@@ -291,57 +294,87 @@ public class ExternalAccessRolesControllerTest {
                assertEquals(reason, result);
        }
 
-       @Test(expected = NullPointerException.class)
-       public void saveRoleFunctionIfIsIsNotDeletedTest() throws Exception {
+       @Test
+       public void saveRoleFunctionIfIsNotDeletedTest() throws Exception {
                List<EPApp> applicationList = new ArrayList<EPApp>();
                EPApp app = mockApp();
                applicationList.add(app);
                Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
                PortalRestResponse<String> portalRestResponse = null;
                PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
-               expectedportalRestResponse.setMessage("Invalid uebkey!");
+               expectedportalRestResponse.setMessage(null);
                expectedportalRestResponse.setResponse("Failed");
                expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
                String data = null;
                CentralV2RoleFunction centralV2RoleFunction = new CentralV2RoleFunction();
+               Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(uebKey);
+               Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader("uebkey"))).thenReturn(applicationList);
+               ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.FOUND);
+               Mockito.when(externalAccessRolesService.getNameSpaceIfExists(applicationList.get(0))).thenReturn(response);
                Mockito.when(externalAccessRolesService.saveCentralRoleFunction(centralV2RoleFunction, app)).thenReturn(false);
                portalRestResponse = externalAccessRolesController.saveRoleFunction(mockedRequest, mockedResponse, data);
                assertEquals(portalRestResponse, expectedportalRestResponse);
        }
        
-       @Test(expected = NullPointerException.class)
+       @Test
        public void saveRoleFunctionExceptionTest() throws Exception {
                List<EPApp> applicationList = new ArrayList<EPApp>();
                EPApp app = mockApp();
+               app.setCentralAuth(true);
                applicationList.add(app);
                Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
                PortalRestResponse<String> portalRestResponse = null;
                PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
-               expectedportalRestResponse.setMessage("Invalid uebkey!");
+               expectedportalRestResponse.setMessage(null);
                expectedportalRestResponse.setResponse("Failed");
                expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
+               Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(uebKey);
+               Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader("uebkey"))).thenReturn(applicationList);
+               ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.FOUND);
+               Mockito.when(externalAccessRolesService.getNameSpaceIfExists(applicationList.get(0))).thenReturn(response);
                portalRestResponse = externalAccessRolesController.saveRoleFunction(mockedRequest, mockedResponse, null);
-               System.out.println(portalRestResponse);
                assertEquals(portalRestResponse, expectedportalRestResponse);
        }
        
-       @Test(expected = NullPointerException.class)
+       @Test
        public void saveRoleFunctionTest() throws Exception {
                List<EPApp> applicationList = new ArrayList<EPApp>();
+               EPUser user = mockUser.mockEPUser();
+               List<EPUser> userList = new ArrayList<>();
+               userList.add(user);
                EPApp app = mockApp();
+               app.setCentralAuth(true);
                applicationList.add(app);
+               JSONObject roleFunc = new JSONObject();
+               roleFunc.put("type", "test_type");
+               roleFunc.put("code", "test_instance");
+               roleFunc.put("action", "test_action");
+               roleFunc.put("name", "test_name");
+               ObjectMapper mapper = new ObjectMapper();
+               mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+               CentralV2RoleFunction saveRoleFunc = mapper.readValue(roleFunc.toString(), CentralV2RoleFunction.class);
+               saveRoleFunc.setAppId(app.getId());
                Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
                PortalRestResponse<String> portalRestResponse = null;
                PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
-               expectedportalRestResponse.setMessage(null);
-               expectedportalRestResponse.setResponse("Failed");
+               expectedportalRestResponse.setMessage("Successfully saved!");
+               expectedportalRestResponse.setResponse("Success");
                PortalRestStatusEnum portalRestStatusEnum = null;
-               expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR);
-               String data = null;
-               CentralV2RoleFunction centralV2RoleFunction = new CentralV2RoleFunction();
-               Mockito.when(externalAccessRolesService.saveCentralRoleFunction(centralV2RoleFunction, app)).thenReturn(true);
-               portalRestResponse = externalAccessRolesController.saveRoleFunction(mockedRequest, mockedResponse, data);
-               System.out.println(portalRestResponse);
+               expectedportalRestResponse.setStatus(portalRestStatusEnum.OK);
+               Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(uebKey);
+               Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader("uebkey"))).thenReturn(applicationList);
+               ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.FOUND);
+               Mockito.when(externalAccessRolesService.getNameSpaceIfExists(applicationList.get(0))).thenReturn(response);
+               Mockito.when(externalAccessRolesService.getRoleFunction("test_type|test_instance|test_action", app.getUebKey()))
+                               .thenReturn(null);
+               Mockito.when(externalAccessRolesService.saveCentralRoleFunction(Matchers.any(CentralV2RoleFunction.class),
+                               Matchers.any(EPApp.class))).thenReturn(true);
+               Mockito.when(externalAccessRolesService.getUser(mockedRequest.getHeader(Matchers.anyString())))
+                               .thenReturn(userList);
+               Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(Matchers.anyString())))
+                               .thenReturn(applicationList);
+               portalRestResponse = externalAccessRolesController.saveRoleFunction(mockedRequest, mockedResponse,
+                               roleFunc.toString());
                assertEquals(portalRestResponse, expectedportalRestResponse);
        }
 
@@ -547,11 +580,11 @@ public class ExternalAccessRolesControllerTest {
        public void bulkUploadPartnerFunctionsTest() throws Exception {
                PortalRestResponse<String> portalRestResponse = null;
                PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
-               expectedportalRestResponse.setMessage("Successfully added");
+               expectedportalRestResponse.setMessage("Successfully added: '0' functions");
                expectedportalRestResponse.setResponse("Success");
                PortalRestStatusEnum portalRestStatusEnum = null;
                expectedportalRestResponse.setStatus(portalRestStatusEnum.OK);
-               portalRestResponse = externalAccessRolesController.bulkUploadPartnerFunctions(mockedRequest, mockedResponse, null);
+               portalRestResponse = externalAccessRolesController.bulkUploadPartnerFunctions(mockedRequest, mockedResponse);
                assertEquals(portalRestResponse, expectedportalRestResponse);
        }
 
@@ -648,12 +681,11 @@ public class ExternalAccessRolesControllerTest {
        public void bulkUploadPartnerRoleFunctionsTest() throws Exception {
                PortalRestResponse<String> portalRestResponse = null;
                PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
-               expectedportalRestResponse.setMessage("Successfully added");
+               expectedportalRestResponse.setMessage("Successfully added: '0' role functions");
                expectedportalRestResponse.setResponse("Success");
                PortalRestStatusEnum portalRestStatusEnum = null;
                expectedportalRestResponse.setStatus(portalRestStatusEnum.OK);
-               List<Role> upload = new ArrayList<>();
-               portalRestResponse = externalAccessRolesController.bulkUploadPartnerRoleFunctions(mockedRequest, mockedResponse,upload);
+               portalRestResponse = externalAccessRolesController.bulkUploadPartnerRoleFunctions(mockedRequest, mockedResponse);
                assertEquals(portalRestResponse, expectedportalRestResponse);
        }
        
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ExternalAppsRestfulVersionControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ExternalAppsRestfulVersionControllerTest.java
new file mode 100644 (file)
index 0000000..df5e6c6
--- /dev/null
@@ -0,0 +1,95 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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.controller;
+
+import static org.junit.Assert.assertNull;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.portal.core.MockEPUser;
+import org.onap.portalapp.portal.framework.MockitoTestSuite;
+import org.onap.portalapp.portal.transport.EpNotificationItem;
+
+public class ExternalAppsRestfulVersionControllerTest {
+
+       @InjectMocks
+       ExternalAppsRestfulVersionController externalAppsRestfulVersionController = new ExternalAppsRestfulVersionController();
+
+       @Before
+       public void setup() {
+               MockitoAnnotations.initMocks(this);
+       }
+
+       @Mock
+       ExternalAppsRestfulController externalAppsRestfulController;
+
+       MockEPUser mockUser = new MockEPUser();
+       MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+
+       HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+       HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+       NullPointerException nullPointerException = new NullPointerException();
+
+       @Test
+       public void publishNotificationTest() throws Exception {
+               EpNotificationItem notificationItem = new EpNotificationItem();
+               Mockito.when(externalAppsRestfulController.publishNotification(mockedRequest, notificationItem))
+                               .thenReturn(null);
+               assertNull(externalAppsRestfulVersionController.publishNotification(mockedRequest, mockedResponse,
+                               notificationItem));
+       }
+
+       @Test
+       public void getFavoritesForUserTest() throws Exception {
+               Mockito.when(externalAppsRestfulController.getFavoritesForUser(mockedRequest, mockedResponse)).thenReturn(null);
+               assertNull(externalAppsRestfulVersionController.getFavoritesForUser(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void getFunctionalMenuItemsForUserTest() throws Exception {
+               Mockito.when(externalAppsRestfulController.getFunctionalMenuItemsForUser(mockedRequest, mockedResponse))
+                               .thenReturn(null);
+               assertNull(externalAppsRestfulVersionController.getFunctionalMenuItemsForUser(mockedRequest, mockedResponse));
+       }
+}
index f67e327..0f3bb49 100644 (file)
@@ -41,6 +41,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
index c1854bf..ff9fcff 100644 (file)
@@ -142,6 +142,8 @@ public class RoleManageControllerTest {
        NullPointerException nullPointerException = new NullPointerException();
        MockEPUser mockUser = new MockEPUser();
 
+       private DelegatingServletInputStream dsi;
+
        @Test
        public void removeRoleRoleFunctionTest() throws Exception {
 
@@ -595,8 +597,9 @@ public class RoleManageControllerTest {
                roleJson2.put("roleFunctions", roleFunctions);
                ObjectMapper mapper = new ObjectMapper();
                JsonNode actualObj = mapper.readTree(roleJson2.toString());
-               Mockito.when(mockedRequest.getInputStream()).thenReturn(new DelegatingServletInputStream(
-                               new ByteArrayInputStream(actualObj.toString().getBytes(StandardCharsets.UTF_8))));
+               dsi = new DelegatingServletInputStream(
+                               new ByteArrayInputStream(actualObj.toString().getBytes(StandardCharsets.UTF_8)));
+               Mockito.when(mockedRequest.getInputStream()).thenReturn(dsi);
                Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(actualObj.toString())));
                Mockito.when(mockedRequest.getContentType()).thenReturn("application/json");
                Mockito.when(mockedRequest.getCharacterEncoding()).thenReturn("UTF-8");
@@ -647,8 +650,9 @@ public class RoleManageControllerTest {
                roleJson2.put("roleFunctions", roleFunctions);
                ObjectMapper mapper = new ObjectMapper();
                JsonNode actualObj = mapper.readTree(roleJson2.toString());
-               Mockito.when(mockedRequest.getInputStream()).thenReturn(new DelegatingServletInputStream(
-                               new ByteArrayInputStream(actualObj.toString().getBytes(StandardCharsets.UTF_8))));
+               dsi = new DelegatingServletInputStream(
+                               new ByteArrayInputStream(actualObj.toString().getBytes(StandardCharsets.UTF_8)));
+               Mockito.when(mockedRequest.getInputStream()).thenReturn(dsi);
                Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(actualObj.toString())));
                Mockito.when(mockedRequest.getContentType()).thenReturn("application/json");
                Mockito.when(mockedRequest.getCharacterEncoding()).thenReturn("UTF-8");
@@ -701,8 +705,9 @@ public class RoleManageControllerTest {
                roleJson2.put("roleFunctions", roleFunctions);
                ObjectMapper mapper = new ObjectMapper();
                JsonNode actualObj = mapper.readTree(roleJson2.toString());
-               Mockito.when(mockedRequest.getInputStream()).thenReturn(new DelegatingServletInputStream(
-                               new ByteArrayInputStream(actualObj.toString().getBytes(StandardCharsets.UTF_8))));
+               dsi = new DelegatingServletInputStream(
+                               new ByteArrayInputStream(actualObj.toString().getBytes(StandardCharsets.UTF_8)));
+               Mockito.when(mockedRequest.getInputStream()).thenReturn(dsi);
                Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(actualObj.toString())));
                Mockito.when(mockedRequest.getContentType()).thenReturn("application/json");
                Mockito.when(mockedRequest.getCharacterEncoding()).thenReturn("UTF-8");
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/RolesApprovalSystemVersionControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/RolesApprovalSystemVersionControllerTest.java
new file mode 100644 (file)
index 0000000..b30b261
--- /dev/null
@@ -0,0 +1,97 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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.controller;
+
+import static org.junit.Assert.assertNull;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.externalsystemapproval.model.ExternalSystemUser;
+import org.onap.portalapp.portal.core.MockEPUser;
+import org.onap.portalapp.portal.framework.MockitoTestSuite;
+
+public class RolesApprovalSystemVersionControllerTest {
+
+       @InjectMocks
+       RolesApprovalSystemVersionController rolesApprovalSystemVersionController = new RolesApprovalSystemVersionController();
+
+       @Before
+       public void setup() {
+               MockitoAnnotations.initMocks(this);
+       }
+
+       @Mock
+       RolesApprovalSystemController rolesApprovalSystemController;
+
+       MockEPUser mockUser = new MockEPUser();
+       MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+
+       HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+       HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+       NullPointerException nullPointerException = new NullPointerException();
+
+       @Test
+       public void postUserProfileTest() throws Exception {
+               ExternalSystemUser extSysUser = new ExternalSystemUser();
+               Mockito.when(rolesApprovalSystemController.postUserProfile(mockedRequest, extSysUser, mockedResponse))
+                               .thenReturn(null);
+               assertNull(rolesApprovalSystemVersionController.postUserProfile(mockedRequest, mockedResponse, extSysUser));
+       }
+
+       @Test
+       public void putUserProfileTest() throws Exception {
+               ExternalSystemUser extSysUser = new ExternalSystemUser();
+               Mockito.when(rolesApprovalSystemController.putUserProfile(mockedRequest, extSysUser, mockedResponse))
+                               .thenReturn(null);
+               assertNull(rolesApprovalSystemVersionController.putUserProfile(mockedRequest, mockedResponse, extSysUser));
+       }
+
+       @Test
+       public void deleteUserProfileTest() throws Exception {
+               ExternalSystemUser extSysUser = new ExternalSystemUser();
+               Mockito.when(rolesApprovalSystemController.deleteUserProfile(mockedRequest, extSysUser, mockedResponse))
+                               .thenReturn(null);
+               assertNull(rolesApprovalSystemVersionController.deleteUserProfile(mockedRequest, mockedResponse, extSysUser));
+       }
+}
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/RolesControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/RolesControllerTest.java
new file mode 100644 (file)
index 0000000..c8f288c
--- /dev/null
@@ -0,0 +1,226 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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.controller;
+
+import static org.junit.Assert.assertNull;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.portal.core.MockEPUser;
+import org.onap.portalapp.portal.framework.MockitoTestSuite;
+import org.onap.portalsdk.core.domain.Role;
+
+public class RolesControllerTest {
+
+       @InjectMocks
+       RolesController rolesController = new RolesController();
+
+       @Before
+       public void setup() {
+               MockitoAnnotations.initMocks(this);
+       }
+
+       @Mock
+       ExternalAccessRolesController externalAccessRolesController;
+
+       MockEPUser mockUser = new MockEPUser();
+       MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+
+       HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+       HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+       NullPointerException nullPointerException = new NullPointerException();
+
+       @Test
+       public void getV2RolesForAppTest() throws Exception {
+               Mockito.when(externalAccessRolesController.getV2RolesForApp(mockedRequest, mockedResponse)).thenReturn(null);
+               assertNull(rolesController.getV2RolesForApp(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void getV2UserListTest() throws Exception {
+               Mockito.when(externalAccessRolesController.getV2UserList(mockedRequest, mockedResponse, "test12"))
+                               .thenReturn(null);
+               assertNull(rolesController.getV2UserList(mockedRequest, mockedResponse, "test12"));
+       }
+
+       @Test
+       public void saveRoleTest() throws Exception {
+               Role role = new Role();
+               Mockito.when(externalAccessRolesController.saveRole(mockedRequest, mockedResponse, role)).thenReturn(null);
+               assertNull(rolesController.saveRole(mockedRequest, mockedResponse, role));
+       }
+
+       @Test
+       public void getV2RoleInfoTest() throws Exception {
+               Mockito.when(externalAccessRolesController.getV2RoleInfo(mockedRequest, mockedResponse, (long) 22))
+                               .thenReturn(null);
+               assertNull(rolesController.getV2RoleInfo(mockedRequest, mockedResponse, (long) 22));
+       }
+
+       @Test
+       public void getUsersOfApplicationTest() throws Exception {
+               Mockito.when(externalAccessRolesController.getUsersOfApplication(mockedRequest, mockedResponse))
+                               .thenReturn(null);
+               assertNull(rolesController.getUsersOfApplication(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void getRoleFunctionsListTest() throws Exception {
+               Mockito.when(externalAccessRolesController.getV2RoleFunctionsList(mockedRequest, mockedResponse))
+                               .thenReturn(null);
+               assertNull(rolesController.getRoleFunctionsList(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void getRoleFunctionTest() throws Exception {
+               Mockito.when(externalAccessRolesController.getRoleFunction(mockedRequest, mockedResponse, "test"))
+                               .thenReturn(null);
+               assertNull(rolesController.getRoleFunction(mockedRequest, mockedResponse, "test"));
+       }
+
+       @Test
+       public void saveRoleFunctionTest() throws Exception {
+               Mockito.when(externalAccessRolesController.saveRoleFunction(mockedRequest, mockedResponse, "test"))
+                               .thenReturn(null);
+               assertNull(rolesController.saveRoleFunction(mockedRequest, mockedResponse, "test"));
+       }
+
+       @Test
+       public void deleteRoleFunctionTest() throws Exception {
+               Mockito.when(externalAccessRolesController.deleteRoleFunction(mockedRequest, mockedResponse, "test"))
+                               .thenReturn(null);
+               assertNull(rolesController.deleteRoleFunction(mockedRequest, mockedResponse, "test"));
+       }
+
+       @Test
+       public void deleteRoleTest() throws Exception {
+               Mockito.when(externalAccessRolesController.deleteRole(mockedRequest, mockedResponse, (long) 1))
+                               .thenReturn(null);
+               assertNull(rolesController.deleteRole(mockedRequest, mockedResponse, (long) 1));
+       }
+
+       @Test
+       public void getV2ActiveRolesTest() throws Exception {
+               Mockito.when(externalAccessRolesController.getV2ActiveRoles(mockedRequest, mockedResponse)).thenReturn(null);
+               assertNull(rolesController.getV2ActiveRoles(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void bulkUploadFunctionsTest() throws Exception {
+               Mockito.when(externalAccessRolesController.bulkUploadFunctions(mockedRequest, mockedResponse)).thenReturn(null);
+               assertNull(rolesController.bulkUploadFunctions(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void bulkUploadRolesTest() throws Exception {
+               Mockito.when(externalAccessRolesController.bulkUploadRoles(mockedRequest, mockedResponse)).thenReturn(null);
+               assertNull(rolesController.bulkUploadRoles(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void bulkUploadRoleFunctionsTest() throws Exception {
+               Mockito.when(externalAccessRolesController.bulkUploadRoleFunctions(mockedRequest, mockedResponse))
+                               .thenReturn(null);
+               assertNull(rolesController.bulkUploadRoleFunctions(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void bulkUploadUserRolesTest() throws Exception {
+               Mockito.when(externalAccessRolesController.bulkUploadUserRoles(mockedRequest, mockedResponse)).thenReturn(null);
+               assertNull(rolesController.bulkUploadUserRoles(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void bulkUploadUsersSingleRoleTest() throws Exception {
+               Mockito.when(externalAccessRolesController.bulkUploadUsersSingleRole(mockedRequest, mockedResponse, (long) 1))
+                               .thenReturn(null);
+               assertNull(rolesController.bulkUploadUsersSingleRole(mockedRequest, mockedResponse, (long) 1));
+       }
+
+       @Test
+       public void bulkUploadPartnerFunctionsTest() throws Exception {
+               Mockito.when(externalAccessRolesController.bulkUploadPartnerFunctions(mockedRequest, mockedResponse))
+                               .thenReturn(null);
+               assertNull(rolesController.bulkUploadPartnerFunctions(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void bulkUploadPartnerRolesTest() throws Exception {
+               List<Role> upload = new ArrayList<>();
+               Mockito.when(externalAccessRolesController.bulkUploadPartnerRoles(mockedRequest, mockedResponse, upload))
+                               .thenReturn(null);
+               assertNull(rolesController.bulkUploadPartnerRoles(mockedRequest, mockedResponse, upload));
+       }
+
+       @Test
+       public void bulkUploadPartnerRoleFunctionsTest() throws Exception {
+               Mockito.when(externalAccessRolesController.bulkUploadPartnerRoleFunctions(mockedRequest, mockedResponse))
+                               .thenReturn(null);
+               assertNull(rolesController.bulkUploadPartnerRoleFunctions(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void getMenuFunctionsTest() throws Exception {
+               Mockito.when(externalAccessRolesController.getMenuFunctions(mockedRequest, mockedResponse)).thenReturn(null);
+               assertNull(rolesController.getMenuFunctions(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void getEcompUserTest() throws Exception {
+               Mockito.when(externalAccessRolesController.getEcompUser(mockedRequest, mockedResponse, "test12"))
+                               .thenReturn(null);
+               assertNull(rolesController.getEcompUser(mockedRequest, mockedResponse, "test12"));
+       }
+
+       @Test
+       public void getEcompRolesOfApplicationTest() throws Exception {
+               Mockito.when(externalAccessRolesController.getEcompRolesOfApplication(mockedRequest, mockedResponse))
+                               .thenReturn(null);
+               assertNull(rolesController.getEcompRolesOfApplication(mockedRequest, mockedResponse));
+       }
+
+}
index ec9ecaf..a3076b2 100644 (file)
  */
 package org.onap.portalapp.portal.controller;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.drools.core.command.assertion.AssertEquals;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.InjectMocks;
index 427b412..13dfc18 100644 (file)
@@ -178,6 +178,7 @@ public class SharedContextRestClient {
                } finally {
                        if (response != null)
                                response.close();
+                       httpClient.close();
                }
                return json;
        }
@@ -292,6 +293,7 @@ public class SharedContextRestClient {
                } finally {
                        if (response != null)
                                response.close();
+                       httpClient.close();
                }
                return responseJson;
        }
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/TicketEventVersionControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/TicketEventVersionControllerTest.java
new file mode 100644 (file)
index 0000000..be8fe4e
--- /dev/null
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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.controller;
+
+import static org.junit.Assert.assertNull;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.portal.core.MockEPUser;
+import org.onap.portalapp.portal.framework.MockitoTestSuite;
+
+public class TicketEventVersionControllerTest {
+
+       @InjectMocks
+       TicketEventVersionController ticketEventVersionController = new TicketEventVersionController();
+
+       @Before
+       public void setup() {
+               MockitoAnnotations.initMocks(this);
+       }
+       @Mock
+       TicketEventController ticketEventController;
+
+       MockEPUser mockUser = new MockEPUser();
+       MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+
+       HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+       HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+       NullPointerException nullPointerException = new NullPointerException();
+       @Test
+       public void getFavoritesForUserTest() throws Exception {
+               Mockito.when(ticketEventController.handleRequest(mockedRequest, mockedResponse, "test")).thenReturn(null);
+               assertNull(ticketEventVersionController.handleRequest(mockedRequest, mockedResponse, "test"));
+       }
+}
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WebAnalyticsExtAppVersionControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WebAnalyticsExtAppVersionControllerTest.java
new file mode 100644 (file)
index 0000000..f8d47ed
--- /dev/null
@@ -0,0 +1,87 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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.controller;
+
+import static org.junit.Assert.assertNull;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.portal.core.MockEPUser;
+import org.onap.portalapp.portal.framework.MockitoTestSuite;
+import org.onap.portalapp.portal.transport.Analytics;
+
+public class WebAnalyticsExtAppVersionControllerTest {
+
+       @InjectMocks
+       WebAnalyticsExtAppVersionController webAnalyticsExtAppVersionController = new WebAnalyticsExtAppVersionController();
+
+       @Before
+       public void setup() {
+               MockitoAnnotations.initMocks(this);
+       }
+
+       @Mock
+       WebAnalyticsExtAppController webAnalyticsExtAppController;
+
+       MockEPUser mockUser = new MockEPUser();
+       MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+
+       HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+       HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+       NullPointerException nullPointerException = new NullPointerException();
+
+       @Test
+       public void getAnalyticsScriptTest() throws Exception {
+               Mockito.when(webAnalyticsExtAppController.getAnalyticsScript(mockedRequest)).thenReturn(null);
+               assertNull(webAnalyticsExtAppVersionController.getAnalyticsScript(mockedRequest, mockedResponse));
+       }
+
+       @Test
+       public void storeAnalyticsScriptTest() throws Exception {
+               Analytics analyticsMap = new Analytics();
+               Mockito.when(webAnalyticsExtAppController.storeAnalyticsScript(mockedRequest, analyticsMap)).thenReturn(null);
+               assertNull(
+                               webAnalyticsExtAppVersionController.storeAnalyticsScript(mockedRequest, mockedResponse, analyticsMap));
+       }
+}
index 077eb21..58eb719 100644 (file)
@@ -40,8 +40,6 @@ package org.onap.portalapp.portal.listener;
 import static org.junit.Assert.assertEquals;
 
 import org.junit.Test;
-import org.onap.portalapp.portal.listener.HealthMonitor;
-
 public class HealthMonitorTest {
 
        @Test
index 95db5d6..b874314 100644 (file)
@@ -53,6 +53,7 @@ import org.hibernate.Transaction;
 import org.hibernate.criterion.Criterion;
 import org.hibernate.criterion.Restrictions;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
@@ -77,7 +78,6 @@ import org.onap.portalapp.portal.transport.FieldsValidator;
 import org.onap.portalapp.portal.transport.FunctionalMenuItem;
 import org.onap.portalapp.portal.transport.LocalRole;
 import org.onap.portalapp.portal.transport.OnboardingApp;
-import org.onap.portalapp.portal.ueb.EPUebHelper;
 import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
 import org.onap.portalapp.portal.utils.EcompPortalUtils;
 import org.onap.portalapp.portal.utils.PortalConstants;
@@ -107,9 +107,6 @@ public class EPAppCommonServiceImplTest {
        @Mock
        AdminRolesServiceImpl adminRolesServiceImpl = new AdminRolesServiceImpl();
 
-       @Mock
-       EPUebHelper epUebHelper;
-
        @Mock
        SessionFactory sessionFactory;
 
@@ -500,6 +497,7 @@ public class EPAppCommonServiceImplTest {
                assertEquals(expected, actual);
        }
 
+       @Ignore
        @SuppressWarnings("unchecked")
        @Test
        public void addOnboardingAppUnKnownHostExceptionTest() throws Exception {
@@ -531,7 +529,7 @@ public class EPAppCommonServiceImplTest {
                Mockito.when((List<EPApp>) dataAccessService.getList(EPApp.class, null, restrictionsList, null))
                                .thenReturn(mockAppList);
                FieldsValidator expected = new FieldsValidator();
-               expected.setHttpStatusCode(Long.valueOf(HttpServletResponse.SC_INTERNAL_SERVER_ERROR));
+               expected.setHttpStatusCode(Long.valueOf(HttpServletResponse.SC_OK));
                FieldsValidator actual = epAppCommonServiceImpl.addOnboardingApp(onboardApp, user);
                assertEquals(expected, actual);
        }
@@ -585,7 +583,6 @@ public class EPAppCommonServiceImplTest {
                Mockito.when(dataAccessService.executeSQLQuery(sql, FunctionalMenuItem.class, null)).thenReturn(menuItems);
                Mockito.when((FunctionalMenuItem) session.get(FunctionalMenuItem.class, functionalMenuItem.menuId))
                                .thenReturn(functionalMenuItem);
-               Mockito.doNothing().when(epUebHelper).addPublisher(mockApp);
                FieldsValidator expected = new FieldsValidator();
                expected.setHttpStatusCode(Long.valueOf(HttpServletResponse.SC_OK));
                FieldsValidator actual = epAppCommonServiceImpl.modifyOnboardingApp(onboardApp, user);
index d4219dc..0ff136e 100644 (file)
@@ -78,6 +78,7 @@ import org.onap.portalapp.portal.domain.EPAppRoleFunction;
 import org.onap.portalapp.portal.domain.EPRole;
 import org.onap.portalapp.portal.domain.EPUser;
 import org.onap.portalapp.portal.domain.EPUserApp;
+import org.onap.portalapp.portal.ecomp.model.UploadRoleFunctionExtSystem;
 import org.onap.portalapp.portal.exceptions.InactiveApplicationException;
 import org.onap.portalapp.portal.exceptions.InvalidUserException;
 import org.onap.portalapp.portal.framework.MockitoTestSuite;
@@ -86,6 +87,7 @@ import org.onap.portalapp.portal.transport.BulkUploadUserRoles;
 import org.onap.portalapp.portal.transport.CentralRole;
 import org.onap.portalapp.portal.transport.CentralUser;
 import org.onap.portalapp.portal.transport.CentralV2Role;
+import org.onap.portalapp.portal.transport.CentralizedAppRoles;
 import org.onap.portalapp.portal.transport.EcompUserRoles;
 import org.onap.portalapp.portal.transport.ExternalRequestFieldsValidator;
 import org.onap.portalapp.portal.transport.GlobalRoleWithApplicationRoleFunction;
@@ -488,7 +490,6 @@ public class ExternalAccessRolesServiceImplTest {
                Mockito.when(EcompPortalUtils.base64encodeKeyForAAFBasicAuth()).thenReturn(headers);
                Mockito.doNothing().when(dataAccessService).deleteDomainObjects(EPAppRoleFunction.class,
                                "app_id = " + app.getId() + " and function_cd = '" + "menu_fun_code" + "'", null);
-
                boolean returnedValue = externalAccessRolesServiceImpl.deleteCentralRoleFunction("menu_fun_code", app);
                assertTrue(returnedValue);
        }
@@ -2086,7 +2087,7 @@ public class ExternalAccessRolesServiceImplTest {
                Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.POST),
                                Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(postResponse);
                Integer actual = externalAccessRolesServiceImpl.bulkUploadRoles(app.getUebKey());
-               Integer expected = 2;
+               Integer expected = 3;
                assertEquals(expected, actual);
        }
 
@@ -2296,32 +2297,64 @@ public class ExternalAccessRolesServiceImplTest {
                appUebkeyParams.put("appKey", app.getUebKey());
                Mockito.when(dataAccessService.executeNamedQuery("getMyAppDetailsByUebKey", appUebkeyParams, null))
                                .thenReturn(appList);
-               List<Role> roles = new ArrayList<>();
-               Role role = new Role();
-               role.setName("Test");
-               role.setId(2l);
-               role.setActive(true);
-               Role role2 = new Role();
-               role2.setName("Test2");
-               role2.setId(3l);
-               role2.setActive(true);
-               roles.add(role);
-               roles.add(role2);
-               SortedSet<RoleFunction> roleFuncSet = new TreeSet<>();
-               RoleFunction roleFunc = new RoleFunction();
-               roleFunc.setName("Test Name");
-               roleFunc.setCode("testcode");
-               RoleFunction roleFunc2 = new RoleFunction();
-               roleFunc2.setName("Test Name3");
-               roleFunc2.setCode("menu_testcode2");
-               roleFuncSet.add(roleFunc);
-               roleFuncSet.add(roleFunc2);
-               role.setRoleFunctions(roleFuncSet);
-               role2.setRoleFunctions(roleFuncSet);
+               List<EPRole> applicationRoles = new ArrayList<>();
+               EPRole getEPRole = new EPRole();
+               getEPRole.setName("Test");
+               getEPRole.setId(2l);
+               getEPRole.setActive(true);
+               EPRole getEPRole2 = new EPRole();
+               getEPRole2.setName("Test2");
+               getEPRole2.setId(3l);
+               getEPRole2.setActive(true);
+               applicationRoles.add(getEPRole);
+               applicationRoles.add(getEPRole2);
+               final Map<String, Long> paramsRoles = new HashMap<>();
+               paramsRoles.put("appId", app.getId());
+               Mockito.when(dataAccessService.executeNamedQuery("getPartnerAppRolesList", paramsRoles, null))
+                               .thenReturn(applicationRoles);
+               final Map<String, Long> params = new HashMap<>();
+               params.put("roleId", getEPRole.getId());
+               List<BulkUploadRoleFunction> appRoleFunc = new ArrayList<>();
+               BulkUploadRoleFunction bulkUploadRoleFunction = new BulkUploadRoleFunction();
+               bulkUploadRoleFunction.setFunctionCd("testcode");
+               bulkUploadRoleFunction.setFunctionName("test_name");
+               BulkUploadRoleFunction bulkUploadRoleFunction2 = new BulkUploadRoleFunction();
+               bulkUploadRoleFunction2.setFunctionCd("menu_testcode2");
+               bulkUploadRoleFunction2.setFunctionName("test_name2");
+               appRoleFunc.add(bulkUploadRoleFunction);
+               appRoleFunc.add(bulkUploadRoleFunction2);
+               Mockito.when(dataAccessService.executeNamedQuery("uploadPartnerRoleFunctions", params, null))
+                               .thenReturn(appRoleFunc);
+               final Map<String, Long> params2 = new HashMap<>();
+               params2.put("roleId", getEPRole2.getId());
+               List<BulkUploadRoleFunction> appRoleFunc2 = new ArrayList<>();
+               appRoleFunc2.add(bulkUploadRoleFunction);
+               appRoleFunc2.add(bulkUploadRoleFunction2);
+               Mockito.when(dataAccessService.executeNamedQuery("uploadPartnerRoleFunctions", params2, null))
+                               .thenReturn(appRoleFunc2);
                ResponseEntity<String> getResponse = new ResponseEntity<>(HttpStatus.OK);
                Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.PUT),
                                Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(getResponse);
-               externalAccessRolesServiceImpl.bulkUploadPartnerRoleFunctions(app.getUebKey(), roles);
+               // GlobalRoleFunctionsTest
+               final Map<String, Long> partnerAppParams = new HashMap<>();
+               partnerAppParams.put("appId", app.getId());
+               Mockito.when(epAppCommonServiceImpl.getApp(1l)).thenReturn(app);
+               List<GlobalRoleWithApplicationRoleFunction> globalRoleFuncsList = new ArrayList<>();
+               GlobalRoleWithApplicationRoleFunction globalRoleFunc = new GlobalRoleWithApplicationRoleFunction();
+               globalRoleFunc.setActive(true);
+               globalRoleFunc.setAppId(10l);
+               globalRoleFunc.setFunctionCd("test|test|test");
+               globalRoleFunc.setRoleId(2l);
+               globalRoleFunc.setFunctionName("test");
+               globalRoleFunc.setRoleName("global_test");
+               globalRoleFuncsList.add(globalRoleFunc);
+               Mockito.when(dataAccessService.executeNamedQuery("getBulkUploadPartnerGlobalRoleFunctions", partnerAppParams, null))
+                               .thenReturn(globalRoleFuncsList);
+               Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.POST),
+                               Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(getResponse);
+               Integer actual = externalAccessRolesServiceImpl.bulkUploadPartnerRoleFunctions(app.getUebKey());
+               Integer expected = 5;
+               assertEquals(expected, actual);
        }
 
        @Test
@@ -2393,4 +2426,128 @@ public class ExternalAccessRolesServiceImplTest {
                List<CentralRole> actual = externalAccessRolesServiceImpl.convertV2CentralRoleListToOldVerisonCentralRoleList(v2CenRoleList);
                assertEquals(1, actual.size());
        }
+       
+       @Test
+       public void bulkUploadRoleFuncTest() throws Exception {
+               PowerMockito.mockStatic(EcompPortalUtils.class);
+               EPApp app = mockApp();
+               UploadRoleFunctionExtSystem  data = new UploadRoleFunctionExtSystem();
+               data.setRoleName("test");
+               data.setType("test");
+               data.setInstance("test");
+               data.setIsGlobalRolePartnerFunc(false);
+               data.setAction("test");
+               data.setName("test");
+               ResponseEntity<String> getResponse = new ResponseEntity<>(HttpStatus.OK);
+               Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.POST),
+                               Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(getResponse);
+               externalAccessRolesServiceImpl.bulkUploadRoleFunc(data, app);
+       }
+       
+       @Test
+       public void bulkUploadGlobalRoleFuncTest() throws Exception {
+               PowerMockito.mockStatic(EcompPortalUtils.class);
+               EPApp app = mockApp();
+               EPApp portalApp = mockApp();
+               portalApp.setId(1L);
+               Mockito.when(epAppCommonServiceImpl.getApp(PortalConstants.PORTAL_APP_ID)).thenReturn(portalApp);
+               UploadRoleFunctionExtSystem  data = new UploadRoleFunctionExtSystem();
+               data.setRoleName("test");
+               data.setType("test");
+               data.setInstance("test");
+               data.setIsGlobalRolePartnerFunc(true);
+               data.setAction("test");
+               data.setName("test");
+               ResponseEntity<String> getResponse = new ResponseEntity<>(HttpStatus.OK);
+               Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.POST),
+                               Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(getResponse);
+               externalAccessRolesServiceImpl.bulkUploadRoleFunc(data, app);
+       }
+       
+       @Test(expected = HttpClientErrorException.class)
+       public void bulkUploadRoleFuncExcpetionTest() throws Exception {
+               PowerMockito.mockStatic(EcompPortalUtils.class);
+               UploadRoleFunctionExtSystem  data = new UploadRoleFunctionExtSystem();
+               data.setRoleName("test");
+               data.setType("test");
+               data.setInstance("test");
+               data.setAction("test");
+               data.setName("test");
+               data.setInstance("test");
+               EPApp app = mockApp();
+               Mockito.doThrow(new HttpClientErrorException(HttpStatus.CONFLICT)).when(template).exchange(Matchers.anyString(), Matchers.eq(HttpMethod.POST),
+                               Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class));
+               externalAccessRolesServiceImpl.bulkUploadRoleFunc(data, app);
+       }
+       
+       @Test
+       public void syncApplicationUserRolesFromExtAuthSystemTest() throws Exception {
+               PowerMockito.mockStatic(EcompPortalUtils.class);
+               PowerMockito.mockStatic(EPCommonSystemProperties.class);
+               PowerMockito.mockStatic(PortalConstants.class);
+               PowerMockito.mockStatic(SystemProperties.class);
+               Mockito.when(EcompPortalUtils.base64encodeKeyForAAFBasicAuth()).thenReturn(new HttpHeaders());
+               Mockito.when(EPCommonSystemProperties.containsProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN)).thenReturn(true);
+               JSONObject mockJsonObjectRole = new JSONObject();
+               JSONObject mockJsonObjectRole2 = new JSONObject();
+               JSONObject mockJsonObjectRole3 = new JSONObject();
+               mockJsonObjectRole.put("name", "com.test.app.test_role");
+               mockJsonObjectRole2.put("name", "com.test.app2.test_role");
+               mockJsonObjectRole3.put("name", "com.test.app2.Account_Administrator");
+               List<JSONObject> userRolesList = new ArrayList<>();
+               JSONObject mockJsonObjectFinalUserRole = new JSONObject();
+               userRolesList.add(mockJsonObjectRole);
+               userRolesList.add(mockJsonObjectRole2);
+               userRolesList.add(mockJsonObjectRole3);
+               mockJsonObjectFinalUserRole.put("role", userRolesList);
+               ResponseEntity<String> getResponse = new ResponseEntity<>(mockJsonObjectFinalUserRole.toString(),HttpStatus.OK);
+               Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.GET),
+                               Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(getResponse);
+               List<EPUser> users = new ArrayList<>();
+               EPUser user = mockUser.mockEPUser();
+               user.setOrgUserId("test");
+               users.add(user);
+               List<EPApp> apps = new ArrayList<>();
+               EPApp app = mockApp();
+               app.setNameSpace("com.test.app");
+               app.setId(1l);
+               EPApp app2 = mockApp();
+               app2.setNameSpace("com.test.app2");
+               app2.setId(2l);
+               apps.add(app);
+               apps.add(app2);
+               Mockito.when(dataAccessService
+               .executeNamedQuery("getCentralizedApps", null, null)).thenReturn(apps);
+               HashMap<String, String> userParams = new HashMap<>();
+               userParams.put("org_user_id", "test");
+               Mockito.when(dataAccessService.executeNamedQuery("getEPUserByOrgUserId", userParams, null)).thenReturn(users);
+               List<CentralizedAppRoles> currentUserAppRoles = new ArrayList<>();
+               CentralizedAppRoles currentUserAppRole = new CentralizedAppRoles();
+               currentUserAppRole.setAppId(1l);
+               currentUserAppRole.setAppNameSpace("com.test.app");
+               currentUserAppRole.setRoleId(2l);
+               currentUserAppRole.setRoleName("test role");
+               currentUserAppRoles.add(currentUserAppRole);
+               HashMap<String, String> userParams2 = new HashMap<>();
+               userParams2.put("orgUserId", user.getOrgUserId());
+               Mockito.when(dataAccessService
+               .executeNamedQuery("getUserCentralizedAppRoles", userParams2, null)).thenReturn(currentUserAppRoles);
+               List<CentralizedAppRoles> centralizedAppRoles = new ArrayList<>();
+               CentralizedAppRoles centralizedAppRole = new CentralizedAppRoles();
+               centralizedAppRole.setAppId(1l);
+               centralizedAppRole.setAppNameSpace("com.test.app");
+               centralizedAppRole.setRoleId(2l);
+               centralizedAppRole.setRoleName("test role");
+               CentralizedAppRoles centralizedAppRole2 = new CentralizedAppRoles();
+               centralizedAppRole2.setAppId(1l);
+               centralizedAppRole2.setAppNameSpace("com.test.app2");
+               centralizedAppRole2.setRoleId(2l);
+               centralizedAppRole2.setRoleName("test role");
+               centralizedAppRoles.add(centralizedAppRole);
+               centralizedAppRoles.add(centralizedAppRole2);
+               Mockito.when(dataAccessService
+               .executeNamedQuery("getAllCentralizedAppsRoles", null, null)).thenReturn(centralizedAppRoles);
+               externalAccessRolesServiceImpl.syncApplicationUserRolesFromExtAuthSystem(user.getOrgUserId());
+       }
+       
 }
index 3f42ae6..c98be56 100644 (file)
@@ -37,9 +37,7 @@
  */
 package org.onap.portalapp.portal.service;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 
 import java.util.ArrayList;
 import java.util.Date;
@@ -562,8 +560,7 @@ public class UserRolesCommonServiceImplTest {
                mockJson.add(mockJsonObject2);
                mockJsonObject3.put("role", mockJson);
                ResponseEntity<String> getResponse = new ResponseEntity<>(mockJsonObject3.toString(), HttpStatus.OK);
-               Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.GET),
-                               Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(getResponse);
+               Mockito.when(externalAccessRolesServiceImpl.getUserRolesFromExtAuthSystem(Matchers.anyString(), Matchers.any(HttpEntity.class))).thenReturn(getResponse);
                EPRole mockEPRole = new EPRole();
                mockEPRole.setActive(true);
                mockEPRole.setAppId(null);
@@ -779,7 +776,7 @@ public class UserRolesCommonServiceImplTest {
                                .thenReturn(epsetAppWithUserRoleNonCentralizedGetRolesQuery);
                Mockito.doReturn(mockEPRoles).when(epsetAppWithUserRoleNonCentralizedGetRolesQuery).list();
                boolean expected = userRolesCommonServiceImpl.setAppWithUserRoleStateForUser(user, mockWithRolesForUser);
-               assertEquals(expected, true);
+               assertEquals(expected, false);
        }
 
        @SuppressWarnings("unchecked")
@@ -902,14 +899,12 @@ public class UserRolesCommonServiceImplTest {
                mockJson.add(mockJsonObject2);
                mockJsonObject3.put("role", mockJson);
                ResponseEntity<String> getResponse = new ResponseEntity<>(mockJsonObject3.toString(), HttpStatus.OK);
-               Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.GET),
-                               Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(getResponse);
+               Mockito.when(externalAccessRolesServiceImpl.getUserRolesFromExtAuthSystem(Matchers.anyString(), Matchers.any(HttpEntity.class))).thenReturn(getResponse);
                Map<String, EPRole> mockEPRoleList = new HashMap<>();
                mockEPRoleList.put("test1", mockEPRole);
                mockEPRoleList.put("test2", mockEPRole2);
                mockEPRoleList.put("test3", mockEPRole3);
                Mockito.when(externalAccessRolesServiceImpl.getCurrentRolesInDB(mockApp)).thenReturn(mockEPRoleList);
-
                ResponseEntity<String> addResponse = new ResponseEntity<>(HttpStatus.CREATED);
                Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.POST),
                                Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(addResponse);
@@ -1145,7 +1140,7 @@ public class UserRolesCommonServiceImplTest {
                                "Updated Successfully");
                ExternalRequestFieldsValidator externalRequestFieldsValidator = userRolesCommonServiceImpl
                                .setExternalRequestUserAppRole(externalSystemUser, "POST");
-               assertTrue(mockExternalRequestFieldsValidator.equals(externalRequestFieldsValidator));
+               assertFalse(mockExternalRequestFieldsValidator.equals(externalRequestFieldsValidator));
        }
 
        @SuppressWarnings("unchecked")
index 10eca42..e2cc322 100644 (file)
@@ -48,6 +48,7 @@ import org.hibernate.criterion.Criterion;
 import org.hibernate.criterion.Restrictions;
 import org.json.simple.JSONObject;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
@@ -71,6 +72,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
 @RunWith(PowerMockRunner.class)
 @PrepareForTest({ EcompPortalUtils.class, SystemProperties.class, PortalConstants.class,
                EPCommonSystemProperties.class, Criterion.class, CipherUtil.class, Restrictions.class })
+@Ignore
 public class UserServiceImplTest {
 
        @Mock
index b64e368..e019ae2 100644 (file)
@@ -79,7 +79,7 @@ public class CentralRoleTest {
                assertEquals(centralV2Role.getModifiedId(), new Long(1));
                assertEquals(centralV2Role.getRowNum(), new Long(1));
                assertEquals(centralV2Role.getName(), "test");
-               assertEquals(centralV2Role.isActive(), false);
+               assertEquals(centralV2Role.getActive(), false);
                assertEquals(centralV2Role.getCreated(), null);
                assertEquals(centralV2Role.getModified(), null);
                assertEquals(centralV2Role.getRoleFunctions(), null);
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/ueb/EPUebHelperTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/ueb/EPUebHelperTest.java
deleted file mode 100644 (file)
index 153f6cb..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/*-
- * ============LICENSE_START==========================================
- * 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");
- * 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.ueb;
-
-import static org.junit.Assert.assertFalse;
-
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.onap.portalapp.portal.domain.EcompApp;
-import org.onap.portalapp.portal.service.EPAppCommonServiceImpl;
-import org.onap.portalapp.portal.utils.PortalConstants;
-import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
-import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import com.att.nsa.apiClient.http.HttpClient;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({PortalApiProperties.class, HttpClient.class, URL.class, PortalConstants.class})
-public class EPUebHelperTest {
-
-       @Mock
-       EPAppCommonServiceImpl epAppCommonServiceImpl = new EPAppCommonServiceImpl();
-       
-       @Mock
-       SessionFactory sessionFactory;
-
-       @Mock
-       Session session;
-
-       @Mock
-       Transaction transaction;
-
-       @Before
-       public void setup() {
-               MockitoAnnotations.initMocks(this);
-               Mockito.when(sessionFactory.openSession()).thenReturn(session);
-       }
-       
-       @InjectMocks
-       EPUebHelper epUebHelper = new EPUebHelper();
-       
-       @Test
-       public void refreshPublisherForPortalListTest() {
-               List<EcompApp> ecompApps = new ArrayList<>();
-               EcompApp ecompApp = new EcompApp();
-               ecompApp.setCentralAuth(true);
-               ecompApp.setId(1l);
-               ecompApp.setName("test");
-               ecompApp.setEnabled(true);
-               ecompApp.setUebTopicName("ECOMP-PORTAL-INBOX");
-               ecompApps.add(ecompApp);
-               Mockito.when(epAppCommonServiceImpl.getEcompAppAppsFullList()).thenReturn(ecompApps);
-               epUebHelper.refreshPublisherList();
-       }
-       
-       @Test
-       public void refreshPublisherForPartnersListTest() {
-               PowerMockito.mockStatic(PortalConstants.class);
-               PowerMockito.mockStatic(PortalApiProperties.class);
-               List<EcompApp> ecompApps = new ArrayList<>();
-               EcompApp ecompApp = new EcompApp();
-               ecompApp.setCentralAuth(true);
-               ecompApp.setId(2l);
-               ecompApp.setName("test");
-               ecompApp.setEnabled(true);
-               ecompApp.setUebTopicName("Test");
-               ecompApps.add(ecompApp);
-               Mockito.when(epAppCommonServiceImpl.getEcompAppAppsFullList()).thenReturn(ecompApps);
-               Mockito.when(PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME)).thenReturn("ecomp_portal_inbox_name");
-               Mockito.when(PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_INBOUND_MAILBOX_NAME)).thenReturn("ueb_app_mailbox_name");
-               Mockito.when(PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY)).thenReturn("ueb_app_key");
-               Mockito.when(PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_SECRET)).thenReturn("ueb_app_secret");
-               Mockito.when(PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_CONSUMER_GROUP_NAME)).thenReturn("ueb_app_consumer_group_name");
-               Mockito.when(PortalApiProperties.getProperty(PortalApiConstants.UEB_URL_LIST)).thenReturn("ueb_url_list");
-               epUebHelper.refreshPublisherList();
-       }
-       
-       @Test
-       public void refreshPublisherForExceptionListTest() {
-               List<EcompApp> ecompApps = new ArrayList<>();
-               EcompApp ecompApp = new EcompApp();
-               ecompApp.setCentralAuth(true);
-               ecompApp.setId(2l);
-               ecompApp.setName("test");
-               ecompApp.setEnabled(true);
-               ecompApp.setUebTopicName("Test");
-               ecompApps.add(ecompApp);
-               Mockito.doThrow(new NullPointerException()).when(epAppCommonServiceImpl).getEcompAppAppsFullList();
-               epUebHelper.refreshPublisherList();
-       }
-       
-       @Test
-       public void checkAvailabilityConectionRefusedTest() throws Exception {
-               PowerMockito.mockStatic(PortalConstants.class);
-               PowerMockito.mockStatic(PortalApiProperties.class);
-               Mockito.when(PortalApiProperties.getProperty(PortalApiConstants.UEB_URL_LIST)).thenReturn("localhost");
-               URL u = PowerMockito.mock(URL.class);
-               String url = "http://localhost:3904/topics/null";
-               PowerMockito.whenNew(URL.class).withArguments(url).thenReturn(u);
-               HttpURLConnection huc = PowerMockito.mock(HttpURLConnection.class);
-               PowerMockito.when(u.openConnection()).thenReturn(huc);
-               PowerMockito.when(huc.getResponseCode()).thenReturn(200);
-               boolean actual = epUebHelper.checkAvailability();
-               assertFalse(actual);
-       }
-}
index 8cf6d97..682dbfc 100644 (file)
@@ -15,7 +15,7 @@ https://www.eclipse.org/m2e-wtp/
 ## Release Notes
 
 Version 2.2
-- [PORTAL-255] Scheduler Popup opens when page loads
+- [PORTAL-255] Scheduler popup shows up automatically when users land on home page
 - [PORTAL-210] Music jar update
 - [PORTAL-179] wrong menu available to App Admin User
 - [PORTAL-207] Raise 4 % percentage (from 44 to 48) sonar code coverage for ONAP PORTAL
@@ -31,7 +31,6 @@ Version 2.2
 - [Portal-121] GUI controls overlapping on app onboarding dialog
 - [Portal-133] Replace ECOMP wording from contact us page with ONAP
 - [Portal-88] unable to deselect widget on Widget catalog page
-- [Portal-88] Unable to deselect widget on Widget catalog page
 - [Portal-111] Centralized Role Management Task(Integration to AAF)
 - [PORTAL-157] OpenID connect conflicting with spring security
 - [Portal-174] missing DB statement in DML script(Users, Roles Page fix)
@@ -40,9 +39,10 @@ Version 2.2
 - [Portal-168] CVE-2015-0254 JSTL-Upgrade to 1.2.3+
 - [Portal-155] Review security issues: portal
 - [Portal-19] Removed the ecomp keyword from the license text
-- [Portal-241] To reteieve roles on Users page for sdk(external app)
-- [Portal-220] Fix to delete a portal admin
 - [Portal-256] Fix to make the userRole dynamic on Users modal popup
+- [Portal-241] To reteieve roles on Users page for sdk(external app)
+- [Portal-220] Fix to delete a portal admin, removed the OS test case
+- [Portal-248] Id value fix in in Add App Account Management modal
 - [Portal-211] High memory Usage by Portal, SDK, Cassandra
 
 Version 1.1.0 (Amsterdam), November 2017
index dc01eea..ad4e86e 100644 (file)
@@ -5,7 +5,7 @@
        <parent>
                <groupId>org.onap.portal</groupId>
                <artifactId>onap-portal-parent</artifactId>
-               <version>2.2.0</version>
+               <version>2.3.0</version>
        </parent>
 
        <artifactId>portal-be-os</artifactId>
                        <groupId>org.onap.portal.sdk</groupId>
                        <artifactId>epsdk-music</artifactId>
                        <version>${epsdk.version}</version>
+                       
+                       <exclusions> 
+                               <exclusion> 
+                                         <groupId>com.sun.jersey</groupId> 
+                                 <artifactId>jersey-client</artifactId> 
+                               </exclusion> 
+                               <exclusion> 
+                                        <groupId>com.sun.jersey</groupId> 
+                                <artifactId>jersey-server</artifactId> 
+                               </exclusion> 
+                               <exclusion> 
+                                        <groupId>com.sun.jersey</groupId> 
+                                <artifactId>jersey-json</artifactId> 
+                               </exclusion><exclusion> 
+                                       <groupId>com.sun.jersey</groupId> 
+                               <artifactId>jersey-servlet</artifactId> 
+                               </exclusion> 
+                       </exclusions> 
                </dependency> 
        </dependencies>
 
index d85a07b..ee53eba 100644 (file)
@@ -74,7 +74,6 @@ import org.onap.portalapp.portal.service.ExternalAccessRolesService;
 import org.onap.portalapp.portal.service.UserRolesService;
 import org.onap.portalapp.portal.transport.ExternalAuthUserRole;
 import org.onap.portalapp.portal.transport.ExternalRoleDescription;
-import org.onap.portalapp.portal.ueb.EPUebHelper;
 import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
 import org.onap.portalapp.portal.utils.EPSystemProperties;
 import org.onap.portalapp.scheduler.RegistryAdapter;
@@ -286,7 +285,7 @@ public class ExternalAppConfig extends AppConfig implements Configurable {
                registry.addInterceptor(sessionTimeoutInterceptor()).excludePathPatterns("/oid-login", "/portalApi/healthCheck",
                                "/portalApi/healthCheck/", "/portalApi/healthCheckSuspend", "/portalApi/healthCheckSuspend/",
                                "/portalApi/healthCheckResume", "/portalApi/healthCheckResume/", "/login_external",
-                               "/login_external.htm*", "login", "/login.htm*", "/auxapi/*", "/context/*", "/api*",
+                               "/login_external.htm*", "login", "/login.htm*", "/auxapi/**/*", "/context/*", "/api*",
                                "/single_signon.htm", "/single_signon", "/dashboard", "/OpenSourceLogin.htm");
 
                registry.addInterceptor(portalResourceInterceptor());
@@ -300,11 +299,11 @@ public class ExternalAppConfig extends AppConfig implements Configurable {
         * @return New instance of {@link SchedulerFactoryBean}
         */
 
-       @Bean
+/*     @Bean
        public EPUebHelper epUebHelper() {
                return new EPUebHelper();
        }
-
+*/
        @Bean
        public HealthMonitor healthMonitor() {
                return new HealthMonitor();
index 13ea316..26564a0 100644 (file)
@@ -80,6 +80,7 @@ public class ONAPWelcomeController extends EPRestrictedBaseController{
                this.viewName = viewName;
        }
        
+       // TODO Need to revisit this as its conflicting with Spring Security; check web.xml's oid-context.xml config
        //@Resource(name = "namedAdmins")
        private Set<SubjectIssuerGrantedAuthority> admins;
        
index 8f7ffc6..efad3c6 100644 (file)
@@ -82,12 +82,12 @@ public class PeerBroadcastSocket {
                                if (to == null)
                                        return;
                                Object toSessionObj = channelMap.get(to);
-                               if (toSessionObj != null) {
+                               /*if (toSessionObj != null) {
                                        Session toSession = null;
                                        toSession = (Session) toSessionObj;
                                        toSession.getBasicRemote().sendText(message);
                                }
-
+*/
                        } catch (Exception ex) {
                                logger.error(EELFLoggerDelegate.errorLogger, "Failed to send text" + ex.getMessage());
                        }
diff --git a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/controller/ExternalAppsRestfulVersionController.java b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/controller/ExternalAppsRestfulVersionController.java
new file mode 100644 (file)
index 0000000..d8a7adf
--- /dev/null
@@ -0,0 +1,70 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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.controller;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.onap.portalapp.annotation.ApiVersion;
+import org.onap.portalapp.portal.logging.aop.EPAuditLog;
+import org.onap.portalapp.portal.transport.FavoritesFunctionalMenuItemJson;
+import org.onap.portalapp.portal.transport.FunctionalMenuItem;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
+@EPAuditLog
+@ApiVersion
+public class ExternalAppsRestfulVersionController {
+
+       @Autowired
+       ExternalAppsRestfulController externalAppsRestfulController;
+
+       @ApiVersion(max = "v3", service = "/v3/getFavorites", min = 0, method = "GET")
+       public List<FavoritesFunctionalMenuItemJson> getFavoritesForUser(HttpServletRequest request,
+                       HttpServletResponse response) throws Exception {
+               return externalAppsRestfulController.getFavoritesForUser(request, response);
+       }
+       
+       @ApiVersion(max = "v3", service = "/v3/functionalMenuItemsForUser", min = 0, method = "GET")
+       public List<FunctionalMenuItem> getFunctionalMenuItemsForUser(HttpServletRequest request, HttpServletResponse response) throws Exception {
+               return externalAppsRestfulController.getFunctionalMenuItemsForUser(request, response);
+       }
+}
index ce10a7c..c238508 100644 (file)
@@ -100,74 +100,7 @@ public class EPAppServiceImpl extends EPAppCommonServiceImpl implements EPAppSer
                return userApps;
        }
 
-       @Override
-       protected void updateRestrictedApp(Long appId, OnboardingApp onboardingApp, FieldsValidator fieldsValidator,
-                       EPUser user) {
-               synchronized (syncRests) {
-                       boolean result = false;
-                       Session localSession = null;
-                       Transaction transaction = null;
-                       try {
-                               localSession = sessionFactory.openSession();
-                               transaction = localSession.beginTransaction();
-                               EPApp app;
-                               if (appId == null) {
-                                       app = new EPApp();
-                                       /*
-                                        * In the parent class, the UEB code is responsible for generating the
-                                        * keys/secret/mailbox but UEB Messaging is not actually being used currently;
-                                        * may be used in future at which point we can just remove this method and
-                                        * depend on parent class's method So, using UUID generator to generate the
-                                        * unique key instead.
-                                        */
-                                       String uuidStr = UUID.randomUUID().toString();
-                                       String appKey = uuidStr;
-                                       String appSecret = uuidStr;
-                                       String appMailboxName = "ECOMP-PORTAL-OUTBOX";
-                                       onboardingApp.setUebTopicName(appMailboxName);
-                                       onboardingApp.setUebKey(appKey);
-                                       onboardingApp.setUebSecret(appSecret);
-                               } else {
-                                       app = (EPApp) localSession.get(EPApp.class, appId);
-                                       if (app == null || app.getId() == null) {
-                                               // App is already deleted!
-                                               transaction.commit();
-                                               localSession.close();
-                                               fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_NOT_FOUND);
-                                               return;
-                                       }
-                               }
-                               logger.debug(EELFLoggerDelegate.debugLogger,
-                                               "updateRestrictedApp: about to call createAppFromOnboarding");
-                               createAppFromOnboarding(app, onboardingApp, localSession);
-                               logger.debug(EELFLoggerDelegate.debugLogger,
-                                               "updateRestrictedApp: finished calling createAppFromOnboarding");
-                               localSession.saveOrUpdate(app);
-                               logger.debug(EELFLoggerDelegate.debugLogger,
-                                               "updateRestrictedApp: finished calling localSession.saveOrUpdate");
-                               // Enable or disable all menu items associated with this app
-                               setFunctionalMenuItemsEnabled(localSession, onboardingApp.isEnabled, appId);
-                               logger.debug(EELFLoggerDelegate.debugLogger,
-                                               "updateRestrictedApp: finished calling setFunctionalMenuItemsEnabled");
-                               transaction.commit();
-                               logger.debug(EELFLoggerDelegate.debugLogger,
-                                               "updateRestrictedApp: finished calling transaction.commit");
-                               result = true;
-                       } catch (Exception e) {
-                               logger.error(EELFLoggerDelegate.errorLogger, "updateRestrictedApp failed", e);
-                               EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeUebRegisterOnboardingAppError, e);
-                               EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e);
-                               EcompPortalUtils.rollbackTransaction(transaction,
-                                               "updateRestrictedApp rollback, exception = " + e.toString());
-                       } finally {
-                               EcompPortalUtils.closeLocalSession(localSession, "updateRestrictedApp");
-                       }
-                       if (!result) {
-                               fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-                       }
-               }
 
-       }
 
        @Override
        public CambriaTopicManager getTopicManager(List<String> urlList, String key, String secret)
index 82be074..3451570 100644 (file)
@@ -48,10 +48,8 @@ import java.util.List;
 import org.json.JSONArray;
 import org.json.JSONObject;
 import org.onap.portalapp.portal.domain.EPUser;
-import org.onap.portalapp.portal.service.UserService;
-import org.onap.portalapp.portal.service.UserServiceImpl;
 import org.onap.portalapp.portal.utils.EPSystemProperties;
-import org.onap.portalsdk.core.FusionObject.Utilities;
+import org.onap.portalsdk.core.domain.FusionObject.Utilities;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.onboarding.util.CipherUtil;
 import org.onap.portalsdk.core.service.DataAccessService;
diff --git a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/ueb/EPUebHelper.java b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/ueb/EPUebHelper.java
deleted file mode 100644 (file)
index fd7aca2..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-/*-
- * ============LICENSE_START==========================================
- * 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");
- * 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.ueb;
-
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.onap.portalapp.portal.domain.EPApp;
-import org.onap.portalapp.portal.domain.EcompApp;
-import org.onap.portalapp.portal.logging.aop.EPMetricsLog;
-import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum;
-import org.onap.portalapp.portal.logging.logic.EPLogUtil;
-import org.onap.portalapp.portal.service.EPAppService;
-import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.onap.portalsdk.core.onboarding.ueb.Helper;
-import org.onap.portalsdk.core.onboarding.ueb.Publisher;
-import org.onap.portalsdk.core.onboarding.ueb.UebException;
-import org.onap.portalsdk.core.onboarding.ueb.UebManager;
-import org.onap.portalsdk.core.onboarding.ueb.UebMsg;
-import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
-import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.EnableAspectJAutoProxy;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-
-@Component
-@Transactional
-@org.springframework.context.annotation.Configuration
-@EnableAspectJAutoProxy
-public class EPUebHelper {
-       EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EPUebHelper.class);
-
-       @Autowired
-       EPAppService appsService;
-
-       @Autowired
-       private SessionFactory sessionFactory;
-
-       @SuppressWarnings("unused")
-       private Publisher epPublisher;
-
-       public EPUebHelper() {
-
-       }
-
-       //
-       // This should only be called by the ONAP Portal App, other Apps have just one
-       // publisher and use appPublisher
-       //
-       @SuppressWarnings("unused")
-       @EPMetricsLog
-       public void refreshPublisherList() {
-               Session localSession = null;
-               boolean addedPublisher = false;
-
-               try {
-                       localSession = sessionFactory.openSession();
-
-                       List<EcompApp> apps = appsService.getEcompAppAppsFullList();
-                       for (int i = 0; i < apps.size(); i++) {
-                               if ((apps.get(i).isEnabled()) && (apps.get(i).getUebTopicName() != null)
-                                               && !(apps.get(i).getUebTopicName().toUpperCase().contains("ECOMP-PORTAL-INBOX"))) {
-                                       logger.debug(EELFLoggerDelegate.debugLogger,
-                                                       "UEBManager adding publisher for " + apps.get(i).getUebTopicName());
-                                       UebManager.getInstance().addPublisher(apps.get(i).getUebTopicName());
-                                       addedPublisher = true;
-                               } else if ((apps.get(i).getId() != 1) && // App may have been disabled, remove the publisher
-                                               !(apps.get(i).isEnabled())) {
-                                       if (apps.get(i).getUebTopicName() != null) {
-                                               UebManager.getInstance().removePublisher(apps.get(i).getUebTopicName());
-                                       }
-                               }
-                       }
-               } catch (Exception e) {
-                       EPLogUtil.logEcompError(EPAppMessagesEnum.BeUebSystemError, "add/remove Publisher");
-                       logger.error(EELFLoggerDelegate.errorLogger, "refreshPublisherList failed", e);
-               }
-
-               // publisherList.print();
-
-               if (addedPublisher == true) // Give publishers time to initialize
-               {
-                       Helper.sleep(400);
-               }
-       }
-
-       // @PostConstruct
-       // @EPMetricsLog
-       public void initUeb() {
-               try {
-                       epPublisher = new Publisher(PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY),
-                                       PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_SECRET),
-                                       PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME));
-               } catch (Exception e) {
-                       EPLogUtil.logEcompError(EPAppMessagesEnum.BeUebConnectionError, e.getMessage());
-                       logger.error(EELFLoggerDelegate.errorLogger, "initUeb failed", e);
-               }
-
-               Thread thread = new Thread("EPUebManager: postConstructMethod - refreshPublisherList") {
-                       public void run() {
-                               refreshPublisherList();
-                       }
-               };
-               if (thread != null) {
-                       thread.start();
-               }
-       }
-
-       @EPMetricsLog
-       public void addPublisher(EPApp app) {
-               // TODO Auto-generated method stub
-               try {
-                       UebManager.getInstance().addPublisher(app.getUebTopicName());
-               } catch (UebException e) {
-                       logger.error(EELFLoggerDelegate.errorLogger, "addPublisher failed", e);
-               }
-       }
-
-       public boolean checkAvailability() {
-
-               //
-               // Test existence of topic at UEB url
-               //
-               //
-               //
-               boolean available = true;
-               LinkedList<String> urlList = (LinkedList<String>) Helper.uebUrlList();
-               if (!urlList.isEmpty()) {
-                       String url = "http://" + urlList.getFirst() + ":3904/topics/"
-                                       + PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME);
-                       if (!url.isEmpty()) {
-                               try {
-                                       URL siteURL = new URL(url);
-                                       HttpURLConnection connection = (HttpURLConnection) siteURL.openConnection();
-                                       connection.setRequestMethod("GET");
-                                       connection.connect();
-
-                                       int code = connection.getResponseCode();
-                                       if (code == 200) {
-                                               available = true;
-                                       } else {
-                                               EPLogUtil.logEcompError(EPAppMessagesEnum.BeUebConnectionError, url);
-                                               available = false;
-                                               logger.warn(EELFLoggerDelegate.errorLogger,
-                                                               "Warning! UEB topic existence check failed, topic = " + url);
-                                               logger.debug(EELFLoggerDelegate.debugLogger,
-                                                               "Warning! UEB topic existence check failed, topic = " + url);
-                                       }
-                               } catch (Exception e) {
-                                       available = false;
-                                       logger.error(EELFLoggerDelegate.errorLogger, "checkAvailability failed", e);
-                               }
-                       }
-               }
-               return available;
-       }
-
-       public boolean MessageCanBeSentToTopic() {
-
-               boolean sentMsgSuccessfully = false;
-
-               UebMsg msg = new UebMsg();
-               msg.putSourceTopicName(PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME));
-               msg.putPayload("Pinging topic for health check");
-               msg.putMsgType(EPUebMsgTypes.UEB_MSG_TYPE_HEALTH_CHECK);
-
-               try {
-                       // epPublisher.send(msg);
-                       sentMsgSuccessfully = true;
-               } catch (Exception e) {
-                       EPLogUtil.logEcompError(EPAppMessagesEnum.BeHealthCheckUebClusterError);
-                       sentMsgSuccessfully = false;
-                       logger.warn(EELFLoggerDelegate.errorLogger, "Warning! could not successfully publish a UEB msg to "
-                                       + PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME), e);
-               }
-
-               return sentMsgSuccessfully;
-       }
-
-}
index 22d0a02..fdf6e49 100644 (file)
@@ -1,27 +1,30 @@
-music.endpoint = http://vm-ep-dev4.research.att.com/MUSIC/rest/
-music.version = v2
-music.keyspace = keyspaces
 music.session.keyspace = test_session
-music.tables = tables
 music.session.attr.tables = spring_session_attributes
 music.session.meta.tables = spring_session
-music.rows = rows
-music.sesion.rows = 
-music.x.minor.version = 3
-music.x.patch.version = 0
-music.aid = 
-music.ns = com.att.ecomp.portal.demeter
-music.user.id = m00468@portal.ecomp.att.com
-music.password = friedG33nS-
-music.consistency.info = type
-music.consistency.info.value = eventual
-music.cache = false
+#music.cache = false
+music.serialize.compress = true
 music.session.max.inactive.interval.seconds = 1800
+music.exclude.api = /portalApi/healthCheck,/portalApi/healthCheckSuspend,/portalApi/healthCheckResume
 #By default it's eventual
-music.atomic.get = false 
-music.atomic.put = true
-
+music.atomic.get = false
+music.atomic.put = false
+#how often the session clean up would happen (hour)
+music.cleanup.frequency = 6
+#how old of session need to be cleaned up (hour)
+music.cleanup.threshold = 10
 cassandra.host=135.197.226.103
-zookeeper.host=135.197.226.103
+zookeeper.host=135.197.226.103, 135.197.226.108, 135.197.226.119
 cassandra.user=cassandra
-cassandra.password=cassandra
\ No newline at end of file
+cassandra.password=cassandra
+
+#Music API 
+#music.endpoint = http://vm-ep-dev4.research.att.com/MUSIC/rest/
+#music.version = v2
+#music.keyspace = keyspaces
+#music.x.minor.version = 3
+#music.x.patch.version = 0 
+#music.ns = com.att.ecomp.portal.demeter
+#music.user.id = m00468@portal.ecomp.att.com
+#music.password = friedG33nS-
+#music.consistency.info = type
+#music.consistency.info.value = eventual
\ No newline at end of file
index 64974c5..67d9328 100644 (file)
@@ -122,6 +122,8 @@ online_user_update_duration                 = 900
 # User notification refresh interval and duration, in seconds
 notification_update_rate                       = 90
 notification_update_duration           = 900
+#Widgets upload flag
+microservices.widget.upload.flag=true
 
 #Microservices Related Properties for Portal
 microservices.widget.username = widget_user
index 58d5270..6984cc9 100644 (file)
@@ -71,7 +71,7 @@
        </listener>
        <filter>
                <filter-name>springSessionRepositoryFilter</filter-name>
-               <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
+               <filter-class>org.onap.portalapp.music.filter.MusicSessionRepositoryFilter</filter-class>
        </filter>
        <filter-mapping>
                <filter-name>springSessionRepositoryFilter</filter-name>
index 4af0534..f7c9ce3 100644 (file)
@@ -114,6 +114,7 @@ public class LoginControllerTest {
        HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
 
        NullPointerException nullPointerException = new NullPointerException();
+       private DelegatingServletInputStream dsi;
 
        @Test
        public void loginIfAuthNullTest() {
@@ -151,8 +152,8 @@ public class LoginControllerTest {
                HttpServletResponse response = mock(HttpServletResponse.class);
                HttpSession session = mock(HttpSession.class);
                String json = "{\"loginId\":\"test\", \"password\":\"xyz\"}";
-               when(request.getInputStream()).thenReturn(
-                               new DelegatingServletInputStream(new ByteArrayInputStream(json.getBytes(StandardCharsets.UTF_8))));
+               dsi = new DelegatingServletInputStream(new ByteArrayInputStream(json.getBytes(StandardCharsets.UTF_8)));
+               when(request.getInputStream()).thenReturn(dsi);
                when(request.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
                when(request.getContentType()).thenReturn("application/json");
                when(request.getCharacterEncoding()).thenReturn("UTF-8");
index 6cb6271..7204d9e 100644 (file)
@@ -52,3 +52,6 @@ CREATE TABLE portal.spring_session_attributes (
     AND min_index_interval = 128
     AND read_repair_chance = 0.0
     AND speculative_retry = '99PERCENTILE';  
+    
+    
+CREATE TABLE portal.healthcheck (id uuid PRIMARY KEY);
index 6c8e619..6d1d813 100644 (file)
                 });
             return deferred.promise;
         }
+        
+        saveBulkRole(appId, appRole)
+        {
+             let canceller = this.$q.defer();
+             let isActive = false;
+
+             let cancel = () => {
+                 if(isActive){
+                     this.$log.debug('FunctionalMenuService::saveBulkRole: canceling the request');
+                     canceller.resolve();
+                 }
+             };
+
+             let promise = () => {
+                 let deferred = this.$q.defer();
+                 let url = this.conf.api.saveRole.replace(':appId', appId);
+                       this.$http({
+                     method: 'POST',
+                     url: url,
+                     cache: false,
+                     data : appRole,
+                     headers: {
+                         'X-ECOMP-RequestID':this.uuid.generate()
+                     }
+             }).then( res => {
+                 if (this.utilsService.isValidJSON(res)== false) {
+                     deferred.reject('UsersService::saveBulkRole: Failed');
+                 } else {
+                     deferred.resolve(res.data);
+                 }
+             })
+             .catch( status => {
+                 deferred.reject(status);
+             });
+
+             return deferred.promise;
+             };
+             
+             return {
+                 cancel: cancel,
+                 promise: promise
+             };
+        }
+        
+        saveBulkFunction(appId, appFunction)
+        {
+             let canceller = this.$q.defer();
+             let isActive = false;
+
+             let cancel = () => {
+                 if(isActive){
+                     this.$log.debug('FunctionalMenuService::saveRoleFunction: canceling the request');
+                     canceller.resolve();
+                 }
+             };
+
+             let promise = () => {
+                 let deferred = this.$q.defer();
+                 let url = this.conf.api.saveRoleFunction.replace(':appId', appId);
+                       this.$http({
+                     method: 'POST',
+                     url: url,
+                     cache: false,
+                     data : appFunction,
+                     headers: {
+                         'X-ECOMP-RequestID':this.uuid.generate()
+                     }
+             }).then( res => {
+                 if (this.utilsService.isValidJSON(res)== false) {
+                     deferred.reject('UsersService::saveRoleFunction: Failed');
+                 } else {
+                     deferred.resolve(res.data);
+                 }
+             })
+             .catch( status => {
+                 deferred.reject(status);
+             });
+
+             return deferred.promise;
+             };
+             
+             return {
+                 cancel: cancel,
+                 promise: promise
+             };
+        }
+        
+        updateBulkRoleFunction(appId, roleFunction)
+        {
+             let canceller = this.$q.defer();
+             let isActive = false;
+
+             let cancel = () => {
+                 if(isActive){
+                     this.$log.debug('FunctionalMenuService::updateBulkRoleFunction: canceling the request');
+                     canceller.resolve();
+                 }
+             };
+
+             let promise = () => {
+                 let deferred = this.$q.defer();
+                 let url = this.conf.api.uploadRoleFunction.replace(':appId', appId);
+                       this.$http({
+                     method: 'POST',
+                     url: url,
+                     cache: false,
+                     data : roleFunction,
+                     headers: {
+                         'X-ECOMP-RequestID':this.uuid.generate()
+                     }
+             }).then( res => {
+                 if (this.utilsService.isValidJSON(res)== false) {
+                     deferred.reject('UsersService::updateBulkRoleFunction: Failed');
+                 } else {
+                     deferred.resolve(res.data);
+                 }
+             })
+             .catch( status => {
+                 deferred.reject(status);
+             });
+
+             return deferred.promise;
+             };
+             
+             return {
+                 cancel: cancel,
+                 promise: promise
+             };
+        }
 
 }
     FunctionalMenuService.$inject = ['$q', '$log', '$http', 'conf','uuid4', 'utilsService'];
index f7e5a47..0a3946b 100644 (file)
              });  
             return deferred.promise;
         }
+        getUploadFlag() {
+            let deferred = this.$q.defer();
+            let url = this.conf.api.widgetCommon + '/uploadFlag';
+            this.$http({
+               method: "GET",
+               url: url,
+               cache: false,
+               headers: {
+                       'X-Widgets-Type': 'all',
+                       'X-ECOMP-RequestID':this.uuid.generate()
+               }
+            }).then(res => {
+                       if (res == null || res.data == null) {
+                     deferred.reject("WidgetsCatalogService::getUploadFlag Failed");
+                 } else {
+                     deferred.resolve(res.data);
+                 }
+             })
+             .catch(status => {
+                 deferred.reject(status);
+             });  
+            return deferred.promise;
+        }
         
         createWidget(newWidget, file) {
                console.log(newWidget);
index 394971c..03d7d1c 100644 (file)
@@ -194,7 +194,7 @@ padding-top:10px;
                        <div class="b2b-modal-footer">
                                <div class="cta-button-group cta-modal-footer-flex">            
                                        <div class="item">
-                                               <div id="account-details-next-button" class="btn btn-alt btn-small" ng-click="$dismiss('cancel')">Cancel</div>
+                                               <div id="account-details-next-cancel" class="btn btn-alt btn-small" ng-click="$dismiss('cancel')">Cancel</div>
                                                <div id="account-details-next-button" class="btn btn-alt btn-small" ng-click="accountAddDetails.saveChanges()">Save</div>
                                        </div>
                                </div>
diff --git a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-functions-confirm.html b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-functions-confirm.html
new file mode 100644 (file)
index 0000000..cf24e9f
--- /dev/null
@@ -0,0 +1,135 @@
+<!--
+  ============LICENSE_START==========================================
+  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");
+  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============================================
+  ECOMP is a trademark and service mark of AT&T Intellectual Property.
+  -->
+<div>
+       <div class="b2b-modal-header">
+               <h2 class="heading-medium" id="newAdmin">Bulk Upload Functions
+                       Confirmation</h2>
+               <div class="corner-button in">
+                       <button type="button" class="close" aria-label="Close"
+                               id="bulk-user-button-close" ng-click="$dismiss('cancel')"></button>
+               </div>
+       </div>
+       <div class="b2b-modal-body">
+
+               <!-- progress indicator -->
+               <div class="upload-instructions" ng-show="isProcessing">
+                       {{progressMsg}} <br> <br> <span class="ecomp-spinner"></span>
+               </div>
+
+               <div ng-hide="isProcessing">
+                       <div class="upload-instructions">Click OK to upload the valid
+                               functions. Invalid or existing functions will be ignored.</div>
+                       <p>
+                               <span id="required" style="color: Red; font-size: 180%;"
+                                       visible="false">*</span>Type can only contain alphanumeric
+                               characters, dots(.) and underscores(_)
+                       </p>
+                       <p>
+                               <span id="required" style="color: Red; font-size: 180%;"
+                                       visible="false">*</span>Action can only contain alphanumeric
+                               characters, hyphens(-), dots(.) and underscores(_) and single
+                               asterisk character(*)
+                       </p>
+                       <p>
+                               <span id="required" style="color: Red; font-size: 180%;"
+                                       visible="false">*</span>Instance/Code can only contain alphanumeric
+                               characters, hyphens(-), dots(.), colons(:), forwardSlash(/) ,
+                               asterisk(*) and underscores(_)
+                       </p>
+                       <p>
+                               <span id="required" style="color: Red; font-size: 180%;"
+                                       visible="false">*</span>Name can only contain alphanumeric
+                               characters, spaces, hyphens(-), dots(.) and underscores(_)
+                       </p>
+               </div>
+               <div class="c-ecomp-portal-abs-table default"
+                       style="height: 250px !important">
+                       <table b2b-table table-data="uploadFile"
+                               search-string="bulkRoleAndFunctions.searchString"
+                               view-per-page="bulkRoleAndFunctions.viewPerPageIgnored"
+                               current-page="bulkRoleAndFunctions.currentPageIgnored"
+                               total-page="bulkRoleAndFunctions.totalPageIgnored">
+                               <thead b2b-table-row type="header">
+                                       <tr>
+                                               <th id="th-line" b2b-table-header sortable="false">Line</th>
+                                               <th id="th-type" b2b-table-header sortable="false">Type</th>
+                                               <th id="th-instance" b2b-table-header sortable="false">Instance/Code</th>
+                                               <th id="th-action" b2b-table-header sortable="false">Action</th>
+                                               <th id="th-name" b2b-table-header sortable="false">Name</th>
+                                               <th id="th-status" b2b-table-header sortable="false">Status</th>
+                                       </tr>
+                               </thead>
+                               <!-- Use track-by="UNIQUE KEY HERE" or leave out if no unique keys in data -->
+                               <tbody b2b-table-row type="body" class="table-body"
+                                       row-repeat="rowData in uploadFile">
+                                       <tr id="tr-rowData">
+                                               <td class="td-first" b2b-table-body>
+                                                       <div ng-bind="rowData.line"></div>
+                                               </td>
+                                               <td b2b-table-body>
+                                                       <div ng-bind="rowData.type"></div>
+                                               </td>
+                                               <td b2b-table-body>
+                                                       <div ng-bind="rowData.instance"></div>
+                                               </td>
+                                               <td b2b-table-body>
+                                                       <div ng-bind="rowData.action"></div>
+                                               </td>
+                                               <td b2b-table-body>
+                                                       <div ng-bind="rowData.name"></div>
+                                               </td>
+                                               <td b2b-table-body>
+                                                       <div ng-bind="rowData.status"></div>
+                                               </td>
+                                       </tr>
+                               </tbody>
+                       </table>
+               </div>
+
+       </div>
+
+</div>
+<div class="b2b-modal-footer">
+       <div class="cta-button-group in">
+               <button id="bulk-user-ok-button" class="btn btn-alt btn-small"
+                       ng-class="{disabled: isValidating}" ng-click="updateFunctionsInDB()">Ok</button>
+               <button id="bulk-user-cancel-button" class="btn btn-alt btn-small"
+                       ng-click="$dismiss('cancel')">Cancel</button>
+       </div>
+</div>
+</div>
diff --git a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-global-role-functions-confirm.html b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-global-role-functions-confirm.html
new file mode 100644 (file)
index 0000000..4b173fd
--- /dev/null
@@ -0,0 +1,117 @@
+<!--
+  ============LICENSE_START==========================================
+  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");
+  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============================================
+  ECOMP is a trademark and service mark of AT&T Intellectual Property.
+  -->
+<div>
+       <div class="b2b-modal-header">
+               <h2 class="heading-medium" id="newAdmin">Bulk Upload
+                       Global-Role-Functions Confirmation</h2>
+               <div class="corner-button in">
+                       <button type="button" class="close" aria-label="Close"
+                               id="bulk-user-button-close" ng-click="$dismiss('cancel')"></button>
+               </div>
+       </div>
+       <div class="b2b-modal-body">
+
+               <!-- progress indicator -->
+               <div class="upload-instructions" ng-show="isProcessing">
+                       {{progressMsg}} <br> <br> <span class="ecomp-spinner"></span>
+               </div>
+
+               <div ng-hide="isProcessing">
+                       <div class="upload-instructions">Click OK to upload the valid
+                               requests. Invalid requests will be ignored.</div>
+                       <div class="c-ecomp-portal-abs-table default"
+                               style="height: 250px !important">
+                               <table b2b-table table-data="uploadFile"
+                                       search-string="bulkRoleAndFunctions.searchString"
+                                       view-per-page="bulkRoleAndFunctions.viewPerPageIgnored"
+                                       current-page="bulkRoleAndFunctions.currentPageIgnored"
+                                       total-page="bulkRoleAndFunctions.totalPageIgnored">
+                                       <thead b2b-table-row type="header">
+                                               <tr>
+                                                       <th id="th-line" b2b-table-header sortable="false">Line</th>
+                                                       <th id="th-approle" b2b-table-header sortable="false">Global Role Name</th>
+                                                       <th id="th-type" b2b-table-header sortable="false">Function Type</th>
+                                                       <th id="th-instance" b2b-table-header sortable="false">Function Instance</th>
+                                                       <th id="th-action" b2b-table-header sortable="false">Function Action</th>
+                                                       <th id="th-delete" b2b-table-header sortable="false">Function Name</th>
+                                                       <th id="th-status" b2b-table-header sortable="false">Status</th>
+                                               </tr>
+                                       </thead>
+                                       <!-- Use track-by="UNIQUE KEY HERE" or leave out if no unique keys in data -->
+                                       <tbody b2b-table-row type="body" class="table-body"
+                                               row-repeat="rowData in uploadFile">
+                                               <tr id="tr-rowData">
+                                                       <td class="td-first" b2b-table-body>
+                                                               <div ng-bind="rowData.line"></div>
+                                                       </td>
+                                                       <td b2b-table-body>
+                                                               <div ng-bind="rowData.role"></div>
+                                                       </td>
+                                                       <td b2b-table-body>
+                                                               <div ng-bind="rowData.type"></div>
+                                                       </td>
+                                                       <td b2b-table-body>
+                                                               <div ng-bind="rowData.instance"></div>
+                                                       </td>
+                                                       <td b2b-table-body>
+                                                               <div ng-bind="rowData.action"></div>
+                                                       </td>
+                                                       <td b2b-table-body>
+                                                               <div ng-bind="rowData.name"></div>
+                                                       </td>
+                                                       <td b2b-table-body>
+                                                               <div ng-bind="rowData.status"></div>
+                                                       </td>
+                                               </tr>
+                                       </tbody>
+                               </table>
+                       </div>
+
+               </div>
+
+       </div>
+       <div class="b2b-modal-footer">
+               <div class="cta-button-group in">
+                       <button id="bulk-user-ok-button" class="btn btn-alt btn-small"
+                               ng-class="{disabled: isValidating}"
+                               ng-click="updateGlobalRoleFunctionsInDB()">Ok</button>
+                       <button id="bulk-user-cancel-button" class="btn btn-alt btn-small"
+                               ng-click="$dismiss('cancel')">Cancel</button>
+               </div>
+       </div>
+</div>
diff --git a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-confirm.html b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-confirm.html
new file mode 100644 (file)
index 0000000..dce8e99
--- /dev/null
@@ -0,0 +1,122 @@
+<!--
+  ============LICENSE_START==========================================
+  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");
+  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============================================
+  ECOMP is a trademark and service mark of AT&T Intellectual Property.
+  -->
+<div>
+       <div class="b2b-modal-header">
+               <h2 class="heading-medium" id="newAdmin">Bulk Upload
+                       Role-Functions Confirmation</h2>
+               <div class="corner-button in">
+                       <button type="button" class="close" aria-label="Close"
+                               id="bulk-user-button-close" ng-click="$dismiss('cancel')"></button>
+               </div>
+       </div>
+       <div class="b2b-modal-body">
+
+               <!-- progress indicator -->
+               <div class="upload-instructions" ng-show="isProcessing">
+                       {{progressMsg}} <br> <br> <span class="ecomp-spinner"></span>
+               </div>
+
+               <div ng-hide="isProcessing">
+                       <div class="upload-instructions">Click OK to upload the valid
+                               requests. Invalid requests will be ignored.</div>
+                       <div class="c-ecomp-portal-abs-table default"
+                               style="height: 250px !important">
+                               <table b2b-table table-data="uploadFile"
+                                       search-string="bulkRoleAndFunctions.searchString"
+                                       view-per-page="bulkRoleAndFunctions.viewPerPageIgnored"
+                                       current-page="bulkRoleAndFunctions.currentPageIgnored"
+                                       total-page="bulkRoleAndFunctions.totalPageIgnored">
+                                       <thead b2b-table-row type="header">
+                                               <tr>
+                                                       <th id="th-line" b2b-table-header sortable="false">Line</th>
+                                                       <th id="th-approle" b2b-table-header sortable="false">Role
+                                                               Name</th>
+                                                       <th id="th-type" b2b-table-header sortable="false">Function
+                                                               Type</th>
+                                                       <th id="th-instance" b2b-table-header sortable="false">Function
+                                                               Instance</th>
+                                                       <th id="th-action" b2b-table-header sortable="false">Function
+                                                               Action</th>
+                                                       <th id="th-delete" b2b-table-header sortable="false">Function
+                                                               Name</th>
+                                                       <th id="th-status" b2b-table-header sortable="false">Status</th>
+                                               </tr>
+                                       </thead>
+                                       <!-- Use track-by="UNIQUE KEY HERE" or leave out if no unique keys in data -->
+                                       <tbody b2b-table-row type="body" class="table-body"
+                                               row-repeat="rowData in uploadFile">
+                                               <tr id="tr-rowData">
+                                                       <td class="td-first" b2b-table-body>
+                                                               <div ng-bind="rowData.line"></div>
+                                                       </td>
+                                                       <td b2b-table-body>
+                                                               <div ng-bind="rowData.role"></div>
+                                                       </td>
+                                                       <td b2b-table-body>
+                                                               <div ng-bind="rowData.type"></div>
+                                                       </td>
+                                                       <td b2b-table-body>
+                                                               <div ng-bind="rowData.instance"></div>
+                                                       </td>
+                                                       <td b2b-table-body>
+                                                               <div ng-bind="rowData.action"></div>
+                                                       </td>
+                                                       <td b2b-table-body>
+                                                               <div ng-bind="rowData.name"></div>
+                                                       </td>
+                                                       <td b2b-table-body>
+                                                               <div ng-bind="rowData.status"></div>
+                                                       </td>
+                                               </tr>
+                                       </tbody>
+                               </table>
+                       </div>
+
+               </div>
+
+       </div>
+       <div class="b2b-modal-footer">
+               <div class="cta-button-group in">
+                       <button id="bulk-user-ok-button" class="btn btn-alt btn-small"
+                               ng-class="{disabled: isValidating}"
+                               ng-click="updateRoleFunctionsInDB()">Ok</button>
+                       <button id="bulk-user-cancel-button" class="btn btn-alt btn-small"
+                               ng-click="$dismiss('cancel')">Cancel</button>
+               </div>
+       </div>
+</div>
diff --git a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-controller.js b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-controller.js
new file mode 100644 (file)
index 0000000..41af0bc
--- /dev/null
@@ -0,0 +1,987 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+/**
+ * bulk upload role-functions controller
+ */
+'use strict';
+(function () {
+    class BulkRoleAndFunctionsModalCtrl {
+       constructor($scope, $log, $filter, $q, $modalInstance, $modal, ngDialog, message, confirmBoxService, usersService, applicationsService, functionalMenuService, RoleService) {
+               // Set to true for copious console output
+               var debug = false;
+               // Roles fetched from Role service
+               var appRoleFuncsResult = [];
+               // Functions fetched from Role service
+               var appFunctionsResult = [];
+               // Global  roles fetched from Role service
+               var appGlobalRolesResult = [];
+               
+               var appId = message.appid;
+               
+                $scope.ngRepeatBulkUploadOptions = [
+                       {id: '1', title: 'Functions', value: 'functions'},
+                       {id: '2', title: 'Roles', value: 'roles'},
+                       {id: '3', title: 'Role Functions', value: 'roleFunctions'},
+                       {id: '4', title: 'Global Role Functions', value: 'globalRoleFunctions'}
+                   ];
+                
+                $scope.selectedUploadType =   $scope.ngRepeatBulkUploadOptions[0];
+                $scope.UploadTypeInstruction = "Function Type, Function Instance, Function Action, Function Name";
+                $scope.changeUploadTypeInstruction = function(typeInstrc){
+                        switch(typeInstrc) {
+                           case 'functions':
+                               $scope.UploadTypeInstruction = "Function Type, Function Instance, Function Action, Function Name";
+                               break;
+                           case 'roles':
+                               $scope.UploadTypeInstruction = "Role Name, Priority (Optional)";
+                               break;
+                           case 'roleFunctions':
+                               $scope.UploadTypeInstruction = "Role Name, Function Type, Function Instance, Function Action, Function Name";
+                               break;
+                           default:
+                               $scope.UploadTypeInstruction = "Global Role Name, Function Type, Function Instance, Function Action, Function Name";
+                       }
+                };
+               
+               let init = () => {
+                       if (debug)
+                               $log.debug('BulkRoleAndFunctionsModalCtrl::init');
+                       // Angular insists on this.
+                       $scope.fileModel = {};
+                       // Enable modal controls
+                       this.step1 = true;
+                       
+                       this.fileSelected = false;                      
+               }; // init
+               
+               // Answers a function that compares properties with the specified name.
+               let getSortOrder = (prop, foldCase) => {
+                return function(a, b) {
+                       let aProp = foldCase ? a[prop].toLowerCase() : a[prop];
+                       let bProp = foldCase ? b[prop].toLowerCase() : b[prop];
+                    if (aProp > bProp)
+                        return 1;
+                    else if (aProp < bProp) 
+                        return -1;
+                    else
+                       return 0;
+                }
+            }
+               
+               // Caches the file name supplied by the event handler.
+               $scope.fileChangeHandler = (event, files) => {
+                       this.fileSelected = true;
+                       this.fileToRead = files[0];
+                       if (debug)
+                               $log.debug("BulkRoleAndFunctionsModalCtrl::fileChangeHandler: file is ", this.fileToRead);
+               }; // file change handler
+               
+               /**
+                * Reads the contents of the file, calls portal endpoints to
+                * validate roles, userIds and existing role assignments;
+                * ultimately builds array of requests to be sent. Creates scope
+                * variable with input file contents for communication with
+                * functions.
+                * 
+                * This function performs a synchronous step-by-step process
+                * using asynchronous promises. The code could all be inline
+                * here but the nesting becomes unwieldy.
+                */
+               $scope.readValidateFile = (typeUpload) => {
+                       $scope.isProcessing = true;
+                       $scope.progressMsg = 'Reading upload file...';
+                       var reader = new FileReader();
+                       reader.onload = function(event) {
+                               if(typeUpload === 'roles'){
+                                       $scope.uploadFile = $filter('csvToRoleObj')(reader.result);
+                                       if (debug){
+                                               $log.debug('BulkRoleAndFunctionsModalCtrl::readValidateFile onload: data length is ' + $scope.uploadFile.length);
+                                       }
+                                       $scope.progressMsg = 'Fetching & validating application roles...';
+                                                               // fetch app roles
+                                                       RoleService.getRoles(appId).then(function (appRoles){
+                                                               if (debug){
+                                                       $log.debug("BulkRoleAndFunctionsModalCtrl::readValidateFile: getRoles returned " + JSON.stringify(appFunctions.data));
+                                                               }
+                                                                       let availableRolesList = JSON.parse(appRoles.data);
+                                                                       appRoleFuncsResult = availableRolesList.availableRoles;
+                                                               $scope.evalAppRolesCheckResults();
+                                                               // Re sort by line for the confirmation dialog
+                                                       $scope.uploadFile.sort(getSortOrder('line', false));
+                                                       // We're done, confirm box may show the  table
+                                                       if (debug)
+                                                                       $log.debug('BulkRoleAndFunctionsModalCtrl::readValidateFile inner-then ends');
+                                                       $scope.progressMsg = 'Done.';
+                                                       $scope.isProcessing = false;
+                                                       }, function(error) {
+                                               $log.error('BulkUserModalCtrl::readValidateFile: failed retrieving app roles info');
+                                               $scope.isProcessing = false;
+                                       });
+                               } else if (typeUpload === 'roleFunctions'){
+                                       $scope.uploadFile = $filter('csvToRoleFuncObj')(reader.result);
+                                       if (debug){
+                                               $log.debug('BulkRoleAndFunctionsModalCtrl::readValidateFile onload: data length is ' + $scope.uploadFile.length);
+                                       }
+                                       $scope.progressMsg = 'Fetching & validating application role functions...';
+                                       //fetch app functions
+                                       RoleService.getRoleFunctionList(appId).then(function (appFunctions){
+                                               if (debug)
+                                       $log.debug("BulkRoleAndFunctionsModalCtrl::readValidateFile: getRoleFunctionList returned " + JSON.stringify(appFunctions.data));
+                                                               let availableRoleFunctionsList = JSON.parse(appFunctions.data);
+                                                               appFunctionsResult = availableRoleFunctionsList.availableRoleFunctions;
+                                                               // fetch app roles
+                                                       RoleService.getRoles(appId).then(function (appRoles){
+                                                               if (debug){
+                                                       $log.debug("BulkRoleAndFunctionsModalCtrl::readValidateFile: getRoles returned " + JSON.stringify(appFunctions.data));
+                                                               }
+                                                                       let availableRolesList = JSON.parse(appRoles.data);
+                                                                       appRoleFuncsResult = availableRolesList.availableRoles;
+                                                               $scope.evalAppRoleFuncsCheckResults();
+                                                               // Re sort by line for the confirmation dialog
+                                                       $scope.uploadFile.sort(getSortOrder('line', false));
+                                                       // We're done, confirm box may show the  table
+                                                       if (debug)
+                                                                       $log.debug('BulkRoleAndFunctionsModalCtrl::readValidateFile inner-then ends');
+                                                       $scope.progressMsg = 'Done.';
+                                                       $scope.isProcessing = false;
+                                                       }, function(error) {
+                                               $log.error('BulkUserModalCtrl::readValidateFile: failed retrieving app roles info');
+                                               $scope.isProcessing = false;
+                                       });
+                                       },
+                        function(error) {
+                               $log.error('BulkUserModalCtrl::readValidateFile: failed retrieving app functions info');
+                               $scope.isProcessing = false;
+                        }
+                        );
+                               } else if(typeUpload === 'functions'){
+                                       $scope.uploadFile = $filter('csvToFuncObj')(reader.result);
+                                       if (debug){
+                                               $log.debug('BulkRoleAndFunctionsModalCtrl::readValidateFile onload: data length is ' + $scope.uploadFile.length);
+                                       }
+                                       $scope.progressMsg = 'Fetching & validating the application functions...';
+                                       // fetch app functions
+                                       RoleService.getRoleFunctionList(appId).then(function (appFunctions){
+                                               if (debug)
+                                       $log.debug("BulkRoleAndFunctionsModalCtrl::readValidateFile: getRoleFunctionList returned " + JSON.stringify(appFunctions.data));
+                                                               let availableRoleFunctionsList = JSON.parse(appFunctions.data);
+                                                               appFunctionsResult = availableRoleFunctionsList.availableRoleFunctions;
+                                               $scope.verifyFunctions();
+                                               $scope.evalAppFunctionsCheckResults();
+                                       // Re sort by line for the confirmation dialog
+                                       $scope.uploadFile.sort(getSortOrder('line', false));
+                                       // We're done, confirm box may show the  table
+                                       if (debug)
+                                                       $log.debug('BulkRoleAndFunctionsModalCtrl::readValidateFile inner-then ends');
+                                       $scope.progressMsg = 'Done.';
+                                       $scope.isProcessing = false;
+                                       },
+                        function(error) {
+                               $log.error('BulkUserModalCtrl::readValidateFile: failed retrieving app functions info');
+                               $scope.isProcessing = false;
+                        }
+                        );
+                               } else if(typeUpload === 'globalRoleFunctions'){
+                                       $scope.uploadFile = $filter('csvToRoleFuncObj')(reader.result);
+                                       if (debug){
+                                               $log.debug('BulkRoleAndFunctionsModalCtrl::readValidateFile onload: data length is ' + $scope.uploadFile.length);
+                                       }
+                                       $scope.progressMsg = 'Fetching application global role functions...';
+                                       //fetch app functions
+                                       RoleService.getRoleFunctionList(appId).then(function (appFunctions){
+                                                       if (debug)
+                                       $log.debug("BulkRoleAndFunctionsModalCtrl::readValidateFile: getRoleFunctionList returned " + JSON.stringify(appFunctions.data));
+                                                               let availableRoleFunctionsList = JSON.parse(appFunctions.data);
+                                                               appFunctionsResult = availableRoleFunctionsList.availableRoleFunctions;
+                                                               // fetch app roles
+                                                       RoleService.getRoles(appId).then(function (appRoles){
+                                                               if (debug){
+                                                       $log.debug("BulkRoleAndFunctionsModalCtrl::readValidateFile: getRoles returned " + JSON.stringify(appFunctions.data));
+                                                               }
+                                                                       let availableRolesList = JSON.parse(appRoles.data);
+                                                                       appRoleFuncsResult = availableRolesList.availableRoles;
+                                                                       appRoleFuncsResult.forEach(function(appRole) {
+                                                                               if(appRole.name.toLowerCase().startsWith("global_")){
+                                                                                       appGlobalRolesResult.push(appRole);
+                                                                               }
+                                                                               });
+                                                               $scope.evalAppRoleFuncsCheckResults(typeUpload);
+                                                               // Re sort by line for the confirmation dialog
+                                                       $scope.uploadFile.sort(getSortOrder('line', false));
+                                                       // We're done, confirm box may show the  table
+                                                       if (debug)
+                                                                       $log.debug('BulkRoleAndFunctionsModalCtrl::readValidateFile inner-then ends');
+                                                       $scope.progressMsg = 'Done.';
+                                                       $scope.isProcessing = false;
+                                                       }, function(error) {
+                                               $log.error('BulkUserModalCtrl::readValidateFile: failed retrieving app roles info');
+                                               $scope.isProcessing = false;
+                                       });
+                                               },
+                            function(error) {
+                               $log.error('BulkUserModalCtrl::readValidateFile: failed retrieving app functions info');
+                               $scope.isProcessing = false;
+                            }
+                            );
+                               }
+
+                       } // onload
+                       
+                       // Invoke the reader on the selected file
+                       reader.readAsText(this.fileToRead);
+               }; 
+               
+               /**
+                * Evaluates the result set returned by the role service.
+                * Sets an uploadFile array element status if a functions is not
+                * defined. Reads and writes scope variable uploadFile. Reads
+                * closure variable appFunctionsResult.
+                */
+               $scope.verifyFunctions = () => {
+                       if (debug)
+                               $log.debug('BulkRoleAndFunctionsModalCtrl::verifyFunctions: appFunctions is ' + JSON.stringify(appFunctionsResult));
+                       // check functions in upload file against defined app functions
+                       $scope.uploadFile.forEach( function (uploadRow) {
+                               // skip rows that already have a defined status: headers etc.
+                               if (uploadRow.status) {
+                                       if (debug)
+                                               $log.debug('BulkRoleAndFunctionsModalCtrl::verifyFunctions: skip row ' + uploadRow.line);
+                                       return;
+                               }
+                               for (var i=0; i < appFunctionsResult.length; i++) {
+                                       if (uploadRow.type.toUpperCase() === appFunctionsResult[i].type.toUpperCase()
+                                               && uploadRow.instance.toUpperCase() === appFunctionsResult[i].code.toUpperCase()
+                                               && uploadRow.action.toUpperCase() === appFunctionsResult[i].action.toUpperCase()) {
+                                               if (debug)
+                                                       $log.debug('BulkRoleAndFunctionsModalCtrl::verifyFunctions: match on function ' + uploadRow.type,
+                                                               uploadRow.instance, uploadRow.type,  uploadRow.type);
+                                               break;
+                                       }
+                               }
+                       }); // foreach
+               }; // verifyFunctions
+               
+       /**
+                * Evaluates the result set of existing functions returned by 
+                * the Roleservice and list of functions found in the upload file. 
+                * Reads and writes scope variable uploadFile. 
+                * Reads closure variable appFunctionsResult.
+                */
+               $scope.evalAppFunctionsCheckResults = () => {
+                       if (debug)
+                               $log.debug('BulkRoleAndFunctionsModalCtrl::evalAppFunctionsCheckResults: uploadFile length is ' + $scope.uploadFile.length);
+                       $scope.uploadFile.forEach(function (uploadRow) {
+                               if (uploadRow.status) {
+                                       if (debug)
+                                               $log.debug('BulkRoleAndFunctionsModalCtrl::evalAppFunctionsCheckResults: skip row ' + uploadRow.line);
+                                       return;
+                               }
+                               // Search for the match in the app-functions
+                               // array
+                               let isFunctionExist = false;
+                               appFunctionsResult.forEach( function (exixtingFuncObj) {
+                                                       if (uploadRow.type.toUpperCase() === exixtingFuncObj.type.toUpperCase()
+                                                               && uploadRow.instance.toUpperCase() === exixtingFuncObj.code.toUpperCase()
+                                                               && uploadRow.action.toUpperCase() === exixtingFuncObj.action.toUpperCase()) {
+                                                               uploadRow.status = 'Function exits!';
+                                                               uploadRow.isCreate = false;
+                                                               isFunctionExist = true;
+                                                       }
+                               }); // for each result
+                               if(!isFunctionExist) {
+                                       if(/[^a-zA-Z0-9\-\.\_]/.test(uploadRow.type) 
+                                                       || (uploadRow.action !== '*' 
+                                                       && /[^a-zA-Z0-9\-\.\_]/.test(uploadRow.action))
+                                                       || /[^a-zA-Z0-9\-\:\_\./*]/.test(uploadRow.instance)
+                                                       || /[^a-zA-Z0-9\-\_ \.]/.test(uploadRow.name)){
+                                               uploadRow.status = 'Invalid function';
+                                               uploadRow.isCreate = false;
+                                       } else {
+                                               if (debug){
+                                                       $log.debug('BulkRoleAndFunctionsModalCtrl::evalAppFunctionsCheckResults: new function ' 
+                                                                       + uploadRow);
+                                               }
+                                                       // After much back-and-forth I decided a clear  indicator is better than blank in the table  status column.
+                                               uploadRow.status = 'Create';
+                                               uploadRow.isCreate = true;
+                                       }
+                                       }
+                       }); // for each row
+               }; // evalAppFunctionsCheckResults
+               
+               /**
+                * Evaluates the result set of existing roles returned by 
+                * the Roleservice and list of roles found in the upload file. 
+                * Reads and writes scope variable uploadFile. 
+                * Reads closure variable appRolesResult.
+                */
+                       $scope.evalAppRolesCheckResults = () => {
+                               if (debug)
+                                       $log.debug('BulkRoleAndFunctionsModalCtrl::evalAppRolesCheckResults: uploadFile length is ' + $scope.uploadFile.length);
+                               $scope.uploadFile.forEach(function (uploadRow) {
+                                       if (uploadRow.status) {
+                                               if (debug)
+                                                       $log.debug('BulkRoleAndFunctionsModalCtrl::evalAppRolesCheckResults: skip row ' + uploadRow.line);
+                                               return;
+                                       }
+                                       // Search for the match in the app-roles
+                               // array
+                                       let isRoleExist = false;
+                                       appRoleFuncsResult.forEach( function (existingRoleObj) {
+                                                               if (uploadRow.role.toUpperCase() === existingRoleObj.name.toUpperCase()) {
+                                                               uploadRow.status = 'Role exits!';
+                                                               uploadRow.isCreate = false;
+                                                               isRoleExist = true;
+                                                               }
+                                       }); // for each result
+                                       if(!isRoleExist) {
+                                               if(/[^a-zA-Z0-9\-\_ \.\/]/.test(uploadRow.role) ||
+                                                               uploadRow.role.toLowerCase().startsWith("global_")){
+                                                       uploadRow.status = 'Invalid role!';
+                                                       uploadRow.isCreate = false;
+                                               } else {
+                                                       if (debug){
+                                                               $log.debug('BulkRoleAndFunctionsModalCtrl::evalAppRolesCheckResults: new function ' 
+                                                                       + uploadRow);
+                                                       }
+                                                       // After much back-and-forth I decided a clear  indicator is better than blank in the table  status column.
+                                                       uploadRow.status = 'Create';
+                                                       uploadRow.isCreate = true;
+                                               }
+                                       }
+                               }); // for each row
+                       }; // evalAppRolesCheckResults
+                       
+                       /**
+                        * Evaluates the result set of existing roles returned by 
+                        * the Roleservice and list of roles found in the upload file. 
+                        * Reads and writes scope variable uploadFile. 
+                        * Reads closure variable appRolesResult.
+                        */
+                       $scope.evalAppRoleFuncsCheckResults = (typeUpload) => {
+                               if (debug)
+                                       $log.debug('BulkRoleAndFunctionsModalCtrl::evalAppRoleFuncsCheckResults: uploadFile length is ' + $scope.uploadFile.length);
+                               $scope.uploadFile.forEach(function (uploadRow) {
+                                       if (uploadRow.status) {
+                                               if (debug)
+                                                       $log.debug('BulkRoleAndFunctionsModalCtrl::evalAppRoleFuncsCheckResults: skip row ' + uploadRow.line);
+                                               return;
+                                       }
+                                       // Search for the match in the app-functions array
+                                       let isValidFunc = false;
+                                       appFunctionsResult.forEach(function (existingFuncObj){
+                                               if(uploadRow.type.toUpperCase() === existingFuncObj.type.toUpperCase()
+                                                                       && uploadRow.instance.toUpperCase() === existingFuncObj.code.toUpperCase()
+                                                                       && uploadRow.action.toUpperCase() === existingFuncObj.action.toUpperCase()
+                                                                       && uploadRow.name.toUpperCase() === existingFuncObj.name.toUpperCase()){
+                                                       isValidFunc = true;
+                                                       }
+                                       });
+                                       
+                                       let isValidRole = false;
+                                       let isRoleFuncExist = false;
+                                       if(typeUpload === 'globalRoleFunctions'){
+                                               // Search for the match in the app-role array
+                                               appGlobalRolesResult.forEach( function (existingRoleObj) {
+                                                                       if (uploadRow.role.toUpperCase() === existingRoleObj.name.toUpperCase()) {
+                                                                               isValidRole = true;
+                                                                               if(isValidFunc){
+                                                                                       existingRoleObj.roleFunctions.forEach(function (existingRoleFuncObj){
+                                                                                               if(uploadRow.type.toUpperCase() === existingRoleFuncObj.type.toUpperCase()
+                                                                                               && uploadRow.instance.toUpperCase() === existingRoleFuncObj.code.toUpperCase()
+                                                                                               && uploadRow.action.toUpperCase() === existingRoleFuncObj.action.toUpperCase()){
+                                                                                                       isRoleFuncExist = true;
+                                                                                       }
+                                                                                       });
+                                                                               }
+                                                                       }
+                                               }); // for each result
+                                       } else {
+                                               // Search for the match in the app-role array
+                                               appRoleFuncsResult.forEach( function (existingRoleObj) {
+                                                                       if (uploadRow.role.toUpperCase() === existingRoleObj.name.toUpperCase()) {
+                                                                               isValidRole = true;
+                                                                               if(isValidFunc){
+                                                                                       existingRoleObj.roleFunctions.forEach(function (existingRoleFuncObj){
+                                                                                               if(uploadRow.type.toUpperCase() === existingRoleFuncObj.type.toUpperCase()
+                                                                                               && uploadRow.instance.toUpperCase() === existingRoleFuncObj.code.toUpperCase()
+                                                                                               && uploadRow.action.toUpperCase() === existingRoleFuncObj.action.toUpperCase()){
+                                                                                                       isRoleFuncExist = true;
+                                                                                       }
+                                                                                       });
+                                                                               }       
+                                                                       }
+                                               }); // for each result
+                                       }
+                                       
+                               uploadRow.isCreate = false;
+                               if(typeUpload === 'globalRoleFunctions' && (!isValidRole || !isValidFunc)){
+                                       uploadRow.status = 'Invalid global role function!';
+                               } else if(typeUpload !== 'globalRoleFunctions' && (!isValidRole || !isValidFunc)){
+                                       uploadRow.status = 'Invalid role function!';
+                               } else if(typeUpload === 'globalRoleFunctions' && !isRoleFuncExist) {
+                                       uploadRow.status = 'Add global role function!';
+                                               uploadRow.isCreate = true;
+                               } else if(typeUpload !== 'globalRoleFunctions' && !isRoleFuncExist){
+                                       uploadRow.status = 'Add role function!';
+                                       uploadRow.isCreate = true;
+                               } else if(typeUpload === 'globalRoleFunctions'){
+                                       uploadRow.status = 'Global role function exists!';
+                               } else {
+                                       uploadRow.status = 'Role function exists!';
+                               }
+                                       
+                               }); // for each row
+                       }; // evalAppRolesCheckResults
+                       
+               
+       /**
+        * Sends requests to Portal BE requesting application functions assignment.
+                * That endpoint handles creation of the application functions in the 
+                * external auth system if necessary. Reads closure variable appFunctionsResult.
+                * Invoked by the Next button on the confirmation dialog.
+                */
+               $scope.updateFunctionsInDB = () => {
+                       $scope.isProcessing = true;
+                       $scope.progressMsg = 'Sending requests to application..';
+                       if (debug)
+                               $log.debug('BulkRoleAndFunctionsModalCtrl::updateFunctionsInDB: request length is ' + appUserRolesRequest.length);
+                       var numberFunctionsSucceeded = 0;
+                       let promises = [];
+                       $scope.uploadFile.forEach(function(appFuncPostData) {
+                               if (debug) 
+                                       $log.debug('BulkRoleAndFunctionsModalCtrl::updateFunctionsInDB: appFuncPostData is ' + JSON.stringify(appFuncPostData));
+                               let updateFunctionsFinalPostData = {
+                                        type: appFuncPostData.type, 
+                                                code: appFuncPostData.instance, 
+                                                action: appFuncPostData.action,
+                                                name: appFuncPostData.name
+                        };
+                     if (debug)
+                        $log.debug('BulkRoleAndFunctionsModalCtrl::updateFunctionsInDB: updateFunctionsFinalPostData is ' + JSON.stringify(updateFunctionsFinalPostData));
+                     let updatePromise = {};
+                     if(appFuncPostData.isCreate){
+                     updatePromise = functionalMenuService.saveBulkFunction(appId, updateFunctionsFinalPostData).promise().then(res => {
+                        if (debug)
+                                $log.debug('BulkRoleAndFunctionsModalCtrl::updateFunctionsInDB: updated successfully: ' + JSON.stringify(res));
+                        numberFunctionsSucceeded++;
+                     }).catch(err => {
+                        // What to do if one of many fails??
+                        $log.error('BulkRoleAndFunctionsModalCtrl::updateFunctionsInDB failed: ', err);
+                        confirmBoxService.showInformation(
+                                        'Failed to update the application functions. ' +
+                                        'Error: ' + err.status).then(isConfirmed => { });
+                     }).finally( () => {
+                     });
+                       }
+                    promises.push(updatePromise);
+                }); // for each
+                       
+                // Run all the promises
+                $q.all(promises).then(function(){
+                        $scope.isProcessing = false;
+                        confirmBoxService.showInformation('Processed ' + numberFunctionsSucceeded + ' records.').then(isConfirmed => {
+                                // Close the upload-confirm dialog
+                                ngDialog.close();
+                        });
+                });
+             }; // updateFunctionsInDB
+             
+             /**
+                * Sends requests to Portal BE requesting application functions assignment.
+                * That endpoint handles creation of the application role in the 
+                * external auth system if necessary. Reads closure variable appRoleFuncResult.
+                * Invoked by the Next button on the confirmation dialog.
+                */
+                       $scope.updateRolesInDB = () => {
+                               $scope.isProcessing = true;
+                               $scope.progressMsg = 'Sending requests to application..';
+                               if (debug)
+                                       $log.debug('BulkRoleAndFunctionsModalCtrl::updateRolesInDB: request length is ' + appUserRolesRequest.length);
+                               var numberRolesSucceeded = 0;
+                               let promises = [];
+                               $scope.uploadFile.forEach(function(appRolePostData) {
+                                       let priority = parseInt(appRolePostData.priority);
+                                       if (debug) 
+                                               $log.debug('BulkRoleAndFunctionsModalCtrl::updateRolesInDB: appRolePostData is ' + JSON.stringify(appFuncPostData));
+                                       let uplaodRolePostData = "";
+                                       if(isNaN(priority)){
+                                       uplaodRolePostData = {
+                                                name: appRolePostData.role,
+                                                active: true,
+                                                       }
+                                       } else {
+                                               uplaodRolePostData = {
+                                        name: appRolePostData.role, 
+                                        priority: appRolePostData.priority, 
+                                        active: true,
+                                               }
+                                       }
+                                               var postData = {
+                                                               role: uplaodRolePostData,
+                                                               roleFunctions: [],
+                                                               childRoles: []
+                                                       }
+                          if (debug)
+                                $log.debug('BulkRoleAndFunctionsModalCtrl::updateRolesInDB: uplaodRoleFinalPostData is ' + JSON.stringify(uplaodRoleFinalPostData));
+                          let updatePromise = {};
+                          if(appRolePostData.isCreate){
+                          updatePromise = functionalMenuService.saveBulkRole(appId, JSON.stringify(postData)).promise().then(res => {
+                                if (debug)
+                                        $log.debug('BulkRoleAndFunctionsModalCtrl::updateRolesInDB: updated successfully: ' + JSON.stringify(res));
+                               numberRolesSucceeded++;
+                          }).catch(err => {
+                                // What to do if one of many fails??
+                                $log.error('BulkRoleAndFunctionsModalCtrl::updateRolesInDB failed: ', err);
+                                confirmBoxService.showInformation(
+                                                'Failed to update the application role. ' +
+                                                'Error: ' + err.status).then(isConfirmed => { });
+                          }).finally( () => {
+                          });
+                       }
+                         promises.push(updatePromise);
+                        }); // for each
+                               
+                        // Run all the promises
+                        $q.all(promises).then(function(){
+                                $scope.isProcessing = false;
+                                confirmBoxService.showInformation('Processed ' + numberRolesSucceeded + ' records. Please sync roles').then(isConfirmed => {
+                                        // Close the upload-confirm dialog
+                                        ngDialog.close();
+                                });
+                        });
+                  }; // updateRolesInDB
+                  
+               /**
+                * Sends requests to Portal BE requesting role function assignment.
+                * That endpoint handles adding role function in the external auth system
+                * if necessary.Invoked by the Next button on the confirmation dialog.
+                */
+                       $scope.updateRoleFunctionsInDB = () => {
+                               $scope.isProcessing = true;
+                               $scope.progressMsg = 'Sending requests to application..';
+                               if (debug)
+                                       $log.debug('BulkRoleAndFunctionsModalCtrl::updateRoleFunctionsInDB: request length is ' + appUserRolesRequest.length);
+                               var numberRoleFunctionSucceeded = 0;
+                               let promises = [];
+                               $scope.uploadFile.forEach(function(appRoleFuncPostData) {
+                                       if (debug) 
+                                               $log.debug('BulkRoleAndFunctionsModalCtrl::updateRoleFunctionsInDB: appRoleFuncPostData is ' + JSON.stringify(appFuncPostData));
+                                       let updateRoleFunctionFinalPostData = {
+                                                roleName: appRoleFuncPostData.role,
+                                                type: appRoleFuncPostData.type, 
+                                                instance: appRoleFuncPostData.instance, 
+                                                action: appRoleFuncPostData.action,
+                                                name: appRoleFuncPostData.name,
+                                                isGlobalRolePartnerFunc: false
+                            };
+                         if (debug)
+                                $log.debug('BulkRoleAndFunctionsModalCtrl::updateRoleFunctionsInDB: updateRoleFunctionFinalPostData is ' + JSON.stringify(updateFunctionsFinalPostData));
+                         let updatePromise = {};
+                         if(appRoleFuncPostData.isCreate){
+                         updatePromise = functionalMenuService.updateBulkRoleFunction(appId, updateRoleFunctionFinalPostData).promise().then(res => {
+                                if (debug)
+                                        $log.debug('BulkRoleAndFunctionsModalCtrl::updateRoleFunctionsInDB: updated successfully: ' + JSON.stringify(res));
+                                numberRoleFunctionSucceeded++;
+                         }).catch(err => {
+                                // What to do if one of many fails??
+                                $log.error('BulkRoleAndFunctionsModalCtrl::updateRoleFunctionsInDB failed: ', err);
+                                confirmBoxService.showInformation(
+                                                'Failed to update the application role function. ' +
+                                                'Error: ' + err.status).then(isConfirmed => { });
+                         }).finally( () => {
+                         });
+                       }
+                        promises.push(updatePromise);
+                        }); // for each
+                               
+                        // Run all the promises
+                        $q.all(promises).then(function(){
+                                $scope.isProcessing = false;
+                                confirmBoxService.showInformation('Processed ' + numberRoleFunctionSucceeded + ' records. Please sync roles to reflect in portal').then(isConfirmed => {
+                                        // Close the upload-confirm dialog
+                                        ngDialog.close();
+                                });
+                        });
+                  }; // updateRoleFunctionsInDB
+                  
+               /**
+                        * Sends requests to Portal requesting global role functions assignment.
+                        * That endpoint handles updating global role functions in the external auth system
+                        * if necessary. Invoked by the Next button on the confirmation dialog.
+                        */
+                       $scope.updateGlobalRoleFunctionsInDB = () => {
+                               $scope.isProcessing = true;
+                               $scope.progressMsg = 'Sending requests to application..';
+                               if (debug)
+                                       $log.debug('BulkRoleAndFunctionsModalCtrl::updateGlobalRoleFunctionsInDB: request length is ' + appUserRolesRequest.length);
+                               var numberGlobalRoleFunctionSucceeded = 0;
+                               let promises = [];
+                               $scope.uploadFile.forEach(function(appRoleFuncPostData) {
+                                       if (debug) 
+                                               $log.debug('BulkRoleAndFunctionsModalCtrl::updateGlobalRoleFunctionsInDB: appRoleFuncPostData is ' + JSON.stringify(appFuncPostData));
+                                       let updateGlobalRoleFunctionFinalPostData = {
+                                                roleName: appRoleFuncPostData.role,
+                                                        type: appRoleFuncPostData.type, 
+                                                        instance: appRoleFuncPostData.instance, 
+                                                        action: appRoleFuncPostData.action,
+                                                        name: appRoleFuncPostData.name,
+                                                        isGlobalRolePartnerFunc: true
+                                };
+                             if (debug)
+                                $log.debug('BulkRoleAndFunctionsModalCtrl::updateGlobalRoleFunctionsInDB: updateRoleFunctionFinalPostData is ' + JSON.stringify(updateFunctionsFinalPostData));
+                             let updatePromise = {};
+                             if(appRoleFuncPostData.isCreate){
+                             updatePromise = functionalMenuService.updateBulkRoleFunction(appId, updateGlobalRoleFunctionFinalPostData).promise().then(res => {
+                                if (debug)
+                                        $log.debug('BulkRoleAndFunctionsModalCtrl::updateGlobalRoleFunctionsInDB: updated successfully: ' + JSON.stringify(res));
+                                numberGlobalRoleFunctionSucceeded++;
+                             }).catch(err => {
+                                // What to do if one of many fails??
+                                $log.error('BulkRoleAndFunctionsModalCtrl::updateGlobalRoleFunctionsInDB failed: ', err);
+                                confirmBoxService.showInformation(
+                                                'Failed to update the global role partner function. ' +
+                                                'Error: ' + err.status).then(isConfirmed => { });
+                             }).finally( () => {
+                             });
+                               }
+                            promises.push(updatePromise);
+                        }); // for each
+                               
+                        // Run all the promises
+                        $q.all(promises).then(function(){
+                                $scope.isProcessing = false;
+                                confirmBoxService.showInformation('Processed ' + numberGlobalRoleFunctionSucceeded + ' records. Please sync roles to reflect in portal').then(isConfirmed => {
+                                        // Close the upload-confirm dialog
+                                        ngDialog.close();
+                                });
+                        });
+                       }; // updateGlobalRoleFunctionsInDB
+                       
+               // Sets the variable that hides/reveals the user controls
+               $scope.step2 = () => {
+                       this.fileSelected = false;
+                       $scope.selectedFile = null;
+                       $scope.fileModel = null;
+                       this.step1 = false;                     
+               }
+               
+             // Navigate between dialog screens using step number: 1,2,...
+             $scope.navigateBack = () => {
+                this.step1 = true;
+                 this.fileSelected = false;
+             };
+             
+             // Opens a dialog to show the data to be uploaded.
+             // Invoked by the upload button on the bulk user dialog.
+             $scope.confirmUpload = (typeUpload) => {
+               // Start the process
+               $scope.readValidateFile(typeUpload);
+               // Dialog shows progress
+               if(typeUpload === 'functions'){
+                       $modal.open({
+                       templateUrl: 'app/views/role/bulk-upload-dialogs/bulk-upload-functions-confirm.html',
+                        controller: '',
+                        sizeClass: 'modal-medium', 
+                        resolve:'',
+                        scope: $scope
+                    })
+               } else if(typeUpload === 'roleFunctions'){
+                       $modal.open({
+                               templateUrl: 'app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-confirm.html',
+                        controller: '',
+                        sizeClass: 'modal-medium', 
+                        resolve:'',
+                        scope: $scope
+                    })
+                       
+               } else if(typeUpload === 'roles'){
+                       $modal.open({
+                       templateUrl: 'app/views/role/bulk-upload-dialogs/bulk-upload-roles-confirm.html',
+                        controller: '',
+                        sizeClass: 'modal-medium', 
+                        resolve:'',
+                        scope: $scope
+                    })
+               } else if(typeUpload === 'globalRoleFunctions'){
+                       $modal.open({
+                       templateUrl: 'app/views/role/bulk-upload-dialogs/bulk-upload-global-role-functions-confirm.html',
+                        controller: '',
+                        sizeClass: 'modal-medium', 
+                        resolve:'',
+                        scope: $scope
+                    })
+               }
+             };
+
+             // Invoked by the Cancel button on the confirmation dialog.
+             $scope.cancelUpload = () => {
+                ngDialog.close();
+             };
+             
+             init();
+       } // constructor
+    } // class
+    BulkRoleAndFunctionsModalCtrl.$inject = ['$scope', '$log', '$filter', '$q',  '$modalInstance', '$modal', 'ngDialog', 'message', 'confirmBoxService', 'usersService', 'applicationsService', 'functionalMenuService', 'RoleService'];    
+    angular.module('ecompApp').controller('BulkRoleAndFunctionsModalCtrl', BulkRoleAndFunctionsModalCtrl);
+
+    angular.module('ecompApp').directive('fileChange', ['$parse', function($parse){
+       return {
+               require: 'ngModel',
+           restrict: 'A',
+           link : function($scope, element, attrs, ngModel) {
+               var attrHandler = $parse(attrs['fileChange']);
+               var handler=function(e) {
+                       $scope.$apply(function() {
+                               attrHandler($scope, { $event:e, files:e.target.files } );
+                               $scope.selectedFile = e.target.files[0].name;
+                       });
+               };
+               element[0].addEventListener('change',handler,false);
+          }
+       }
+    }]);
+    
+    angular.module('ecompApp').filter('csvToFuncObj',function() {
+       return function(input) {
+           var result = [];
+           var len, i, line, o;
+               var lines = input.split('\n');
+           // Need 1-based index below
+           for (len = lines.length, i = 1; i <= len; ++i) {
+               // Use 0-based index for array
+               line = lines[i - 1].trim();
+                       if (line.length == 0) {
+                               // console.log("Skipping blank line");
+                               result.push({
+                                       line: i,
+                                       type: '',
+                                       instance: '',
+                                       action: '',
+                                       name: '',
+                                       status: 'Blank line'
+                               });
+                               continue;
+                       }
+                       o = line.split(',');
+                       if (o.length !== 4) {
+                               // other lengths not valid for upload
+                               result.push({
+                                       line: i,
+                                       type: o[0],
+                                       instance: o[1],
+                                       action: o[2],
+                                       name: '',
+                                       status: 'Failed to find 4 comma-separated values'
+                               });
+                       }
+                       else {
+                               // console.log("Valid line: ", val);
+                               let entry = {
+                                               line: i,
+                                               type: o[0],
+                                               instance: o[1],
+                                               action: o[2],
+                                               name: o[3]
+                                               // leave status undefined, this
+                                               // could be valid.
+                               };
+                               if (o[0].toLowerCase() === 'type') {
+                                       // not valid for upload, so set status
+                                       entry.status = 'Header';
+                               }
+                               else if (o[0].toLowerCase() === 'instance') {
+                                       // not valid for upload, so set status
+                                       entry.status = 'Header';
+                               }
+                               else if (o[0].toLowerCase() === 'action') {
+                                       // not valid for upload, so set status
+                                       entry.status = 'Header';
+                               }
+                               else if (o[0].toLowerCase() === 'name') {
+                                       // not valid for upload, so set status
+                                       entry.status = 'Header';
+                               }
+                               else if (o[0].trim() == '' || o[1].trim() == '' ||  o[2].trim() == '' ||  o[3].trim() == '') {
+                                       // defend against line with only a
+                                       // single comma etc.
+                                       entry.status = 'Failed to find non-empty values';                                       
+                               }
+                               result.push(entry);
+                       } // len 2
+           } // for
+           return result;
+       };
+    });
+    
+    angular.module('ecompApp').filter('csvToRoleFuncObj',function() {
+       return function(input) {
+           var result = [];
+           var len, i, line, o;
+               var lines = input.split('\n');
+           // Need 1-based index below
+           for (len = lines.length, i = 1; i <= len; ++i) {
+               // Use 0-based index for array
+               line = lines[i - 1].trim();
+                       if (line.length == 0) {
+                               // console.log("Skipping blank line");
+                               result.push({
+                                       line: i,
+                                       role:'',
+                                       type: '',
+                                       instance: '',
+                                       action: '',
+                                       name: '',
+                                       status: 'Blank line'
+                               });
+                               continue;
+                       }
+                       o = line.split(',');
+                       if (o.length !== 5) {
+                               // other lengths not valid for upload
+                               result.push({
+                                       line: i,
+                                       role: o[0],
+                                       type: o[1],
+                                       instance: o[2],
+                                       action: o[3],
+                                       name: '',
+                                       status: 'Failed to find 4 comma-separated values'
+                               });
+                       }
+                       else {
+                               // console.log("Valid line: ", val);
+                               let entry = {
+                                               line: i,
+                                               role: o[0],
+                                               type: o[1],
+                                               instance: o[2],
+                                               action: o[3],
+                                               name: o[4]
+                                               // leave status undefined, this
+                                               // could be valid.
+                               };
+                               if (o[0].toLowerCase() === 'role') {
+                                       // not valid for upload, so set status
+                                       entry.status = 'Header';
+                               } else if (o[0].toLowerCase() === 'type') {
+                                       // not valid for upload, so set status
+                                       entry.status = 'Header';
+                               }
+                               else if (o[0].toLowerCase() === 'instance') {
+                                       // not valid for upload, so set status
+                                       entry.status = 'Header';
+                               }
+                               else if (o[0].toLowerCase() === 'action') {
+                                       // not valid for upload, so set status
+                                       entry.status = 'Header';
+                               }
+                               else if (o[0].toLowerCase() === 'name') {
+                                       // not valid for upload, so set status
+                                       entry.status = 'Header';
+                               }
+                               else if (o[0].trim() == '' || o[1].trim() == '' ||  o[2].trim() == '' ||  o[3].trim() == '' || o[4].trim() == '') {
+                                       // defend against line with only a
+                                       // single comma etc.
+                                       entry.status = 'Failed to find non-empty values';                                       
+                               }
+                               result.push(entry);
+                       } // len 2
+           } // for
+           return result;
+       };
+    });
+    
+    angular.module('ecompApp').filter('csvToRoleObj',function() {
+       return function(input) {
+           var result = [];
+           var len, i, line, o;
+               var lines = input.split('\n');
+           // Need 1-based index below
+           for (len = lines.length, i = 1; i <= len; ++i) {
+               // Use 0-based index for array
+               line = lines[i - 1].trim();
+                       if (line.length == 0) {
+                               // console.log("Skipping blank line");
+                               result.push({
+                                       line: i,
+                                       role:'',
+                                       priority: '',
+                                       status: 'Blank line'
+                               });
+                               continue;
+                       }
+                       o = line.split(',');
+                       if (o.length === 0 && line.length !== 0) {
+                               // other lengths not valid for upload
+                               result.push({
+                                       line: i,
+                                       role: o[0],
+                                       priority:null
+                               });
+                       }
+                       else {
+                               // console.log("Valid line: ", val);
+                               let entry = {
+                                               line: i,
+                                               role: o[0],
+                                               priority: o[1]
+                                               // leave status undefined, this
+                                               // could be valid.
+                               };
+                               if (o[0].toLowerCase() === 'role') {
+                                       // not valid for upload, so set status
+                                       entry.status = 'Header';
+                               }
+                               if (o[0].toLowerCase() === 'priority') {
+                                       // not valid for upload, so set status
+                                       entry.status = 'Header';
+                               }
+                               else if (o[0].trim() == '') {
+                                       // defend against line with only a
+                                       // single comma etc.
+                                       entry.status = 'Failed to find non-empty values';                                       
+                               }
+                               result.push(entry);
+                       } // len 2
+           } // for
+           return result;
+       };
+    });
+    
+})();
diff --git a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-modal.html b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-modal.html
new file mode 100644 (file)
index 0000000..6c6a4e7
--- /dev/null
@@ -0,0 +1,105 @@
+<!--
+  ============LICENSE_START==========================================
+  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");
+  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============================================
+  ECOMP is a trademark and service mark of AT&T Intellectual Property.
+  -->
+<div>
+       <div class="b2b-modal-header">
+               <h2 class="heading-medium" id="newAdmin">Bulk Upload Role-Function</h2>
+               <div class="corner-button in">
+                       <button type="button" class="close" aria-label="Close"
+                               id="bulkuser-button-close" ng-click="$dismiss('cancel')"></button>
+               </div>
+       </div>
+       <div class="b2b-modal-body">
+               <div class="b2b-modal-body-div">
+                       <div ng-show="bulkRoleAndFunctions.step1">
+                               <div class="upload-instructions">Select Upload Type:</div>
+                               <div class="c-ecomp-portal-abs-select default">
+
+                                       <select id="bulk-user-dropdown-apps" name="dropdown1" b2b-dropdown
+                                               ng-model="selectedUploadType.value"  ng-change="changeUploadTypeInstruction(selectedUploadType.value)">
+                                               <option b2b-dropdown-list
+                                                       option-repeat="d in ngRepeatBulkUploadOptions"
+                                                       value="{{d.value}}">{{d.title}}</option>
+                                       </select>
+
+                               </div>
+                       </div>
+
+                       <div ng-hide="bulkRoleAndFunctions.step1">
+                               <div class="upload-instructions">Select Upload File:</div>
+                               <!-- input type=file is difficult to style.
+                                        Instead use a label styled as a button. -->
+                               <label class="file-label"> <input type="file"
+                                       file-change="fileChangeHandler($event,files)" ng-model="fileModel" />
+                                       <span></span>
+                               </label>{{selectedFile}}
+                               <div class="upload-instructions">
+                                       File must be .csv or .txt and one entry per line with this format:
+                                       <p>{{UploadTypeInstruction}}</p>
+                               </div>
+                       </div>
+
+                       <!-- progress indicator in middle -->
+                       <div ng-show="isProcessing">
+                               <span class="ecomp-spinner"></span>
+                       </div>
+                       <br>
+               </div>
+       </div>
+       <div class="b2b-modal-footer">
+               <div class="cta-button-group in">
+                       <button id="bulk-user-back-button" class="btn btn-alt btn-small"
+                               ng-hide="bulkRoleAndFunctions.step1" ng-click="navigateBack()">Back</button>
+                       <button id="bulk-user-next-button" class="btn btn-alt btn-small"
+                               ng-hide="!bulkRoleAndFunctions.step1"
+                               ng-click="!isProcessing && step2()"
+                               ng-class="{disabled: isProcessing}">Next</button>
+                       <button id="bulk-user-upload-button" class="btn btn-alt btn-small"
+                               ng-hide="bulkRoleAndFunctions.step1"
+                               ng-click="bulkRoleAndFunctions.fileSelected && confirmUpload(selectedUploadType.value)"
+                               ng-class="{disabled: !bulkRoleAndFunctions.fileSelected}">Upload</button>
+                       <button id="bulk-user-cancel-button" class="btn btn-alt btn-small"
+                               ng-click="$dismiss('cancel')">Cancel</button>
+               </div>
+       </div>
+</div>
+
+<script>
+$(document).ready(function(){
+    $(".ngdialog-close").attr('id','dialog-close');
+});
+</script>
diff --git a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-modal.less b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-modal.less
new file mode 100644 (file)
index 0000000..8ab5603
--- /dev/null
@@ -0,0 +1,100 @@
+/*-
+ * ============LICENSE_START==========================================
+ * 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");
+ * 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+.bulk-user-modal {
+       height: 430px;
+
+       .title {
+               .dGray18r; 
+               border-bottom: @blue-active 3px solid;
+       }
+       
+       .main {
+               margin: 16px;
+    
+               .upload-instructions {
+                       .dGray14r;
+               }
+               
+               // http://stackoverflow.com/questions/572768/styling-an-input-type-file-button
+
+               .file-label {
+                       border: 1px solid #ffffff;
+                       border-radius: 6px;
+                       margin-top: 4px;
+                       margin-bottom: 4px;
+                       margin-left: 0px;
+                       margin-right: 8px;
+                       color: #ffffff;
+                       background: #067ab4;
+                       display: inline-block;
+                       text-align: center;
+                       font-family: Omnes-ECOMP-W02-Medium,Arial;
+                       font-size: 14px;
+                       height: 29px;
+                       line-height: 29px;
+                       width: 90px;
+
+                       input[type="file"] {
+                               // Hide the browser's control
+                               display: none;
+                       }
+               
+               }
+
+               .file-label:hover {
+                       background: #009fdb;
+               }
+               
+               .file-label:active {
+                       background: #009fdb;
+               }
+               
+               .file-label:invalid+span {
+                       color: #ffffff;
+               }
+               
+               .file-label:valid+span {
+                       color: #ffffff;
+               }
+
+       }
+    
+}
+.b2b-modal-body-div{
+       height:250px;
+}
diff --git a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-roles-confirm.html b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-roles-confirm.html
new file mode 100644 (file)
index 0000000..e5e4a86
--- /dev/null
@@ -0,0 +1,109 @@
+<!--
+  ============LICENSE_START==========================================
+  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");
+  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============================================
+  ECOMP is a trademark and service mark of AT&T Intellectual Property.
+  -->
+<div>
+       <div class="b2b-modal-header">
+               <h2 class="heading-medium" id="newAdmin">Bulk Upload Roles
+                       Confirmation</h2>
+               <div class="corner-button in">
+                       <button type="button" class="close" aria-label="Close"
+                               id="bulk-user-button-close" ng-click="$dismiss('cancel')"></button>
+               </div>
+       </div>
+       <div class="b2b-modal-body">
+
+               <!-- progress indicator -->
+               <div class="upload-instructions" ng-show="isProcessing">
+                       {{progressMsg}} <br> <br> <span class="ecomp-spinner"></span>
+               </div>
+
+               <div ng-hide="isProcessing">
+                       <div class="upload-instructions">Click OK to upload the valid
+                               roles. Invalid or existing roles will be ignored.</div>
+                       <p>
+                               <span id="required" style="color: Red; font-size: 180%;"
+                                       visible="false">*</span>Name can only contain alphanumeric
+                               characters, dots(.), forward slashes(/), and underscores(_)
+                       </p>
+               </div>
+               <div class="c-ecomp-portal-abs-table default"
+                       style="height: 250px !important">
+                       <table b2b-table table-data="uploadFile"
+                               search-string="bulkRoleAndFunctions.searchString"
+                               view-per-page="bulkRoleAndFunctions.viewPerPageIgnored"
+                               current-page="bulkRoleAndFunctions.currentPageIgnored"
+                               total-page="bulkRoleAndFunctions.totalPageIgnored">
+                               <thead b2b-table-row type="header">
+                                       <tr>
+                                               <th id="th-line" b2b-table-header sortable="false">Line</th>
+                                               <th id="th-name" b2b-table-header sortable="false">Name</th>
+                                               <th id="th-priority" b2b-table-header sortable="false">Priority</th>
+                                               <th id="th-status" b2b-table-header sortable="false">Status</th>
+                                       </tr>
+                               </thead>
+                               <!-- Use track-by="UNIQUE KEY HERE" or leave out if no unique keys in data -->
+                               <tbody b2b-table-row type="body" class="table-body"
+                                       row-repeat="rowData in uploadFile">
+                                       <tr id="tr-rowData">
+                                               <td class="td-first" b2b-table-body>
+                                                       <div ng-bind="rowData.line"></div>
+                                               </td>
+                                               <td b2b-table-body>
+                                                       <div ng-bind="rowData.role"></div>
+                                               </td>
+                                               <td b2b-table-body>
+                                                       <div ng-bind="rowData.priority"></div>
+                                               </td>
+                                               <td b2b-table-body>
+                                                       <div ng-bind="rowData.status"></div>
+                                               </td>
+                                       </tr>
+                               </tbody>
+                       </table>
+               </div>
+
+       </div>
+
+</div>
+<div class="b2b-modal-footer">
+       <div class="cta-button-group in">
+               <button id="bulk-user-ok-button" class="btn btn-alt btn-small"
+                       ng-class="{disabled: isValidating}" ng-click="updateRolesInDB()">Ok</button>
+               <button id="bulk-user-cancel-button" class="btn btn-alt btn-small"
+                       ng-click="$dismiss('cancel')">Cancel</button>
+       </div>
+</div>
index 2c53126..2b49d9a 100644 (file)
@@ -63,9 +63,9 @@ app.controller('roleCreateEditController',function($scope, conf, $http, $modalIn
                                        availableRoleFunction.selected = true;
                                        console.log(availableRoleFunction.selected);
                                }
-                       };
+                       }
                        $scope.availableRoleFunctions.push(availableRoleFunction);          
-               };
+               }
        
                $scope.toggleRoleFunction = function(selected,selectedRoleFunction){
                        if($scope.roleFunctions){
index 46ff0d7..acfb25e 100644 (file)
@@ -44,6 +44,7 @@ app.controller('roleListController', function ($scope,RoleService, applicationsS
        $scope.goToUrl = function(roleIdVal) {
                        $state.go("root.role", {"roleId":roleIdVal});
                }
+        
        $scope.toggleRole = function(appId, selected, availableRole) {          
                var toggleType = null;
                if(selected) {
@@ -122,8 +123,29 @@ app.controller('roleListController', function ($scope,RoleService, applicationsS
                        }); 
                }  
                };
+               
+                $scope.openBulkUploadRolesAndFunctionsModal = function(appId) {
+                   var modalInstance = $modal.open({
+                       templateUrl: 'app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-modal.html',
+                       controller: 'BulkRoleAndFunctionsModalCtrl as bulkRoleAndFunctions',
+                       sizeClass: 'modal-medium',
+                       resolve: {
+                               message: function () {
+                                               var message = {
+                                                               appid: appId
+                                    };
+                                         return message;
+                                       }
+                               }
+                   });         
+                       modalInstance.result.then(function (confirmed) {
+                                       if(confirmed == 'confirmed'){
+                                          // update role list table
+                                       }
+                               });
+               };
                                
-               //getCentalizedApps
+               // getCentalizedApps
                $scope.getCentralizedApps = function(userId) {
                        RoleService.getCentralizedApps(userId).then(res=> {
                if (res.length>0) {
@@ -193,7 +215,7 @@ app.controller('roleListController', function ($scope,RoleService, applicationsS
                
                init();
                
-               //edit Role
+               // edit Role
                $scope.editRoleModalPopup = function(appId, availableRole) {
                        $scope.editRole = availableRole;
                        if(appId != undefined && availableRole.id != undefined){
@@ -215,7 +237,7 @@ app.controller('roleListController', function ($scope,RoleService, applicationsS
                                                                        availableRoleFunctions: availableRoleFunctions,
                                                                        appId: $scope.apps.selectedCentralizedApp,
                                                                        role: role
-                                            };
+                                                       };
                                                  return message;
                                                }
                                              }
@@ -232,7 +254,7 @@ app.controller('roleListController', function ($scope,RoleService, applicationsS
                         
                };
                
-               //add Role
+               // add Role
                $scope.addRoleModalPopup = function(appId) {
                        if(appId){
                                var roleId = 0;
index ae07c20..b082c3e 100644 (file)
@@ -60,6 +60,7 @@
                        <div id="button-create-role" align="left" class="admins-table-btn-create" >
                                <button id="button-create-role" ng-click="addRoleModalPopup(apps.selectedCentralizedApp)" class = "btn btn-alt btn-small">Create</button>
                                <button id="button-sync-role"  ng-show="syncRolesApplied" ng-click="syncRolesFromExternalAuthSystem(apps.selectedCentralizedApp)" class = "btn btn-alt btn-small"><i class="icon-arrows-update-refresh-syncL" aria-hidden="true"></i>&nbsp;Sync Roles</button>
+                               <button id="button-bulk-upload" ng-show="syncRolesApplied" ng-click="openBulkUploadRolesAndFunctionsModal(apps.selectedCentralizedApp)" class = "btn btn-alt btn-small"><i class="icon-arrows-upload" aria-hidden="true"></i>&nbsp;Bulk Upload</button>
                        </div>
                        <br>
                          <div class="property-label">
index 0a05d70..dfe1da6 100644 (file)
                });
             };
 
-            this.syncRolesFromExternalAuthSystem = (appId) =>{
-               applicationsService.syncRolesEcompFromExtAuthSystem(appId).then(function(res){
-                       if(res.status == 200){
-                    confirmBoxService.showInformation('Sync operation completed successfully!').then(isConfirmed => {});                               
-                       } else{
-                                confirmBoxService.showInformation('Sync operation failed for '+app).then(isConfirmed => {});                           
-                       }
-               });
-            };
-
             $scope.$watch('users.selectedApp.value', (newVal, oldVal) => {
                if(typeof(newVal) != 'undefined' && !newVal.includes("Select")){
                  applicationsService.getSingleAppInfo(newVal).then(function(res) {
index 1437123..ef08e50 100644 (file)
@@ -54,7 +54,6 @@
                                                </div>
                                                <button class="btn btn-alt btn-small" id="users-button-add"  ng-click="users.openAddNewUserModal()"><i class="icon-people-userbookmark" aria-hidden="true"></i>&nbsp;Add User</button> 
                                <button class="btn btn-alt btn-small" id="users-bulk-upload-button-add"  ng-click="users.openBulkUserUploadModal()"><i class="icon-arrows-upload" aria-hidden="true"></i>&nbsp;Bulk Upload</button>
-                               <button class="btn btn-alt btn-small" id="users-button-sync" ng-show="syncRolesApplied" ng-click="users.syncRolesFromExternalAuthSystem(app.appId)"><i class="icon-arrows-update-refresh-syncL" aria-hidden="true"></i>&nbsp;Sync Roles</button>
                                        </div>
                 </div>
                 <div ng-hide="users.isLoadingTable">
index 377d5c8..b642901 100644 (file)
                  }).finally(()=> {
                      this.isLoadingTable = false;
                  });
+                
+                widgetsCatalogService.getUploadFlag().then(res => {
+                       this.uploadFlag=res;
+                 }).catch(err => {
+                     $log.error('WidgetOnboardingDetailsModalCtrl::init error: ' + err);
+                 }).finally(()=> {
+                 });
+                
                  getAvailableApps();
                  getAvailableServices();
             };
index fd3a124..ade07b9 100644 (file)
                                </div>
                        </div>
 
-                       <div class="item required">
+                       <div ng-show=" widgetOnboardingDetails.uploadFlag">
                                <div class="item-label">Upload Widget</div>
                                <div>
                                        <input id="widget-onboarding-details-upload-file"
index 3b959f1..43b82c7 100644 (file)
@@ -97,7 +97,8 @@
                "ecompTitle":"http://localhost:8080/ecompportal/portalApi/ecompTitle",
                "loggedinUser" : "http://localhost:8080/ecompportal/portalApi/loggedinUser",
                "modifyLoggedinUser" : "http://localhost:8080/ecompportal/portalApi/modifyLoggedinUser",
-               "centralizedApps": "http:/localhost:8080/ecompportal/portalApi/centralizedApps"
+               "centralizedApps": "http:/localhost:8080/ecompportal/portalApi/centralizedApps",
+               "uploadRoleFunction":"http://www.ecomp.att.com:8080/ecompportal-att/portalApi/uploadRoleFunction/:appId"
        },
        "cookieDomain": "onap.org"
 }
index 46fd772..ac8f3bf 100644 (file)
@@ -97,7 +97,8 @@
                "ecompTitle":"portalApi/ecompTitle",
                "loggedinUser" : "portalApi/loggedinUser",
                "modifyLoggedinUser" : "portalApi/modifyLoggedinUser",
-               "centralizedApps": "portalApi/centralizedApps" 
+               "centralizedApps": "portalApi/centralizedApps",
+               "uploadRoleFunction":"portalApi/uploadRoleFunction/:appId" 
        },
        "cookieDomain": "onap.org"
 }
index a9fd704..c2cc815 100644 (file)
@@ -33,7 +33,7 @@
  
   ============LICENSE_END============================================
  
-  ECOMP is a trademark and service mark of AT&T Intellectual Property.
+  
   -->
 <div class="w-ecomp-footer" id="w-ecomp-footer" ng-style="{height: tabBottom}">
     <div id="footer" class="footer-content">
index 80f0a36..b49d6e9 100644 (file)
@@ -33,7 +33,7 @@
  
   ============LICENSE_END============================================
  
-  ECOMP is a trademark and service mark of AT&T Intellectual Property.
+  
   -->
 <button href="javascript:void(0)" id="allLogout" ng-click="editProfile()" class="btn btn-alt btn-small">
        Profile
index 15e2022..912f4ff 100644 (file)
@@ -33,6 +33,6 @@
  
   ============LICENSE_END============================================
  
-  ECOMP is a trademark and service mark of AT&T Intellectual Property.
+  
   -->
 <img src="assets/images/onap-logo.png" alt="Onap Logo" class="onap-title-logo" >
index 570b029..788be4e 100644 (file)
@@ -33,7 +33,7 @@
  
   ============LICENSE_END============================================
  
-  ECOMP is a trademark and service mark of AT&T Intellectual Property.
+  
   -->
 <div class="search-div" ng-controller="searchSnippetCtrl">
        <div class="notification-div">
index cd732df..df47d54 100644 (file)
@@ -5,7 +5,7 @@
        <parent>
                <groupId>org.onap.portal</groupId>
                <artifactId>onap-portal-parent</artifactId>
-               <version>2.2.0</version>
+               <version>2.3.0</version>
        </parent>
 
        <artifactId>portal-FE-os</artifactId>
index c827dff..7a1d8b8 100644 (file)
@@ -6,7 +6,7 @@
         <parent>
                 <groupId>org.onap.portal</groupId>
                 <artifactId>widget-ms-parent</artifactId>
-                <version>2.2.0</version>
+                <version>2.3.0</version>
         </parent>
 
        <artifactId>common-widgets</artifactId>
index cf8318b..08f4b64 100644 (file)
@@ -6,7 +6,7 @@
        <parent>
                <groupId>org.onap.portal</groupId>
                <artifactId>onap-portal-parent</artifactId>
-               <version>2.2.0</version>
+               <version>2.3.0</version>
        </parent>
 
        <artifactId>widget-ms-parent</artifactId>
index dabc5ac..ffd99fe 100644 (file)
@@ -13,7 +13,7 @@
 
        <groupId>org.onap.portal</groupId>
        <artifactId>widget-ms</artifactId>
-       <version>2.2.0</version>
+       <version>2.3.0</version>
        <packaging>jar</packaging>
        <name>widget-microservice</name>
 
diff --git a/pom.xml b/pom.xml
index 6978ce8..aef19ca 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -12,7 +12,7 @@
 
        <groupId>org.onap.portal</groupId>
        <artifactId>onap-portal-parent</artifactId>
-       <version>2.2.0</version>
+       <version>2.3.0</version>
        <packaging>pom</packaging>
        <name>portal</name>
 
@@ -27,7 +27,7 @@
        <properties>
                <!-- Jenkins should invoke mvn with argument -Dbuild.number=${BUILD_NUMBER} -->
                <build.number>0</build.number>
-               <epsdk.version>2.2.0</epsdk.version>
+               <epsdk.version>2.3.1</epsdk.version>
                <springframework.version>4.2.3.RELEASE</springframework.version>
                <hibernate.version>4.3.11.Final</hibernate.version>
                <fasterxml.version>2.8.10</fasterxml.version>