Merge "NotValidDataException.java-junits"
authorLorraine Welch <lb2391@att.com>
Tue, 17 Dec 2019 20:12:28 +0000 (20:12 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 17 Dec 2019 20:12:28 +0000 (20:12 +0000)
220 files changed:
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/SharedContext.java
portal-BE/docker-compose.yml
portal-BE/pom.xml
portal-BE/src/main/java/org/onap/portal/aop/service/FnLanguageServiceAOP.java
portal-BE/src/main/java/org/onap/portal/aop/service/FnUserServiceAOP.java
portal-BE/src/main/java/org/onap/portal/configuration/DBInitializingBean.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/configuration/SecurityConfig.java
portal-BE/src/main/java/org/onap/portal/configuration/WebMvcConfiguration.java
portal-BE/src/main/java/org/onap/portal/controller/LanguageController.java
portal-BE/src/main/java/org/onap/portal/controller/UserController.java
portal-BE/src/main/java/org/onap/portal/controller/UserRolesController.java
portal-BE/src/main/java/org/onap/portal/controller/WebAnalyticsExtAppController.java
portal-BE/src/main/java/org/onap/portal/controller/WidgetMSController.java
portal-BE/src/main/java/org/onap/portal/controller/WidgetsCatalogController.java
portal-BE/src/main/java/org/onap/portal/controller/WidgetsCatalogMarkupController.java
portal-BE/src/main/java/org/onap/portal/controller/WidgetsController.java
portal-BE/src/main/java/org/onap/portal/dao/ep/EpAppFunctionDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/ep/EpAppRoleFunctionDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/ep/EpBasicAuthAccountDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/ep/EpMicroserviceDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/ep/EpPersUserAppSortDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/ep/EpUserRolesRequestDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/ep/EpUserRolesRequestDetDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnAppContactUsDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnAppDao.java
portal-BE/src/main/java/org/onap/portal/dao/fn/FnAuditLogDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnCommonWidgetDataDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnDisplayTextDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnFunctionDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnLanguageDao.java
portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuActivityDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuAlertMethodDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuMenuSetDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuPriorityDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuTabSetDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalAncestorsDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalRolesDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnPersUserAppSelDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzCronTriggersDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzJobDetailsDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzLocksDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzSchedulerStateDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzTriggersDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnRestrictedUrlDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnRoleCompositeDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnRoleDao.java
portal-BE/src/main/java/org/onap/portal/dao/fn/FnRoleFunctionDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnSharedContextDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnTabDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnTabSelectedDao.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/dao/fn/FnUserDao.java
portal-BE/src/main/java/org/onap/portal/dao/fn/FnUserRoleDao.java
portal-BE/src/main/java/org/onap/portal/domain/db/DomainVo.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/domain/db/VUrlAccess.java
portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFavoriteReports.java
portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFilehistLog.java
portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFolder.java
portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFolderAccess.java
portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrLuFileType.java
portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReport.java
portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportAccess.java
portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportEmailSentLog.java
portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportFileHistory.java
portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportLog.java
portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportSchedule.java
portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportScheduleUsers.java
portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportTemplateMap.java
portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableJoin.java
portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableRole.java
portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableSource.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpAppFunction.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpAppRoleFunction.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpBasicAuthAccount.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpEndpoints.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpEndpointsBasicAuthAccount.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroservice.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroserviceParameter.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpNotification.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpPersUserAppSort.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpPersUserWidgetPlacement.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpPersUserWidgetSel.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpRoleNotification.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpUserNotification.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpUserRolesRequest.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpUserRolesRequestDet.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWebAnalyticsSource.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalog.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalogFiles.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalogParameter.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalogRole.java
portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetPreviewFiles.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnApp.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAppContactUs.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAuditAction.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAuditActionLog.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAuditLog.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnBroadcastMessage.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnChatRoom.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnCommonWidgetData.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnDatasource.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnDisplayText.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnFunction.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLanguage.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuActivity.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuAlertMethod.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuMenuSet.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuPriority.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuTabSet.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuTimezone.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenu.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenuFunctional.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenuFunctionalAncestors.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenuFunctionalRoles.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnOrg.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnPersUserAppSel.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzCronTriggers.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzJobDetails.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzSchedulerState.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzTriggers.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRestrictedUrl.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRole.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRoleComposite.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRoleFunction.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRoleV.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnScheduleWorkflows.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnSharedContext.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnTab.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnTabSelected.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUser.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUserRole.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnWidget.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnWorkflow.java
portal-BE/src/main/java/org/onap/portal/domain/db/fn/compositePK/FnRoleCompositeId.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/domain/dto/DomainVo.java [deleted file]
portal-BE/src/main/java/org/onap/portal/domain/dto/PortalRestStatusEnum.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppCatalogItem.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppCategoryFunctionsItem.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppContactUs.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppContactUsItem.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/BasicAuthCredentials.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/CentralV2RoleFunction.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/CommonWidgetsEnum.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPApp.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPAppRoleFunction.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPEndpoint.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPEndpointAccount.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPRole.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserApp.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppCatalogRoles.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRoles.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRolesRequest.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRolesRequestDetail.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppsManualSortPreference.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppsSortPreference.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPWidgetsManualSortPreference.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/MicroserviceData.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/MicroserviceParameter.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PersUserAppSelection.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PersUserWidgetSelection.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PortalRestStatusEnum.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/SearchResultItem.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/SharedContext.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/Widget.java
portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/WidgetCatalogParameter.java
portal-BE/src/main/java/org/onap/portal/domain/dto/transport/CentralV2Role.java
portal-BE/src/main/java/org/onap/portal/domain/dto/transport/CentralV2RoleFunction.java
portal-BE/src/main/java/org/onap/portal/domain/dto/transport/CommonWidget.java
portal-BE/src/main/java/org/onap/portal/domain/dto/transport/EPUserAppCurrentRoles.java
portal-BE/src/main/java/org/onap/portal/domain/dto/transport/EcompUserAppRoles.java
portal-BE/src/main/java/org/onap/portal/domain/dto/transport/EpNotificationItemVO.java
portal-BE/src/main/java/org/onap/portal/domain/dto/transport/EpRoleNotificationItem.java
portal-BE/src/main/java/org/onap/portal/domain/dto/transport/GlobalRoleWithApplicationRoleFunction.java
portal-BE/src/main/java/org/onap/portal/domain/dto/transport/OnboardingWidget.java
portal-BE/src/main/java/org/onap/portal/domain/dto/transport/Role.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/domain/mapper/FnUserMapper.java
portal-BE/src/main/java/org/onap/portal/exception/DeleteDomainObjectFailedException.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/exception/SyncUserRolesException.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/logging/aop/EPEELFLoggerAdvice.java
portal-BE/src/main/java/org/onap/portal/logging/format/EPAppMessagesEnum.java
portal-BE/src/main/java/org/onap/portal/logging/logic/EPLogUtil.java
portal-BE/src/main/java/org/onap/portal/service/AdminRolesService.java
portal-BE/src/main/java/org/onap/portal/service/ApplicationsRestClientService.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/service/AppsCacheService.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/service/EcompUserAppRolesService.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/service/ExternalAccessRolesService.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/service/PersUserWidgetService.java
portal-BE/src/main/java/org/onap/portal/service/WidgetMService.java
portal-BE/src/main/java/org/onap/portal/service/WidgetService.java
portal-BE/src/main/java/org/onap/portal/service/ep/EpAppFunctionService.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/service/ep/EpMicroserviceParameterService.java
portal-BE/src/main/java/org/onap/portal/service/ep/EpUserRolesRequestDetService.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/service/ep/EpUserRolesRequestService.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/service/ep/EpWidgetCatalogParameterService.java
portal-BE/src/main/java/org/onap/portal/service/fn/FnAppService.java
portal-BE/src/main/java/org/onap/portal/service/fn/FnLanguageService.java
portal-BE/src/main/java/org/onap/portal/service/fn/FnMenuFunctionalRolesService.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/service/fn/FnMenuFunctionalService.java [new file with mode: 0644]
portal-BE/src/main/java/org/onap/portal/service/fn/FnRoleService.java
portal-BE/src/main/java/org/onap/portal/service/fn/FnUserRoleService.java
portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java
portal-BE/src/main/java/org/onap/portal/service/fn/old/AppsCacheService.java [deleted file]
portal-BE/src/main/java/org/onap/portal/utils/EPUserUtils.java
portal-BE/src/main/java/org/onap/portal/utils/EcompPortalUtils.java
portal-BE/src/main/java/org/onap/portal/validation/SecureString.java
portal-BE/src/main/resources/application.properties
portal-BE/src/main/resources/data.sql [deleted file]
portal-BE/src/main/resources/data2.sql [new file with mode: 0644]
portal-BE/src/main/resources/test.properties
portal-BE/src/test/java/org/onap/portal/controller/LanguageControllerTest.java
portal-BE/src/test/java/org/onap/portal/controller/UserControllerTest.java
portal-BE/src/test/java/org/onap/portal/controller/UserRolesControllerTest.java
portal-BE/src/test/java/org/onap/portal/controller/WidgetMSControllerTest.java
portal-BE/src/test/java/org/onap/portal/controller/WidgetsCatalogControllerTest.java
portal-BE/src/test/java/org/onap/portal/controller/WidgetsControllerTest.java
portal-BE/src/test/java/org/onap/portal/framework/MockitoTestSuite.java
portal-BE/src/test/java/org/onap/portal/service/ep/EpWidgetCatalogParameterServiceTest.java
portal-BE/src/test/java/org/onap/portal/service/fn/FnUserRoleServiceTest.java [new file with mode: 0644]
portal-BE/src/test/java/org/onap/portal/service/fn/FnUserServiceTest.java

index 14837db..729540c 100644 (file)
@@ -43,6 +43,7 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 
 import javax.validation.constraints.Digits;
@@ -69,7 +70,8 @@ public class SharedContext extends DomainVo {
        private static final long serialVersionUID = 7287469622586677888L;
 
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+       @SequenceGenerator(name="portal_generator", sequenceName = "portal_generator", initialValue = 1000)
+  @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "portal_generator")
        @Digits(integer = 11, fraction = 0)
        private Long id;
 
index 33ae6b0..9b8f1ed 100644 (file)
@@ -21,6 +21,7 @@ services:
       - MYSQL_USER=${spring_datasource_username}
       - MYSQL_PASSWORD=${spring_datasource_password}
       - MYSQL_RANDOM_ROOT_PASSWORD=yes
+      - MYSQL_INITDB_SKIP_TZINFO=1
     healthcheck:
       test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
     networks:
index 13477b6..a882f75 100644 (file)
@@ -5,7 +5,7 @@
       <parent>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-parent</artifactId>
-            <version>2.2.0.M4</version>
+            <version>2.2.1.RELEASE</version>
             <relativePath/> <!-- lookup parent from repository -->
       </parent>
       <groupId>org.onap</groupId>
             <dependency>
                   <groupId>org.apache.cxf</groupId>
                   <artifactId>cxf-rt-rs-client</artifactId>
-                  <version>3.3.2</version>
+                  <version>3.3.4</version>
                   <scope>compile</scope>
             </dependency>
       </dependencies>
index db8e069..4b48ae4 100644 (file)
@@ -60,17 +60,17 @@ public class FnLanguageServiceAOP {
        @Autowired
        private DataValidator dataValidator;
 
-       @Before("execution(* org.onap.portal.service.fn.FnLanguageService.save(..)) && args(principal, fnLanguage)")
-       public void save(final Principal principal, final FnLanguage fnLanguage) {
+       @Before("execution(* org.onap.portal.service.fn.FnLanguageService.save(..)) && args(fnLanguage)")
+       public void save(final FnLanguage fnLanguage) {
               if (fnLanguage == null) {
-                     LOGGER.info("User " + principal.getName() + " try to save NULL fnLanguage");
+                     LOGGER.info("User " +  " try to save NULL fnLanguage");
                      throw new NullPointerException("FnLanguage cannot be null or empty");
               }
               if (!dataValidator.isValid(fnLanguage)) {
                      String violations = dataValidator.getConstraintViolations(fnLanguage).stream()
                              .map(ConstraintViolation::getMessage)
                              .collect(Collectors.joining(", "));
-                     LOGGER.info("User " + principal.getName() + " try to save not valid fnLanguage: " + violations);
+                     LOGGER.info("User " + " try to save not valid fnLanguage: " + violations);
                      throw new IllegalArgumentException("FnLanguage is not valid, " + violations);
               }
        }
index 65fc88d..f891392 100644 (file)
@@ -47,7 +47,6 @@ import org.aspectj.lang.annotation.Aspect;
 import org.aspectj.lang.annotation.Before;
 import org.onap.portal.domain.db.fn.FnUser;
 import org.onap.portal.domain.mapper.FnUserMapper;
-import org.onap.portal.service.fn.FnUserService;
 import org.onap.portal.validation.DataValidator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
diff --git a/portal-BE/src/main/java/org/onap/portal/configuration/DBInitializingBean.java b/portal-BE/src/main/java/org/onap/portal/configuration/DBInitializingBean.java
new file mode 100644 (file)
index 0000000..ebd23cd
--- /dev/null
@@ -0,0 +1,1444 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.configuration;
+
+import java.math.BigInteger;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.onap.portal.dao.ep.EpAppFunctionDao;
+import org.onap.portal.dao.ep.EpAppRoleFunctionDao;
+import org.onap.portal.dao.ep.EpBasicAuthAccountDao;
+import org.onap.portal.dao.ep.EpMicroserviceDao;
+import org.onap.portal.dao.ep.EpMicroserviceParameterDao;
+import org.onap.portal.dao.ep.EpPersUserAppSortDao;
+import org.onap.portal.dao.fn.EpWidgetCatalogDao;
+import org.onap.portal.dao.fn.FnAppContactUsDao;
+import org.onap.portal.dao.fn.FnAppDao;
+import org.onap.portal.dao.fn.FnAuditLogDao;
+import org.onap.portal.dao.fn.FnCommonWidgetDataDao;
+import org.onap.portal.dao.fn.FnDisplayTextDao;
+import org.onap.portal.dao.fn.FnFunctionDao;
+import org.onap.portal.dao.fn.FnLanguageDao;
+import org.onap.portal.dao.fn.FnLuActivityDao;
+import org.onap.portal.dao.fn.FnLuAlertMethodDao;
+import org.onap.portal.dao.fn.FnLuMenuSetDao;
+import org.onap.portal.dao.fn.FnLuPriorityDao;
+import org.onap.portal.dao.fn.FnLuTabSetDao;
+import org.onap.portal.dao.fn.FnLuTimezoneDao;
+import org.onap.portal.dao.fn.FnMenuDao;
+import org.onap.portal.dao.fn.FnMenuFunctionalAncestorsDao;
+import org.onap.portal.dao.fn.FnMenuFunctionalDao;
+import org.onap.portal.dao.fn.FnMenuFunctionalRolesDao;
+import org.onap.portal.dao.fn.FnPersUserAppSelDao;
+import org.onap.portal.dao.fn.FnQzCronTriggersDao;
+import org.onap.portal.dao.fn.FnQzJobDetailsDao;
+import org.onap.portal.dao.fn.FnQzLocksDao;
+import org.onap.portal.dao.fn.FnQzSchedulerStateDao;
+import org.onap.portal.dao.fn.FnQzTriggersDao;
+import org.onap.portal.dao.fn.FnRestrictedUrlDao;
+import org.onap.portal.dao.fn.FnRoleCompositeDao;
+import org.onap.portal.dao.fn.FnRoleDao;
+import org.onap.portal.dao.fn.FnRoleFunctionDao;
+import org.onap.portal.dao.fn.FnSharedContextDao;
+import org.onap.portal.dao.fn.FnTabDao;
+import org.onap.portal.dao.fn.FnTabSelectedDao;
+import org.onap.portal.dao.fn.FnUserDao;
+import org.onap.portal.dao.fn.FnUserRoleDao;
+import org.onap.portal.domain.db.ep.EpAppFunction;
+import org.onap.portal.domain.db.ep.EpAppRoleFunction;
+import org.onap.portal.domain.db.ep.EpBasicAuthAccount;
+import org.onap.portal.domain.db.ep.EpMicroservice;
+import org.onap.portal.domain.db.ep.EpMicroserviceParameter;
+import org.onap.portal.domain.db.ep.EpPersUserAppSort;
+import org.onap.portal.domain.db.ep.EpWidgetCatalog;
+import org.onap.portal.domain.db.fn.FnApp;
+import org.onap.portal.domain.db.fn.FnAppContactUs;
+import org.onap.portal.domain.db.fn.FnAuditLog;
+import org.onap.portal.domain.db.fn.FnCommonWidgetData;
+import org.onap.portal.domain.db.fn.FnDisplayText;
+import org.onap.portal.domain.db.fn.FnFunction;
+import org.onap.portal.domain.db.fn.FnLanguage;
+import org.onap.portal.domain.db.fn.FnLuActivity;
+import org.onap.portal.domain.db.fn.FnLuAlertMethod;
+import org.onap.portal.domain.db.fn.FnLuMenuSet;
+import org.onap.portal.domain.db.fn.FnLuPriority;
+import org.onap.portal.domain.db.fn.FnLuTabSet;
+import org.onap.portal.domain.db.fn.FnLuTimezone;
+import org.onap.portal.domain.db.fn.FnMenu;
+import org.onap.portal.domain.db.fn.FnMenuFunctional;
+import org.onap.portal.domain.db.fn.FnMenuFunctionalAncestors;
+import org.onap.portal.domain.db.fn.FnMenuFunctionalRoles;
+import org.onap.portal.domain.db.fn.FnPersUserAppSel;
+import org.onap.portal.domain.db.fn.FnQzCronTriggers;
+import org.onap.portal.domain.db.fn.FnQzJobDetails;
+import org.onap.portal.domain.db.fn.FnQzLocks;
+import org.onap.portal.domain.db.fn.FnQzSchedulerState;
+import org.onap.portal.domain.db.fn.FnQzTriggers;
+import org.onap.portal.domain.db.fn.FnRestrictedUrl;
+import org.onap.portal.domain.db.fn.FnRole;
+import org.onap.portal.domain.db.fn.FnRoleComposite;
+import org.onap.portal.domain.db.fn.FnRoleFunction;
+import org.onap.portal.domain.db.fn.FnSharedContext;
+import org.onap.portal.domain.db.fn.FnTab;
+import org.onap.portal.domain.db.fn.FnTabSelected;
+import org.onap.portal.domain.db.fn.FnUser;
+import org.onap.portal.domain.db.fn.FnUserRole;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class DBInitializingBean implements org.springframework.beans.factory.InitializingBean {
+
+  private final FnAppDao fnAppDao;
+  private final EpAppFunctionDao epAppFunctionDao;
+  private final FnRoleDao fnRoleDao;
+  private final EpAppRoleFunctionDao epAppRoleFunctionDao;
+  private final EpBasicAuthAccountDao epBasicAuthAccountDao;
+  private final EpMicroserviceDao epMicroserviceDao;
+  private final EpMicroserviceParameterDao epMicroserviceParameterDao;
+  private final EpWidgetCatalogDao epWidgetCatalogDao;
+  private final FnAppContactUsDao fnAppContactUsDao;
+  private final FnCommonWidgetDataDao fnCommonWidgetDataDao;
+  private final FnLanguageDao fnLanguageDao;
+  private final FnDisplayTextDao fnDisplayTextDao;
+  private final FnFunctionDao fnFunctionDao;
+  private final FnLuActivityDao fnLuActivityDao;
+  private final FnLuAlertMethodDao fnLuAlertMethodDao;
+  private final FnLuMenuSetDao fnLuMenuSetDao;
+  private final FnLuPriorityDao fnLuPriorityDao;
+  private final FnLuTimezoneDao fnLuTimezoneDao;
+  private final FnMenuDao fnMenuDao;
+  private final FnMenuFunctionalDao fnMenuFunctionalDao;
+  private final FnMenuFunctionalAncestorsDao fnMenuFunctionalAncestorsDao;
+  private final FnMenuFunctionalRolesDao fnMenuFunctionalRolesDao;
+  private final FnQzJobDetailsDao fnQzJobDetailsDao;
+  private final FnQzLocksDao fnQzLocksDao;
+  private final FnQzSchedulerStateDao fnQzSchedulerStateDao;
+  private final FnQzTriggersDao fnQzTriggersDao;
+  private final FnQzCronTriggersDao fnQzCronTriggersDao;
+  private final FnRestrictedUrlDao fnRestrictedUrlDao;
+  private final FnRoleCompositeDao fnRoleCompositeDao;
+  private final FnRoleFunctionDao fnRoleFunctionDao;
+  private final FnSharedContextDao fnSharedContextDao;
+  private final FnLuTabSetDao fnLuTabSetDao;
+  private final FnTabDao fnTabDao;
+  private final FnTabSelectedDao fnTabSelectedDao;
+  private final FnUserDao fnUserDao;
+  private final EpPersUserAppSortDao epPersUserAppSortDao;
+  private final FnPersUserAppSelDao fnPersUserAppSelDao;
+  private final FnAuditLogDao fnAuditLogDao;
+  private final FnUserRoleDao fnUserRoleDao;
+
+  @Autowired
+  public DBInitializingBean(FnAppDao fnAppDao, EpAppFunctionDao epAppFunctionDao,
+      FnRoleDao fnRoleDao, EpAppRoleFunctionDao epAppRoleFunctionDao,
+      EpBasicAuthAccountDao epBasicAuthAccountDao, EpMicroserviceDao epMicroserviceDao,
+      EpMicroserviceParameterDao epMicroserviceParameterDao,
+      EpWidgetCatalogDao epWidgetCatalogDao, FnAppContactUsDao fnAppContactUsDao,
+      FnCommonWidgetDataDao fnCommonWidgetDataDao, FnLanguageDao fnLanguageDao,
+      FnDisplayTextDao fnDisplayTextDao, FnFunctionDao fnFunctionDao,
+      FnLuActivityDao fnLuActivityDao, FnLuAlertMethodDao fnLuAlertMethodDao,
+      FnLuMenuSetDao fnLuMenuSetDao, FnLuPriorityDao fnLuPriorityDao,
+      FnLuTimezoneDao fnLuTimezoneDao, FnMenuDao fnMenuDao,
+      FnMenuFunctionalDao fnMenuFunctionalDao,
+      FnMenuFunctionalAncestorsDao fnMenuFunctionalAncestorsDao,
+      FnMenuFunctionalRolesDao fnMenuFunctionalRolesDao, FnQzJobDetailsDao fnQzJobDetailsDao,
+      FnQzLocksDao fnQzLocksDao, FnQzSchedulerStateDao fnQzSchedulerStateDao,
+      FnQzTriggersDao fnQzTriggersDao, FnQzCronTriggersDao fnQzCronTriggersDao,
+      FnRestrictedUrlDao fnRestrictedUrlDao, FnRoleCompositeDao fnRoleCompositeDao,
+      FnRoleFunctionDao fnRoleFunctionDao, FnSharedContextDao fnSharedContextDao,
+      FnLuTabSetDao fnLuTabSetDao, FnTabDao fnTabDao, FnTabSelectedDao fnTabSelectedDao,
+      FnUserDao fnUserDao, EpPersUserAppSortDao epPersUserAppSortDao,
+      FnPersUserAppSelDao fnPersUserAppSelDao, FnAuditLogDao fnAuditLogDao,
+      FnUserRoleDao fnUserRoleDao) {
+    this.fnAppDao = fnAppDao;
+    this.epAppFunctionDao = epAppFunctionDao;
+    this.fnRoleDao = fnRoleDao;
+    this.epAppRoleFunctionDao = epAppRoleFunctionDao;
+    this.epBasicAuthAccountDao = epBasicAuthAccountDao;
+    this.epMicroserviceDao = epMicroserviceDao;
+    this.epMicroserviceParameterDao = epMicroserviceParameterDao;
+    this.epWidgetCatalogDao = epWidgetCatalogDao;
+    this.fnAppContactUsDao = fnAppContactUsDao;
+    this.fnCommonWidgetDataDao = fnCommonWidgetDataDao;
+    this.fnLanguageDao = fnLanguageDao;
+    this.fnDisplayTextDao = fnDisplayTextDao;
+    this.fnFunctionDao = fnFunctionDao;
+    this.fnLuActivityDao = fnLuActivityDao;
+    this.fnLuAlertMethodDao = fnLuAlertMethodDao;
+    this.fnLuMenuSetDao = fnLuMenuSetDao;
+    this.fnLuPriorityDao = fnLuPriorityDao;
+    this.fnLuTimezoneDao = fnLuTimezoneDao;
+    this.fnMenuDao = fnMenuDao;
+    this.fnMenuFunctionalDao = fnMenuFunctionalDao;
+    this.fnMenuFunctionalAncestorsDao = fnMenuFunctionalAncestorsDao;
+    this.fnMenuFunctionalRolesDao = fnMenuFunctionalRolesDao;
+    this.fnQzJobDetailsDao = fnQzJobDetailsDao;
+    this.fnQzLocksDao = fnQzLocksDao;
+    this.fnQzSchedulerStateDao = fnQzSchedulerStateDao;
+    this.fnQzTriggersDao = fnQzTriggersDao;
+    this.fnQzCronTriggersDao = fnQzCronTriggersDao;
+    this.fnRestrictedUrlDao = fnRestrictedUrlDao;
+    this.fnRoleCompositeDao = fnRoleCompositeDao;
+    this.fnRoleFunctionDao = fnRoleFunctionDao;
+    this.fnSharedContextDao = fnSharedContextDao;
+    this.fnLuTabSetDao = fnLuTabSetDao;
+    this.fnTabDao = fnTabDao;
+    this.fnTabSelectedDao = fnTabSelectedDao;
+    this.fnUserDao = fnUserDao;
+    this.epPersUserAppSortDao = epPersUserAppSortDao;
+    this.fnPersUserAppSelDao = fnPersUserAppSelDao;
+    this.fnAuditLogDao = fnAuditLogDao;
+    this.fnUserRoleDao = fnUserRoleDao;
+  }
+
+  @Override
+  public void afterPropertiesSet() {
+    initAllTablesTable();
+  }
+
+  private void initAllTablesTable() {
+
+    // FN_APP TABLE
+
+    FnApp app = FnApp.builder()
+        .appName("Default")
+        .appImageUrl("assets/images/tmp/portal1.png")
+        .appDescription("Some Default Description")
+        .appNotes("Some Default Note")
+        .appUrl("http://localhost")
+        .appAlternateUrl("http://localhost")
+        .appRestEndpoint("http://localhost:8080/ecompportal")
+        .mlAppName("EcompPortal")
+        .mlAppAdminId("")
+        .motsId(null)
+        .appPassword("dR2NABMkxPaFbIbym87ZwQ==")
+        .open(false)
+        .enabled(false)
+        .activeYn(true)
+        .appUsername("m00468@portal.onap.org")
+        .uebKey("EkrqsjQqZt4ZrPh6'")
+        .uebSecret(null)
+        .uebTopicName(null)
+        .appType(1L)
+        .authCentral(true)
+        .authNamespace("org.onap.portal")
+        .build();
+    FnApp app2 = FnApp.builder()
+        .appName("xDemo App")
+        .appImageUrl("images/cache/portal-222865671_37476.png")
+        .appDescription(null)
+        .appNotes(null)
+        .appUrl("http://portal-sdk.simpledemo.onap.org:30212/ONAPPORTALSDK/welcome.htm")
+        .appAlternateUrl(null)
+        .appRestEndpoint("http://portal-sdk:8080/ONAPPORTALSDK/api/v3")
+        .mlAppName("")
+        .mlAppAdminId("")
+        .motsId(null)
+        .appPassword("2VxipM8Z3SETg32m3Gp0FvKS6zZ2uCbCw46WDyK6T5E=")
+        .open(false)
+        .enabled(true)
+        .activeYn(true)
+        .appUsername("Default")
+        .uebKey("ueb_key")
+        .uebSecret("ueb_secret")
+        .uebTopicName("ECOMP-PORTAL-OUTBOX")
+        .appType(1L)
+        .authCentral(false)
+        .authNamespace(null)
+        .build();
+    FnApp app3 = FnApp.builder()
+        .appName("DMaaP Bus Ctrl")
+        .appImageUrl("images/cache/portal944583064_80711.png")
+        .appDescription(null)
+        .appNotes(null)
+        .appUrl("http://dmaap-bc.simpledemo.onap.org:/ECOMPDBCAPP/dbc#/dmaap")
+        .appAlternateUrl(null)
+        .appRestEndpoint("http://dmaap-bc:8989/ECOMPDBCAPP/api/v2")
+        .mlAppName("")
+        .mlAppAdminId("")
+        .motsId(null)
+        .appPassword("okYTaDrhzibcbGVq5mjkVQ==")
+        .open(false)
+        .enabled(false)
+        .activeYn(true)
+        .appUsername("Default")
+        .uebKey("ueb_key")
+        .uebSecret("ueb_secret")
+        .uebTopicName("ECOMP-PORTAL-OUTBOX")
+        .appType(1L)
+        .authCentral(false)
+        .authNamespace(null)
+        .build();
+    FnApp app4 = FnApp.builder()
+        .appName("SDC")
+        .appImageUrl("images/cache/portal956868231_53879.png")
+        .appDescription(null)
+        .appNotes(null)
+        .appUrl("http://sdc.api.fe.simpledemo.onap.org:30206/sdc1/portal")
+        .appAlternateUrl(null)
+        .appRestEndpoint("http://sdc-be:8080/api/v3")
+        .mlAppName("")
+        .mlAppAdminId("")
+        .motsId(null)
+        .appPassword("j85yNhyIs7zKYbR1VlwEfNhS6b7Om4l0Gx5O8931sCI=")
+        .open(false)
+        .enabled(true)
+        .activeYn(true)
+        .appUsername("sdc")
+        .uebKey("ueb_key")
+        .uebSecret("ueb_secret")
+        .uebTopicName("ECOMP-PORTAL-OUTBOX")
+        .appType(1L)
+        .authCentral(true)
+        .authNamespace("org.onap.sdc")
+        .build();
+    FnApp app5 = FnApp.builder()
+        .appName("Policy")
+        .appImageUrl("images/cache/portal1470452815_67021.png")
+        .appDescription(null)
+        .appNotes(null)
+        .appUrl("https://policy.api.simpledemo.onap.org:30219/onap/policy")
+        .appAlternateUrl(null)
+        .appRestEndpoint("https://pap:8443/onap/api/v3")
+        .mlAppName("")
+        .mlAppAdminId("")
+        .motsId(null)
+        .appPassword("2VxipM8Z3SETg32m3Gp0FvKS6zZ2uCbCw46WDyK6T5E=")
+        .open(false)
+        .enabled(true)
+        .activeYn(true)
+        .appUsername("Default")
+        .uebKey("ueb_key_5")
+        .uebSecret("ueb_secret")
+        .uebTopicName("ECOMP-PORTAL-OUTBOX")
+        .appType(1L)
+        .authCentral(true)
+        .authNamespace("org.onap.policy")
+        .build();
+    FnApp app6 = FnApp.builder()
+        .appName("Virtual Infrastructure Deployment")
+        .appImageUrl("images/cache/portal-345993588_92550.png")
+        .appDescription(null)
+        .appNotes(null)
+        .appUrl("https://vid.api.simpledemo.onap.org:30200/vid/welcome.htm")
+        .appAlternateUrl(null)
+        .appRestEndpoint("https://vid:8443/vid/api/v3")
+        .mlAppName("")
+        .mlAppAdminId("")
+        .motsId(null)
+        .appPassword("2VxipM8Z3SETg32m3Gp0FvKS6zZ2uCbCw46WDyK6T5E=")
+        .open(false)
+        .enabled(true)
+        .activeYn(true)
+        .appUsername("Default")
+        .uebKey("2Re7Pvdkgw5aeAUD")
+        .uebSecret("S31PrbOzGgL4hg4owgtx47Da")
+        .uebTopicName("ECOMP-PORTAL-OUTBOX-90")
+        .appType(1L)
+        .authCentral(true)
+        .authNamespace("org.onap.vid")
+        .build();
+    FnApp app7 = FnApp.builder()
+        .appName("A&AI UI")
+        .appImageUrl("images/cache/portal-345993588_92550.png")
+        .appDescription(null)
+        .appNotes(null)
+        .appUrl("https://aai.ui.simpledemo.onap.org:30220/services/aai/webapp/index.html#/viewInspect")
+        .appAlternateUrl(null)
+        .appRestEndpoint("https://aai-sparky-be.onap:8000/api/v2")
+        .mlAppName("")
+        .mlAppAdminId("")
+        .motsId(null)
+        .appPassword("4LK69amiIFtuzcl6Gsv97Tt7MLhzo03aoOx7dTvdjKQ=")
+        .open(false)
+        .enabled(true)
+        .activeYn(true)
+        .appUsername("aaiui")
+        .uebKey("ueb_key_7")
+        .uebSecret("ueb_secret")
+        .uebTopicName("ECOMP-PORTAL-OUTBOX")
+        .appType(1L)
+        .authCentral(true)
+        .authNamespace("org.onap.aai")
+        .build();
+    FnApp app8 = FnApp.builder()
+        .appName("CLI")
+        .appImageUrl("images/cache/portal-345993588_92550.png")
+        .appDescription(null)
+        .appNotes(null)
+        .appUrl("http://cli.api.simpledemo.onap.org:30260/")
+        .appAlternateUrl(null)
+        .appRestEndpoint(null)
+        .mlAppName("")
+        .mlAppAdminId("?")
+        .motsId(null)
+        .appPassword("")
+        .open(false)
+        .enabled(false)
+        .activeYn(true)
+        .appUsername("")
+        .uebKey("")
+        .uebSecret("")
+        .uebTopicName("")
+        .appType(1L)
+        .authCentral(false)
+        .authNamespace(null)
+        .build();
+    FnApp app9 = FnApp.builder()
+        .appName("MSB")
+        .appImageUrl("images/cache/portal-345993588_92550.png")
+        .appDescription(null)
+        .appNotes(null)
+        .appUrl("http://msb.api.simpledemo.onap.org:30280/iui/microservices/default.html")
+        .appAlternateUrl(null)
+        .appRestEndpoint(null)
+        .mlAppName("")
+        .mlAppAdminId("")
+        .motsId(null)
+        .appPassword("")
+        .open(true)
+        .enabled(true)
+        .activeYn(true)
+        .appUsername("")
+        .uebKey("")
+        .uebSecret("")
+        .uebTopicName("")
+        .appType(2L)
+        .authCentral(false)
+        .authNamespace(null)
+        .build();
+    FnApp app10 = FnApp.builder()
+        .appName("MSB")
+        .appImageUrl("images/cache/portal-345993588_92550.png")
+        .appDescription(null)
+        .appNotes(null)
+        .appUrl("http://msb.api.simpledemo.onap.org:30280/iui/microservices/default.html")
+        .appAlternateUrl(null)
+        .appRestEndpoint(null)
+        .mlAppName("")
+        .mlAppAdminId("")
+        .motsId(null)
+        .appPassword("")
+        .open(true)
+        .enabled(true)
+        .activeYn(true)
+        .appUsername("")
+        .uebKey("")
+        .uebSecret("")
+        .uebTopicName("")
+        .appType(2L)
+        .authCentral(false)
+        .authNamespace(null)
+        .build();
+    List<FnApp> fnApps = new ArrayList<>(Arrays.asList(app, app2, app3, app4, app5, app6, app7, app8, app9, app10));
+    fnAppDao.saveAll(fnApps);
+
+    // EP_APP_FUNCTION TABLE
+
+    EpAppFunction function1 = EpAppFunction.builder().appId(app).functionCd("menu|menu_acc_admin|*")
+        .functionName("Admin Account Menu'").build();
+    EpAppFunction function2 = EpAppFunction.builder().appId(app).functionCd("menu|menu_admin|*")
+        .functionName("Admin Menu").build();
+    EpAppFunction function3 = EpAppFunction.builder().appId(app).functionCd("menu|menu_home|*")
+        .functionName("Home Menu").build();
+    EpAppFunction function4 = EpAppFunction.builder().appId(app).functionCd("menu|menu_logout|*")
+        .functionName("Logout Menu").build();
+    EpAppFunction function5 = EpAppFunction.builder().appId(app).functionCd("menu|menu_web_analytics|*")
+        .functionName("Web Analytics").build();
+    EpAppFunction function6 = EpAppFunction.builder().appId(app).functionCd("url|addWebAnalyticsReport|*")
+        .functionName("Add Web Analytics Report").build();
+    EpAppFunction function7 = EpAppFunction.builder().appId(app).functionCd("url|appsFullList|*")
+        .functionName("Apps Full List").build();
+    EpAppFunction function8 = EpAppFunction.builder().appId(app).functionCd("url|centralizedApps|*")
+        .functionName("Centralized Apps").build();
+    EpAppFunction function9 = EpAppFunction.builder().appId(app).functionCd("url|edit_notification|*")
+        .functionName("User Notification").build();
+    EpAppFunction function10 = EpAppFunction.builder().appId(app).functionCd("url|functionalMenu|*")
+        .functionName("Functional Menu").build();
+    EpAppFunction function11 = EpAppFunction.builder().appId(app).functionCd("url|getAdminNotifications|*")
+        .functionName("Admin Notifications").build();
+    EpAppFunction function12 = EpAppFunction.builder().appId(app).functionCd("url|getAllWebAnalytics|*")
+        .functionName("Get All Web Analytics").build();
+    EpAppFunction function13 = EpAppFunction.builder().appId(app).functionCd("url|getFunctionalMenuRole|*")
+        .functionName("Get Functional Menu Role").build();
+    EpAppFunction function14 = EpAppFunction.builder().appId(app).functionCd("url|getNotificationAppRoles|*")
+        .functionName("Get Notification App Roles").build();
+    EpAppFunction function15 = EpAppFunction.builder().appId(app).functionCd("url|getUserAppsWebAnalytics|*")
+        .functionName("Get User Apps Web Analytics").build();
+    EpAppFunction function16 = EpAppFunction.builder().appId(app).functionCd("url|getUserJourneyAnalyticsReport|*")
+        .functionName("Get User Journey Report").build();
+    EpAppFunction function17 = EpAppFunction.builder().appId(app).functionCd("url|get_roles%2f%2a|*")
+        .functionName("getRolesOfApp").build();
+    EpAppFunction function18 = EpAppFunction.builder().appId(app).functionCd("url|get_role_functions%2f%2a|*")
+        .functionName("Get Role Functions").build();
+    EpAppFunction function19 = EpAppFunction.builder().appId(app).functionCd("url|login|*").functionName("Login")
+        .build();
+    EpAppFunction function20 = EpAppFunction.builder().appId(app).functionCd("url|notification_code|*")
+        .functionName("Notification Code").build();
+    EpAppFunction function21 = EpAppFunction.builder().appId(app)
+        .functionCd("url|role_function_list%2fsaveRoleFunction%2f%2a|*").functionName("Save Role Function").build();
+    EpAppFunction function22 = EpAppFunction.builder().appId(app).functionCd("url|saveNotification|*")
+        .functionName("publish notifications").build();
+    EpAppFunction function23 = EpAppFunction.builder().appId(app).functionCd("url|syncRoles|*")
+        .functionName("SyncRoles").build();
+    EpAppFunction function24 = EpAppFunction.builder().appId(app).functionCd("url|url_role.htm|*")
+        .functionName("role page").build();
+    EpAppFunction function25 = EpAppFunction.builder().appId(app).functionCd("url|url_welcome.htm|*")
+        .functionName("welcome page").build();
+    EpAppFunction function26 = EpAppFunction.builder().appId(app).functionCd("url|userAppRoles|*")
+        .functionName("userAppRoles").build();
+    EpAppFunction function27 = EpAppFunction.builder().appId(app).functionCd("url|userApps|*")
+        .functionName("User Apps").build();
+    List<EpAppFunction> epAppFunctions = new ArrayList<>(Arrays
+        .asList(function1, function2, function3, function4, function5, function6, function7, function8, function9,
+            function10, function11, function12, function13, function14, function15, function16, function17, function18,
+            function19, function20, function21, function22, function23, function24, function25, function26,
+            function27));
+    epAppFunctionDao.saveAll(epAppFunctions);
+
+    // FN_ROLE TABLE
+
+    // TODO should he change .appId(app2.getId()) to .appId(app2)??
+    // what that .appRoleId(0L) stands for? should we connect this fields with some field from FnApp?
+
+    FnRole fnRole1 = FnRole.builder().roleName("System_Administrator").activeYn(true).priority(1).appId(null).appRoleId(null).build();
+    FnRole fnRole16 = FnRole.builder().roleName("Standard_User").activeYn(true).priority(5).appId(null).appRoleId(null).build();
+    FnRole fnRole900 = FnRole.builder().roleName("Restricted_App_Role").activeYn(true).priority(1).appId(null).appRoleId(null).build();
+    FnRole fnRole950 = FnRole.builder().roleName("Portal_Notification_Admin").activeYn(true).priority(1).appId(null).appRoleId(null).build();
+    FnRole fnRole999 = FnRole.builder().roleName("Account_Administrator").activeYn(true).priority(1).appId(null).appRoleId(null).build();
+    FnRole fnRole1000 = FnRole.builder().roleName("System_Administrator").activeYn(true).priority(1).appId(app2.getId()).appRoleId(1L).build();
+    FnRole fnRole1001 = FnRole.builder().roleName("Standard_User").activeYn(true).priority(1).appId(app2.getId()).appRoleId(16L).build();
+    FnRole fnRole1002 = FnRole.builder().roleName("System_Administrator").activeYn(true).priority(1).appId(app3.getId()).appRoleId(1L).build();
+    FnRole fnRole1003 = FnRole.builder().roleName("Standard_User").activeYn(true).priority(1).appId(app3.getId()).appRoleId(16L).build();
+    FnRole fnRole1004 = FnRole.builder().roleName("ADMIN").activeYn(true).priority(1).appId(app4.getId()).appRoleId(0L).build();
+    FnRole fnRole1005 = FnRole.builder().roleName("TESTOR").activeYn(true).priority(1).appId(app4.getId()).appRoleId(1L).build();
+    FnRole fnRole1006 = FnRole.builder().roleName("System_Administrator").activeYn(true).priority(1).appId(app5.getId()).appRoleId(1L).build();
+    FnRole fnRole1007 = FnRole.builder().roleName("Standard_User").activeYn(true).priority(1).appId(app5.getId()).appRoleId(16L).build();
+    FnRole fnRole1008 = FnRole.builder().roleName("System_Administrator").activeYn(true).priority(1).appId(app6.getId()).appRoleId(1L).build();
+    FnRole fnRole1009 = FnRole.builder().roleName("Standard_User").activeYn(true).priority(1).appId(app6.getId()).appRoleId(16L).build();
+    FnRole fnRole1010 = FnRole.builder().roleName("Usage_Analyst").activeYn(true).priority(1).appId(null).appRoleId(null).build();
+    FnRole fnRole1011 = FnRole.builder().roleName("View").activeYn(true).priority(1).appId(app7.getId()).appRoleId(1L).build();
+    FnRole fnRole1012 = FnRole.builder().roleName("Standard_User").activeYn(true).priority(1).appId(app7.getId()).appRoleId(16L).build();
+    FnRole fnRole2115 = FnRole.builder().roleName("Portal_Usage_Analyst").activeYn(true).priority(6).appId(null).appRoleId(null).build();
+
+    List<FnRole> fnRoles = new ArrayList<>(Arrays
+        .asList(fnRole1, fnRole16, fnRole900, fnRole950, fnRole999, fnRole1000, fnRole1001, fnRole1002, fnRole1003, fnRole1004, fnRole1005,
+            fnRole1006, fnRole1007, fnRole1008, fnRole1009, fnRole1010, fnRole1011, fnRole1012, fnRole2115));
+    fnRoleDao.saveAll(fnRoles);
+
+    // EP_APP_ROLE_FUNCTION TABLE
+
+    EpAppRoleFunction epAppRoleFunction1 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole1)
+        .epAppFunction(function19).build();
+    EpAppRoleFunction epAppRoleFunction2 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole1)
+        .epAppFunction(function2).build();
+    EpAppRoleFunction epAppRoleFunction3 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole1)
+        .epAppFunction(function3).build();
+    EpAppRoleFunction epAppRoleFunction4 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole1)
+        .epAppFunction(function4).build();
+    EpAppRoleFunction epAppRoleFunction5 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole1010)
+        .epAppFunction(function19).build();
+    EpAppRoleFunction epAppRoleFunction6 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole1010)
+        .epAppFunction(function3).build();
+    EpAppRoleFunction epAppRoleFunction7 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole1010)
+        .epAppFunction(function4).build();
+    EpAppRoleFunction epAppRoleFunction8 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole950)
+        .epAppFunction(function9).build();
+    EpAppRoleFunction epAppRoleFunction9 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole950)
+        .epAppFunction(function11).build();
+    EpAppRoleFunction epAppRoleFunction10 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole950)
+        .epAppFunction(function22).build();
+    EpAppRoleFunction epAppRoleFunction11 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole999)
+        .epAppFunction(function26).build();
+    EpAppRoleFunction epAppRoleFunction12 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole999)
+        .epAppFunction(function11).build();
+    EpAppRoleFunction epAppRoleFunction13 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole999)
+        .epAppFunction(function27).build();
+    EpAppRoleFunction epAppRoleFunction14 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole1010)
+        .epAppFunction(function5).build();
+    EpAppRoleFunction epAppRoleFunction15 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole2115)
+        .epAppFunction(function5).build();
+    EpAppRoleFunction epAppRoleFunction16 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole1)
+        .epAppFunction(function1).build();
+    EpAppRoleFunction epAppRoleFunction17 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole999)
+        .epAppFunction(function1).build();
+    EpAppRoleFunction epAppRoleFunction18 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole999)
+        .epAppFunction(function8).build();
+    EpAppRoleFunction epAppRoleFunction19 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole999)
+        .epAppFunction(function12).build();
+    EpAppRoleFunction epAppRoleFunction20 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole999)
+        .epAppFunction(function13).build();
+    EpAppRoleFunction epAppRoleFunction21 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole999)
+        .epAppFunction(function14).build();
+    EpAppRoleFunction epAppRoleFunction22 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole999)
+        .epAppFunction(function15).build();
+    EpAppRoleFunction epAppRoleFunction23 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole999)
+        .epAppFunction(function16).build();
+    EpAppRoleFunction epAppRoleFunction24 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole999)
+        .epAppFunction(function17).build();
+    EpAppRoleFunction epAppRoleFunction25 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole999)
+        .epAppFunction(function18).build();
+    EpAppRoleFunction epAppRoleFunction26 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole999)
+        .epAppFunction(function20).build();
+    EpAppRoleFunction epAppRoleFunction27 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole999)
+        .epAppFunction(function21).build();
+    EpAppRoleFunction epAppRoleFunction28 = EpAppRoleFunction.builder().appId(app).fnRole(fnRole999)
+        .epAppFunction(function23).build();
+
+    List<EpAppRoleFunction> epAppRoleFunctions = new ArrayList<>(Arrays
+        .asList(epAppRoleFunction1, epAppRoleFunction2, epAppRoleFunction3, epAppRoleFunction4, epAppRoleFunction5,
+            epAppRoleFunction6, epAppRoleFunction7, epAppRoleFunction8, epAppRoleFunction9, epAppRoleFunction10,
+            epAppRoleFunction11, epAppRoleFunction12, epAppRoleFunction13, epAppRoleFunction14, epAppRoleFunction15,
+            epAppRoleFunction16, epAppRoleFunction17, epAppRoleFunction18, epAppRoleFunction19, epAppRoleFunction20,
+            epAppRoleFunction21, epAppRoleFunction22, epAppRoleFunction23, epAppRoleFunction24, epAppRoleFunction25,
+            epAppRoleFunction26, epAppRoleFunction27, epAppRoleFunction28));
+
+    epAppRoleFunctionDao.saveAll(epAppRoleFunctions);
+
+    EpBasicAuthAccount epBasicAuthAccount = EpBasicAuthAccount.builder().extAppName("JIRA").username("jira").password("6APqvG4AU2rfLgCvMdySwQ==").activeYn(true).build();
+    epBasicAuthAccountDao.save(epBasicAuthAccount);
+
+    // EP_MICROSERVICE TABLE
+
+    EpMicroservice epMicroservice1 = EpMicroservice.builder().name("News Microservice").description("News").appId(app).endpointUrl("http://portal-app:8989/ONAPPORTAL/commonWidgets").securityType("Basic Authentication").username("portal").password("6APqvG4AU2rfLgCvMdySwQ==").active(true).build();
+    EpMicroservice epMicroservice2 = EpMicroservice.builder().name("Events Microservice").description("Events").appId(app).endpointUrl("http://portal-app:8989/ONAPPORTAL/commonWidgets").securityType("Basic Authentication").username("portal").password("APqvG4AU2rfLgCvMdySwQ==").active(true).build();
+    EpMicroservice epMicroservice3 = EpMicroservice.builder().name("Resources Microservice").description("Resources").appId(app).endpointUrl("http://portal-app:8989/ONAPPORTAL/commonWidgets").securityType("Basic Authentication").username("portal").password("APqvG4AU2rfLgCvMdySwQ==").active(true).build();
+    EpMicroservice epMicroservice4 = EpMicroservice.builder().name("Portal-Common-Scheduler Microservice").description("Portal-Common-Scheduler").appId(app).endpointUrl("http://portal-app:8989/ONAPPORTAL/commonWidgets").securityType("Basic Authentication").username("portal").password("APqvG4AU2rfLgCvMdySwQ==").active(true).build();
+
+    List<EpMicroservice> epMicroservices = new ArrayList<>(Arrays.asList(epMicroservice1, epMicroservice2, epMicroservice3, epMicroservice4));
+
+    epMicroserviceDao.saveAll(epMicroservices);
+
+    // ep_microservice_parameter table
+
+    EpMicroserviceParameter parameter1 = EpMicroserviceParameter.builder().serviceId(epMicroservice1).paraKey("resourceType").paraValue("NEWS").build();
+    EpMicroserviceParameter parameter2 = EpMicroserviceParameter.builder().serviceId(epMicroservice2).paraKey("resourceType").paraValue("EVENTS").build();
+    EpMicroserviceParameter parameter3 = EpMicroserviceParameter.builder().serviceId(epMicroservice3).paraKey("resourceType").paraValue("IMPORTANTRESOURCES").build();
+    EpMicroserviceParameter parameter4 = EpMicroserviceParameter.builder().serviceId(epMicroservice4).paraKey("resourceType").paraValue(null).build();
+
+    List<EpMicroserviceParameter> epMicroserviceParameters = new ArrayList<>(Arrays.asList(parameter1, parameter2, parameter3, parameter4));
+
+    epMicroserviceParameterDao.saveAll(epMicroserviceParameters);
+
+    // ep_widget_catalog table
+    //TODO should we connect serviceId to EpMicroservice?
+
+    EpWidgetCatalog epWidgetCatalog1 = EpWidgetCatalog.builder().wdgName("News").serviceId(1L).wdgDesc("News").wdgFileLoc("news-widget.zip").allUserFlag(true).build();
+    EpWidgetCatalog epWidgetCatalog2 = EpWidgetCatalog.builder().wdgName("Events").serviceId(2L).wdgDesc("Events").wdgFileLoc("events-widget.zip").allUserFlag(true).build();
+    EpWidgetCatalog epWidgetCatalog3 = EpWidgetCatalog.builder().wdgName("Resources").serviceId(3L).wdgDesc("Resources").wdgFileLoc("resources-widget.zip").allUserFlag(true).build();
+    EpWidgetCatalog epWidgetCatalog4 = EpWidgetCatalog.builder().wdgName("Portal-Common-Scheduler").serviceId(4L).wdgDesc("Portal-Common-Scheduler").wdgFileLoc("portal-common-scheduler-widget.zip").allUserFlag(true).build();
+
+    List<EpWidgetCatalog> epWidgetCatalogs = new ArrayList<>(Arrays.asList(epWidgetCatalog1, epWidgetCatalog2, epWidgetCatalog3, epWidgetCatalog4));
+
+    epWidgetCatalogDao.saveAll(epWidgetCatalogs);
+
+    // ep_widget_catalog_files table
+    //TODO
+
+    //EpWidgetCatalogFiles epWidgetCatalogFiles = EpWidgetCatalogFiles.builder().fileId().widgetId().widgetName().frameworkJs().controllerJs().markupHtml().widgetCss().build();
+
+    // fn_app_contact_us table
+
+    FnAppContactUs fnAppContactUs1 = FnAppContactUs.builder().fnApp(app2).contactName("Portal SDK Team").contactEmail("portal@lists.onap.org").url("https://wiki.onap.org/display/DW/Approved+Projects").activeYn(null).description("xDemo Application").build();
+    FnAppContactUs fnAppContactUs2 = FnAppContactUs.builder().fnApp(app3).contactName("DBC Team").contactEmail("portal@lists.onap.org").url("https://wiki.onap.org/display/DW/Approved+Projects").activeYn(null).description("DBC").build();
+    FnAppContactUs fnAppContactUs3 = FnAppContactUs.builder().fnApp(app4).contactName("SDC Team").contactEmail("sdc@lists.onap.org").url("https://wiki.onap.org/display/DW/Approved+Projects").activeYn(null).description("Service Design and Creation (SDC).").build();
+    FnAppContactUs fnAppContactUs4 = FnAppContactUs.builder().fnApp(app5).contactName("Policy Team").contactEmail("policy@lists.onap.org").url("https://wiki.onap.org/display/DW/Approved+Projects").activeYn(null).description("Policy").build();
+    FnAppContactUs fnAppContactUs5 = FnAppContactUs.builder().fnApp(app6).contactName("VID Team").contactEmail("vid@lists.onap.org").url("https://wiki.onap.org/display/DW/Approved+Projects").activeYn(null).description("Virtual Infrastructure Design.").build();
+    FnAppContactUs fnAppContactUs6 = FnAppContactUs.builder().fnApp(app7).contactName("AAI UI Team").contactEmail("aaiui@lists.onap.org").url("https://wiki.onap.org/display/DW/Approved+Projects").activeYn(null).description("AAI UI Application").build();
+    FnAppContactUs fnAppContactUs7 = FnAppContactUs.builder().fnApp(app8).contactName("CLI Team").contactEmail("onap-discuss@lists.onap.org").url("https://wiki.onap.org/display/DW/Approved+Projects").activeYn(null).description("CLI Application").build();
+    FnAppContactUs fnAppContactUs8 = FnAppContactUs.builder().fnApp(app10).contactName("SO Team").contactEmail("so@lists.onap.org").url("https://wiki.onap.org/display/DW/Approved+Projects").activeYn(null).description("Service Orchestration (SO).").build();
+
+    List<FnAppContactUs> fnAppContactUses = new ArrayList<>(Arrays.asList(fnAppContactUs1, fnAppContactUs2, fnAppContactUs3, fnAppContactUs4, fnAppContactUs5, fnAppContactUs6, fnAppContactUs7, fnAppContactUs8));
+
+    fnAppContactUsDao.saveAll(fnAppContactUses);
+
+    // fn_common_widget_data table
+
+    FnCommonWidgetData fnCommonWidgetData1  = FnCommonWidgetData.builder().category("NEWS").href("https://www.onap.org/announcement/2017/09/27/open-network-automation-platform-onap-project-continues-rapid-membership-growth").title("Open Network Automation Platform ONAP Project Continues Rapid Membership Growth").content(null).eventDate(null).sortOrder(10L).build();
+    FnCommonWidgetData fnCommonWidgetData2  = FnCommonWidgetData.builder().category("NEWS").href("https://www.onap.org/announcement/2017/02/23/the-linux-foundation-announces-the-formation-of-a-new-project-to-help-accelerate-innovation-in-open-networking-automation").title("The Linux Foundation Announces Merger of Open Source ECOMP and OPEN-O to Form New Open Network Automation Platform ONAP Project").content(null).eventDate(null).sortOrder(20L).build();
+    FnCommonWidgetData fnCommonWidgetData3  = FnCommonWidgetData.builder().category("NEWS").href("http://about.att.com/story/orange_testing_att_open_source_ecomp_platform.html").title("Orange Testing AT&Ts Open Source ECOMP Platform for Building Software-Defined Network Capabilities").content(null).eventDate(null).sortOrder(30L).build();
+    FnCommonWidgetData fnCommonWidgetData4  = FnCommonWidgetData.builder().category("NEWS").href("http://about.att.com/innovationblog/linux_foundation").title("Opening up ECOMP: Our Network Operating System for SDN").content(null).eventDate(null).sortOrder(40L).build();
+    FnCommonWidgetData fnCommonWidgetData5  = FnCommonWidgetData.builder().category("EVENTS").href("https://onapbeijing2017.sched.com/list/descriptions/").title("ONAP Beijing Release Developer Forum").content(null).eventDate("2017-12-11").sortOrder(1L).build();
+    FnCommonWidgetData fnCommonWidgetData6  = FnCommonWidgetData.builder().category("EVENTS").href("https://events.linuxfoundation.org/events/open-networking-summit-north-america-2018").title("Open Networking Summit").content(null).eventDate("2018-03-26").sortOrder(2L).build();
+    FnCommonWidgetData fnCommonWidgetData7  = FnCommonWidgetData.builder().category("IMPORTANTRESOURCES").href("http://onap.readthedocs.io/en/latest/guides/onap-developer/developing/index.html").title("Development Guides").content(null).eventDate(null).sortOrder(1L).build();
+    FnCommonWidgetData fnCommonWidgetData8  = FnCommonWidgetData.builder().category("IMPORTANTRESOURCES").href("https://wiki.onap.org/").title("ONAP Wiki").content(null).eventDate(null).sortOrder(2L).build();
+    FnCommonWidgetData fnCommonWidgetData9  = FnCommonWidgetData.builder().category("IMPORTANTRESOURCES").href("http://onap.readthedocs.io/en/latest/guides/onap-developer/developing/index.html#portal-platform").title("ONAP Portal Documentation").content(null).eventDate(null).sortOrder(3L).build();
+    FnCommonWidgetData fnCommonWidgetData10  = FnCommonWidgetData.builder().category("IMPORTANTRESOURCES").href("http://onap.readthedocs.io/en/latest/guides/onap-developer/architecture/index.html#architecture").title("ONAP Architecture").content(null).eventDate(null).sortOrder(4L).build();
+
+    List<FnCommonWidgetData> fnCommonWidgetDataList = new ArrayList<>(Arrays.asList(fnCommonWidgetData1, fnCommonWidgetData2, fnCommonWidgetData3, fnCommonWidgetData4, fnCommonWidgetData5, fnCommonWidgetData6, fnCommonWidgetData7, fnCommonWidgetData8, fnCommonWidgetData9, fnCommonWidgetData10));
+
+    fnCommonWidgetDataDao.saveAll(fnCommonWidgetDataList);
+
+    // fn_language table
+    //TODO fix china text
+    FnLanguage language1 = new FnLanguage("English", "EN");
+    FnLanguage language2 = new FnLanguage("简体ä¸\u00ADæ–‡", "CN");
+
+    fnLanguageDao.save(language1);
+    fnLanguageDao.save(language2);
+
+    // fn_display_text table
+    // TODO should we change languageId from long type to FnLanguage?
+
+    FnDisplayText fnDisplayText1 = FnDisplayText.builder().languageId(1L).textId(2L).textLabel("Home").build();
+    FnDisplayText fnDisplayText2 = FnDisplayText.builder().languageId(1L).textId(3L).textLabel("Application Catalog").build();
+    FnDisplayText fnDisplayText3 = FnDisplayText.builder().languageId(1L).textId(4L).textLabel("Widget Catalog").build();
+    FnDisplayText fnDisplayText4 = FnDisplayText.builder().languageId(1L).textId(5L).textLabel("Admins").build();
+    FnDisplayText fnDisplayText5 = FnDisplayText.builder().languageId(1L).textId(6L).textLabel("Roles").build();
+    FnDisplayText fnDisplayText6 = FnDisplayText.builder().languageId(1L).textId(7L).textLabel("Users").build();
+    FnDisplayText fnDisplayText7 = FnDisplayText.builder().languageId(1L).textId(8L).textLabel("Portal Admins").build();
+    FnDisplayText fnDisplayText8 = FnDisplayText.builder().languageId(1L).textId(9L).textLabel("Application Onboarding").build();
+    FnDisplayText fnDisplayText9 = FnDisplayText.builder().languageId(1L).textId(10L).textLabel("Widget Onboarding").build();
+    FnDisplayText fnDisplayText10 = FnDisplayText.builder().languageId(1L).textId(11L).textLabel("Edit Functional Menu").build();
+    FnDisplayText fnDisplayText11 = FnDisplayText.builder().languageId(1L).textId(12L).textLabel("User Notifications").build();
+    FnDisplayText fnDisplayText12 = FnDisplayText.builder().languageId(1L).textId(13L).textLabel("Microservice Onboarding").build();
+    FnDisplayText fnDisplayText13 = FnDisplayText.builder().languageId(1L).textId(15L).textLabel("App Account Management").build();
+    FnDisplayText fnDisplayText14 = FnDisplayText.builder().languageId(2L).textId(2L).textLabel("主页").build();
+    FnDisplayText fnDisplayText15 = FnDisplayText.builder().languageId(2L).textId(3L).textLabel("应用目录").build();
+    FnDisplayText fnDisplayText16 = FnDisplayText.builder().languageId(2L).textId(4L).textLabel("部件目录").build();
+    FnDisplayText fnDisplayText17 = FnDisplayText.builder().languageId(2L).textId(5L).textLabel("管ç\90†å‘˜").build();
+    FnDisplayText fnDisplayText18 = FnDisplayText.builder().languageId(2L).textId(6L).textLabel("角色").build();
+    FnDisplayText fnDisplayText19 = FnDisplayText.builder().languageId(2L).textId(7L).textLabel("用户").build();
+    FnDisplayText fnDisplayText20 = FnDisplayText.builder().languageId(2L).textId(8L).textLabel("门户管ç\90†å‘˜").build();
+    FnDisplayText fnDisplayText21 = FnDisplayText.builder().languageId(2L).textId(9L).textLabel("应用管ç\90†").build();
+    FnDisplayText fnDisplayText22 = FnDisplayText.builder().languageId(2L).textId(10L).textLabel("部件管ç\90†").build();
+    FnDisplayText fnDisplayText23 = FnDisplayText.builder().languageId(2L).textId(11L).textLabel("编辑功能è\8fœå\8d•").build();
+    FnDisplayText fnDisplayText24 = FnDisplayText.builder().languageId(2L).textId(12L).textLabel("用户通知").build();
+    FnDisplayText fnDisplayText25 = FnDisplayText.builder().languageId(2L).textId(13L).textLabel("å¾®æœ\8d务管ç\90†").build();
+    FnDisplayText fnDisplayText26 = FnDisplayText.builder().languageId(2L).textId(15L).textLabel("应用账户管ç\90†").build();
+
+    List<FnDisplayText> fnDisplayTexts = new ArrayList<>(Arrays.asList(fnDisplayText1, fnDisplayText2, fnDisplayText3,
+        fnDisplayText4, fnDisplayText5, fnDisplayText6, fnDisplayText7, fnDisplayText8, fnDisplayText9, fnDisplayText10,
+        fnDisplayText11, fnDisplayText12, fnDisplayText13, fnDisplayText14, fnDisplayText15, fnDisplayText16, fnDisplayText17,
+        fnDisplayText18, fnDisplayText19, fnDisplayText20, fnDisplayText21, fnDisplayText22, fnDisplayText23, fnDisplayText24,
+        fnDisplayText25, fnDisplayText26));
+
+    fnDisplayTextDao.saveAll(fnDisplayTexts);
+
+    // fn_function table
+
+    FnFunction editNotification = FnFunction.builder().functionCd("edit_notification").functionName("User Notification").build();
+    FnFunction getAdminNotifications = FnFunction.builder().functionCd("getAdminNotifications").functionName("Admin Notifications").build();
+    FnFunction login = FnFunction.builder().functionCd("login").functionName("Login").build();
+    FnFunction menuAdmin = FnFunction.builder().functionCd("menu_admin").functionName("Admin Menu").build();
+    FnFunction menuAjax = FnFunction.builder().functionCd("menu_ajax").functionName("Ajax Menu").build();
+    FnFunction menuCustomer = FnFunction.builder().functionCd("menu_customer").functionName("Customer Menu").build();
+    FnFunction menuCustomerCreate = FnFunction.builder().functionCd("menu_customer_create").functionName("Customer Create").build();
+    FnFunction menuFeedback = FnFunction.builder().functionCd("menu_feedback").functionName("Feedback Menu").build();
+    FnFunction menuHelp = FnFunction.builder().functionCd("menu_help").functionName("Help Menu").build();
+    FnFunction menuHome = FnFunction.builder().functionCd("menu_home").functionName("Home Menu").build();
+    FnFunction menuJob = FnFunction.builder().functionCd("menu_job").functionName("Job Menu").build();
+    FnFunction menuJobCreate = FnFunction.builder().functionCd("menu_job_create").functionName("Job Create").build();
+    FnFunction menuJobDesigner = FnFunction.builder().functionCd("menu_job_designer").functionName("Process in Designer view").build();
+    FnFunction menuLogout = FnFunction.builder().functionCd("menu_logout").functionName("Logout Menu").build();
+    FnFunction menuMap = FnFunction.builder().functionCd("menu_map").functionName("Map Menu").build();
+    FnFunction menuNotes = FnFunction.builder().functionCd("menu_notes").functionName("Notes Menu").build();
+    FnFunction menuProcess = FnFunction.builder().functionCd("menu_process").functionName("Process List").build();
+    FnFunction menuProfile = FnFunction.builder().functionCd("menu_profile").functionName("Profile Menu").build();
+    FnFunction menuProfileCreate = FnFunction.builder().functionCd("menu_profile_create").functionName("Profile Create").build();
+    FnFunction menuProfileImport = FnFunction.builder().functionCd("menu_profile_import").functionName("Profile Import").build();
+    FnFunction menuReports = FnFunction.builder().functionCd("menu_reports").functionName("Reports Menu").build();
+    FnFunction menuSample = FnFunction.builder().functionCd("menu_sample").functionName("Sample Pages Menu").build();
+    FnFunction menuTab = FnFunction.builder().functionCd("menu_tab").functionName("Sample Tab Menu").build();
+    FnFunction menuTask = FnFunction.builder().functionCd("menu_task").functionName("Task Menu").build();
+    FnFunction menuTaskSearch = FnFunction.builder().functionCd("menu_task_search").functionName("Task Search").build();
+    FnFunction menuWebAnalytics = FnFunction.builder().functionCd("menu_web_analytics").functionName("Web Analytics").build();
+    FnFunction saveNotification = FnFunction.builder().functionCd("saveNotification").functionName("publish notifications").build();
+    FnFunction viewReports = FnFunction.builder().functionCd("view_reports").functionName("View Raptor reports").build();
+
+    List<FnFunction> fnFunctions = new ArrayList<>(Arrays.asList(editNotification, getAdminNotifications, login, menuAdmin,
+        menuAjax, menuCustomer, menuCustomerCreate, menuFeedback, menuHelp, menuHome, menuJob, menuJobCreate,
+        menuJobDesigner, menuLogout, menuMap, menuNotes, menuProcess, menuProfile, menuProfileCreate, menuProfileImport,
+        menuReports, menuSample, menuTab, menuTask, menuTaskSearch, menuWebAnalytics, saveNotification, viewReports));
+
+    fnFunctionDao.saveAll(fnFunctions);
+
+    // fn_lu_activity table
+
+    FnLuActivity activity1 = FnLuActivity.builder().activity_cd("add_child_role").activity("add_child_role").build();
+    FnLuActivity activity2 = FnLuActivity.builder().activity_cd("add_role").activity("add_role").build();
+    FnLuActivity activity3 = FnLuActivity.builder().activity_cd("add_role_function").activity("add_role_function").build();
+    FnLuActivity activity4 = FnLuActivity.builder().activity_cd("add_user_role").activity("add_user_role").build();
+    FnLuActivity activity5 = FnLuActivity.builder().activity_cd("apa").activity("Add Portal Admin").build();
+    FnLuActivity appAccess = FnLuActivity.builder().activity_cd("app_access").activity("App Access").build();
+    FnLuActivity activity7 = FnLuActivity.builder().activity_cd("dpa").activity("Delete Portal Admin").build();
+    FnLuActivity activity8 = FnLuActivity.builder().activity_cd("eaaf").activity("External auth add function").build();
+    FnLuActivity activity9 = FnLuActivity.builder().activity_cd("eaar").activity("External auth add role").build();
+    FnLuActivity activity10 = FnLuActivity.builder().activity_cd("eadf").activity("External auth delete function").build();
+    FnLuActivity activity11 = FnLuActivity.builder().activity_cd("eadr").activity("External auth delete role").build();
+    FnLuActivity activity12 = FnLuActivity.builder().activity_cd("eauf").activity("External auth update function").build();
+    FnLuActivity activity13 = FnLuActivity.builder().activity_cd("eaurf").activity("External auth update role and function").build();
+    FnLuActivity activity14 = FnLuActivity.builder().activity_cd("functional_access").activity("Functional Access").build();
+    FnLuActivity activity15 = FnLuActivity.builder().activity_cd("guest_login").activity("Guest Login").build();
+    FnLuActivity activity16 = FnLuActivity.builder().activity_cd("left_menu_access").activity("Left Menu Access").build();
+    FnLuActivity activity17 = FnLuActivity.builder().activity_cd("login").activity("Login").build();
+    FnLuActivity activity18 = FnLuActivity.builder().activity_cd("logout").activity("Logout").build();
+    FnLuActivity activity19 = FnLuActivity.builder().activity_cd("mobile_login").activity("Mobile Login").build();
+    FnLuActivity activity20 = FnLuActivity.builder().activity_cd("mobile_logout").activity("Mobile Logout").build();
+    FnLuActivity activity21 = FnLuActivity.builder().activity_cd("remove_child_role").activity("remove_child_role").build();
+    FnLuActivity activity22 = FnLuActivity.builder().activity_cd("remove_role").activity("remove_role").build();
+    FnLuActivity activity23 = FnLuActivity.builder().activity_cd("remove_role_function").activity("remove_role_function").build();
+    FnLuActivity activity24 = FnLuActivity.builder().activity_cd("remove_user_role").activity("remove_user_role").build();
+    FnLuActivity activity25 = FnLuActivity.builder().activity_cd("search").activity("Search").build();
+    FnLuActivity tabAccess = FnLuActivity.builder().activity_cd("tab_access").activity("Tab Access").build();
+    FnLuActivity activity27 = FnLuActivity.builder().activity_cd("uaa").activity("Update Account Admin").build();
+    FnLuActivity activity28 = FnLuActivity.builder().activity_cd("uu").activity("Update User").build();
+
+    List<FnLuActivity> luActivities = new ArrayList<>(Arrays.asList(activity1, activity2, activity3, activity4, activity5,
+        appAccess, activity7, activity8, activity9, activity10, activity11, activity12, activity13, activity14, activity15,
+        activity16, activity17, activity18, activity19, activity20, activity21, activity22, activity23, activity24, activity25,
+        tabAccess, activity27, activity28));
+
+    fnLuActivityDao.saveAll(luActivities);
+
+    //fn_lu_alert_method table
+
+    FnLuAlertMethod alertMethod1 = FnLuAlertMethod.builder().alertMethodCd("EMAIL").alertMethod("Email").build();
+    FnLuAlertMethod alertMethod2 = FnLuAlertMethod.builder().alertMethodCd("FAX").alertMethod("Fax").build();
+    FnLuAlertMethod alertMethod3 = FnLuAlertMethod.builder().alertMethodCd("PAGER").alertMethod("Pager").build();
+    FnLuAlertMethod alertMethod4 = FnLuAlertMethod.builder().alertMethodCd("PHONE").alertMethod("Phone").build();
+    FnLuAlertMethod alertMethod5 = FnLuAlertMethod.builder().alertMethodCd("SMS").alertMethod("SMS").build();
+
+    List<FnLuAlertMethod> alertMethods = new ArrayList<>(Arrays.asList(alertMethod1, alertMethod2, alertMethod3, alertMethod4, alertMethod5));
+
+    fnLuAlertMethodDao.saveAll(alertMethods);
+
+    // fn_lu_menu_set table
+
+    FnLuMenuSet menuSet = FnLuMenuSet.builder().menuSetCd("APP").menuSetName("Application Menu").build();
+
+    fnLuMenuSetDao.save(menuSet);
+
+    // fn_lu_tab_set table
+
+    FnLuTabSet fnLuTabSet = FnLuTabSet.builder().tabSetCd("APP").tabSetName("Application Tabs").build();
+
+    fnLuTabSetDao.save(fnLuTabSet);
+
+    // fn_lu_priority table
+
+    FnLuPriority low = FnLuPriority.builder().priority("Low").activeYn(true).sortOrder(10L).build();
+    FnLuPriority normal = FnLuPriority.builder().priority("Normal").activeYn(true).sortOrder(20L).build();
+    FnLuPriority high = FnLuPriority.builder().priority("High").activeYn(true).sortOrder(30L).build();
+    FnLuPriority urgent = FnLuPriority.builder().priority("Urgent").activeYn(true).sortOrder(40L).build();
+    FnLuPriority fatal = FnLuPriority.builder().priority("Fatal").activeYn(true).sortOrder(50L).build();
+
+    List<FnLuPriority> priorities = new ArrayList<>(Arrays.asList(low, normal, high, urgent, fatal));
+
+    fnLuPriorityDao.saveAll(priorities);
+
+    // fn_lu_timezone table
+
+    FnLuTimezone USEastern = FnLuTimezone.builder().timezoneName("US/Eastern").timezoneValue("US/Eastern").build();
+    FnLuTimezone USCentral = FnLuTimezone.builder().timezoneName("US/Central").timezoneValue("US/Central").build();
+    FnLuTimezone USMountain = FnLuTimezone.builder().timezoneName("US/Mountain").timezoneValue("US/Mountain").build();
+    FnLuTimezone USArizona = FnLuTimezone.builder().timezoneName("US/Arizona").timezoneValue("America/Phoenix").build();
+    FnLuTimezone USPacific = FnLuTimezone.builder().timezoneName("US/Pacific").timezoneValue("US/Pacific").build();
+    FnLuTimezone USAlaska = FnLuTimezone.builder().timezoneName("US/Alaska").timezoneValue("US/Alaska").build();
+    FnLuTimezone USHawaii = FnLuTimezone.builder().timezoneName("US/Hawaii").timezoneValue("US/Hawaii").build();
+
+    List<FnLuTimezone> timezones = new ArrayList<>(Arrays.asList(USEastern, USCentral, USMountain, USArizona, USPacific, USAlaska, USHawaii));
+
+    fnLuTimezoneDao.saveAll(timezones);
+
+    // fn_menu table
+
+    FnMenu menu1 = FnMenu.builder().label("root").parentId(null).sortOrder(10).action(null).functionCd("menu_home").activeYn(false).menuSetCd(menuSet).separatorYn(false).imageSrc(null).build();
+    FnMenu menu2 = FnMenu.builder().label("Home").parentId(menu1).sortOrder(10).action("root.applicationsHome").functionCd("menu_home").activeYn(true).menuSetCd(menuSet).separatorYn(false).imageSrc("icon-building-home").build();
+    FnMenu menu3 = FnMenu.builder().label("Application Catalog").parentId(menu1).sortOrder(15).action("root.appCatalog").functionCd("menu_home").activeYn(true).menuSetCd(menuSet).separatorYn(false).imageSrc("icon-retail-gallery").build();
+    FnMenu menu4 = FnMenu.builder().label("Widget Catalog").parentId(menu1).sortOrder(20).action("root.widgetCatalog").functionCd("menu_home").activeYn(true).menuSetCd(menuSet).separatorYn(false).imageSrc("icon-retail-gallery").build();
+    FnMenu menu5 = FnMenu.builder().label("Admins").parentId(menu1).sortOrder(40).action("root.admins").functionCd("menu_admin").activeYn(true).menuSetCd(menuSet).separatorYn(false).imageSrc("icon-content-star").build();
+    FnMenu menu6 = FnMenu.builder().label("Roles").parentId(menu1).sortOrder(45).action("root.roles").functionCd("menu_acc_admin").activeYn(true).menuSetCd(menuSet).separatorYn(false).imageSrc("icon-people-groupcollaboration").build();
+    FnMenu menu7 = FnMenu.builder().label("Users").parentId(menu1).sortOrder(50).action("root.users").functionCd("menu_acc_admin").activeYn(true).menuSetCd(menuSet).separatorYn(false).imageSrc("icon-people-groupcollaboration").build();
+    FnMenu menu8 = FnMenu.builder().label("Portal Admins").parentId(menu1).sortOrder(60).action("root.portalAdmins").functionCd("menu_admin").activeYn(true).menuSetCd(menuSet).separatorYn(false).imageSrc("icon-controls-settingsconnectedactivity").build();
+    FnMenu menu9 = FnMenu.builder().label("Application Onboarding").parentId(menu1).sortOrder(70).action("root.applications").functionCd("menu_admin").activeYn(true).menuSetCd(menuSet).separatorYn(false).imageSrc("icon-content-grid2").build();
+    FnMenu menu10 = FnMenu.builder().label("Widget Onboarding").parentId(menu1).sortOrder(80).action("root.widgetOnboarding").functionCd("menu_admin").activeYn(true).menuSetCd(menuSet).separatorYn(false).imageSrc("icon-content-grid2").build();
+    FnMenu menu11 = FnMenu.builder().label("Edit Functional Menu").parentId(menu1).sortOrder(90).action("root.functionalMenu").functionCd("menu_admin").activeYn(true).menuSetCd(menuSet).separatorYn(false).imageSrc("icon-misc-pen").build();
+    FnMenu menu12 = FnMenu.builder().label("User Notifications").parentId(menu1).sortOrder(100).action("root.userNotifications").functionCd("edit_notification").activeYn(true).menuSetCd(menuSet).separatorYn(false).imageSrc("icon-controls-settingsconnectedactivity").build();
+    FnMenu menu13 = FnMenu.builder().label("Microservice Onboarding").parentId(menu1).sortOrder(110).action("root.microserviceOnboarding").functionCd("menu_admin").activeYn(true).menuSetCd(menuSet).separatorYn(false).imageSrc("icon-content-grid2").build();
+    FnMenu menu14 = FnMenu.builder().label("App Account Management").parentId(menu1).sortOrder(130).action("root.accountOnboarding").functionCd("menu_admin").activeYn(true).menuSetCd(menuSet).separatorYn(false).imageSrc("icon-content-grid2").build();
+
+    List<FnMenu> fnMenus = new ArrayList<>(Arrays.asList(menu1, menu2, menu3, menu4, menu5, menu6, menu7, menu8, menu9, menu10, menu11, menu12, menu13, menu14));
+
+    fnMenuDao.saveAll(fnMenus);
+
+    // fn_menu_functional table
+
+    FnMenuFunctional menuFunctional175 = FnMenuFunctional.builder().columnNum(1L).text("Manage").parentMenuId(null).url("").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional178 = FnMenuFunctional.builder().columnNum(2L).text("Support").parentMenuId(null).url("").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional1 = FnMenuFunctional.builder().columnNum(2L).text("Design").parentMenuId(menuFunctional175).url("").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional2 = FnMenuFunctional.builder().columnNum(8L).text("ECOMP Platform Management").parentMenuId(menuFunctional175).url("").activeYn(false).imageSrc(null).build();
+    FnMenuFunctional menuFunctional3 = FnMenuFunctional.builder().columnNum(5L).text("Technology Insertion").parentMenuId(menuFunctional175).url("").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional5 = FnMenuFunctional.builder().columnNum(7L).text("Performance Management").parentMenuId(menuFunctional175).url("").activeYn(false).imageSrc(null).build();
+    FnMenuFunctional menuFunctional6 = FnMenuFunctional.builder().columnNum(6L).text("Technology Management").parentMenuId(menuFunctional175).url("").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional7 = FnMenuFunctional.builder().columnNum(4L).text("Capacity Planning").parentMenuId(menuFunctional175).url("").activeYn(false).imageSrc(null).build();
+    FnMenuFunctional menuFunctional8 = FnMenuFunctional.builder().columnNum(3L).text("Operations Planning").parentMenuId(menuFunctional175).url("").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional11 = FnMenuFunctional.builder().columnNum(1L).text("Product Design").parentMenuId(menuFunctional1).url("").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional12 = FnMenuFunctional.builder().columnNum(2L).text("Resource/Service Design & Onboarding").parentMenuId(menuFunctional1).url("").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional13 = FnMenuFunctional.builder().columnNum(3L).text("Orchestration recipe/Process Design").parentMenuId(menuFunctional1).url("").activeYn(false).imageSrc(null).build();
+    FnMenuFunctional menuFunctional14 = FnMenuFunctional.builder().columnNum(4L).text("Service Graph visualizer").parentMenuId(menuFunctional1).url("").activeYn(false).imageSrc(null).build();
+    FnMenuFunctional menuFunctional15 = FnMenuFunctional.builder().columnNum(5L).text("Distribution").parentMenuId(menuFunctional1).url("").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional16 = FnMenuFunctional.builder().columnNum(6L).text("Testing").parentMenuId(menuFunctional1).url("").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional17 = FnMenuFunctional.builder().columnNum(7L).text("Simulation").parentMenuId(menuFunctional1).url("").activeYn(false).imageSrc(null).build();
+    FnMenuFunctional menuFunctional18 = FnMenuFunctional.builder().columnNum(8L).text("Certification").parentMenuId(menuFunctional1).url("").activeYn(false).imageSrc(null).build();
+    FnMenuFunctional menuFunctional19 = FnMenuFunctional.builder().columnNum(9L).text("Policy Creation/Management").parentMenuId(menuFunctional1).url("http://policy.api.simpledemo.onap.org:8443/onap/policy").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional20 = FnMenuFunctional.builder().columnNum(10L).text("Catalog Browser").parentMenuId(menuFunctional1).url("").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional24 = FnMenuFunctional.builder().columnNum(5L).text("Create/Manage Policy").parentMenuId(menuFunctional12).url("http://policy.api.simpledemo.onap.org:8443/onap/policy").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional56 = FnMenuFunctional.builder().columnNum(1L).text("Policy Engineering").parentMenuId(menuFunctional8).url("http://policy.api.simpledemo.onap.org:8443/onap/policy").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional115 = FnMenuFunctional.builder().columnNum(1L).text("Test/Approve a Resource or Service").parentMenuId(menuFunctional16).url("http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/dashboard").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional130 = FnMenuFunctional.builder().columnNum(1L).text("Favorites").parentMenuId(menuFunctional175).url("").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional139 = FnMenuFunctional.builder().columnNum(2L).text("Approve a Service for distribution").parentMenuId(menuFunctional12).url("http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/dashboard").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional142 = FnMenuFunctional.builder().columnNum(3L).text("Create a License model").parentMenuId(menuFunctional12).url("http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/onboardVendor").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional145 = FnMenuFunctional.builder().columnNum(1L).text("Distribute a Service").parentMenuId(menuFunctional15).url("http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/dashboard").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional181 = FnMenuFunctional.builder().columnNum(1L).text("Contact Us").parentMenuId(menuFunctional178).url("").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional184 = FnMenuFunctional.builder().columnNum(2L).text("Get Access").parentMenuId(menuFunctional178).url("").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional301 = FnMenuFunctional.builder().columnNum(1L).text("Create a Product").parentMenuId(menuFunctional11).url("http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/dashboard").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional304 = FnMenuFunctional.builder().columnNum(2L).text("Create a Vendor Software Product").parentMenuId(menuFunctional11).url("http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/onboardVendor").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional307 = FnMenuFunctional.builder().columnNum(1L).text("Manage a Resource/Service").parentMenuId(menuFunctional20).url("http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/catalog").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional310 = FnMenuFunctional.builder().columnNum(2L).text("Manage a Product").parentMenuId(menuFunctional20).url("http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/catalog").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional313 = FnMenuFunctional.builder().columnNum(3L).text("View a Resource/Service/Product").parentMenuId(menuFunctional20).url("http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/catalog").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional316 = FnMenuFunctional.builder().columnNum(11L).text("Administration").parentMenuId(menuFunctional1).url("").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional148 = FnMenuFunctional.builder().columnNum(1L).text("User Management / Category Management").parentMenuId(menuFunctional316).url("http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/adminDashboard").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional317 = FnMenuFunctional.builder().columnNum(1L).text("Message Bus Management").parentMenuId(menuFunctional6).url("http://portal.api.simpledemo.onap.org:8989/ECOMPDBCAPP/dbc#/dmaap").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional318 = FnMenuFunctional.builder().columnNum(1L).text("Infrastructure Provisioning").parentMenuId(menuFunctional3).url("").activeYn(true).imageSrc(null).build();
+    FnMenuFunctional menuFunctional319 = FnMenuFunctional.builder().columnNum(1L).text("Infrastructure VNF Provisioning").parentMenuId(menuFunctional318).url("https://vid.api.simpledemo.onap.org:8443/vid/welcome.htm").activeYn(true).imageSrc(null).build();
+
+    List<FnMenuFunctional> menuFunctionals = new ArrayList<>(Arrays.asList(menuFunctional175, menuFunctional178,
+        menuFunctional1, menuFunctional2, menuFunctional3, menuFunctional5, menuFunctional6, menuFunctional7,
+        menuFunctional8, menuFunctional11, menuFunctional12, menuFunctional13, menuFunctional14, menuFunctional15,
+        menuFunctional16, menuFunctional17, menuFunctional18, menuFunctional19, menuFunctional20, menuFunctional24,
+        menuFunctional56, menuFunctional115, menuFunctional130, menuFunctional139, menuFunctional142, menuFunctional145,
+        menuFunctional181, menuFunctional184, menuFunctional301, menuFunctional304, menuFunctional307, menuFunctional310,
+        menuFunctional313, menuFunctional316, menuFunctional148, menuFunctional317, menuFunctional318, menuFunctional319));
+
+
+    fnMenuFunctionalDao.saveAll(menuFunctionals);
+
+    // fn_menu_functional_ancestors table
+
+    FnMenuFunctionalAncestors ancestors1 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional175).ancestorMenuId(menuFunctional175).depth(0).build();
+    FnMenuFunctionalAncestors ancestors2 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional178).ancestorMenuId(menuFunctional178).depth(0).build();
+    FnMenuFunctionalAncestors ancestors3 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional11).ancestorMenuId(menuFunctional11).depth(0).build();
+    FnMenuFunctionalAncestors ancestors4 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional12).ancestorMenuId(menuFunctional12).depth(0).build();
+    FnMenuFunctionalAncestors ancestors5 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional13).ancestorMenuId(menuFunctional13).depth(0).build();
+    FnMenuFunctionalAncestors ancestors6 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional14).ancestorMenuId(menuFunctional14).depth(0).build();
+    FnMenuFunctionalAncestors ancestors7 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional15).ancestorMenuId(menuFunctional15).depth(0).build();
+    FnMenuFunctionalAncestors ancestors8 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional16).ancestorMenuId(menuFunctional16).depth(0).build();
+    FnMenuFunctionalAncestors ancestors9 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional17).ancestorMenuId(menuFunctional17).depth(0).build();
+    FnMenuFunctionalAncestors ancestors10 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional18).ancestorMenuId(menuFunctional18).depth(0).build();
+    FnMenuFunctionalAncestors ancestors11 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional19).ancestorMenuId(menuFunctional19).depth(0).build();
+    FnMenuFunctionalAncestors ancestors12 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional20).ancestorMenuId(menuFunctional20).depth(0).build();
+    FnMenuFunctionalAncestors ancestors13 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional316).ancestorMenuId(menuFunctional316).depth(0).build();
+    FnMenuFunctionalAncestors ancestors14 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional318).ancestorMenuId(menuFunctional318).depth(0).build();
+    FnMenuFunctionalAncestors ancestors15 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional317).ancestorMenuId(menuFunctional317).depth(0).build();
+    FnMenuFunctionalAncestors ancestors16 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional56).ancestorMenuId(menuFunctional56).depth(0).build();
+    FnMenuFunctionalAncestors ancestors17 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional301).ancestorMenuId(menuFunctional301).depth(0).build();
+    FnMenuFunctionalAncestors ancestors18 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional304).ancestorMenuId(menuFunctional304).depth(0).build();
+    FnMenuFunctionalAncestors ancestors19 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional24).ancestorMenuId(menuFunctional24).depth(0).build();
+    FnMenuFunctionalAncestors ancestors20 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional139).ancestorMenuId(menuFunctional139).depth(0).build();
+    FnMenuFunctionalAncestors ancestors21 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional142).ancestorMenuId(menuFunctional142).depth(0).build();
+    FnMenuFunctionalAncestors ancestors22 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional145).ancestorMenuId(menuFunctional145).depth(0).build();
+    FnMenuFunctionalAncestors ancestors23 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional115).ancestorMenuId(menuFunctional115).depth(0).build();
+    FnMenuFunctionalAncestors ancestors24 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional307).ancestorMenuId(menuFunctional307).depth(0).build();
+    FnMenuFunctionalAncestors ancestors25 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional310).ancestorMenuId(menuFunctional310).depth(0).build();
+    FnMenuFunctionalAncestors ancestors26 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional313).ancestorMenuId(menuFunctional313).depth(0).build();
+    FnMenuFunctionalAncestors ancestors27 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional1).ancestorMenuId(menuFunctional1).depth(0).build();
+    FnMenuFunctionalAncestors ancestors28 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional2).ancestorMenuId(menuFunctional2).depth(0).build();
+    FnMenuFunctionalAncestors ancestors29 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional3).ancestorMenuId(menuFunctional3).depth(0).build();
+    FnMenuFunctionalAncestors ancestors30 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional5).ancestorMenuId(menuFunctional5).depth(0).build();
+    FnMenuFunctionalAncestors ancestors31 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional6).ancestorMenuId(menuFunctional6).depth(0).build();
+    FnMenuFunctionalAncestors ancestors32 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional7).ancestorMenuId(menuFunctional7).depth(0).build();
+    FnMenuFunctionalAncestors ancestors33 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional8).ancestorMenuId(menuFunctional8).depth(0).build();
+    FnMenuFunctionalAncestors ancestors34 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional130).ancestorMenuId(menuFunctional130).depth(0).build();
+    FnMenuFunctionalAncestors ancestors35 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional181).ancestorMenuId(menuFunctional181).depth(0).build();
+    FnMenuFunctionalAncestors ancestors36 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional184).ancestorMenuId(menuFunctional184).depth(0).build();
+    FnMenuFunctionalAncestors ancestors37 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional148).ancestorMenuId(menuFunctional148).depth(0).build();
+    FnMenuFunctionalAncestors ancestors38 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional319).ancestorMenuId(menuFunctional319).depth(0).build();
+    FnMenuFunctionalAncestors ancestors64 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional11).ancestorMenuId(menuFunctional1).depth(1).build();
+    FnMenuFunctionalAncestors ancestors65 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional12).ancestorMenuId(menuFunctional1).depth(1).build();
+    FnMenuFunctionalAncestors ancestors66 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional13).ancestorMenuId(menuFunctional1).depth(1).build();
+    FnMenuFunctionalAncestors ancestors67 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional14).ancestorMenuId(menuFunctional1).depth(1).build();
+    FnMenuFunctionalAncestors ancestors68 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional15).ancestorMenuId(menuFunctional1).depth(1).build();
+    FnMenuFunctionalAncestors ancestors69 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional16).ancestorMenuId(menuFunctional1).depth(1).build();
+    FnMenuFunctionalAncestors ancestors70 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional17).ancestorMenuId(menuFunctional1).depth(1).build();
+    FnMenuFunctionalAncestors ancestors71 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional18).ancestorMenuId(menuFunctional1).depth(1).build();
+    FnMenuFunctionalAncestors ancestors72 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional19).ancestorMenuId(menuFunctional1).depth(1).build();
+    FnMenuFunctionalAncestors ancestors73 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional20).ancestorMenuId(menuFunctional1).depth(1).build();
+    FnMenuFunctionalAncestors ancestors74 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional316).ancestorMenuId(menuFunctional1).depth(1).build();
+    FnMenuFunctionalAncestors ancestors75 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional318).ancestorMenuId(menuFunctional3).depth(1).build();
+    FnMenuFunctionalAncestors ancestors76 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional317).ancestorMenuId(menuFunctional6).depth(1).build();
+    FnMenuFunctionalAncestors ancestors77 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional56).ancestorMenuId(menuFunctional8).depth(1).build();
+    FnMenuFunctionalAncestors ancestors78 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional301).ancestorMenuId(menuFunctional11).depth(1).build();
+    FnMenuFunctionalAncestors ancestors79 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional304).ancestorMenuId(menuFunctional11).depth(1).build();
+    FnMenuFunctionalAncestors ancestors80 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional24).ancestorMenuId(menuFunctional12).depth(1).build();
+    FnMenuFunctionalAncestors ancestors81 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional139).ancestorMenuId(menuFunctional12).depth(1).build();
+    FnMenuFunctionalAncestors ancestors82 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional142).ancestorMenuId(menuFunctional12).depth(1).build();
+    FnMenuFunctionalAncestors ancestors83 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional145).ancestorMenuId(menuFunctional15).depth(1).build();
+    FnMenuFunctionalAncestors ancestors84 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional115).ancestorMenuId(menuFunctional16).depth(1).build();
+    FnMenuFunctionalAncestors ancestors85 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional307).ancestorMenuId(menuFunctional20).depth(1).build();
+    FnMenuFunctionalAncestors ancestors86 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional310).ancestorMenuId(menuFunctional20).depth(1).build();
+    FnMenuFunctionalAncestors ancestors87 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional313).ancestorMenuId(menuFunctional20).depth(1).build();
+    FnMenuFunctionalAncestors ancestors88 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional1).ancestorMenuId(menuFunctional175).depth(1).build();
+    FnMenuFunctionalAncestors ancestors89 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional2).ancestorMenuId(menuFunctional175).depth(1).build();
+    FnMenuFunctionalAncestors ancestors90 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional3).ancestorMenuId(menuFunctional175).depth(1).build();
+    FnMenuFunctionalAncestors ancestors91 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional5).ancestorMenuId(menuFunctional175).depth(1).build();
+    FnMenuFunctionalAncestors ancestors92 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional6).ancestorMenuId(menuFunctional175).depth(1).build();
+    FnMenuFunctionalAncestors ancestors93 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional7).ancestorMenuId(menuFunctional175).depth(1).build();
+    FnMenuFunctionalAncestors ancestors94 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional8).ancestorMenuId(menuFunctional175).depth(1).build();
+    FnMenuFunctionalAncestors ancestors95 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional130).ancestorMenuId(menuFunctional175).depth(1).build();
+    FnMenuFunctionalAncestors ancestors96 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional181).ancestorMenuId(menuFunctional178).depth(1).build();
+    FnMenuFunctionalAncestors ancestors97 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional184).ancestorMenuId(menuFunctional178).depth(1).build();
+    FnMenuFunctionalAncestors ancestors98 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional148).ancestorMenuId(menuFunctional316).depth(1).build();
+    FnMenuFunctionalAncestors ancestors99 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional319).ancestorMenuId(menuFunctional318).depth(1).build();
+    FnMenuFunctionalAncestors ancestors127 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional301).ancestorMenuId(menuFunctional1).depth(2).build();
+    FnMenuFunctionalAncestors ancestors128 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional304).ancestorMenuId(menuFunctional1).depth(2).build();
+    FnMenuFunctionalAncestors ancestors129 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional24).ancestorMenuId(menuFunctional1).depth(2).build();
+    FnMenuFunctionalAncestors ancestors130 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional139).ancestorMenuId(menuFunctional1).depth(2).build();
+    FnMenuFunctionalAncestors ancestors131 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional142).ancestorMenuId(menuFunctional1).depth(2).build();
+    FnMenuFunctionalAncestors ancestors132 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional145).ancestorMenuId(menuFunctional1).depth(2).build();
+    FnMenuFunctionalAncestors ancestors133 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional115).ancestorMenuId(menuFunctional1).depth(2).build();
+    FnMenuFunctionalAncestors ancestors134 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional307).ancestorMenuId(menuFunctional1).depth(2).build();
+    FnMenuFunctionalAncestors ancestors135 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional310).ancestorMenuId(menuFunctional1).depth(2).build();
+    FnMenuFunctionalAncestors ancestors136 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional313).ancestorMenuId(menuFunctional1).depth(2).build();
+    FnMenuFunctionalAncestors ancestors137 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional148).ancestorMenuId(menuFunctional1).depth(2).build();
+    FnMenuFunctionalAncestors ancestors138 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional319).ancestorMenuId(menuFunctional3).depth(2).build();
+    FnMenuFunctionalAncestors ancestors139 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional11).ancestorMenuId(menuFunctional175).depth(2).build();
+    FnMenuFunctionalAncestors ancestors140 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional12).ancestorMenuId(menuFunctional175).depth(2).build();
+    FnMenuFunctionalAncestors ancestors141 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional13).ancestorMenuId(menuFunctional175).depth(2).build();
+    FnMenuFunctionalAncestors ancestors142 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional14).ancestorMenuId(menuFunctional175).depth(2).build();
+    FnMenuFunctionalAncestors ancestors143 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional15).ancestorMenuId(menuFunctional175).depth(2).build();
+    FnMenuFunctionalAncestors ancestors144 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional16).ancestorMenuId(menuFunctional175).depth(2).build();
+    FnMenuFunctionalAncestors ancestors145 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional17).ancestorMenuId(menuFunctional175).depth(2).build();
+    FnMenuFunctionalAncestors ancestors146 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional18).ancestorMenuId(menuFunctional175).depth(2).build();
+    FnMenuFunctionalAncestors ancestors147 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional19).ancestorMenuId(menuFunctional175).depth(2).build();
+    FnMenuFunctionalAncestors ancestors148 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional20).ancestorMenuId(menuFunctional175).depth(2).build();
+    FnMenuFunctionalAncestors ancestors149 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional316).ancestorMenuId(menuFunctional175).depth(2).build();
+    FnMenuFunctionalAncestors ancestors150 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional318).ancestorMenuId(menuFunctional175).depth(2).build();
+    FnMenuFunctionalAncestors ancestors151 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional317).ancestorMenuId(menuFunctional175).depth(2).build();
+    FnMenuFunctionalAncestors ancestors152 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional56).ancestorMenuId(menuFunctional175).depth(2).build();
+    FnMenuFunctionalAncestors ancestors158 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional301).ancestorMenuId(menuFunctional175).depth(3).build();
+    FnMenuFunctionalAncestors ancestors159 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional304).ancestorMenuId(menuFunctional175).depth(3).build();
+    FnMenuFunctionalAncestors ancestors160 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional24).ancestorMenuId(menuFunctional175).depth(3).build();
+    FnMenuFunctionalAncestors ancestors161 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional139).ancestorMenuId(menuFunctional175).depth(3).build();
+    FnMenuFunctionalAncestors ancestors162 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional142).ancestorMenuId(menuFunctional175).depth(3).build();
+    FnMenuFunctionalAncestors ancestors163 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional145).ancestorMenuId(menuFunctional175).depth(3).build();
+    FnMenuFunctionalAncestors ancestors164 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional115).ancestorMenuId(menuFunctional175).depth(3).build();
+    FnMenuFunctionalAncestors ancestors165 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional307).ancestorMenuId(menuFunctional175).depth(3).build();
+    FnMenuFunctionalAncestors ancestors166 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional310).ancestorMenuId(menuFunctional175).depth(3).build();
+    FnMenuFunctionalAncestors ancestors167 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional313).ancestorMenuId(menuFunctional175).depth(3).build();
+    FnMenuFunctionalAncestors ancestors168 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional148).ancestorMenuId(menuFunctional175).depth(3).build();
+    FnMenuFunctionalAncestors ancestors169 = FnMenuFunctionalAncestors.builder().menuId(menuFunctional319).ancestorMenuId(menuFunctional175).depth(3).build();
+
+    List<FnMenuFunctionalAncestors> ancestors = new ArrayList<>(Arrays.asList(ancestors1, ancestors2,
+        ancestors3, ancestors4, ancestors5, ancestors6, ancestors7, ancestors8, ancestors9, ancestors10,
+        ancestors11, ancestors12, ancestors13, ancestors14, ancestors15, ancestors16, ancestors17, ancestors18,
+        ancestors19, ancestors20, ancestors21, ancestors22, ancestors23, ancestors24, ancestors25, ancestors26,
+        ancestors27, ancestors28, ancestors29, ancestors30, ancestors31, ancestors32, ancestors33,
+        ancestors34, ancestors35, ancestors36, ancestors37, ancestors38, ancestors64, ancestors65, ancestors66,
+        ancestors67, ancestors68, ancestors69, ancestors70, ancestors71, ancestors72, ancestors73, ancestors74,
+        ancestors75, ancestors76, ancestors77, ancestors78, ancestors79, ancestors80, ancestors81, ancestors82,
+        ancestors83, ancestors84, ancestors85, ancestors86, ancestors87, ancestors88, ancestors89, ancestors90,
+        ancestors91, ancestors92, ancestors93, ancestors94, ancestors95, ancestors96, ancestors97, ancestors98,
+        ancestors99, ancestors127, ancestors128, ancestors129, ancestors130, ancestors131, ancestors132, ancestors133,
+        ancestors134, ancestors135, ancestors136, ancestors137, ancestors138, ancestors139, ancestors140, ancestors141,
+        ancestors142, ancestors143, ancestors144, ancestors145, ancestors146, ancestors147, ancestors148, ancestors149,
+        ancestors150, ancestors151, ancestors152, ancestors158, ancestors159, ancestors160, ancestors161, ancestors162,
+        ancestors163, ancestors164, ancestors165, ancestors166, ancestors167, ancestors168, ancestors169));
+
+    fnMenuFunctionalAncestorsDao.saveAll(ancestors);
+
+    // fn_menu_functional_roles table
+
+    FnMenuFunctionalRoles functionalRoles1 = FnMenuFunctionalRoles.builder().menuId(menuFunctional19).appId(app5).roleId(fnRole1007).build();
+    FnMenuFunctionalRoles functionalRoles2 = FnMenuFunctionalRoles.builder().menuId(menuFunctional19).appId(app5).roleId(fnRole1006).build();
+    FnMenuFunctionalRoles functionalRoles3 = FnMenuFunctionalRoles.builder().menuId(menuFunctional24).appId(app5).roleId(fnRole1007).build();
+    FnMenuFunctionalRoles functionalRoles4 = FnMenuFunctionalRoles.builder().menuId(menuFunctional24).appId(app5).roleId(fnRole1006).build();
+    FnMenuFunctionalRoles functionalRoles5 = FnMenuFunctionalRoles.builder().menuId(menuFunctional56).appId(app5).roleId(fnRole1007).build();
+    FnMenuFunctionalRoles functionalRoles6 = FnMenuFunctionalRoles.builder().menuId(menuFunctional56).appId(app5).roleId(fnRole1006).build();
+    FnMenuFunctionalRoles functionalRoles8 = FnMenuFunctionalRoles.builder().menuId(menuFunctional115).appId(app4).roleId(fnRole1004).build();
+    FnMenuFunctionalRoles functionalRoles9 = FnMenuFunctionalRoles.builder().menuId(menuFunctional115).appId(app4).roleId(fnRole1005).build();
+    FnMenuFunctionalRoles functionalRoles10 = FnMenuFunctionalRoles.builder().menuId(menuFunctional139).appId(app4).roleId(fnRole1004).build();
+    FnMenuFunctionalRoles functionalRoles11 = FnMenuFunctionalRoles.builder().menuId(menuFunctional139).appId(app4).roleId(fnRole1005).build();
+    FnMenuFunctionalRoles functionalRoles12 = FnMenuFunctionalRoles.builder().menuId(menuFunctional142).appId(app4).roleId(fnRole1004).build();
+    FnMenuFunctionalRoles functionalRoles13 = FnMenuFunctionalRoles.builder().menuId(menuFunctional142).appId(app4).roleId(fnRole1005).build();
+    FnMenuFunctionalRoles functionalRoles14 = FnMenuFunctionalRoles.builder().menuId(menuFunctional145).appId(app4).roleId(fnRole1004).build();
+    FnMenuFunctionalRoles functionalRoles15 = FnMenuFunctionalRoles.builder().menuId(menuFunctional145).appId(app4).roleId(fnRole1005).build();
+    FnMenuFunctionalRoles functionalRoles16 = FnMenuFunctionalRoles.builder().menuId(menuFunctional148).appId(app4).roleId(fnRole1004).build();
+    FnMenuFunctionalRoles functionalRoles17 = FnMenuFunctionalRoles.builder().menuId(menuFunctional148).appId(app4).roleId(fnRole1005).build();
+    FnMenuFunctionalRoles functionalRoles18 = FnMenuFunctionalRoles.builder().menuId(menuFunctional301).appId(app4).roleId(fnRole1004).build();
+    FnMenuFunctionalRoles functionalRoles19 = FnMenuFunctionalRoles.builder().menuId(menuFunctional301).appId(app4).roleId(fnRole1005).build();
+    FnMenuFunctionalRoles functionalRoles20 = FnMenuFunctionalRoles.builder().menuId(menuFunctional304).appId(app4).roleId(fnRole1004).build();
+    FnMenuFunctionalRoles functionalRoles21 = FnMenuFunctionalRoles.builder().menuId(menuFunctional304).appId(app4).roleId(fnRole1005).build();
+    FnMenuFunctionalRoles functionalRoles22 = FnMenuFunctionalRoles.builder().menuId(menuFunctional307).appId(app4).roleId(fnRole1004).build();
+    FnMenuFunctionalRoles functionalRoles23 = FnMenuFunctionalRoles.builder().menuId(menuFunctional307).appId(app4).roleId(fnRole1005).build();
+    FnMenuFunctionalRoles functionalRoles24 = FnMenuFunctionalRoles.builder().menuId(menuFunctional310).appId(app4).roleId(fnRole1004).build();
+    FnMenuFunctionalRoles functionalRoles25 = FnMenuFunctionalRoles.builder().menuId(menuFunctional310).appId(app4).roleId(fnRole1005).build();
+    FnMenuFunctionalRoles functionalRoles26 = FnMenuFunctionalRoles.builder().menuId(menuFunctional313).appId(app4).roleId(fnRole1004).build();
+    FnMenuFunctionalRoles functionalRoles27 = FnMenuFunctionalRoles.builder().menuId(menuFunctional313).appId(app4).roleId(fnRole1005).build();
+    FnMenuFunctionalRoles functionalRoles39 = FnMenuFunctionalRoles.builder().menuId(menuFunctional319).appId(app6).roleId(fnRole1009).build();
+    FnMenuFunctionalRoles functionalRoles40 = FnMenuFunctionalRoles.builder().menuId(menuFunctional319).appId(app6).roleId(fnRole1008).build();
+    FnMenuFunctionalRoles functionalRoles42 = FnMenuFunctionalRoles.builder().menuId(menuFunctional317).appId(app3).roleId(fnRole1003).build();
+    FnMenuFunctionalRoles functionalRoles43 = FnMenuFunctionalRoles.builder().menuId(menuFunctional317).appId(app3).roleId(fnRole1002).build();
+
+    List<FnMenuFunctionalRoles> functionalRoles = new ArrayList<>(Arrays.asList(functionalRoles1, functionalRoles2,
+        functionalRoles3, functionalRoles4, functionalRoles5, functionalRoles6, functionalRoles8, functionalRoles9,
+        functionalRoles10, functionalRoles11, functionalRoles12, functionalRoles13, functionalRoles14, functionalRoles15,
+        functionalRoles16, functionalRoles17, functionalRoles18, functionalRoles19, functionalRoles20, functionalRoles21,
+        functionalRoles22, functionalRoles23, functionalRoles24, functionalRoles25, functionalRoles26, functionalRoles27,
+        functionalRoles39, functionalRoles40, functionalRoles42, functionalRoles43));
+
+    fnMenuFunctionalRolesDao.saveAll(functionalRoles);
+
+    // fn_qz_job_details table
+
+    FnQzJobDetails fnQzJobDetails1 = FnQzJobDetails.builder().schedName("Scheduler_20190808_one").jobName("LogJob")
+        .jobGroup("AppGroup").description(null).jobClassName("org.onap.portalapp.scheduler.LogJob").isDurable(false)
+        .isNonconcurrent(true).isUpdateData(true).requestsRecovery(false).jobData("��\\0\u0005sr\\0\u0015org.quartz.JobDataMap���迩��\u0002\\0\\0xr\\0&org.quartz.utils.StringKeyDirtyFlagMap�\b����](\u0002\\0\u0001Z\\0\u0013allowsTransientDataxr\\0\u001Dorg.quartz.utils.DirtyFlagMap\u0013�.�(v\\n�\u0002\\0\u0002Z\\0\u0005dirtyL\\0\u0003mapt\\0\u000FLjava/util/Map;xp\u0001sr\\0\u0011java.util.HashMap\u0005\u0007���\u0016`�\u0003\\0\u0002F\\0\\nloadFactorI\\0\tthresholdxp?@\\0\\0\\0\\0\\0\fw\b\\0\\0\\0\u0010\\0\\0\\0\u0001t\\0\u0005unitst\\0\u0005bytesx\\0".getBytes()).build();
+    FnQzJobDetails fnQzJobDetails2   = FnQzJobDetails.builder().schedName("Scheduler_20190808_one")
+        .jobName("PortalSessionTimeoutFeedJob").jobGroup("AppGroup").description(null)
+        .jobClassName("org.onap.portalapp.service.sessionmgt.TimeoutHandler").isDurable(false)
+        .isNonconcurrent(true).isUpdateData(true).requestsRecovery(false).jobData("��\\0\u0005sr\\0\u0015org.quartz.JobDataMap���迩��\u0002\\0\\0xr\\0&org.quartz.utils.StringKeyDirtyFlagMap�\b����](\u0002\\0\u0001Z\\0\u0013allowsTransientDataxr\\0\u001Dorg.quartz.utils.DirtyFlagMap\u0013�.�(v\\n�\u0002\\0\u0002Z\\0\u0005dirtyL\\0\u0003mapt\\0\u000FLjava/util/Map;xp\\0sr\\0\u0011java.util.HashMap\u0005\u0007���\u0016`�\u0003\\0\u0002F\\0\\nloadFactorI\\0\tthresholdxp?@\\0\\0\\0\\0\\0\u0010w\b\\0\\0\\0\u0010\\0\\0\\0\\0x\\0".getBytes()).build();
+
+    List<FnQzJobDetails> jobDetails = new ArrayList<>(Arrays.asList(fnQzJobDetails1, fnQzJobDetails2));
+
+    fnQzJobDetailsDao.saveAll(jobDetails);
+
+    // fn_qz_locks table
+
+    FnQzLocks fnQzLocks1 = new FnQzLocks("Scheduler_20190808_one", "STATE_ACCESS");
+    FnQzLocks fnQzLocks2 = new FnQzLocks("Scheduler_20190808_one", "TRIGGER_ACCESS");
+
+    List<FnQzLocks> locks = new ArrayList<>(Arrays.asList(fnQzLocks1, fnQzLocks2));
+
+    fnQzLocksDao.saveAll(locks);
+
+    // fn_qz_scheduler_state table
+
+    FnQzSchedulerState schedulerState = FnQzSchedulerState.builder().schedName("Scheduler_20190808_one")
+        .instanceName("portal-portal-app-76c9f7bfb5-s8rhd1565254283688").lastCheckinTime(BigInteger.valueOf(1565691615399L))
+        .checkinInterval(BigInteger.valueOf(20000L)).build();
+
+    fnQzSchedulerStateDao.save(schedulerState);
+
+    // fn_qz_triggers table
+    //TODO
+    FnQzTriggers trigger1 = FnQzTriggers.builder().fnQzJobDetails(fnQzJobDetails1).schedName("Scheduler_20190808_one").jobName("LogJob").jobGroup("AppGroup").triggerName("LogTrigger").triggerGroup("AppGroup").description(null).nextFireTime(1565691660000L).prevFireTime(1565691600000L).priority(0).triggerState("WAITING").triggerType("CRON").startTime(1565254275000L).endTime(0L).calendarName(null).misfireInstr(BigInteger.valueOf(0L)).jobData("".getBytes()).build();
+    FnQzTriggers trigger2 = FnQzTriggers.builder().fnQzJobDetails(fnQzJobDetails2).schedName("Scheduler_20190808_one").jobName("PortalSessionTimeoutFeedJob").jobGroup("AppGroup").triggerName("PortalSessionTimeoutFeedTrigger").triggerGroup("AppGroup").description(null).nextFireTime(1565691900000L).prevFireTime(1565691600000L).priority(0).triggerState("WAITING").triggerType("CRON").startTime(1565254275000L).endTime(0L).calendarName(null).misfireInstr(BigInteger.valueOf(0L)).jobData("".getBytes()).build();
+
+    List<FnQzTriggers> fnQzTriggers = new ArrayList<>(Arrays.asList(trigger1, trigger2));
+
+    // fnQzTriggersDao.saveAll(fnQzTriggers);
+
+    // fn_qz_cron_triggers table
+    //TODO
+
+    FnQzCronTriggers cronTrigger1 = FnQzCronTriggers.builder().schedName("Scheduler_20190808_one").triggerName("LogTrigger").triggerGroup("AppGroup").cronExpression("0 * * * * ? *").timeZoneId("GMT").build();
+    FnQzCronTriggers cronTrigger2 = FnQzCronTriggers.builder().schedName("Scheduler_20190808_one").triggerName("PortalSessionTimeoutFeedTrigger").triggerGroup("AppGroup").cronExpression("0 0/5 * * * ? *").timeZoneId("GMT").build();
+
+    List<FnQzCronTriggers> cronTriggers = new ArrayList<>(Arrays.asList(cronTrigger1, cronTrigger2));
+
+    //fnQzCronTriggersDao.saveAll(cronTriggers);
+
+    // fn_restricted_url table
+    //TODO
+    FnRestrictedUrl url1 = FnRestrictedUrl.builder().restrictedUrl("async_test.htm").functionCd(menuHome).build();
+    FnRestrictedUrl url2 = FnRestrictedUrl.builder().restrictedUrl("attachment.htm").functionCd(menuAdmin).build();
+    FnRestrictedUrl url3 = FnRestrictedUrl.builder().restrictedUrl("broadcast.htm").functionCd(menuAdmin).build();
+    FnRestrictedUrl url4 = FnRestrictedUrl.builder().restrictedUrl("chatWindow.htm").functionCd(menuHome).build();
+    FnRestrictedUrl url5 = FnRestrictedUrl.builder().restrictedUrl("contact_list.htm").functionCd(menuHome).build();
+    FnRestrictedUrl url6 = FnRestrictedUrl.builder().restrictedUrl("customer_dynamic_list.htm").functionCd(menuHome).build();
+    FnRestrictedUrl url7 = FnRestrictedUrl.builder().restrictedUrl("event.htm").functionCd(menuHome).build();
+    FnRestrictedUrl url8 = FnRestrictedUrl.builder().restrictedUrl("event_list.htm").functionCd(menuHome).build();
+    FnRestrictedUrl url9 = FnRestrictedUrl.builder().restrictedUrl("file_upload.htm").functionCd(menuAdmin).build();
+    FnRestrictedUrl url10 = FnRestrictedUrl.builder().restrictedUrl("gauge.htm").functionCd(menuTab).build();
+    FnRestrictedUrl url11 = FnRestrictedUrl.builder().restrictedUrl("gmap_controller.htm").functionCd(menuTab).build();
+    FnRestrictedUrl url12 = FnRestrictedUrl.builder().restrictedUrl("gmap_frame.htm").functionCd(menuTab).build();
+    FnRestrictedUrl url13 = FnRestrictedUrl.builder().restrictedUrl("jbpm_designer.htm").functionCd(menuJobCreate).build();
+    FnRestrictedUrl url14 = FnRestrictedUrl.builder().restrictedUrl("jbpm_drools.htm").functionCd(menuJobCreate).build();
+    FnRestrictedUrl url15 = FnRestrictedUrl.builder().restrictedUrl("job.htm").functionCd(menuAdmin).build();
+    FnRestrictedUrl url16 = FnRestrictedUrl.builder().restrictedUrl("map.htm").functionCd(menuTab).build();
+    FnRestrictedUrl url17 = FnRestrictedUrl.builder().restrictedUrl("map_download.htm").functionCd(menuTab).build();
+    FnRestrictedUrl url18 = FnRestrictedUrl.builder().restrictedUrl("map_grid_search.htm").functionCd(menuTab).build();
+    FnRestrictedUrl url19 = FnRestrictedUrl.builder().restrictedUrl("mobile_welcome.htm").functionCd(menuHome).build();
+    FnRestrictedUrl url20 = FnRestrictedUrl.builder().restrictedUrl("process_job.htm").functionCd(menuJobCreate).build();
+    FnRestrictedUrl url21 = FnRestrictedUrl.builder().restrictedUrl("profile.htm").functionCd(menuProfileCreate).build();
+    FnRestrictedUrl url22 = FnRestrictedUrl.builder().restrictedUrl("raptor.htm").functionCd(menuReports).build();
+    FnRestrictedUrl url23 = FnRestrictedUrl.builder().restrictedUrl("raptor.htm").functionCd(viewReports).build();
+    FnRestrictedUrl url24 = FnRestrictedUrl.builder().restrictedUrl("raptor2.htm").functionCd(menuReports).build();
+    FnRestrictedUrl url25 = FnRestrictedUrl.builder().restrictedUrl("raptor_blob_extract.htm").functionCd(menuReports).build();
+    FnRestrictedUrl url26 = FnRestrictedUrl.builder().restrictedUrl("raptor_blob_extract.htm").functionCd(viewReports).build();
+    FnRestrictedUrl url27 = FnRestrictedUrl.builder().restrictedUrl("raptor_email_attachment.htm").functionCd(menuReports).build();
+    FnRestrictedUrl url28 = FnRestrictedUrl.builder().restrictedUrl("raptor_search.htm").functionCd(menuReports).build();
+    FnRestrictedUrl url29 = FnRestrictedUrl.builder().restrictedUrl("report_list.htm").functionCd(menuReports).build();
+    FnRestrictedUrl url30 = FnRestrictedUrl.builder().restrictedUrl("role.htm").functionCd(menuAdmin).build();
+    FnRestrictedUrl url31 = FnRestrictedUrl.builder().restrictedUrl("role_function.htm").functionCd(menuAdmin).build();
+    FnRestrictedUrl url32 = FnRestrictedUrl.builder().restrictedUrl("sample_animated_map.htm").functionCd(menuTab).build();
+    FnRestrictedUrl url33 = FnRestrictedUrl.builder().restrictedUrl("sample_map.htm").functionCd(menuHome).build();
+    FnRestrictedUrl url34 = FnRestrictedUrl.builder().restrictedUrl("sample_map_2.htm").functionCd(menuTab).build();
+    FnRestrictedUrl url35 = FnRestrictedUrl.builder().restrictedUrl("sample_map_3.htm").functionCd(menuTab).build();
+    FnRestrictedUrl url36 = FnRestrictedUrl.builder().restrictedUrl("tab2_sub1.htm").functionCd(menuTab).build();
+    FnRestrictedUrl url37 = FnRestrictedUrl.builder().restrictedUrl("tab2_sub2_link1.htm").functionCd(menuTab).build();
+    FnRestrictedUrl url38 = FnRestrictedUrl.builder().restrictedUrl("tab2_sub2_link2.htm").functionCd(menuTab).build();
+    FnRestrictedUrl url39 = FnRestrictedUrl.builder().restrictedUrl("tab2_sub3.htm").functionCd(menuTab).build();
+    FnRestrictedUrl url40 = FnRestrictedUrl.builder().restrictedUrl("tab3.htm").functionCd(menuTab).build();
+    FnRestrictedUrl url41 = FnRestrictedUrl.builder().restrictedUrl("tab4.htm").functionCd(menuTab).build();
+    FnRestrictedUrl url42 = FnRestrictedUrl.builder().restrictedUrl("template.jsp").functionCd(menuHome).build();
+    FnRestrictedUrl url43 = FnRestrictedUrl.builder().restrictedUrl("test.htm").functionCd(menuAdmin).build();
+
+    List<FnRestrictedUrl> urls = new ArrayList<>(Arrays.asList(url1, url2, url3, url4, url5, url6, url7, url8, url9,
+        url10, url11, url12, url13, url14, url15, url16, url17, url18, url19, url20, url21, url22, url23, url24, url25,
+        url26, url27, url28, url29, url30, url31, url32, url33, url34, url35, url36, url37, url38, url39, url40, url41,
+        url42, url43));
+
+    //fnRestrictedUrlDao.saveAll(urls);
+
+    // fn_role_composite table
+    //TODO
+    FnRoleComposite roleComposite = FnRoleComposite.builder().parentRoles(fnRole1).childRoles(fnRole16).build();
+
+    //fnRoleCompositeDao.save(roleComposite);
+
+    // fn_role_function table
+
+    FnRoleFunction roleFunction1 = FnRoleFunction.builder().role(fnRole1).functionCd(login).build();
+    FnRoleFunction roleFunction2 = FnRoleFunction.builder().role(fnRole1).functionCd(menuAdmin).build();
+    FnRoleFunction roleFunction3 = FnRoleFunction.builder().role(fnRole1).functionCd(menuAjax).build();
+    FnRoleFunction roleFunction4 = FnRoleFunction.builder().role(fnRole1).functionCd(menuCustomer).build();
+    FnRoleFunction roleFunction5 = FnRoleFunction.builder().role(fnRole1).functionCd(menuCustomerCreate).build();
+    FnRoleFunction roleFunction6 = FnRoleFunction.builder().role(fnRole1).functionCd(menuFeedback).build();
+    FnRoleFunction roleFunction7 = FnRoleFunction.builder().role(fnRole1).functionCd(menuHelp).build();
+    FnRoleFunction roleFunction8 = FnRoleFunction.builder().role(fnRole1).functionCd(menuHome).build();
+    FnRoleFunction roleFunction9 = FnRoleFunction.builder().role(fnRole1).functionCd(menuJob).build();
+    FnRoleFunction roleFunction10 = FnRoleFunction.builder().role(fnRole1).functionCd(menuJobCreate).build();
+    FnRoleFunction roleFunction11 = FnRoleFunction.builder().role(fnRole1).functionCd(menuLogout).build();
+    FnRoleFunction roleFunction12 = FnRoleFunction.builder().role(fnRole1).functionCd(menuNotes).build();
+    FnRoleFunction roleFunction13 = FnRoleFunction.builder().role(fnRole1).functionCd(menuProcess).build();
+    FnRoleFunction roleFunction14 = FnRoleFunction.builder().role(fnRole1).functionCd(menuProfile).build();
+    FnRoleFunction roleFunction15 = FnRoleFunction.builder().role(fnRole1).functionCd(menuProfileCreate).build();
+    FnRoleFunction roleFunction16 = FnRoleFunction.builder().role(fnRole1).functionCd(menuProfileImport).build();
+    FnRoleFunction roleFunction17 = FnRoleFunction.builder().role(fnRole1).functionCd(menuReports).build();
+    FnRoleFunction roleFunction18 = FnRoleFunction.builder().role(fnRole1).functionCd(menuSample).build();
+    FnRoleFunction roleFunction19 = FnRoleFunction.builder().role(fnRole1).functionCd(menuTab).build();
+    FnRoleFunction roleFunction20 = FnRoleFunction.builder().role(fnRole16).functionCd(login).build();
+    FnRoleFunction roleFunction21 = FnRoleFunction.builder().role(fnRole16).functionCd(menuAjax).build();
+    FnRoleFunction roleFunction22 = FnRoleFunction.builder().role(fnRole16).functionCd(menuCustomer).build();
+    FnRoleFunction roleFunction23 = FnRoleFunction.builder().role(fnRole16).functionCd(menuCustomerCreate).build();
+    FnRoleFunction roleFunction24 = FnRoleFunction.builder().role(fnRole16).functionCd(menuHome).build();
+    FnRoleFunction roleFunction25 = FnRoleFunction.builder().role(fnRole16).functionCd(menuLogout).build();
+    FnRoleFunction roleFunction26 = FnRoleFunction.builder().role(fnRole16).functionCd(menuMap).build();
+    FnRoleFunction roleFunction27 = FnRoleFunction.builder().role(fnRole16).functionCd(menuProfile).build();
+    FnRoleFunction roleFunction28 = FnRoleFunction.builder().role(fnRole16).functionCd(menuReports).build();
+    FnRoleFunction roleFunction29 = FnRoleFunction.builder().role(fnRole16).functionCd(menuTab).build();
+    FnRoleFunction roleFunction30 = FnRoleFunction.builder().role(fnRole950).functionCd(editNotification).build();
+    FnRoleFunction roleFunction31 = FnRoleFunction.builder().role(fnRole950).functionCd(getAdminNotifications).build();
+    FnRoleFunction roleFunction32 = FnRoleFunction.builder().role(fnRole950).functionCd(saveNotification).build();
+    FnRoleFunction roleFunction33 = FnRoleFunction.builder().role(fnRole1010).functionCd(menuWebAnalytics).build();
+    FnRoleFunction roleFunction34 = FnRoleFunction.builder().role(fnRole2115).functionCd(menuWebAnalytics).build();
+
+    List<FnRoleFunction> roleFunctions = new ArrayList<>(Arrays.asList(roleFunction1,
+        roleFunction2, roleFunction3, roleFunction4, roleFunction5, roleFunction6, roleFunction7, roleFunction8,
+        roleFunction9, roleFunction10, roleFunction11, roleFunction12, roleFunction13, roleFunction14, roleFunction15,
+        roleFunction16, roleFunction17, roleFunction18, roleFunction19, roleFunction20, roleFunction21, roleFunction22,
+        roleFunction23, roleFunction24, roleFunction25, roleFunction26, roleFunction27, roleFunction28, roleFunction29,
+        roleFunction30, roleFunction31, roleFunction32, roleFunction33, roleFunction34));
+
+    fnRoleFunctionDao.saveAll(roleFunctions);
+
+
+    // fn_shared_context table
+
+    FnSharedContext sharedContext1 = FnSharedContext.builder().createTime(LocalDateTime.now()).contextId("b999771d~2d60~4638~a670~d47d17219157").ckey("USER_FIRST_NAME").cvalue("Jimmy").build();
+    FnSharedContext sharedContext2 = FnSharedContext.builder().createTime(LocalDateTime.now()).contextId("b999771d~2d60~4638~a670~d47d17219157").ckey("USER_LAST_NAME").cvalue("Hendrix").build();
+    FnSharedContext sharedContext3 = FnSharedContext.builder().createTime(LocalDateTime.now()).contextId("b999771d~2d60~4638~a670~d47d17219157").ckey("USER_EMAIL").cvalue("admin@onap.org").build();
+    FnSharedContext sharedContext4 = FnSharedContext.builder().createTime(LocalDateTime.now()).contextId("b999771d~2d60~4638~a670~d47d17219157").ckey("USER_ORG_USERID").cvalue("jh0003").build();
+    FnSharedContext sharedContext5 = FnSharedContext.builder().createTime(LocalDateTime.now()).contextId("29cc8f94~5a7d~41f8~b359~432bb903a718").ckey("USER_FIRST_NAME").cvalue("Demo").build();
+    FnSharedContext sharedContext6 = FnSharedContext.builder().createTime(LocalDateTime.now()).contextId("29cc8f94~5a7d~41f8~b359~432bb903a718").ckey("USER_LAST_NAME").cvalue("User").build();
+    FnSharedContext sharedContext7 = FnSharedContext.builder().createTime(LocalDateTime.now()).contextId("29cc8f94~5a7d~41f8~b359~432bb903a718").ckey("USER_EMAIL").cvalue("demo@openecomp.org").build();
+    FnSharedContext sharedContext8 = FnSharedContext.builder().createTime(LocalDateTime.now()).contextId("29cc8f94~5a7d~41f8~b359~432bb903a718").ckey("USER_ORG_USERID").cvalue("demo").build();
+    FnSharedContext sharedContext9 = FnSharedContext.builder().createTime(LocalDateTime.now()).contextId("7e3ced0a~52a3~492a~be53~2885d2df5a43").ckey("USER_FIRST_NAME").cvalue("Demo").build();
+    FnSharedContext sharedContext10 = FnSharedContext.builder().createTime(LocalDateTime.now()).contextId("7e3ced0a~52a3~492a~be53~2885d2df5a43").ckey("USER_LAST_NAME").cvalue("User").build();
+    FnSharedContext sharedContext11 = FnSharedContext.builder().createTime(LocalDateTime.now()).contextId("7e3ced0a~52a3~492a~be53~2885d2df5a43").ckey("USER_EMAIL").cvalue("demo@openecomp.org").build();
+    FnSharedContext sharedContext12 = FnSharedContext.builder().createTime(LocalDateTime.now()).contextId("7e3ced0a~52a3~492a~be53~2885d2df5a43").ckey("USER_ORG_USERID").cvalue("demo").build();
+
+    List<FnSharedContext> sharedContexts = new ArrayList<>(Arrays.asList(sharedContext1, sharedContext2, sharedContext3,
+        sharedContext4, sharedContext5, sharedContext6, sharedContext7, sharedContext8, sharedContext9, sharedContext10, sharedContext11, sharedContext12));
+
+    fnSharedContextDao.saveAll(sharedContexts);
+
+    // fn_tab table
+
+    FnTab TAB1 = FnTab.builder().tabCd("TAB1").tabName("Tab 1").tabDescr("Tab 1 Information").action("tab1.htm").functionCd(menuTab).activeYn(true).sortDrder(10L).parentTabCd(null).tabSetCd(fnLuTabSet).build();
+    FnTab TAB2 = FnTab.builder().tabCd("TAB2").tabName("Tab 2").tabDescr("Tab 2 Information").action("tab2_sub1.htm").functionCd(menuTab).activeYn(true).sortDrder(20L).parentTabCd(null).tabSetCd(fnLuTabSet).build();
+    FnTab TAB2_SUB1 = FnTab.builder().tabCd("TAB2_SUB1").tabName("Sub Tab 1").tabDescr("Sub Tab 1 Information").action("tab2_sub1.htm").functionCd(menuTab).activeYn(true).sortDrder(10L).parentTabCd("TAB2").tabSetCd(fnLuTabSet).build();
+    FnTab TAB2_SUB1_S1 = FnTab.builder().tabCd("TAB2_SUB1_S1").tabName("Left Tab 1").tabDescr("Sub - Sub Tab 1 Information").action("tab2_sub1.htm").functionCd(menuTab).activeYn(true).sortDrder(10L).parentTabCd("TAB2_SUB1").tabSetCd(fnLuTabSet).build();
+    FnTab TAB2_SUB2 = FnTab.builder().tabCd("TAB2_SUB2").tabName("Sub Tab 2").tabDescr("Sub Tab 2 Information").action("tab2_sub2.htm").functionCd(menuTab).activeYn(true).sortDrder(20L).parentTabCd("TAB2").tabSetCd(fnLuTabSet).build();
+    FnTab TAB2_SUB3 = FnTab.builder().tabCd("TAB2_SUB3").tabName("Sub Tab 3").tabDescr("Sub Tab 3 Information").action("tab2_sub3.htm").functionCd(menuTab).activeYn(true).sortDrder(30L).parentTabCd("TAB2").tabSetCd(fnLuTabSet).build();
+    FnTab TAB3 = FnTab.builder().tabCd("TAB3").tabName("Tab 3").tabDescr("Tab 3 Information").action("tab3.htm").functionCd(menuTab).activeYn(true).sortDrder(30L).parentTabCd(null).tabSetCd(fnLuTabSet).build();
+    FnTab TAB4 = FnTab.builder().tabCd("TAB4").tabName("Tab 4").tabDescr("Tab 4 Information").action("tab4.htm").functionCd(menuTab).activeYn(true).sortDrder(40L).parentTabCd(null).tabSetCd(fnLuTabSet).build();
+
+    List<FnTab> fnTabs = new ArrayList<>(Arrays.asList(TAB1, TAB2, TAB2_SUB1, TAB2_SUB1_S1, TAB2_SUB2, TAB2_SUB3, TAB3, TAB4));
+
+    fnTabDao.saveAll(fnTabs);
+
+    // fn_tab_selected table
+
+    FnTabSelected tabSelected1 = FnTabSelected.builder().selectedTabCd(TAB1).tab_uri("tab1").build();
+    FnTabSelected tabSelected2 = FnTabSelected.builder().selectedTabCd(TAB2).tab_uri("tab2_sub1").build();
+    FnTabSelected tabSelected3 = FnTabSelected.builder().selectedTabCd(TAB2).tab_uri("tab2_sub2").build();
+    FnTabSelected tabSelected4 = FnTabSelected.builder().selectedTabCd(TAB2).tab_uri("tab2_sub3").build();
+    FnTabSelected tabSelected5 = FnTabSelected.builder().selectedTabCd(TAB2_SUB1).tab_uri("tab2_sub1").build();
+    FnTabSelected tabSelected6 = FnTabSelected.builder().selectedTabCd(TAB2_SUB1_S1).tab_uri("tab2_sub1").build();
+    FnTabSelected tabSelected7 = FnTabSelected.builder().selectedTabCd(TAB2_SUB2).tab_uri("tab2_sub2").build();
+    FnTabSelected tabSelected8 = FnTabSelected.builder().selectedTabCd(TAB2_SUB3).tab_uri("tab2_sub3").build();
+    FnTabSelected tabSelected9 = FnTabSelected.builder().selectedTabCd(TAB3).tab_uri("tab3").build();
+    FnTabSelected tabSelected10 = FnTabSelected.builder().selectedTabCd(TAB4).tab_uri("tab4").build();
+
+    List<FnTabSelected> tabSelecteds = new ArrayList<>(Arrays.asList(tabSelected1, tabSelected2, tabSelected3, tabSelected4,
+        tabSelected5, tabSelected6, tabSelected7, tabSelected8, tabSelected9, tabSelected10));
+
+//    fnTabSelectedDao.saveAll(tabSelecteds);
+
+    // fn_user table
+
+    FnUser fnUser1 = FnUser.builder().firstName("Demo").lastName("User").email("demo@openecomp.org").orgUserId("demo").loginId("demo").loginPwd("demo123").lastLoginDate(LocalDateTime.now()).activeYn(true).createdDate(LocalDateTime.now()).modifiedDate(LocalDateTime.now()).isSystemUser(false).isInternalYn(false).guest(false).stateCd("NJ").countryCd("US").timezone(USEastern).languageId(language1).build();
+    FnUser fnUser2 = FnUser.builder().firstName("Jimmy").lastName("Hendrix").email("admin@onap.org").orgUserId("jh0003").loginId("jh0003").loginPwd("demo123").lastLoginDate(LocalDateTime.now()).activeYn(true).createdDate(LocalDateTime.now()).modifiedDate(LocalDateTime.now()).isSystemUser(false).isInternalYn(false).guest(false).stateCd("NJ").countryCd("US").timezone(USEastern).languageId(language1).build();
+    FnUser fnUser3 = FnUser.builder().firstName("Carlos").lastName("Santana").email("designer@onap.org").orgUserId("cs0008").loginId("cs0008").loginPwd("demo123").lastLoginDate(LocalDateTime.now()).activeYn(true).createdDate(LocalDateTime.now()).modifiedDate(LocalDateTime.now()).isSystemUser(false).isInternalYn(false).guest(false).stateCd("NJ").countryCd("US").timezone(USEastern).languageId(language1).build();
+    FnUser fnUser4 = FnUser.builder().firstName("Joni").lastName("Mitchell").email("tester@onap.org").orgUserId("jm0007").loginId("jm0007").loginPwd("demo123").lastLoginDate(LocalDateTime.now()).activeYn(true).createdDate(LocalDateTime.now()).modifiedDate(LocalDateTime.now()).isSystemUser(false).isInternalYn(false).guest(false).stateCd("NJ").countryCd("US").timezone(USEastern).languageId(language1).build();
+    FnUser fnUser5 = FnUser.builder().firstName("Steve").lastName("Regev").email("ops@onap.org").orgUserId("op0001").loginId("op0001").loginPwd("demo123").lastLoginDate(LocalDateTime.now()).activeYn(true).createdDate(LocalDateTime.now()).modifiedDate(LocalDateTime.now()).isSystemUser(false).isInternalYn(false).guest(false).stateCd("NJ").countryCd("US").timezone(USEastern).languageId(language1).build();
+    FnUser fnUser6 = FnUser.builder().firstName("David").lastName("Shadmi").email("governor@onap.org").orgUserId("gv0001").loginId("gv0001").loginPwd("demo123").lastLoginDate(LocalDateTime.now()).activeYn(true).createdDate(LocalDateTime.now()).modifiedDate(LocalDateTime.now()).isSystemUser(false).isInternalYn(false).guest(false).stateCd("NJ").countryCd("US").timezone(USEastern).languageId(language1).build();
+    FnUser fnUser7 = FnUser.builder().firstName("Teddy").lastName("Isashar").email("pm1@onap.org").orgUserId("pm0001").loginId("pm0001").loginPwd("demo123").lastLoginDate(LocalDateTime.now()).activeYn(true).createdDate(LocalDateTime.now()).modifiedDate(LocalDateTime.now()).isSystemUser(false).isInternalYn(false).guest(false).stateCd("NJ").countryCd("US").timezone(USEastern).languageId(language1).build();
+    FnUser fnUser8 = FnUser.builder().firstName("Eden").lastName("Rozin").email("ps1@onap.org").orgUserId("ps0001").loginId("ps0001").loginPwd("demo123").lastLoginDate(LocalDateTime.now()).activeYn(true).createdDate(LocalDateTime.now()).modifiedDate(LocalDateTime.now()).isSystemUser(false).isInternalYn(false).guest(false).stateCd("NJ").countryCd("US").timezone(USEastern).languageId(language1).build();
+    FnUser fnUser9 = FnUser.builder().firstName("vid1").lastName("user").email("vid1@onap.org").orgUserId("vid1").loginId("vid1").loginPwd("demo123").lastLoginDate(LocalDateTime.now()).activeYn(true).createdDate(LocalDateTime.now()).modifiedDate(LocalDateTime.now()).isSystemUser(false).isInternalYn(false).guest(false).stateCd("NJ").countryCd("US").timezone(USEastern).languageId(language1).build();
+    FnUser fnUser10 = FnUser.builder().firstName("vid2").lastName("user").email("vid2@onap.org").orgUserId("vid2").loginId("vid2").loginPwd("demo123").lastLoginDate(LocalDateTime.now()).activeYn(true).createdDate(LocalDateTime.now()).modifiedDate(LocalDateTime.now()).isSystemUser(false).isInternalYn(false).guest(false).stateCd("NJ").countryCd("US").timezone(USEastern).languageId(language1).build();
+    FnUser fnUser11 = FnUser.builder().firstName("vid3").lastName("user").email("vid3@onap.org").orgUserId("vid3").loginId("vid3").loginPwd("demo123").lastLoginDate(LocalDateTime.now()).activeYn(true).createdDate(LocalDateTime.now()).modifiedDate(LocalDateTime.now()).isSystemUser(false).isInternalYn(false).guest(false).stateCd("NJ").countryCd("US").timezone(USEastern).languageId(language1).build();
+    FnUser fnUser12 = FnUser.builder().firstName("steve").lastName("user").email("steve@onap.org").orgUserId("steve").loginId("steve").loginPwd("demo123").lastLoginDate(LocalDateTime.now()).activeYn(true).createdDate(LocalDateTime.now()).modifiedDate(LocalDateTime.now()).isSystemUser(false).isInternalYn(false).guest(false).stateCd("NJ").countryCd("US").timezone(USEastern).languageId(language1).build();
+
+    List<FnUser> fnUsers = new ArrayList<>(Arrays.asList(fnUser1, fnUser2, fnUser3, fnUser4, fnUser5, fnUser6, fnUser7, fnUser8, fnUser9, fnUser10, fnUser11, fnUser12));
+
+    fnUserDao.saveAll(fnUsers);
+
+    // ep_pers_user_app_sort table
+
+    EpPersUserAppSort appSort = EpPersUserAppSort.builder().userID(fnUser1).sortPref(0).build();
+
+    epPersUserAppSortDao.save(appSort);
+
+    // fn_pers_user_app_sel table
+
+    FnPersUserAppSel appSel1 = FnPersUserAppSel.builder().userId(fnUser1).appId(app7).statusCd("S").build();
+    FnPersUserAppSel appSel2 = FnPersUserAppSel.builder().userId(fnUser1).appId(app8).statusCd("S").build();
+    FnPersUserAppSel appSel3 = FnPersUserAppSel.builder().userId(fnUser1).appId(app10).statusCd("S").build();
+    FnPersUserAppSel appSel4 = FnPersUserAppSel.builder().userId(fnUser1).appId(app5).statusCd("S").build();
+
+    List<FnPersUserAppSel> appSels = new ArrayList<>(Arrays.asList(appSel1, appSel2, appSel3, appSel4));
+
+    fnPersUserAppSelDao.saveAll(appSels);
+
+    // fn_audit_log table
+
+    FnAuditLog fnAuditLog1 = FnAuditLog.builder().userId(fnUser1).activityCd(appAccess).auditDate(LocalDateTime.now()).comments("https://aai.ui.simpledemo.onap.org:30220/services/aai/webapp/index.html").affectedRecordIdBk(null).affectedRecordId("7").build();
+    FnAuditLog fnAuditLog2 = FnAuditLog.builder().userId(fnUser1).activityCd(tabAccess).auditDate(LocalDateTime.now()).comments("https://aai.ui.simpledemo.onap.org:30220/services/aai/webapp/index.html?cc=1565259532115").affectedRecordIdBk(null).affectedRecordId("7").build();
+    FnAuditLog fnAuditLog3 = FnAuditLog.builder().userId(fnUser1).activityCd(tabAccess).auditDate(LocalDateTime.now()).comments("Home").affectedRecordIdBk(null).affectedRecordId("1").build();
+    FnAuditLog fnAuditLog4 = FnAuditLog.builder().userId(fnUser1).activityCd(tabAccess).auditDate(LocalDateTime.now()).comments("https://aai.ui.simpledemo.onap.org:30220/services/aai/webapp/index.html?cc=1565259538769").affectedRecordIdBk(null).affectedRecordId("7").build();
+    FnAuditLog fnAuditLog5 = FnAuditLog.builder().userId(fnUser1).activityCd(appAccess).auditDate(LocalDateTime.now()).comments("https://aai.ui.simpledemo.onap.org:30220/services/aai/webapp/index.html").affectedRecordIdBk(null).affectedRecordId("7").build();
+    FnAuditLog fnAuditLog6 = FnAuditLog.builder().userId(fnUser1).activityCd(tabAccess).auditDate(LocalDateTime.now()).comments("https://aai.ui.simpledemo.onap.org:30220/services/aai/webapp/index.html?cc=1565259538769").affectedRecordIdBk(null).affectedRecordId("7").build();
+    FnAuditLog fnAuditLog7 = FnAuditLog.builder().userId(fnUser1).activityCd(tabAccess).auditDate(LocalDateTime.now()).comments("Home").affectedRecordIdBk(null).affectedRecordId("1").build();
+
+    List<FnAuditLog> auditLogs = new ArrayList<>(Arrays.asList(fnAuditLog1, fnAuditLog2, fnAuditLog3, fnAuditLog4, fnAuditLog5, fnAuditLog6, fnAuditLog7));
+
+    fnAuditLogDao.saveAll(auditLogs);
+
+    // fn_user_role table
+
+    FnUserRole userRole1 = FnUserRole.builder().userId(fnUser1).roleId(fnRole1).priority(1L).fnAppId(app).build();
+    FnUserRole userRole2 = FnUserRole.builder().userId(fnUser1).roleId(fnRole950).priority(1L).fnAppId(app).build();
+    FnUserRole userRole3 = FnUserRole.builder().userId(fnUser1).roleId(fnRole999).priority(1L).fnAppId(app).build();
+    FnUserRole userRole4 = FnUserRole.builder().userId(fnUser1).roleId(fnRole999).priority(1L).fnAppId(app2).build();
+    FnUserRole userRole5 = FnUserRole.builder().userId(fnUser1).roleId(fnRole999).priority(1L).fnAppId(app3).build();
+    FnUserRole userRole6 = FnUserRole.builder().userId(fnUser1).roleId(fnRole999).priority(1L).fnAppId(app4).build();
+    FnUserRole userRole7 = FnUserRole.builder().userId(fnUser1).roleId(fnRole999).priority(1L).fnAppId(app5).build();
+    FnUserRole userRole8 = FnUserRole.builder().userId(fnUser1).roleId(fnRole999).priority(1L).fnAppId(app6).build();
+    FnUserRole userRole9 = FnUserRole.builder().userId(fnUser1).roleId(fnRole999).priority(1L).fnAppId(app7).build();
+    FnUserRole userRole10 = FnUserRole.builder().userId(fnUser1).roleId(fnRole1000).priority(1L).fnAppId(app2).build();
+    FnUserRole userRole11 = FnUserRole.builder().userId(fnUser1).roleId(fnRole1001).priority(1L).fnAppId(app2).build();
+    FnUserRole userRole12 = FnUserRole.builder().userId(fnUser1).roleId(fnRole1002).priority(1L).fnAppId(app3).build();
+    FnUserRole userRole13 = FnUserRole.builder().userId(fnUser1).roleId(fnRole1004).priority(1L).fnAppId(app4).build();
+    FnUserRole userRole14 = FnUserRole.builder().userId(fnUser1).roleId(fnRole1006).priority(1L).fnAppId(app5).build();
+    FnUserRole userRole15 = FnUserRole.builder().userId(fnUser1).roleId(fnRole1008).priority(1L).fnAppId(app6).build();
+    FnUserRole userRole16 = FnUserRole.builder().userId(fnUser2).roleId(fnRole999).priority(1L).fnAppId(app4).build();
+    FnUserRole userRole17 = FnUserRole.builder().userId(fnUser2).roleId(fnRole1004).priority(1L).fnAppId(app4).build();
+    FnUserRole userRole18 = FnUserRole.builder().userId(fnUser3).roleId(fnRole16).priority(null).fnAppId(app4).build();
+    FnUserRole userRole19 = FnUserRole.builder().userId(fnUser3).roleId(fnRole1005).priority(null).fnAppId(app4).build();
+    FnUserRole userRole20 = FnUserRole.builder().userId(fnUser4).roleId(fnRole16).priority(null).fnAppId(app4).build();
+    FnUserRole userRole21 = FnUserRole.builder().userId(fnUser4).roleId(fnRole1005).priority(null).fnAppId(app4).build();
+    FnUserRole userRole22 = FnUserRole.builder().userId(fnUser5).roleId(fnRole16).priority(null).fnAppId(app4).build();
+    FnUserRole userRole23 = FnUserRole.builder().userId(fnUser5).roleId(fnRole1005).priority(null).fnAppId(app4).build();
+    FnUserRole userRole24 = FnUserRole.builder().userId(fnUser6).roleId(fnRole16).priority(null).fnAppId(app4).build();
+    FnUserRole userRole25 = FnUserRole.builder().userId(fnUser6).roleId(fnRole1005).priority(null).fnAppId(app4).build();
+    FnUserRole userRole26 = FnUserRole.builder().userId(fnUser7).roleId(fnRole16).priority(null).fnAppId(app4).build();
+    FnUserRole userRole27 = FnUserRole.builder().userId(fnUser7).roleId(fnRole1005).priority(null).fnAppId(app4).build();
+    FnUserRole userRole28 = FnUserRole.builder().userId(fnUser8).roleId(fnRole16).priority(null).fnAppId(app4).build();
+    FnUserRole userRole29 = FnUserRole.builder().userId(fnUser8).roleId(fnRole1005).priority(null).fnAppId(app4).build();
+    FnUserRole userRole30 = FnUserRole.builder().userId(fnUser9).roleId(fnRole16).priority(null).fnAppId(app6).build();
+    FnUserRole userRole31 = FnUserRole.builder().userId(fnUser9).roleId(fnRole999).priority(null).fnAppId(app).build();
+    FnUserRole userRole32 = FnUserRole.builder().userId(fnUser9).roleId(fnRole1008).priority(null).fnAppId(app6).build();
+    FnUserRole userRole33 = FnUserRole.builder().userId(fnUser10).roleId(fnRole16).priority(null).fnAppId(app6).build();
+    FnUserRole userRole34 = FnUserRole.builder().userId(fnUser10).roleId(fnRole1008).priority(null).fnAppId(app6).build();
+    FnUserRole userRole35 = FnUserRole.builder().userId(fnUser10).roleId(fnRole1009).priority(null).fnAppId(app6).build();
+    FnUserRole userRole36 = FnUserRole.builder().userId(fnUser11).roleId(fnRole16).priority(null).fnAppId(app6).build();
+    FnUserRole userRole37 = FnUserRole.builder().userId(fnUser12).roleId(fnRole16).priority(null).fnAppId(app7).build();
+    FnUserRole userRole38 = FnUserRole.builder().userId(fnUser12).roleId(fnRole1011).priority(null).fnAppId(app7).build();
+    FnUserRole userRole39 = FnUserRole.builder().userId(fnUser12).roleId(fnRole1012).priority(null).fnAppId(app7).build();
+
+    List<FnUserRole> userRoles = new ArrayList<>(Arrays.asList(userRole1, userRole2, userRole2, userRole3, userRole4,
+        userRole5, userRole6, userRole7, userRole8, userRole9, userRole10, userRole11, userRole12, userRole13, userRole14,
+        userRole15, userRole16, userRole17, userRole18, userRole19, userRole20, userRole21, userRole22, userRole23, userRole24,
+        userRole25, userRole26, userRole27, userRole28, userRole29, userRole30, userRole31, userRole32, userRole33, userRole34,
+        userRole35, userRole36, userRole37, userRole38, userRole39));
+
+    fnUserRoleDao.saveAll(userRoles);
+
+
+  }
+}
index 3fae09c..a0542ec 100644 (file)
@@ -52,45 +52,47 @@ import org.springframework.security.crypto.password.PasswordEncoder;
 @Configuration
 @EnableWebSecurity
 public class SecurityConfig extends WebSecurityConfigurerAdapter {
-       @Autowired
-       private FnUserService fnUserService;
 
-       @Override
-       protected void configure(AuthenticationManagerBuilder auth) throws Exception {
-              auth.userDetailsService(fnUserService)
-                      .passwordEncoder(new PasswordEncoder() {
-                             @Override
-                             public String encode(CharSequence rawPassword) {
-                                    return rawPassword.toString();
-                             }
+  @Autowired
+  private FnUserService fnUserService;
 
-                             @Override
-                             public boolean matches(CharSequence rawPassword, String encodedPassword) {
-                                    return true;
-                             }
-                      });
-       }
+  @Override
+  protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+    auth.userDetailsService(fnUserService)
+        .passwordEncoder(new PasswordEncoder() {
+          @Override
+          public String encode(CharSequence rawPassword) {
+            return rawPassword.toString();
+          }
 
-       @Override
-       protected void configure(HttpSecurity http) throws Exception {
-              http
-                      .authorizeRequests()
-                      .antMatchers("/img/**").permitAll()
-                      .anyRequest().authenticated()
-                      .and()
-                      .formLogin()
-                      .loginPage("/login")
-                      .permitAll()
-                      .and()
-                      .logout()
-                      .permitAll()
-                      .and()
-                      .httpBasic();
+          @Override
+          public boolean matches(CharSequence rawPassword, String encodedPassword) {
+            return true;
+          }
+        });
+  }
 
-              http.csrf().disable();
-              http.headers().frameOptions().disable();
+  @Override
+  protected void configure(HttpSecurity http) throws Exception {
+    http
+        .authorizeRequests()
+        .antMatchers("/img/**").permitAll()
+        .antMatchers("/h2-console/**").permitAll()
+        .anyRequest().authenticated()
+        .and()
+        .formLogin()
+        .loginPage("/login")
+        .permitAll()
+        .and()
+        .logout()
+        .permitAll()
+        .and()
+        .httpBasic();
 
-       }
+    http.csrf().disable();
+    http.headers().frameOptions().disable();
+
+  }
 
 
 }
index 90b0256..f3b3818 100644 (file)
@@ -40,6 +40,8 @@
 
 package org.onap.portal.configuration;
 
+import org.onap.portal.dao.fn.FnFunctionDao;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.core.Ordered;
 import org.springframework.web.servlet.config.annotation.EnableWebMvc;
@@ -50,9 +52,17 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 @ComponentScan("org.springframework.security.samples.mvc")
 public class WebMvcConfiguration implements WebMvcConfigurer {
 
+       private final FnFunctionDao fnFunctionDao;
+
+       @Autowired
+       public WebMvcConfiguration(FnFunctionDao fnFunctionDao) {
+              this.fnFunctionDao = fnFunctionDao;
+       }
+
        @Override
        public void addViewControllers(ViewControllerRegistry registry) {
               registry.addViewController("login.html").setViewName("login.html");
               registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
        }
+
 }
index c545d7f..4a25e61 100644 (file)
@@ -101,7 +101,7 @@ public class LanguageController {
                             @SuppressWarnings("OptionalGetWithoutIsPresent")
                             FnUser user = fnUserService.getUser(userId).get();
                             user.setLanguageId(fnLanguage);
-                            fnUserService.saveFnUser(principal, user);
+                            fnUserService.saveFnUser(user);
                             //response.setResponse(fnUserMapper.fnUserToFnUserDto(user).toString());
                             response.setMessage("SUCCESS");
                             response.setStatus(PortalRestStatusEnum.OK);
@@ -134,7 +134,7 @@ public class LanguageController {
               PortalRestResponse<String> response = new PortalRestResponse<>();
               try {
                      response.setMessage("SUCCESS");
-                     response.setResponse(languageService.save(principal, fnLanguage).toString());
+                     response.setResponse(languageService.save(fnLanguage).toString());
                      response.setStatus(PortalRestStatusEnum.OK);
               } catch (Exception e) {
                      LOGGER.error("Exception in saveLanguage", e);
index c2dcccd..571ab20 100644 (file)
@@ -62,7 +62,7 @@ import org.springframework.web.bind.annotation.RestController;
 public class UserController {
 
        private static final String HIDDEN_DEFAULT_PASSWORD = "*****";
-       private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UserController.class);
+       private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UserController.class);
 
        private final FnUserService userService;
        private final DataValidator dataValidator;
@@ -113,7 +113,7 @@ public class UserController {
                                    user.setLoginPwd(CipherUtil
                                            .encryptPKC(profileDetail.getLoginPassword(), "AGLDdG4D04BKm2IxIWEr8o==!"));
                             }
-                            userService.saveFnUser(principal, user);
+                            userService.saveFnUser(user);
                             // Update user info in the session
                             portalRestResponse = new PortalRestResponse<>(PortalRestStatusEnum.OK, "success", null);
                      }
index fdd1de2..dbba777 100644 (file)
 package org.onap.portal.controller;
 
 import java.security.Principal;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.cxf.transport.http.HTTPException;
+import org.onap.portal.domain.db.fn.FnRole;
 import org.onap.portal.domain.db.fn.FnUser;
+import org.onap.portal.domain.dto.ecomp.EPUserAppCatalogRoles;
+import org.onap.portal.domain.dto.ecomp.EcompAuditLog;
+import org.onap.portal.domain.dto.ecomp.ExternalSystemAccess;
+import org.onap.portal.domain.dto.ecomp.PortalRestResponse;
+import org.onap.portal.domain.dto.ecomp.PortalRestStatusEnum;
+import org.onap.portal.domain.dto.transport.AppNameIdIsAdmin;
+import org.onap.portal.domain.dto.transport.AppWithRolesForUser;
+import org.onap.portal.domain.dto.transport.AppsListWithAdminRole;
+import org.onap.portal.domain.dto.transport.ExternalRequestFieldsValidator;
+import org.onap.portal.domain.dto.transport.FieldsValidator;
+import org.onap.portal.domain.dto.transport.RoleInAppForUser;
+import org.onap.portal.domain.dto.transport.UserApplicationRoles;
+import org.onap.portal.logging.aop.EPEELFLoggerAdvice;
+import org.onap.portal.logging.logic.EPLogUtil;
 import org.onap.portal.service.AdminRolesService;
+import org.onap.portal.service.ApplicationsRestClientService;
+import org.onap.portal.service.fn.FnUserRoleService;
 import org.onap.portal.service.fn.FnUserService;
+import org.onap.portal.utils.EPCommonSystemProperties;
+import org.onap.portal.utils.EcompPortalUtils;
+import org.onap.portal.utils.PortalConstants;
+import org.onap.portalsdk.core.domain.AuditLog;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.portalsdk.core.restful.domain.EcompRole;
+import org.onap.portalsdk.core.service.AuditServiceImpl;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.slf4j.MDC;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
+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.RestController;
 
 @RestController
 @Configuration
 public class UserRolesController {
 
-       private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UserRolesController.class);
-
-       private final FnUserService fnUserService;
-       private final AdminRolesService adminRolesService;
-
-
-/*
-       private final UserRolesService userRolesService;
-       private final ApplicationsRestClientService applicationsRestClientService;
-       private final SearchService searchService;*/
-
-
-       private static final String FAILURE = "failure";
-
-       @Autowired
-       public UserRolesController(final FnUserService fnUserService,
-               final AdminRolesService adminRolesService) {
-              this.fnUserService = fnUserService;
-              this.adminRolesService = adminRolesService;
-       }
-
-/*
-
-       @RequestMapping(value = {"/portalApi/queryUsers"}, method = RequestMethod.GET, produces = "application/json")
-       @PreAuthorize("hasRole('System_Administrator') and hasRole('Account_Administrator')")
-       public String getPhoneBookSearchResult(Principal principal, @RequestParam("search") String searchString,
-               HttpServletResponse response) {
-              FnUser user = fnUserService.loadUserByUsername(principal.getName());
-
-              String searchResult = null;
-              if (!adminRolesService.isSuperAdmin(user) && !adminRolesService.isAccountAdmin(user)
-                      && !adminRolesService.isRoleAdmin(user)) {
-                     EcompPortalUtils.setBadPermissions(user, response, "getPhoneBookSearchResult");
-              } else {
-                     searchString = searchString.trim();
-                     if (searchString.length() > 2) {
-                            searchResult = searchService.searchUsersInPhoneBook(searchString);
-                     } else {
-                            logger.info(EELFLoggerDelegate.errorLogger,
-                                    "getPhoneBookSearchResult - too short search string: " + searchString);
-                     }
-              }
-              EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/queryUsers", "result =", searchResult);
-
-              return searchResult;
-       }
-
-       @RequestMapping(value = {"/portalApi/adminAppsRoles"}, method = {
-               RequestMethod.GET}, produces = "application/json")
-       public AppsListWithAdminRole getAppsWithAdminRoleStateForUser(Principal principal,
-               @RequestParam("user") String orgUserId, HttpServletResponse response) {
-
-              FnUser user = fnUserService.loadUserByUsername(principal.getName());
-
-              AppsListWithAdminRole result = null;
-              if (!adminRolesService.isSuperAdmin(user)) {
-                     EcompPortalUtils.setBadPermissions(user, response, "getAppsWithAdminRoleStateForUser");
-              } else {
-                     if (EcompPortalUtils.legitimateUserId(orgUserId)) {
-                            result = adminRolesService.getAppsWithAdminRoleStateForUser(orgUserId);
-                     } else {
-                            logger.info(EELFLoggerDelegate.errorLogger,
-                                    "getAppsWithAdminRoleStateForUser - parms error, no Organization User ID");
-                            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
-                     }
-              }
-
-              StringBuilder adminAppRoles = new StringBuilder();
-              if (result != null) {
-                     if (!result.appsRoles.isEmpty()) {
-                            adminAppRoles.append("User '" + result.orgUserId + "' has admin role to the apps = {");
-                            for (AppNameIdIsAdmin adminAppRole : result.appsRoles) {
-                                   if (adminAppRole.isAdmin) {
-                                          adminAppRoles.append(adminAppRole.appName + ", ");
-                                   }
-                            }
-                            adminAppRoles.append("}.");
-                     } else {
-                            adminAppRoles.append("User '" + result.orgUserId + "' has no Apps with Admin Role.");
-                     }
-              } else {
-                     logger.error(EELFLoggerDelegate.errorLogger,
-                             "putAppWithUserRoleStateForUser: getAppsWithAdminRoleStateForUser result is null");
-              }
-
-              logger.info(EELFLoggerDelegate.errorLogger, adminAppRoles.toString());
-
-              EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/adminAppsRoles", "get result =", result);
-
-              return result;
-       }
-
-       @RequestMapping(value = {"/portalApi/adminAppsRoles"}, method = {
-               RequestMethod.PUT}, produces = "application/json")
-       public FieldsValidator putAppsWithAdminRoleStateForUser(Principal principal,
-               @RequestBody AppsListWithAdminRole newAppsListWithAdminRoles, HttpServletResponse response) {
-
-              // newAppsListWithAdminRoles.appsRoles
-              FieldsValidator fieldsValidator = new FieldsValidator();
-              StringBuilder newAppRoles = new StringBuilder();
-              if (newAppsListWithAdminRoles != null) {
-                     if (!newAppsListWithAdminRoles.appsRoles.isEmpty()) {
-                            newAppRoles
-                                    .append("User '" + newAppsListWithAdminRoles.orgUserId
-                                            + "' has admin role to the apps = { ");
-                            for (AppNameIdIsAdmin adminAppRole : newAppsListWithAdminRoles.appsRoles) {
-                                   if (adminAppRole.isAdmin) {
-                                          newAppRoles.append(adminAppRole.appName + " ,");
-                                   }
-                            }
-                            newAppRoles.deleteCharAt(newAppRoles.length() - 1);
-                            newAppRoles.append("}.");
-                     } else {
-                            newAppRoles.append("User '" + newAppsListWithAdminRoles.orgUserId
-                                    + "' has no Apps with Admin Role.");
-                     }
-              } else {
-                     logger.error(EELFLoggerDelegate.errorLogger,
-                             "putAppWithUserRoleStateForUser: putAppsWithAdminRoleStateForUser result is null");
-                     fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-              }
-
-              logger.info(EELFLoggerDelegate.errorLogger, newAppRoles.toString());
-
-              FnUser user = fnUserService.loadUserByUsername(principal.getName());
-
-              boolean changesApplied = false;
-
-              if (!adminRolesService.isSuperAdmin(user)) {
-                     EcompPortalUtils.setBadPermissions(user, response, "putAppsWithAdminRoleStateForUser");
-              } else {
-                     changesApplied = adminRolesService.setAppsWithAdminRoleStateForUser(newAppsListWithAdminRoles);
-                     AuditLog auditLog = new AuditLog();
-                     auditLog.setUserId(user.getId());
-                     auditLog.setActivityCode(EcompAuditLog.CD_ACTIVITY_UPDATE_ACCOUNT_ADMIN);
-                     if (newAppsListWithAdminRoles != null) {
-                            auditLog.setAffectedRecordId(newAppsListWithAdminRoles.orgUserId);
-                     }
-                     auditLog.setComments(
-                             EcompPortalUtils
-                                     .truncateString(newAppRoles.toString(), 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));
-                     if (newAppsListWithAdminRoles != null) {
-                            logger.info(EELFLoggerDelegate.auditLogger,
-                                    EPLogUtil.formatAuditLogMessage(
-                                            "UserRolesController.putAppsWithAdminRoleStateForUser",
-                                            EcompAuditLog.CD_ACTIVITY_UPDATE_ACCOUNT_ADMIN, user.getOrgUserId(),
-                                            newAppsListWithAdminRoles.orgUserId, newAppRoles.toString()));
-                     }
-                     MDC.remove(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP);
-                     MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP);
-                     MDC.remove(SystemProperties.MDC_TIMER);
-              }
-              EcompPortalUtils
-                      .logAndSerializeObject(logger, "/portalApi/adminAppsRoles", "put result =", changesApplied);
-
-              return fieldsValidator;
-       }
-
-
-       @RequestMapping(value = {"/portalApi/userAppRoles"}, method = {
-               RequestMethod.GET}, produces = "application/json")
-       public List<RoleInAppForUser> getAppRolesForUser(Principal principal,
-               @RequestParam("user") String orgUserId,
-               @RequestParam("app") Long appid, @RequestParam("externalRequest") Boolean extRequestValue,
-               @RequestParam("isSystemUser") Boolean isSystemUser,
-               HttpServletResponse response) {
-              FnUser user = fnUserService.loadUserByUsername(principal.getName());
-              List<RoleInAppForUser> result = null;
-              String feErrorString = "";
-              if (!adminRolesService.isAccountAdmin(user) && !adminRolesService.isRoleAdmin(user)) {
-                     logger.debug(EELFLoggerDelegate.debugLogger,
-                             "getAppRolesForUser: Accountadminpermissioncheck {}, RoleAdmincheck {}",
-                             adminRolesService.isAccountAdmin(user), adminRolesService.isRoleAdmin(user));
-                     EcompPortalUtils.setBadPermissions(user, response, "getAppRolesForUser");
-                     feErrorString = EcompPortalUtils.getFEErrorString(true, response.getStatus());
-              } else {
-                     if ((!isSystemUser && EcompPortalUtils.legitimateUserId(orgUserId)) || isSystemUser) {
-                            result = userRolesService.getAppRolesForUser(appid, orgUserId, extRequestValue, user);
-                            logger.debug(EELFLoggerDelegate.debugLogger, "getAppRolesForUser: result {}, appId {}",
-                                    result, appid);
-                            int responseCode = EcompPortalUtils.getExternalAppResponseCode();
-                            if (responseCode != 0 && responseCode != 200) {
-                                   // external error
-                                   response.setStatus(responseCode);
-                                   feErrorString = EcompPortalUtils.getFEErrorString(false, responseCode);
-                            } else if (result == null) {
-                                   // If the result is null, there was an internal onap error
-                                   // in the service call.
-                                   response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-                                   feErrorString = EcompPortalUtils.getFEErrorString(true,
-                                           HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-                            }
-                     } else {
-                            logger.info(EELFLoggerDelegate.errorLogger, "getAppRolesForUser - no Organization User ID");
-                            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
-                            feErrorString = EcompPortalUtils.getFEErrorString(true, HttpServletResponse.SC_BAD_REQUEST);
-                     }
-              }
-
-              StringBuilder sbUserApps = new StringBuilder();
-              if (result != null && !result.isEmpty()) {
-                     sbUserApps.append("User '" + orgUserId + "' has Roles={");
-                     for (RoleInAppForUser appRole : result) {
-                            if (appRole.isApplied) {
-                                   sbUserApps.append(appRole.roleName + ", ");
-                            }
-                     }
-                     sbUserApps.append("} assigned to the appId '" + appid + "'.");
-              } else {
-                     // Not sure creating an empty object will make any difference
-                     // but would like to give it a shot for defect #DE221057
-                     if (result == null) {
-                            result = new ArrayList<>();
-                     }
-                     sbUserApps.append("User '" + orgUserId + "' and appid " + appid + " has no roles");
-              }
-              logger.info(EELFLoggerDelegate.errorLogger, sbUserApps.toString());
-
-              EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/userAppRoles", "get result =", result);
-              if (feErrorString != "") {
-                     logger.debug(EELFLoggerDelegate.debugLogger, "LR: FEErrorString to header: " + feErrorString);
-
-                     response.addHeader("FEErrorString", feErrorString);
-                     response.addHeader("Access-Control-Expose-Headers", "FEErrorString");
-              }
-              return result;
-       }
-
-       @RequestMapping(value = {"/portalApi/userAppRoles"}, method = {
-               RequestMethod.PUT}, produces = "application/json")
-       public PortalRestResponse<String> putAppWithUserRoleStateForUser(Principal principal,
-               @RequestBody AppWithRolesForUser newAppRolesForUser, HttpServletResponse response) {
-              // FieldsValidator fieldsValidator = new FieldsValidator();
-              PortalRestResponse<String> portalResponse = new PortalRestResponse<>();
-              StringBuilder sbUserApps = new StringBuilder();
-              if (newAppRolesForUser != null) {
-                     sbUserApps.append("User '" + newAppRolesForUser.getOrgUserId());
-                     if (newAppRolesForUser.getAppId() != null && !newAppRolesForUser.getAppRoles().isEmpty()) {
-                            sbUserApps.append("' has roles = { ");
-                            for (RoleInAppForUser appRole : newAppRolesForUser.getAppRoles()) {
-                                   if (appRole.isApplied) {
-                                          sbUserApps.append(appRole.roleName + " ,");
-                                   }
-                            }
-                            sbUserApps.deleteCharAt(sbUserApps.length() - 1);
-                            sbUserApps.append("} assigned for the app " + newAppRolesForUser.getAppId());
-                     } else {
-                            sbUserApps.append("' has no roles assigned for app " + newAppRolesForUser.getAppId());
-                     }
-              }
-              logger.info(EELFLoggerDelegate.applicationLogger, "putAppWithUserRoleStateForUser: {}",
-                      sbUserApps.toString());
-
-              FnUser user = fnUserService.loadUserByUsername(principal.getName());
-              // boolean changesApplied = false;
-              ExternalRequestFieldsValidator changesApplied = null;
-
-              if (!adminRolesService.isAccountAdmin(user) && !adminRolesService.isRoleAdmin(user)) {
-                     EcompPortalUtils.setBadPermissions(user, response, "putAppWithUserRoleStateForUser");
-              } else if (newAppRolesForUser == null) {
-                     logger.error(EELFLoggerDelegate.errorLogger,
-                             "putAppWithUserRoleStateForUser: newAppRolesForUser is null");
-              } else {
-                     changesApplied = userRolesService.setAppWithUserRoleStateForUser(user, newAppRolesForUser);
-                     try {
-                            if (changesApplied.isResult()) {
-                                   logger.info(EELFLoggerDelegate.applicationLogger,
-                                           "putAppWithUserRoleStateForUser: succeeded for app {}, user {}",
-                                           newAppRolesForUser.getAppId(),
-                                           newAppRolesForUser.getAppId());
-
-                                   MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP,
-                                           EPEELFLoggerAdvice.getCurrentDateTimeUTC());
-                                   AuditLog auditLog = new AuditLog();
-                                   auditLog.setUserId(user.getId());
-                                   auditLog.setActivityCode(EcompAuditLog.CD_ACTIVITY_UPDATE_USER);
-                                   auditLog.setAffectedRecordId(newAppRolesForUser.getOrgUserId());
-                                   auditLog.setComments(EcompPortalUtils.truncateString(sbUserApps.toString(),
-                                           PortalConstants.AUDIT_LOG_COMMENT_SIZE));
-                                   auditService.logActivity(auditLog, null);
-
-                                   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(
-                                                   "UserRolesController.putAppWithUserRoleStateForUser",
-                                                   EcompAuditLog.CD_ACTIVITY_UPDATE_USER, user.getOrgUserId(),
-                                                   newAppRolesForUser.getOrgUserId(), sbUserApps.toString()));
-                                   MDC.remove(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP);
-                                   MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP);
-                                   MDC.remove(SystemProperties.MDC_TIMER);
-                                   portalResponse = new PortalRestResponse<>(PortalRestStatusEnum.OK, "success", null);
-
-                            }
-                            if (!changesApplied.isResult()) {
-                                   throw new Exception(changesApplied.getDetailMessage());
-                            }
-
-                     } catch (Exception e) {
-                            logger.error(EELFLoggerDelegate.errorLogger,
-                                    "putAppWithUserRoleStateForUser: failed for app {}, user {}",
-                                    newAppRolesForUser.getAppId(),
-                                    newAppRolesForUser.getOrgUserId(), e);
-                            portalResponse = new PortalRestResponse<>(PortalRestStatusEnum.ERROR, e.getMessage(), null);
-                     }
-              }
-
-              EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/userAppRoles", "put result =", changesApplied);
-              return portalResponse;
-       }
-
-       @RequestMapping(value = {"/portalApi/updateRemoteUserProfile"}, method = {
-               RequestMethod.GET}, produces = "application/json")
-       public PortalRestResponse<String> updateRemoteUserProfile(HttpServletRequest request) {
-
-              String updateRemoteUserFlag = FAILURE;
-              try {
-                     // saveNewUser = userService.saveNewUser(newUser);
-                     String orgUserId = request.getParameter("loginId");
-                     Long appId = Long.parseLong(request.getParameter("appId"));
-                     userRolesService.updateRemoteUserProfile(orgUserId, appId);
-
-              } catch (Exception e) {
-                     logger.error(EELFLoggerDelegate.errorLogger, "updateRemoteUserProfile failed", e);
-                     return new PortalRestResponse<>(PortalRestStatusEnum.OK, updateRemoteUserFlag, e.getMessage());
-              }
-              return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, updateRemoteUserFlag, "");
-
-       }
-
-       @RequestMapping(value = {"/portalApi/app/{appId}/users"}, method = {
-               RequestMethod.GET}, produces = "application/json")
-       public List<UserApplicationRoles> getUsersFromAppEndpoint(HttpServletRequest request,
-               @PathVariable("appId") Long appId) throws HTTPException {
-              try {
-                     logger.debug(EELFLoggerDelegate.debugLogger, "/portalApi/app/{}/users was invoked", appId);
-                     return userRolesService.getUsersFromAppEndpoint(appId);
-              } catch (Exception e) {
-                     logger.error(EELFLoggerDelegate.errorLogger, "getUsersFromAppEndpoint failed", e);
-                     return new ArrayList<>();
-              }
-       }
-
-       @RequestMapping(value = {"/portalApi/app/{appId}/roles"}, method = {
-               RequestMethod.GET}, produces = "application/json")
-       public List<EcompRole> testGetRoles(HttpServletRequest request, @PathVariable("appId") Long appId)
-               throws HTTPException {
-              EcompRole[] appRoles = applicationsRestClientService.get(EcompRole[].class, appId, "/roles");
-              List<EcompRole> rolesList = Arrays.asList(appRoles);
-              EcompPortalUtils
-                      .logAndSerializeObject(logger, "/portalApi/app/{appId}/roles", "response for appId=" + appId,
-                              rolesList);
-
-              return rolesList;
-       }
-
-       @RequestMapping(value = {"/portalApi/admin/import/app/{appId}/roles"}, method = {
-               RequestMethod.GET}, produces = "application/json")
-       public List<FnRole> importRolesFromRemoteApplication(HttpServletRequest request,
-               @PathVariable("appId") Long appId)
-               throws HTTPException {
-              List<FnRole> rolesList = userRolesService.importRolesFromRemoteApplication(appId);
-              EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/admin/import/app/{appId}/roles",
-                      "response for appId=" + appId, rolesList);
-
-              return rolesList;
-       }
-
-       @RequestMapping(value = {"/portalApi/app/{appId}/user/{orgUserId}/roles"}, method = {
-               RequestMethod.GET}, produces = "application/json")
-       public EcompRole testGetRoles(HttpServletRequest request, @PathVariable("appId") Long appId,
-               @PathVariable("orgUserId") String orgUserId) throws Exception {
-              if (!EcompPortalUtils.legitimateUserId(orgUserId)) {
-                     String msg = "Error /user/<user>/roles not legitimate orgUserId = " + orgUserId;
-                     logger.error(EELFLoggerDelegate.errorLogger, msg);
-                     throw new Exception(msg);
-              }
-              EcompRole[] roles = applicationsRestClientService.get(EcompRole[].class, appId,
-                      String.format("/user/%s/roles", orgUserId));
-              if (roles.length != 1) {
-                     String msg =
-                             "Error /user/<user>/roles returned array. expected size 1 recieved size = " + roles.length;
-                     logger.error(EELFLoggerDelegate.errorLogger, msg);
-                     throw new Exception(msg);
-              }
-
-              EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/app/{appId}/user/{orgUserId}/roles",
-                      "response for appId='" + appId + "' and orgUserId='" + orgUserId + "'", roles[0]);
-              return roles[0];
-       }
-
-       @RequestMapping(value = {"/portalApi/saveUserAppRoles"}, method = {
-               RequestMethod.PUT}, produces = "application/json")
-       public FieldsValidator putAppWithUserRoleRequest(Principal principal,
-               @RequestBody AppWithRolesForUser newAppRolesForUser, HttpServletResponse response) {
-              FieldsValidator fieldsValidator = null;
-              try {
-
-                     FnUser user = fnUserService.loadUserByUsername(principal.getName());
-                     fieldsValidator = userRolesService.putUserAppRolesRequest(newAppRolesForUser, user);
-                     response.setStatus(fieldsValidator.httpStatusCode.intValue());
-
-              } catch (Exception e) {
-                     logger.error(EELFLoggerDelegate.errorLogger, "putAppWithUserRoleRequest failed", e);
-
-              }
-              // return fieldsValidator;
-              EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/saveUserAppRoles", "PUT result =",
-                      response.getStatus());
-              return fieldsValidator;
-       }
-
-       @RequestMapping(value = {"/portalApi/appCatalogRoles"}, method = {
-               RequestMethod.GET}, produces = "application/json")
-       public List<EPUserAppCatalogRoles> getUserAppCatalogRoles(Principal principal,
-               @RequestParam("appName") String appName) {
-              FnUser user = fnUserService.loadUserByUsername(principal.getName());
-              List<EPUserAppCatalogRoles> userAppRoleList = null;
-              try {
-                     userAppRoleList = userRolesService.getUserAppCatalogRoles(user, appName);
-              } catch (Exception e) {
-                     logger.error(EELFLoggerDelegate.errorLogger, "putUserWidgetsSortPref failed", e);
-
-              }
-              Collections.sort(userAppRoleList, getUserAppCatalogRolesComparator);
-              EcompPortalUtils
-                      .logAndSerializeObject(logger, "/portalApi/userApplicationRoles", "result =", userAppRoleList);
-
-              return userAppRoleList;
-
-       }
-
-       private Comparator<EPUserAppCatalogRoles> getUserAppCatalogRolesComparator =
-               Comparator.comparing(EPUserAppCatalogRoles::getRolename);
-
-       @RequestMapping(value = "/portalApi/externalRequestAccessSystem", method = RequestMethod.GET,
-               produces = "application/json")
-       public ExternalSystemAccess readExternalRequestAccess(HttpServletRequest request) {
-              ExternalSystemAccess result = null;
-              try {
-                     result = userRolesService.getExternalRequestAccess();
-                     EcompPortalUtils
-                             .logAndSerializeObject(logger, "/portalApi/externalRequestAccessSystem", "GET result =",
-                                     result);
-              } catch (Exception e) {
-                     logger.error(EELFLoggerDelegate.errorLogger,
-                             "readExternalRequestAccess failed: " + e.getMessage());
-              }
-              return result;
-       }
+  private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UserRolesController.class);
+
+  private final FnUserService fnUserService;
+  private final FnUserRoleService fnUserRoleService;
+  private final AdminRolesService adminRolesService;
+  private final ApplicationsRestClientService applicationsRestClientService;
+  private final AuditServiceImpl auditService = new AuditServiceImpl();
+
+  private static final String FAILURE = "failure";
+
+  @Autowired
+  public UserRolesController(final FnUserService fnUserService,
+      FnUserRoleService fnUserRoleService,
+      final AdminRolesService adminRolesService,
+      ApplicationsRestClientService applicationsRestClientService) {
+    this.fnUserService = fnUserService;
+    this.fnUserRoleService = fnUserRoleService;
+    this.adminRolesService = adminRolesService;
+    this.applicationsRestClientService = applicationsRestClientService;
+  }
+
+
+  /*
+         @RequestMapping(value = {"/portalApi/queryUsers"}, method = RequestMethod.GET, produces = "application/json")
+         @PreAuthorize("hasRole('System_Administrator') and hasRole('Account_Administrator')")
+         public String getPhoneBookSearchResult(Principal principal, @RequestParam("search") String searchString,
+                 HttpServletResponse response) {
+                FnUser user = fnUserService.loadUserByUsername(principal.getName());
+
+                String searchResult = null;
+                if (!adminRolesService.isSuperAdmin(user) && !adminRolesService.isAccountAdmin(user)
+                        && !adminRolesService.isRoleAdmin(user)) {
+                       EcompPortalUtils.setBadPermissions(user, response, "getPhoneBookSearchResult");
+                } else {
+                       searchString = searchString.trim();
+                       if (searchString.length() > 2) {
+                              searchResult = searchService.searchUsersInPhoneBook(searchString);
+                       } else {
+                              logger.info(EELFLoggerDelegate.errorLogger,
+                                      "getPhoneBookSearchResult - too short search string: " + searchString);
+                       }
+                }
+                EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/queryUsers", "result =", searchResult);
+
+                return searchResult;
+         }
+
+
+         @RequestMapping(value = {"/portalApi/adminAppsRoles"}, method = {
+                 RequestMethod.GET}, produces = "application/json")
+         public AppsListWithAdminRole getAppsWithAdminRoleStateForUser(Principal principal,
+                 @RequestParam("user") String orgUserId, HttpServletResponse response) {
+
+                FnUser user = fnUserService.loadUserByUsername(principal.getName());
+
+                AppsListWithAdminRole result = null;
+                if (!adminRolesService.isSuperAdmin(user)) {
+                       EcompPortalUtils.setBadPermissions(user, response, "getAppsWithAdminRoleStateForUser");
+                } else {
+                       if (EcompPortalUtils.legitimateUserId(orgUserId)) {
+                              result = adminRolesService.getAppsWithAdminRoleStateForUser(orgUserId);
+                       } else {
+                              logger.info(EELFLoggerDelegate.errorLogger,
+                                      "getAppsWithAdminRoleStateForUser - parms error, no Organization User ID");
+                              response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+                       }
+                }
+
+                StringBuilder adminAppRoles = new StringBuilder();
+                if (result != null) {
+                       if (!result.appsRoles.isEmpty()) {
+                              adminAppRoles.append("User '" + result.orgUserId + "' has admin role to the apps = {");
+                              for (AppNameIdIsAdmin adminAppRole : result.appsRoles) {
+                                     if (adminAppRole.isAdmin) {
+                                            adminAppRoles.append(adminAppRole.appName + ", ");
+                                     }
+                              }
+                              adminAppRoles.append("}.");
+                       } else {
+                              adminAppRoles.append("User '" + result.orgUserId + "' has no Apps with Admin Role.");
+                       }
+                } else {
+                       logger.error(EELFLoggerDelegate.errorLogger,
+                               "putAppWithUserRoleStateForUser: getAppsWithAdminRoleStateForUser result is null");
+                }
+
+                logger.info(EELFLoggerDelegate.errorLogger, adminAppRoles.toString());
+
+                EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/adminAppsRoles", "get result =", result);
+
+                return result;
+         }
 */
-
-
-       @RequestMapping(value = {"/portalApi/checkIfUserIsSuperAdmin"}, method = RequestMethod.GET,
-               produces = "application/json")
-       public boolean checkIfUserIsSuperAdmin(Principal principal) {
-              FnUser user = fnUserService.loadUserByUsername(principal.getName());
-
-              boolean isSuperAdmin = false;
-              try {
-                     isSuperAdmin = adminRolesService.isSuperAdmin(user.getOrgUserId());
-              } catch (Exception e) {
-                     logger.error(EELFLoggerDelegate.errorLogger, "checkIfUserIsSuperAdmin failed: " + e.getMessage());
-              }
-              return isSuperAdmin;
-       }
+  @RequestMapping(value = {"/portalApi/adminAppsRoles"}, method = {
+      RequestMethod.PUT}, produces = "application/json")
+  public FieldsValidator putAppsWithAdminRoleStateForUser(Principal principal,
+      @RequestBody AppsListWithAdminRole newAppsListWithAdminRoles, HttpServletResponse response) {
+    // newAppsListWithAdminRoles.appsRoles
+    FieldsValidator fieldsValidator = new FieldsValidator();
+    StringBuilder newAppRoles = new StringBuilder();
+    if (newAppsListWithAdminRoles != null) {
+      if (!newAppsListWithAdminRoles.getAppsRoles().isEmpty()) {
+        newAppRoles.append("User '").append(newAppsListWithAdminRoles.getOrgUserId())
+            .append("' has admin role to the apps = { ");
+        for (AppNameIdIsAdmin adminAppRole : newAppsListWithAdminRoles.getAppsRoles()) {
+          if (adminAppRole.getIsAdmin()) {
+            newAppRoles.append(adminAppRole.getAppName()).append(" ,");
+          }
+        }
+        newAppRoles.deleteCharAt(newAppRoles.length() - 1);
+        newAppRoles.append("}.");
+      } else {
+        newAppRoles.append("User '").append(newAppsListWithAdminRoles.getOrgUserId())
+            .append("' has no Apps with Admin Role.");
+      }
+    } else {
+      logger.error(EELFLoggerDelegate.errorLogger,
+          "putAppWithUserRoleStateForUser: putAppsWithAdminRoleStateForUser result is null");
+      fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+    }
+
+    logger.info(EELFLoggerDelegate.errorLogger, newAppRoles.toString());
+
+    FnUser user = fnUserService.loadUserByUsername(principal.getName());
+
+    boolean changesApplied = false;
+
+    if (!adminRolesService.isSuperAdmin(user.getLoginId())) {
+      EcompPortalUtils.setBadPermissions(user, response, "putAppsWithAdminRoleStateForUser");
+    } else {
+      changesApplied = adminRolesService.setAppsWithAdminRoleStateForUser(newAppsListWithAdminRoles);
+      AuditLog auditLog = new AuditLog();
+      auditLog.setUserId(user.getId());
+      auditLog.setActivityCode(EcompAuditLog.CD_ACTIVITY_UPDATE_ACCOUNT_ADMIN);
+      if (newAppsListWithAdminRoles != null) {
+        auditLog.setAffectedRecordId(newAppsListWithAdminRoles.getOrgUserId());
+      }
+      auditLog.setComments(
+          EcompPortalUtils
+              .truncateString(newAppRoles.toString(), 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));
+      if (newAppsListWithAdminRoles != null) {
+        logger.info(EELFLoggerDelegate.auditLogger,
+            EPLogUtil.formatAuditLogMessage(
+                "UserRolesController.putAppsWithAdminRoleStateForUser",
+                EcompAuditLog.CD_ACTIVITY_UPDATE_ACCOUNT_ADMIN, user.getOrgUserId(),
+                newAppsListWithAdminRoles.getOrgUserId(), newAppRoles.toString()));
+      }
+      MDC.remove(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP);
+      MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP);
+      MDC.remove(SystemProperties.MDC_TIMER);
+    }
+    EcompPortalUtils
+        .logAndSerializeObject(logger, "/portalApi/adminAppsRoles", "put result =", changesApplied);
+
+    return fieldsValidator;
+  }
+
+  @RequestMapping(value = {"/portalApi/userAppRoles"}, method = {
+      RequestMethod.GET}, produces = "application/json")
+  public List<RoleInAppForUser> getAppRolesForUser(Principal principal,
+      @RequestParam("user") String orgUserId,
+      @RequestParam("app") Long appid, @RequestParam("externalRequest") Boolean extRequestValue,
+      @RequestParam("isSystemUser") Boolean isSystemUser,
+      HttpServletResponse response) {
+    FnUser user = fnUserService.loadUserByUsername(principal.getName());
+    List<RoleInAppForUser> result = null;
+    String feErrorString = "";
+    if (!adminRolesService.isAccountAdmin(user) && !adminRolesService.isRoleAdmin(user.getId())) {
+      logger.debug(EELFLoggerDelegate.debugLogger,
+          "getAppRolesForUser: Accountadminpermissioncheck {}, RoleAdmincheck {}",
+          adminRolesService.isAccountAdmin(user), adminRolesService.isRoleAdmin(user.getId()));
+      EcompPortalUtils.setBadPermissions(user, response, "getAppRolesForUser");
+      feErrorString = EcompPortalUtils.getFEErrorString(true, response.getStatus());
+    } else {
+      if (isSystemUser || EcompPortalUtils.legitimateUserId(orgUserId)) {
+        result = adminRolesService.getAppRolesForUser(appid, orgUserId, extRequestValue, user.getId());
+        logger.debug(EELFLoggerDelegate.debugLogger, "getAppRolesForUser: result {}, appId {}",
+            result, appid);
+        int responseCode = EcompPortalUtils.getExternalAppResponseCode();
+        if (responseCode != 0 && responseCode != 200) {
+          // external error
+          response.setStatus(responseCode);
+          feErrorString = EcompPortalUtils.getFEErrorString(false, responseCode);
+        } else if (result == null) {
+          // If the result is null, there was an internal onap error
+          // in the service call.
+          response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+          feErrorString = EcompPortalUtils.getFEErrorString(true,
+              HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+        }
+      } else {
+        logger.info(EELFLoggerDelegate.errorLogger, "getAppRolesForUser - no Organization User ID");
+        response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+        feErrorString = EcompPortalUtils.getFEErrorString(true, HttpServletResponse.SC_BAD_REQUEST);
+      }
+    }
+
+    StringBuilder sbUserApps = new StringBuilder();
+    if (result != null && !result.isEmpty()) {
+      sbUserApps.append("User '").append(orgUserId).append("' has Roles={");
+      for (RoleInAppForUser appRole : result) {
+        if (appRole.getIsApplied()) {
+          sbUserApps.append(appRole.getRoleName()).append(", ");
+        }
+      }
+      sbUserApps.append("} assigned to the appId '").append(appid).append("'.");
+    } else {
+      // Not sure creating an empty object will make any difference
+      // but would like to give it a shot for defect #DE221057
+      if (result == null) {
+        result = new ArrayList<>();
+      }
+      sbUserApps.append("User '").append(orgUserId).append("' and appid ").append(appid).append(" has no roles");
+    }
+    logger.info(EELFLoggerDelegate.errorLogger, sbUserApps.toString());
+
+    EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/userAppRoles", "get result =", result);
+    if (!feErrorString.isEmpty()) {
+      logger.debug(EELFLoggerDelegate.debugLogger, "LR: FEErrorString to header: " + feErrorString);
+
+      response.addHeader("FEErrorString", feErrorString);
+      response.addHeader("Access-Control-Expose-Headers", "FEErrorString");
+    }
+    return result;
+  }
+
+
+  @RequestMapping(value = {"/portalApi/userAppRoles"}, method = {
+      RequestMethod.PUT}, produces = "application/json")
+  public PortalRestResponse<String> putAppWithUserRoleStateForUser(Principal principal,
+      @RequestBody AppWithRolesForUser newAppRolesForUser, HttpServletResponse response) {
+    // FieldsValidator fieldsValidator = new FieldsValidator();
+    PortalRestResponse<String> portalResponse = new PortalRestResponse<>();
+    StringBuilder sbUserApps = new StringBuilder();
+    if (newAppRolesForUser != null) {
+      sbUserApps.append("User '").append(newAppRolesForUser.getOrgUserId());
+      if (newAppRolesForUser.getAppId() != null && !newAppRolesForUser.getAppRoles().isEmpty()) {
+        sbUserApps.append("' has roles = { ");
+        for (RoleInAppForUser appRole : newAppRolesForUser.getAppRoles()) {
+          if (appRole.getIsApplied()) {
+            sbUserApps.append(appRole.getRoleName()).append(" ,");
+          }
+        }
+        sbUserApps.deleteCharAt(sbUserApps.length() - 1);
+        sbUserApps.append("} assigned for the app ").append(newAppRolesForUser.getAppId());
+      } else {
+        sbUserApps.append("' has no roles assigned for app ").append(newAppRolesForUser.getAppId());
+      }
+    }
+    logger.info(EELFLoggerDelegate.applicationLogger, "putAppWithUserRoleStateForUser: {}",
+        sbUserApps.toString());
+
+    FnUser user = fnUserService.loadUserByUsername(principal.getName());
+    // boolean changesApplied = false;
+    ExternalRequestFieldsValidator changesApplied = null;
+
+    if (!adminRolesService.isAccountAdmin(user) && !adminRolesService.isRoleAdmin(user.getId())) {
+      EcompPortalUtils.setBadPermissions(user, response, "putAppWithUserRoleStateForUser");
+    } else if (newAppRolesForUser == null) {
+      logger.error(EELFLoggerDelegate.errorLogger,
+          "putAppWithUserRoleStateForUser: newAppRolesForUser is null");
+    } else {
+      changesApplied = adminRolesService.setAppWithUserRoleStateForUser(user, newAppRolesForUser);
+      try {
+        if (changesApplied.isResult()) {
+          logger.info(EELFLoggerDelegate.applicationLogger,
+              "putAppWithUserRoleStateForUser: succeeded for app {}, user {}",
+              newAppRolesForUser.getAppId(),
+              newAppRolesForUser.getAppId());
+
+          MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP,
+              EPEELFLoggerAdvice.getCurrentDateTimeUTC());
+          AuditLog auditLog = new AuditLog();
+          auditLog.setUserId(user.getId());
+          auditLog.setActivityCode(EcompAuditLog.CD_ACTIVITY_UPDATE_USER);
+          auditLog.setAffectedRecordId(newAppRolesForUser.getOrgUserId());
+          auditLog.setComments(EcompPortalUtils.truncateString(sbUserApps.toString(),
+              PortalConstants.AUDIT_LOG_COMMENT_SIZE));
+          auditService.logActivity(auditLog, null);
+
+          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(
+                  "UserRolesController.putAppWithUserRoleStateForUser",
+                  EcompAuditLog.CD_ACTIVITY_UPDATE_USER, user.getOrgUserId(),
+                  newAppRolesForUser.getOrgUserId(), sbUserApps.toString()));
+          MDC.remove(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP);
+          MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP);
+          MDC.remove(SystemProperties.MDC_TIMER);
+          portalResponse = new PortalRestResponse<>(PortalRestStatusEnum.OK, "success", null);
+
+        }
+        if (!changesApplied.isResult()) {
+          throw new Exception(changesApplied.getDetailMessage());
+        }
+
+      } catch (Exception e) {
+        logger.error(EELFLoggerDelegate.errorLogger,
+            "putAppWithUserRoleStateForUser: failed for app {}, user {}",
+            newAppRolesForUser.getAppId(),
+            newAppRolesForUser.getOrgUserId(), e);
+        portalResponse = new PortalRestResponse<>(PortalRestStatusEnum.ERROR, e.getMessage(), null);
+      }
+    }
+
+    EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/userAppRoles", "put result =", changesApplied);
+    return portalResponse;
+  }
+
+  @RequestMapping(value = {"/portalApi/updateRemoteUserProfile"}, method = {
+      RequestMethod.GET}, produces = "application/json")
+  public PortalRestResponse<String> updateRemoteUserProfile(HttpServletRequest request) {
+
+    String updateRemoteUserFlag = FAILURE;
+    try {
+      // saveNewUser = userService.saveNewUser(newUser);
+      String orgUserId = request.getParameter("loginId");
+      long appId = Long.parseLong(request.getParameter("appId"));
+      fnUserRoleService.updateRemoteUserProfile(orgUserId, appId);
+    } catch (Exception e) {
+      logger.error(EELFLoggerDelegate.errorLogger, "updateRemoteUserProfile failed", e);
+      return new PortalRestResponse<>(PortalRestStatusEnum.OK, updateRemoteUserFlag, e.getMessage());
+    }
+    return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, updateRemoteUserFlag, "");
+
+  }
+
+  @RequestMapping(value = {"/portalApi/app/{appId}/users"}, method = {
+      RequestMethod.GET}, produces = "application/json")
+  public List<UserApplicationRoles> getUsersFromAppEndpoint(@PathVariable("appId") Long appId) {
+    try {
+      logger.debug(EELFLoggerDelegate.debugLogger, "/portalApi/app/{}/users was invoked", appId);
+      return fnUserRoleService.getUsersFromAppEndpoint(appId);
+    } catch (Exception e) {
+      logger.error(EELFLoggerDelegate.errorLogger, "getUsersFromAppEndpoint failed", e);
+      return new ArrayList<>();
+    }
+  }
+
+  @RequestMapping(value = {"/portalApi/app/{appId}/roles"}, method = {
+      RequestMethod.GET}, produces = "application/json")
+  public List<EcompRole> testGetRoles(HttpServletRequest request, @PathVariable("appId") Long appId)
+      throws HTTPException {
+    EcompRole[] appRoles = applicationsRestClientService.get(EcompRole[].class, appId, "/roles");
+    List<EcompRole> rolesList = Arrays.asList(appRoles);
+    EcompPortalUtils
+        .logAndSerializeObject(logger, "/portalApi/app/{appId}/roles", "response for appId=" + appId,
+            rolesList);
+
+    return rolesList;
+  }
+
+
+  @RequestMapping(value = {"/portalApi/admin/import/app/{appId}/roles"}, method = {
+      RequestMethod.GET}, produces = "application/json")
+  public List<FnRole> importRolesFromRemoteApplication(@PathVariable("appId") Long appId) throws HTTPException {
+    List<FnRole> rolesList = fnUserRoleService.importRolesFromRemoteApplication(appId);
+    EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/admin/import/app/{appId}/roles",
+        "response for appId=" + appId, rolesList);
+
+    return rolesList;
+  }
+
+
+  @RequestMapping(value = {"/portalApi/app/{appId}/user/{orgUserId}/roles"}, method = {
+      RequestMethod.GET}, produces = "application/json")
+  public EcompRole testGetRoles(@PathVariable("appId") Long appId,
+      @PathVariable("orgUserId") String orgUserId) throws Exception {
+    if (!EcompPortalUtils.legitimateUserId(orgUserId)) {
+      String msg = "Error /user/<user>/roles not legitimate orgUserId = " + orgUserId;
+      logger.error(EELFLoggerDelegate.errorLogger, msg);
+      throw new Exception(msg);
+    }
+    EcompRole[] roles = applicationsRestClientService.get(EcompRole[].class, appId,
+        String.format("/user/%s/roles", orgUserId));
+    if (roles.length != 1) {
+      String msg =
+          "Error /user/<user>/roles returned array. expected size 1 recieved size = " + roles.length;
+      logger.error(EELFLoggerDelegate.errorLogger, msg);
+      throw new Exception(msg);
+    }
+
+    EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/app/{appId}/user/{orgUserId}/roles",
+        "response for appId='" + appId + "' and orgUserId='" + orgUserId + "'", roles[0]);
+    return roles[0];
+  }
+
+
+  @RequestMapping(value = {"/portalApi/saveUserAppRoles"}, method = {
+      RequestMethod.PUT}, produces = "application/json")
+  public FieldsValidator putAppWithUserRoleRequest(Principal principal,
+      @RequestBody AppWithRolesForUser newAppRolesForUser, HttpServletResponse response) {
+    FieldsValidator fieldsValidator = null;
+    FnUser user = fnUserService.loadUserByUsername(principal.getName());
+    try {
+      fieldsValidator = fnUserRoleService.putUserAppRolesRequest(newAppRolesForUser, user);
+      response.setStatus(0);
+
+    } catch (Exception e) {
+      logger.error(EELFLoggerDelegate.errorLogger, "putAppWithUserRoleRequest failed", e);
+
+    }
+    // return fieldsValidator;
+    EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/saveUserAppRoles", "PUT result =",
+        response.getStatus());
+    return fieldsValidator;
+  }
+
+
+  @SuppressWarnings("ConstantConditions")
+  @RequestMapping(value = {"/portalApi/appCatalogRoles"}, method = {
+      RequestMethod.GET}, produces = "application/json")
+  public List<EPUserAppCatalogRoles> getUserAppCatalogRoles(Principal principal,
+      @RequestParam("appName") String appName) {
+    FnUser user = fnUserService.loadUserByUsername(principal.getName());
+    List<EPUserAppCatalogRoles> userAppRoleList = null;
+    try {
+      userAppRoleList = fnUserRoleService.getUserAppCatalogRoles(user, appName);
+    } catch (Exception e) {
+      logger.error(EELFLoggerDelegate.errorLogger, "putUserWidgetsSortPref failed", e);
+
+    }
+    userAppRoleList.sort(getUserAppCatalogRolesComparator);
+    EcompPortalUtils
+        .logAndSerializeObject(logger, "/portalApi/userApplicationRoles", "result =", userAppRoleList);
+
+    return userAppRoleList;
+
+  }
+
+
+  private final Comparator<EPUserAppCatalogRoles> getUserAppCatalogRolesComparator =
+      Comparator.comparing(EPUserAppCatalogRoles::getRoleName);
+
+  @RequestMapping(value = "/portalApi/externalRequestAccessSystem", method = RequestMethod.GET,
+      produces = "application/json")
+  public ExternalSystemAccess readExternalRequestAccess() {
+    ExternalSystemAccess result = null;
+    try {
+      result = fnUserRoleService.getExternalRequestAccess();
+      EcompPortalUtils
+          .logAndSerializeObject(logger, "/portalApi/externalRequestAccessSystem", "GET result =",
+              result);
+    } catch (Exception e) {
+      logger.error(EELFLoggerDelegate.errorLogger,
+          "readExternalRequestAccess failed: " + e.getMessage());
+    }
+    return result;
+
+  }
+
+  @RequestMapping(value = {"/portalApi/checkIfUserIsSuperAdmin"}, method = RequestMethod.GET,
+      produces = "application/json")
+  public boolean checkIfUserIsSuperAdmin(Principal principal) {
+    FnUser user = fnUserService.loadUserByUsername(principal.getName());
+
+    boolean isSuperAdmin = false;
+    try {
+      isSuperAdmin = adminRolesService.isSuperAdmin(user.getLoginId());
+    } catch (Exception e) {
+      logger.error(EELFLoggerDelegate.errorLogger, "checkIfUserIsSuperAdmin failed: " + e.getMessage());
+    }
+    return isSuperAdmin;
+  }
 }
index 849b262..20c6454 100644 (file)
@@ -57,8 +57,8 @@ import org.onap.portal.domain.dto.transport.Analytics;
 import org.onap.portal.logging.aop.EPAuditLog;
 import org.onap.portal.logging.aop.EPEELFLoggerAdvice;
 import org.onap.portal.logging.logic.EPLogUtil;
+import org.onap.portal.service.AppsCacheService;
 import org.onap.portal.service.WidgetMService;
-import org.onap.portal.service.fn.old.AppsCacheService;
 import org.onap.portal.utils.EPCommonSystemProperties;
 import org.onap.portal.utils.EcompPortalUtils;
 import org.onap.portal.utils.PortalConstants;
@@ -133,7 +133,7 @@ public class WebAnalyticsExtAppController {
                }
                if (app != null) {
                        String restEndPoint = app.getAppRestEndpoint();
-                       if(restEndPoint.indexOf("/api")!=-1) {
+                       if(restEndPoint.contains("/api")) {
                                version = restEndPoint.substring(restEndPoint.indexOf("api"));
                        }
                }
index ab1b280..92b4b51 100644 (file)
@@ -55,7 +55,7 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RequestMapping("/portalApi/consul")
 public class WidgetMSController {
-       private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetMSController.class);
+       private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetMSController.class);
 
        private final WidgetMService widgetMService;
 
index 07695ae..5977944 100644 (file)
@@ -92,12 +92,12 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
 @EPAuditLog
 public class WidgetsCatalogController {
 
-       private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetsCatalogController.class);
+       private final 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();
-       private String whatService = "widgets-service";
+       private final RestTemplate template = new RestTemplate();
+       private final String whatService = "widgets-service";
 
        private final EpWidgetCatalogParameterService epWidgetCatalogParameterService;
        private final EpMicroserviceParameterService epMicroserviceParameterService;
@@ -326,7 +326,7 @@ public class WidgetsCatalogController {
                             userResult.setDefaultValue(param.getPara_value());
                             userResult.setParamKey(param.getPara_key());
                             EpWidgetCatalogParameter userValue = epWidgetCatalogParameterService
-                                    .getUserParamById(widgetId, user.getUserId(),
+                                    .getUserParamById(widgetId, user.getId(),
                                             param.getId());
                             if (userValue == null) {
                                    userResult.setUserValue(param.getPara_value());
@@ -410,7 +410,7 @@ public class WidgetsCatalogController {
               try {
                      EpWidgetCatalogParameter oldParam = epWidgetCatalogParameterService
                              .getUserParamById(widgetParameters.getWidgetId().getWidgetId(),
-                                     widgetParameters.getUserId().getUserId(), widgetParameters.getParamId().getId());
+                                     widgetParameters.getUserId().getId(), widgetParameters.getParamId().getId());
                      if (oldParam != null) {
                             oldParam.setParamId(widgetParameters.getParamId());
                             oldParam.setUserId(widgetParameters.getUserId());
index e63de2e..4a4287c 100644 (file)
@@ -64,7 +64,7 @@ import org.springframework.web.multipart.commons.CommonsMultipartResolver;
 public class WidgetsCatalogMarkupController {
 
        private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetsCatalogMarkupController.class);
-       private RestTemplate template = new RestTemplate();
+       private final RestTemplate template = new RestTemplate();
        private final String whatService = "widgets-service";
 
        @Autowired
@@ -77,9 +77,7 @@ public class WidgetsCatalogMarkupController {
 
        static {
               // for localhost testing only
-              javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier((hostname, sslSession) -> {
-                     return hostname.equals("localhost");
-              });
+              javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier((hostname, sslSession) -> hostname.equals("localhost"));
        }
 
        @GetMapping(value = "/portalApi/microservices/markup/{widgetId}")
index 556c7ef..6a92fbc 100644 (file)
@@ -78,18 +78,13 @@ public class WidgetsController {
 
        private final FnUserService fnUserService;
        private final WidgetService widgetService;
-       private final AdminRolesService adminRolesService;
-       private final DataValidator dataValidator;
        private final PersUserWidgetService persUserWidgetService;
 
        @Autowired
        public WidgetsController(final FnUserService fnUserService, final WidgetService widgetService,
-               final AdminRolesService adminRolesService, final DataValidator dataValidator,
                final PersUserWidgetService persUserWidgetService) {
               this.fnUserService = fnUserService;
               this.widgetService = widgetService;
-              this.adminRolesService = adminRolesService;
-              this.dataValidator = dataValidator;
               this.persUserWidgetService = persUserWidgetService;
        }
 
@@ -127,7 +122,7 @@ public class WidgetsController {
               onboardingWidget.setId(widgetId);
               onboardingWidget.normalize();
               try {
-                     fieldsValidator = widgetService.setOnboardingWidget(user.getUserId(), onboardingWidget);
+                     fieldsValidator = widgetService.setOnboardingWidget(user.getId(), onboardingWidget);
                      response.setStatus(fieldsValidator.getHttpStatusCode().intValue());
               } catch (IllegalArgumentException e) {
                      fieldsValidator = new FieldsValidator();
@@ -153,7 +148,7 @@ public class WidgetsController {
               onboardingWidget.normalize();
 
               try {
-                     fieldsValidator = widgetService.setOnboardingWidget(user.getUserId(), onboardingWidget);
+                     fieldsValidator = widgetService.setOnboardingWidget(user.getId(), onboardingWidget);
               } catch (IllegalArgumentException e) {
                      fieldsValidator = new FieldsValidator();
                      fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_NOT_ACCEPTABLE);
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpAppFunctionDao.java b/portal-BE/src/main/java/org/onap/portal/dao/ep/EpAppFunctionDao.java
new file mode 100644 (file)
index 0000000..c7782b5
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.ep;
+
+import java.util.List;
+import org.onap.portal.domain.db.ep.EpAppFunction;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface EpAppFunctionDao extends JpaRepository<EpAppFunction, Long> {
+
+  @Query
+  List<EpAppFunction> getAppRoleFunctionList(final @Param("roleId") Long roleId, final @Param("appId") Long appId);
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpAppRoleFunctionDao.java b/portal-BE/src/main/java/org/onap/portal/dao/ep/EpAppRoleFunctionDao.java
new file mode 100644 (file)
index 0000000..3296eb7
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.ep;
+
+import org.onap.portal.domain.db.ep.EpAppRoleFunction;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface EpAppRoleFunctionDao extends JpaRepository<EpAppRoleFunction, Integer> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpBasicAuthAccountDao.java b/portal-BE/src/main/java/org/onap/portal/dao/ep/EpBasicAuthAccountDao.java
new file mode 100644 (file)
index 0000000..cc3219c
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.ep;
+
+import org.onap.portal.domain.db.ep.EpBasicAuthAccount;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+@Repository
+public interface EpBasicAuthAccountDao extends JpaRepository<EpBasicAuthAccount, Long> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpMicroserviceDao.java b/portal-BE/src/main/java/org/onap/portal/dao/ep/EpMicroserviceDao.java
new file mode 100644 (file)
index 0000000..d68e1f8
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.ep;
+
+import org.onap.portal.domain.db.ep.EpMicroservice;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+@Repository
+public interface EpMicroserviceDao extends JpaRepository<EpMicroservice, Long> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpPersUserAppSortDao.java b/portal-BE/src/main/java/org/onap/portal/dao/ep/EpPersUserAppSortDao.java
new file mode 100644 (file)
index 0000000..bc9da59
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.ep;
+
+import org.onap.portal.domain.db.ep.EpPersUserAppSort;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface EpPersUserAppSortDao extends JpaRepository<EpPersUserAppSort, Long> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpUserRolesRequestDao.java b/portal-BE/src/main/java/org/onap/portal/dao/ep/EpUserRolesRequestDao.java
new file mode 100644 (file)
index 0000000..7924d43
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.ep;
+
+import java.util.List;
+import org.onap.portal.domain.db.ep.EpUserRolesRequest;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface EpUserRolesRequestDao extends JpaRepository<EpUserRolesRequest, Long> {
+  @Query
+  List<EpUserRolesRequest> userAppRolesRequestList(final @Param("userId") Long userId, final @Param("appId") Long appId);
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpUserRolesRequestDetDao.java b/portal-BE/src/main/java/org/onap/portal/dao/ep/EpUserRolesRequestDetDao.java
new file mode 100644 (file)
index 0000000..cfc97ba
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.ep;
+
+import java.util.List;
+import org.onap.portal.domain.db.ep.EpUserRolesRequestDet;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface EpUserRolesRequestDetDao extends JpaRepository<EpUserRolesRequestDet, Long> {
+
+  @Query
+  List<EpUserRolesRequestDet> appRolesRequestDetailList(final @Param("reqId") Long reqId);
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnAppContactUsDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnAppContactUsDao.java
new file mode 100644 (file)
index 0000000..39603eb
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnAppContactUs;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+@Repository
+public interface FnAppContactUsDao extends JpaRepository<FnAppContactUs, Long> {
+
+}
index 616ee2d..f86456f 100644 (file)
@@ -1,7 +1,10 @@
 package org.onap.portal.dao.fn;
 
+import java.util.List;
 import org.onap.portal.domain.db.fn.FnApp;
 import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
 import org.springframework.stereotype.Repository;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -9,4 +12,10 @@ import org.springframework.transaction.annotation.Transactional;
 @Transactional
 public interface FnAppDao extends JpaRepository<FnApp, Long> {
 
+  @Query
+  List<FnApp> getByUebKey(final @Param("uebKey") String uebKey);
+
+  @Query
+  List<FnApp> getCentralizedApps();
+
 }
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnAuditLogDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnAuditLogDao.java
new file mode 100644 (file)
index 0000000..4e747b4
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnAuditLog;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface FnAuditLogDao extends JpaRepository<FnAuditLog, Integer> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnCommonWidgetDataDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnCommonWidgetDataDao.java
new file mode 100644 (file)
index 0000000..deb062f
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnCommonWidgetData;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface FnCommonWidgetDataDao extends JpaRepository<FnCommonWidgetData, Long> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnDisplayTextDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnDisplayTextDao.java
new file mode 100644 (file)
index 0000000..fae8d68
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnDisplayText;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+@Repository
+public interface FnDisplayTextDao extends JpaRepository<FnDisplayText, Long> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnFunctionDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnFunctionDao.java
new file mode 100644 (file)
index 0000000..6892de2
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnFunction;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+@Repository
+public interface FnFunctionDao extends JpaRepository<FnFunction, String> {
+
+}
index 6e3d829..c79fb0e 100644 (file)
@@ -42,11 +42,15 @@ package org.onap.portal.dao.fn;
 
 import org.onap.portal.domain.db.fn.FnLanguage;
 import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
 import org.springframework.stereotype.Repository;
 import org.springframework.transaction.annotation.Transactional;
 
 @Repository
 @Transactional
 public interface FnLanguageDao extends JpaRepository<FnLanguage, Long> {
+  @Query
+  FnLanguage getByLanguageAlias(final @Param("alias") String alias);
 
 }
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuActivityDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuActivityDao.java
new file mode 100644 (file)
index 0000000..abc8cff
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnLuActivity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+@Repository
+public interface FnLuActivityDao extends JpaRepository<FnLuActivity, String> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuAlertMethodDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuAlertMethodDao.java
new file mode 100644 (file)
index 0000000..cfd22ce
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnLuAlertMethod;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+@Repository
+public interface FnLuAlertMethodDao extends JpaRepository<FnLuAlertMethod, String> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuMenuSetDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuMenuSetDao.java
new file mode 100644 (file)
index 0000000..adcb792
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnLuMenuSet;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface FnLuMenuSetDao extends JpaRepository<FnLuMenuSet, String> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuPriorityDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuPriorityDao.java
new file mode 100644 (file)
index 0000000..98253ce
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnLuPriority;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface FnLuPriorityDao extends JpaRepository<FnLuPriority, Long> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuTabSetDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuTabSetDao.java
new file mode 100644 (file)
index 0000000..bcc3a1b
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnLuTabSet;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface FnLuTabSetDao extends JpaRepository<FnLuTabSet, String> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuDao.java
new file mode 100644 (file)
index 0000000..bbd1b6a
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnMenu;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface FnMenuDao extends JpaRepository<FnMenu, Integer> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalAncestorsDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalAncestorsDao.java
new file mode 100644 (file)
index 0000000..3ffc7bb
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnMenuFunctionalAncestors;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+@Repository
+public interface FnMenuFunctionalAncestorsDao extends JpaRepository<FnMenuFunctionalAncestors, Integer> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalDao.java
new file mode 100644 (file)
index 0000000..0c8ac4a
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import java.util.List;
+import org.onap.portal.domain.db.fn.FnMenuFunctional;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+@Repository
+public interface FnMenuFunctionalDao extends JpaRepository<FnMenuFunctional, Long> {
+  @Query
+  List<FnMenuFunctional> retrieveByMenuId(final @Param("menuId") Long menuId);
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalRolesDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalRolesDao.java
new file mode 100644 (file)
index 0000000..10b189b
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import java.util.List;
+import org.onap.portal.domain.db.fn.FnMenuFunctionalRoles;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+@Repository
+public interface FnMenuFunctionalRolesDao extends JpaRepository<FnMenuFunctionalRoles, Long> {
+
+  @Query
+  List<FnMenuFunctionalRoles> retrieveByRoleId(final @Param("roleId") Long roleId);
+
+  @Query
+  List<FnMenuFunctionalRoles> retrieveByMenuId(final @Param("menuId") Long menuId);
+
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnPersUserAppSelDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnPersUserAppSelDao.java
new file mode 100644 (file)
index 0000000..ff7e6e7
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnPersUserAppSel;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface FnPersUserAppSelDao extends JpaRepository<FnPersUserAppSel, Long> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzCronTriggersDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzCronTriggersDao.java
new file mode 100644 (file)
index 0000000..ec09ae5
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnQzCronTriggers;
+import org.onap.portal.domain.db.fn.compositePK.FnQzTriggersId;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface FnQzCronTriggersDao extends JpaRepository<FnQzCronTriggers, FnQzTriggersId> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzJobDetailsDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzJobDetailsDao.java
new file mode 100644 (file)
index 0000000..3a3a418
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnQzJobDetails;
+import org.onap.portal.domain.db.fn.FnQzJobDetails.FnQzJobDetailsID;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface FnQzJobDetailsDao extends JpaRepository<FnQzJobDetails, FnQzJobDetailsID> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzLocksDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzLocksDao.java
new file mode 100644 (file)
index 0000000..7063cf7
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnQzLocks;
+import org.onap.portal.domain.db.fn.FnQzLocks.FnQzLocksID;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface FnQzLocksDao extends JpaRepository<FnQzLocks, FnQzLocksID> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzSchedulerStateDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzSchedulerStateDao.java
new file mode 100644 (file)
index 0000000..17bbd7f
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnQzSchedulerState;
+import org.onap.portal.domain.db.fn.FnQzSchedulerState.FnQzSchedulerStateID;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface FnQzSchedulerStateDao extends JpaRepository<FnQzSchedulerState, FnQzSchedulerStateID> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzTriggersDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzTriggersDao.java
new file mode 100644 (file)
index 0000000..55a86de
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnQzTriggers;
+import org.onap.portal.domain.db.fn.compositePK.FnQzTriggersId;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface FnQzTriggersDao extends JpaRepository<FnQzTriggers, FnQzTriggersId> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnRestrictedUrlDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnRestrictedUrlDao.java
new file mode 100644 (file)
index 0000000..1bf54d6
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnRestrictedUrl;
+import org.onap.portal.domain.db.fn.FnRestrictedUrl.FnRestrictedUrlId;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface FnRestrictedUrlDao extends JpaRepository<FnRestrictedUrl, FnRestrictedUrlId> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnRoleCompositeDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnRoleCompositeDao.java
new file mode 100644 (file)
index 0000000..89df2c4
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnRoleComposite;
+import org.onap.portal.domain.db.fn.compositePK.FnRoleCompositeId;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface FnRoleCompositeDao extends JpaRepository<FnRoleComposite, FnRoleCompositeId> {
+
+}
index 66f4758..f979be6 100644 (file)
@@ -52,6 +52,31 @@ import org.springframework.transaction.annotation.Transactional;
 @Transactional
 public interface FnRoleDao extends JpaRepository<FnRole, Long> {
 
-       @Query
-       List<FnRole> retrieveAppRoleByAppRoleIdAndByAppId(final @Param("appId") Long appId,  final @Param("appRoleId") Long appRoleId);
+  @Query
+  List<FnRole> retrieveAppRoleByAppRoleIdAndByAppId(final @Param("appId") Long appId,
+      final @Param("appRoleId") Long appRoleId);
+
+  @Query
+  List<FnRole> getUserRoleOnUserIdAndAppId(final @Param("userId") Long userId, final @Param("appId") Long appId);
+
+  @Query
+  List<FnRole> retrieveAppRoleByRoleIdWhereAppIdIsNull(final @Param("roleId") Long roleId);
+
+  @Query
+  List<FnRole> retrieveAppRolesWhereAppIdIsNull();
+
+  @Query
+  List<FnRole> retrieveAppRolesByAppId(final @Param("appId") Long id);
+
+  @Query
+  List<FnRole> retrieveActiveRolesOfApplication(final @Param("appId") Long appId);
+
+  @Query
+  List<FnRole> retrieveAppRolesByRoleNameAndByAppId(final @Param("roleName") String roleName, final @Param("appId") Long appId);
+
+  @Query
+  List<FnRole> getGlobalRolesOfPortal();
+
+  @Query
+  FnRole getSysAdminRoleId();
 }
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnRoleFunctionDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnRoleFunctionDao.java
new file mode 100644 (file)
index 0000000..eaafb78
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnRoleFunction;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+@Repository
+public interface FnRoleFunctionDao extends JpaRepository<FnRoleFunction, Long> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnSharedContextDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnSharedContextDao.java
new file mode 100644 (file)
index 0000000..765bc1d
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnSharedContext;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface FnSharedContextDao extends JpaRepository<FnSharedContext, Long> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnTabDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnTabDao.java
new file mode 100644 (file)
index 0000000..c6518a9
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnTab;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface FnTabDao extends JpaRepository<FnTab, String> {
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnTabSelectedDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnTabSelectedDao.java
new file mode 100644 (file)
index 0000000..42da97e
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.dao.fn;
+
+import org.onap.portal.domain.db.fn.FnTabSelected;
+import org.onap.portal.domain.db.fn.FnTabSelected.FnTabSelectedId;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+@Transactional
+public interface FnTabSelectedDao extends JpaRepository<FnTabSelected, FnTabSelectedId> {
+
+}
index 8dbfb70..f52075c 100644 (file)
@@ -52,10 +52,12 @@ import org.springframework.transaction.annotation.Transactional;
 @Repository
 @Transactional
 public interface FnUserDao extends JpaRepository<FnUser, Long> {
-       Optional<FnUser> findByLoginId(String username);
+
+       @Query
+       Optional<FnUser> findByLoginId(final @Param("loginId") String username);
 
        @Override
-       FnUser getOne(Long integer);
+       FnUser getOne(Long ID);
 
        @Query
        Optional<List<FnUser>> getUserWithOrgUserId(final @Param("orgId") String orgId);
index 9c0a6fe..402304b 100644 (file)
@@ -61,5 +61,11 @@ public interface FnUserRoleDao extends JpaRepository<FnUserRole, Long> {
        List<UserRole> isSuperAdmin(final @Param("orgUserId") String orgUserId, final @Param("roleId") Long roleId, final @Param("appId") Long appId);
 
        @Query
-       List<FnUserRole> getUserRolesForRoleIdAndAppId(final @Param("roleId") Long roleId, final @Param("appId") Long appId);
+       List<FnUserRole> retrieveByAppIdAndUserId(final @Param("appId") Long appId, final @Param("userId") String userId);
+
+       @Query
+       List<FnUserRole> retrieveByAppIdAndRoleId(final @Param("appId") Long appId, final @Param("roleId") Long roleId);
+
+       @Query
+       List<FnUserRole> retrieveByUserIdAndRoleId(final @Param("userId") Long userId, final @Param("roleId") Long roleId);
 }
diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/DomainVo.java b/portal-BE/src/main/java/org/onap/portal/domain/db/DomainVo.java
new file mode 100644 (file)
index 0000000..477d915
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.domain.db;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.Set;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Index;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+import javax.validation.constraints.Digits;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.onap.portal.domain.db.fn.FnUser;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+@Table(name = "domain")
+@Getter
+@Setter
+@Entity
+@NoArgsConstructor
+@AllArgsConstructor
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+public class DomainVo implements Serializable, Cloneable, Comparable {
+
+  private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(DomainVo.class);
+  private static final long serialVersionUID = 1L;
+
+  @Id
+  @GeneratedValue(strategy = GenerationType.AUTO)
+  @Column(name = "id", length = 11, nullable = false, columnDefinition = "bigint AUTO_INCREMENT")
+  @Digits(integer = 11, fraction = 0)
+  private Long id;
+  private LocalDateTime created;
+  private LocalDateTime modified;
+  private Long rowNum;
+  private Serializable auditUserId;
+
+  @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+  @JoinColumn(name = "created_id", columnDefinition = "bigint")
+  private DomainVo createdId;
+  @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+  @JoinColumn(name = "modified_id", columnDefinition = "bigint")
+  private DomainVo modifiedId;
+
+  @OneToMany(
+      targetEntity = DomainVo.class,
+      mappedBy = "createdId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<DomainVo> fnUsersCreatedId;
+  @OneToMany(
+      targetEntity = DomainVo.class,
+      mappedBy = "modifiedId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<DomainVo> fnUsersModifiedId;
+
+  public DomainVo(Long id) {
+    this.id = id;
+  }
+
+  @Override
+  public int compareTo(Object obj) {
+    Long c1 = this.getId();
+    Long c2 = ((org.onap.portalsdk.core.domain.support.DomainVo) obj).getId();
+    return c1 != null && c2 != null ? c1.compareTo(c2) : 1;
+  }
+
+  public Object copy(boolean isIdNull) {
+    ByteArrayOutputStream baos = null;
+    ByteArrayInputStream bais = null;
+    ObjectOutputStream oos = null;
+    ObjectInputStream ois = null;
+    DomainVo newVo = null;
+
+    try {
+      baos = new ByteArrayOutputStream();
+      oos = new ObjectOutputStream(baos);
+      oos.writeObject(this);
+      bais = new ByteArrayInputStream(baos.toByteArray());
+      ois = new ObjectInputStream(bais);
+      newVo = (DomainVo) ois.readObject();
+      if (isIdNull) {
+        newVo.setId(null);
+      }
+    } catch (Exception var8) {
+      logger.error("exception occured", var8);
+    }
+
+    return newVo;
+  }
+
+  public Object clone() throws CloneNotSupportedException {
+    return super.clone();
+  }
+
+  public boolean equals(Object other) {
+    if (this == other) {
+      return true;
+    } else if (other == null) {
+      return false;
+    } else if (!(other instanceof DomainVo)) {
+      return false;
+    } else {
+      DomainVo castOther = (DomainVo) other;
+      return this.getId().equals(castOther.getId())
+          && this.getCreated().equals(castOther.getCreated())
+          && this.getModified().equals(castOther.getModified());
+    }
+  }
+
+  public DomainVo(DomainVo domainVo) {
+    this.id = domainVo.id;
+    this.created = domainVo.created;
+    this.modified = domainVo.modified;
+    this.rowNum = domainVo.rowNum;
+    this.auditUserId = domainVo.auditUserId;
+  }
+}
index 9f50f3b..34e22c4 100644 (file)
@@ -46,6 +46,7 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
@@ -69,7 +70,8 @@ import org.hibernate.annotations.Subselect;
 @NoArgsConstructor
 public class VUrlAccess implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "id", nullable = false)
        private Long id;
        @Column(name = "url", length = 200)
index 6c8296a..ce47c2e 100644 (file)
@@ -43,8 +43,11 @@ package org.onap.portal.domain.db.cr;
 import java.io.Serializable;
 import javax.persistence.Column;
 import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.IdClass;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.Positive;
@@ -77,6 +80,8 @@ CREATE TABLE `cr_favorite_reports` (
 public class CrFavoriteReports implements Serializable{
        @Id
        @Column(name = "user_id", length = 11, nullable = false)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Digits(integer = 11, fraction = 0)
        @Positive
        private Long userId;
index 3dec4ee..f6b8a65 100644 (file)
@@ -43,7 +43,10 @@ package org.onap.portal.domain.db.cr;
 import java.time.LocalDateTime;
 import javax.persistence.Column;
 import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.Size;
@@ -73,6 +76,8 @@ CREATE TABLE `cr_filehist_log` (
 @Entity
 public class CrFilehistLog {
        @Id
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "schedule_id", length = 11, nullable = false)
        @Digits(integer = 11, fraction = 0)
        private Long scheduledId;
index 44e3902..741258b 100644 (file)
@@ -54,6 +54,7 @@ import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
 import javax.persistence.OneToMany;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
@@ -93,7 +94,8 @@ CREATE TABLE `cr_folder` (
 @Entity
 public class CrFolder implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "folder_id", length = 11, nullable = false)
        @Digits(integer = 11, fraction = 0)
        @Positive
@@ -114,7 +116,7 @@ public class CrFolder implements Serializable {
        @Column(name = "create_date", nullable = false, columnDefinition = "datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()")
        @NotNull
        private LocalDateTime createDate;
-       @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+       @ManyToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
        @JoinColumn(name = "parent_Folder_Id")
        private CrFolder parentFolderId;
        @Column(name = "public_Yn", length = 1, nullable = false, columnDefinition = "varchar(1) DEFAULT 'n'")
@@ -125,7 +127,7 @@ public class CrFolder implements Serializable {
        @OneToMany(
                targetEntity = CrFolder.class,
                mappedBy = "parentFolderId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<CrFolder> crFolders;
index 05ec246..7a99359 100644 (file)
@@ -47,6 +47,7 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
@@ -80,7 +81,8 @@ CREATE TABLE `cr_folder_access` (
 @Entity
 public class CrFolderAccess implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "folder_access_id", length = 11, nullable = false)
        @Digits(integer = 11, fraction = 0)
        @Positive
index 94201c5..e4393d9 100644 (file)
@@ -46,8 +46,11 @@ import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.OneToMany;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
@@ -81,6 +84,8 @@ CREATE TABLE `cr_lu_file_type` (
 public class CrLuFileType implements Serializable {
        @Id
        @Column(name = "lookup_id", length = 2, nullable = false)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Digits(integer = 2, fraction = 0)
        @Positive
        private Long lookupId;
@@ -101,7 +106,7 @@ public class CrLuFileType implements Serializable {
        @OneToMany(
                targetEntity = CrReportFileHistory.class,
                mappedBy = "fileTypeId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<CrReportFileHistory> crReportFileHistories;
index 791518d..a7e6fdc 100644 (file)
@@ -201,35 +201,35 @@ public class CrReport implements Serializable {
        @OneToMany(
                targetEntity = CrReportSchedule.class,
                mappedBy = "repId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<CrReportSchedule> crReportSchedules;
        @OneToMany(
                targetEntity = CrReportAccess.class,
                mappedBy = "repId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<CrReportAccess> crReportAccesses;
        @OneToMany(
                targetEntity = CrReportLog.class,
                mappedBy = "repId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<CrReportLog> crReportLogs;
        @OneToMany(
                targetEntity = CrReportEmailSentLog.class,
                mappedBy = "repId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<CrReportEmailSentLog> crReportEmailSentLogs;
        @OneToMany(
                targetEntity = CrReportFileHistory.class,
                mappedBy = "repId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<CrReportFileHistory> crReportFileHistories;
index 2eb50c7..15aaf02 100644 (file)
@@ -87,7 +87,7 @@ CREATE TABLE `cr_report_access` (
 @IdClass(CrReportAccessId.class)
 public class CrReportAccess implements Serializable{
        @Id
-       @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+       @ManyToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
        @JoinColumn(name = "rep_id")
        @Valid
        private CrReport repId;
index e43c5c7..7a63890 100644 (file)
@@ -103,7 +103,7 @@ public class CrReportEmailSentLog implements Serializable {
        @SafeHtml
        @NotNull
        private String genKey;
-       @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+       @ManyToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
        @JoinColumn(name = "rep_id", nullable = false)
        @NotNull
        @Valid
index 05696ab..63aafa7 100644 (file)
@@ -47,12 +47,15 @@ import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.JoinTable;
 import javax.persistence.ManyToMany;
 import javax.persistence.ManyToOne;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.Valid;
 import javax.validation.constraints.Digits;
@@ -108,6 +111,7 @@ CREATE TABLE `cr_report_file_history` (
 public class CrReportFileHistory implements Serializable {
        @Id
        @Column(name = "hist_id", nullable = false, length = 11)
+       @GeneratedValue(strategy = GenerationType.AUTO)
        @Digits(integer = 11, fraction = 0)
        private Long histId;
        @Column(name = "sched_user_id", nullable = false)
@@ -122,7 +126,7 @@ public class CrReportFileHistory implements Serializable {
        @Digits(integer = 11, fraction = 0)
        @NotNull
        private Long userId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "rep_id")
        @Valid
        private CrReport repId;
@@ -133,7 +137,7 @@ public class CrReportFileHistory implements Serializable {
        @Size(max = 50)
        @SafeHtml
        private String recurrence;
-       @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+       @ManyToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
        @JoinColumn(name = "file_type_id")
        @Valid
        private CrLuFileType fileTypeId;
@@ -170,11 +174,11 @@ public class CrReportFileHistory implements Serializable {
        @Digits(integer = 38, fraction = 0)
        private Long deletedBy;
 
-       @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+       @ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
        @JoinTable(
                name = "cr_hist_user_map",
                joinColumns = {@JoinColumn(name = "hist_id", referencedColumnName = "hist_id")},
-               inverseJoinColumns = {@JoinColumn(name = "user_id", referencedColumnName = "user_id")}
+               inverseJoinColumns = {@JoinColumn(name = "user_id", referencedColumnName = "id", columnDefinition = "bigint not null")}
        )
        private Set<FnUser> fnUserList;
 }
index 30a0b27..2c05fa5 100644 (file)
@@ -52,6 +52,7 @@ import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.Valid;
 import javax.validation.constraints.Digits;
@@ -87,10 +88,11 @@ CREATE TABLE `cr_report_log` (
 @Entity
 public class CrReportLog implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @JoinColumn(name = "id")
        private Long id;
-       @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+       @ManyToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
        @JoinColumn(name = "rep_id")
        @NotNull
        @Valid
index 611dd19..0920f18 100644 (file)
@@ -53,6 +53,7 @@ import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
 import javax.persistence.OneToMany;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.Valid;
 import javax.validation.constraints.Digits;
@@ -102,7 +103,8 @@ CREATE TABLE `cr_report_schedule` (
 @Entity
 public class CrReportSchedule implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "schedule_id", length = 11, nullable = false)
        @Digits(integer = 11, fraction = 0)
        @Positive
@@ -112,7 +114,7 @@ public class CrReportSchedule implements Serializable {
        @Positive
        @NotNull
        private Long schedUserId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "rep_id", nullable = false)
        @Valid
        @NotNull
@@ -180,7 +182,7 @@ public class CrReportSchedule implements Serializable {
        @OneToMany(
                targetEntity = CrReportScheduleUsers.class,
                mappedBy = "scheduleId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<CrReportScheduleUsers> crReportScheduleUsers;
index 237956c..8c6d761 100644 (file)
@@ -84,7 +84,7 @@ CREATE TABLE `cr_report_schedule_users` (
 @IdClass(CrReportScheduleUsersId.class)
 public class CrReportScheduleUsers implements Serializable{
        @Id
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "schedule_id", nullable = false)
        @Valid
        @NotNull
index a886bfd..466902a 100644 (file)
@@ -43,7 +43,10 @@ package org.onap.portal.domain.db.cr;
 import java.io.Serializable;
 import javax.persistence.Column;
 import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Pattern;
@@ -72,6 +75,8 @@ public class CrReportTemplateMap implements Serializable {
        @Id
        @Column(name = "report_id", nullable = false)
        @NotNull
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        private Long reportId;
        @Column(name = "template_file", length = 200)
        @Pattern(regexp = "[YNyn]")
index eb1117c..c894bf0 100644 (file)
@@ -51,6 +51,7 @@ import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.Valid;
 import javax.validation.constraints.NotNull;
@@ -86,15 +87,16 @@ CREATE TABLE `cr_table_join` (
 public class CrTableJoin implements Serializable {
        //TODO Unique constrains {srcTableName, destTableName}?
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "id", nullable = false, columnDefinition = "int(11) auto_increment")
        private Long id;
-       @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+       @ManyToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
        @JoinColumn(name = "src_table_name", nullable = false)
        @Valid
        @NotNull
        private CrTableSource srcTableName;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "dest_table_name", nullable = false)
        @Valid
        @NotNull
index 7b6a301..8042c41 100644 (file)
@@ -82,7 +82,7 @@ public class CrTableRole implements Serializable{
        @Id
        @Valid
        @JoinColumn(name = "table_name", nullable = false)
-       @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+       @ManyToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
        private CrTableSource tableName;
        @Id
        @Digits(integer = 11, fraction = 0)
index 791e561..078b538 100644 (file)
@@ -113,21 +113,21 @@ public class CrTableSource implements Serializable {
        @OneToMany(
                targetEntity = CrTableJoin.class,
                mappedBy = "srcTableName",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<CrTableJoin> crTableJoins;
        @OneToMany(
                targetEntity = CrTableJoin.class,
                mappedBy = "destTableName",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<CrTableJoin> crTableJoins1;
        @OneToMany(
                targetEntity = CrTableRole.class,
                mappedBy = "tableName",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<CrTableRole> crTableRoles;
index d37c71e..2c23c3d 100644 (file)
 package org.onap.portal.domain.db.ep;
 
 import java.io.Serializable;
+import java.time.LocalDateTime;
 import java.util.Set;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
 import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
 import javax.persistence.OneToMany;
 import javax.persistence.Table;
 import javax.validation.Valid;
+import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
-import lombok.EqualsAndHashCode;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.hibernate.validator.constraints.SafeHtml;
-import org.onap.portal.domain.db.ep.EpAppFunction.EpAppFunctionId;
+import org.onap.portal.domain.db.DomainVo;
 import org.onap.portal.domain.db.fn.FnApp;
 
 /*
@@ -76,51 +78,90 @@ CREATE TABLE `ep_app_function` (
         )
 */
 
-@Table(name = "ep_app_function", indexes = {@Index(name = "fk_ep_app_function_app_id", columnList = "app_id")})
+@NamedQueries({
+    @NamedQuery(
+        name = "EpAppFunction.getAppRoleFunctionList",
+        query = "from\n"
+            + "  EpAppRoleFunction rf,\n"
+            + "  EpAppFunction f\n"
+            + " where\n"
+            + "  rf.fnRole.id = :roleId\n"
+            + "  and rf.appId.id = :appId\n"
+            + "  and rf.appId.id = f.appId.id\n"
+            + "  and rf.epAppFunction.functionCd = f.functionCd"
+    )
+})
+
+@Table(name = "ep_app_function", indexes = {
+    @Index(name = "fk_ep_app_function_app_id", columnList = "app_id"),
+    @Index(name = "fk_ep_app_id_function_cd", columnList = "app_id, function_cd", unique = true)})
 
 @Getter
 @Setter
 @Entity
-@IdClass(EpAppFunctionId.class)
 @NoArgsConstructor
 @AllArgsConstructor
-public class EpAppFunction implements Serializable{
-       @Id
-       @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
-       @JoinColumn(name = "app_id")
-       @Valid
-       private FnApp appId;
-       @Id
-       @Column(name = "function_cd", length = 250, nullable = false)
-       @Size(max = 250)
-       @NotNull
-       @SafeHtml
-       private String functionCd;
-       @Column(name = "function_name", length = 250, nullable = false)
-       @Size(max = 250)
-       @NotNull
-       @SafeHtml
-       private String functionName;
-       @OneToMany(
-               targetEntity = EpAppRoleFunction.class,
-               mappedBy = "epAppFunction",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<EpAppRoleFunction> epAppRoleFunctions;
+public class EpAppFunction extends DomainVo implements Serializable {
+
+  @ManyToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
+  @JoinColumn(name = "app_id", columnDefinition = "bigint")
+  @Valid
+  private FnApp appId;
+  @Column(name = "function_cd", length = 250, nullable = false)
+  @Size(max = 250)
+  @NotNull
+  @SafeHtml
+  private String functionCd;
+  @Column(name = "function_name", length = 250, nullable = false)
+  @Size(max = 250)
+  @NotNull
+  @SafeHtml
+  private String functionName;
+
+  private Long roleId;
+  private String type;
+  @SafeHtml
+  private String action;
+  @SafeHtml
+  private String editUrl;
+
+  @OneToMany(
+      targetEntity = EpAppRoleFunction.class,
+      mappedBy = "epAppFunction",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<EpAppRoleFunction> epAppRoleFunctions;
+
+  public EpAppFunction(Long id, String code, String name, FnApp appId, String type, String action, String editUrl) {
+    super();
+    super.setId(id);
+    this.functionCd = code;
+    this.functionName = name;
+    this.appId = appId;
+    this.type = type;
+    this.action = action;
+    this.editUrl = editUrl;
+  }
 
-       @Getter
-       @Setter
-       @EqualsAndHashCode
-       @NoArgsConstructor
-       @AllArgsConstructor
-       public static class EpAppFunctionId implements Serializable {
-              @Valid
-              private FnApp appId;
-              @Size(max = 250)
-              @NotNull
-              @SafeHtml
-              private String functionCd;
-       }
+  @Builder
+  public EpAppFunction(@Digits(integer = 11, fraction = 0) Long id,
+      LocalDateTime created, LocalDateTime modified, Long rowNum, Serializable auditUserId,
+      DomainVo createdId, DomainVo modifiedId, Set<DomainVo> fnUsersCreatedId,
+      Set<DomainVo> fnUsersModifiedId, @Valid FnApp appId,
+      @Size(max = 250) @NotNull @SafeHtml String functionCd,
+      @Size(max = 250) @NotNull @SafeHtml String functionName, Long roleId, String type,
+      @SafeHtml String action, @SafeHtml String editUrl,
+      Set<EpAppRoleFunction> epAppRoleFunctions) {
+    super(id, created, modified, rowNum, auditUserId, createdId, modifiedId, fnUsersCreatedId, fnUsersModifiedId);
+    this.appId = appId;
+    this.functionCd = functionCd;
+    this.functionName = functionName;
+    this.roleId = roleId;
+    this.type = type;
+    this.action = action;
+    this.editUrl = editUrl;
+    this.epAppRoleFunctions = epAppRoleFunctions;
+  }
 }
 
index 8a60688..3cb219a 100644 (file)
@@ -58,6 +58,7 @@ import javax.validation.Valid;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -83,41 +84,43 @@ CREATE TABLE `ep_app_role_function` (
 */
 
 @Table(name = "ep_app_role_function", indexes = {
-        @Index(name = "fk_ep_app_role_function_ep_app_func_role_id", columnList = "app_id, role_id, function_cd", unique = true),
-        @Index(name = "fk_ep_app_role_function_ep_app_func", columnList = "app_id, function_cd"),
-        @Index(name = "fk_ep_app_role_function_role_id", columnList = "role_id")
+    @Index(name = "fk_ep_app_role_function_ep_app_func_role_id", columnList = "app_id, role_id, function_cd", unique = true),
+    @Index(name = "fk_ep_app_role_function_ep_app_func", columnList = "app_id, function_cd"),
+    @Index(name = "fk_ep_app_role_function_role_id", columnList = "role_id")
 })
 @NoArgsConstructor
 @AllArgsConstructor
 @Getter
 @Setter
 @Entity
+@Builder
 public class EpAppRoleFunction implements Serializable {
-       @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
-       @Column(name = "id", length = 11, nullable = false, columnDefinition = "int(11) NOT NULL AUTO_INCREMENT")
-       @Digits(integer = 11, fraction = 0)
-       private Integer id;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "app_id", insertable = false, updatable = false)
-       @Valid
-       @NotNull
-       private FnApp appId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "role_id")
-       @Valid
-       @NotNull
-       private FnRole fnRole;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumns({
-               @JoinColumn(name = "app_id", referencedColumnName = "app_id"),
-               @JoinColumn(name = "function_cd", referencedColumnName = "function_cd")
-       })
-       @Valid
-       @NotNull
-       private EpAppFunction epAppFunction;
-       @Column(name = "role_app_id", length = 20)
-       @Digits(integer = 20, fraction = 0)
-       @SafeHtml
-       private String roleAppId;
+
+  @Id
+  @GeneratedValue(strategy = GenerationType.AUTO)
+  @Column(name = "id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
+  @Digits(integer = 11, fraction = 0)
+  private Integer id;
+  @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+  @JoinColumn(name = "app_id", insertable = false, updatable = false, columnDefinition = "bigint")
+  @Valid
+  @NotNull
+  private FnApp appId;
+  @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+  @JoinColumn(name = "role_id", columnDefinition = "bigint")
+  @Valid
+  @NotNull
+  private FnRole fnRole;
+  @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+  @JoinColumns({
+      @JoinColumn(name = "app_id", referencedColumnName = "app_id"),
+      @JoinColumn(name = "function_cd", referencedColumnName = "function_cd")
+  })
+  @Valid
+  @NotNull
+  private EpAppFunction epAppFunction;
+  @Column(name = "role_app_id", length = 20)
+  @Digits(integer = 20, fraction = 0)
+  @SafeHtml
+  private String roleAppId;
 }
index c65c0d3..7f42a0f 100644 (file)
@@ -56,6 +56,7 @@ import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Pattern;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -75,40 +76,38 @@ CREATE TABLE `ep_basic_auth_account` (
 @Table(name = "ep_basic_auth_account")
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
 public class EpBasicAuthAccount implements Serializable {
-       @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
-       @Column(name = "id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
-       @Digits(integer = 11, fraction = 0)
-       private Long id;
-       @Column(name = "ext_app_name", length = 50, nullable = false)
-       @Size(max = 50)
-       @SafeHtml
-       @NotNull
-       private String extAppName;
-       @Column(name = "username", length = 50, nullable = false)
-       @Size(max = 50)
-       @SafeHtml
-       @NotNull
-       private String username;
-       @Column(name = "password", length = 50)
-       @Size(max = 50)
-       @SafeHtml
-       private String password;
-       @Column(name = "active_yn", length = 1, nullable = false, columnDefinition = "char(1) NOT NULL default 'Y'")
-       @Pattern(regexp = "[YNyn]")
-       @Size(max = 1)
-       @NotNull
-       @SafeHtml
-       private String activeYn;
-       @OneToMany(
-               targetEntity = EpEndpointsBasicAuthAccount.class,
-               mappedBy = "accountId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<EpEndpointsBasicAuthAccount> epEndpointsBasicAuthAccounts;
+
+  @Id
+  @GeneratedValue(strategy = GenerationType.AUTO)
+  @Column(name = "id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
+  @Digits(integer = 11, fraction = 0)
+  private Long id;
+  @Column(name = "ext_app_name", length = 50, nullable = false)
+  @Size(max = 50)
+  @SafeHtml
+  @NotNull
+  private String extAppName;
+  @Column(name = "username", length = 50, nullable = false)
+  @Size(max = 50)
+  @SafeHtml
+  @NotNull
+  private String username;
+  @Column(name = "password", length = 50)
+  @Size(max = 50)
+  @SafeHtml
+  private String password;
+  @Column(name = "active_yn", nullable = false, columnDefinition = "boolean default true")
+  private Boolean activeYn;
+  @OneToMany(
+      targetEntity = EpEndpointsBasicAuthAccount.class,
+      mappedBy = "accountId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<EpEndpointsBasicAuthAccount> epEndpointsBasicAuthAccounts;
 }
index ccb1bb2..a176611 100644 (file)
@@ -50,6 +50,7 @@ import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.OneToMany;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
@@ -77,7 +78,8 @@ CREATE TABLE `ep_endpoints` (
 @Entity
 public class EpEndpoints implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
        @Digits(integer = 11, fraction = 0)
        private Long id;
@@ -92,7 +94,7 @@ public class EpEndpoints implements Serializable {
        @OneToMany(
                targetEntity = EpEndpointsBasicAuthAccount.class,
                mappedBy = "epId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<EpEndpointsBasicAuthAccount> epEndpointsBasicAuthAccounts;
index 9cf7d36..2f36b1a 100644 (file)
@@ -53,6 +53,7 @@ import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.Valid;
 import javax.validation.constraints.Digits;
@@ -95,15 +96,16 @@ CREATE TABLE `ep_endpoints_basic_auth_account` (
 @Entity
 public class EpEndpointsBasicAuthAccount implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
        @Digits(integer = 11, fraction = 0)
        private Long id;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "ep_id", columnDefinition = "INT(11) DEFAULT NULL")
        @Valid
        private EpEndpoints epId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "account_id", columnDefinition = "INT(11) DEFAULT NULL")
        @Valid
        private EpBasicAuthAccount accountId;
index 6c6b39c..69e28dc 100644 (file)
@@ -54,12 +54,14 @@ import javax.persistence.JoinColumn;
 import javax.persistence.ManyToMany;
 import javax.persistence.ManyToOne;
 import javax.persistence.OneToMany;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.Valid;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.Pattern;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -89,6 +91,7 @@ CREATE TABLE `ep_microservice` (
 })
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
@@ -106,8 +109,8 @@ public class EpMicroservice implements Serializable {
        @Size(max = 50)
        @SafeHtml
        private String description;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "app_Id")
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+       @JoinColumn(name = "app_Id", columnDefinition = "bigint")
        @Valid
        private FnApp appId;
        @Column(name = "endpoint_url", length = 200)
@@ -128,17 +131,14 @@ public class EpMicroservice implements Serializable {
        @Size(max = 50)
        @SafeHtml
        private String password;
-       @Column(name = "active", length = 1, columnDefinition = "CHAR(1) DEFAULT 'Y'")
-       @Pattern(regexp = "[YNyn]")
-       @Size(max = 1)
-       @SafeHtml
-       private String active;
-       @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+       @Column(name = "active", length = 1, columnDefinition = "boolean DEFAULT true")
+       private Boolean active = true;
+       @ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
        private Set<EpWidgetCatalog> epWidgetCatalogList;
        @OneToMany(
                targetEntity = EpMicroserviceParameter.class,
                mappedBy = "serviceId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<EpMicroserviceParameter> epMicroserviceParameters;
index 36c073a..74b051f 100644 (file)
@@ -98,11 +98,11 @@ CREATE TABLE `ep_microservice_parameter` (
 public class EpMicroserviceParameter implements Serializable {
 
        @Id
-       @GeneratedValue(strategy = GenerationType.IDENTITY)
+       @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "id", length = 11, nullable = false)
        @Digits(integer = 11, fraction = 0)
        private Long id;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "service_id")
        private EpMicroservice serviceId;
        @Column(name = "para_key", length = 50)
@@ -116,7 +116,7 @@ public class EpMicroserviceParameter implements Serializable {
        @OneToMany(
                targetEntity = EpWidgetCatalogParameter.class,
                mappedBy = "paramId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<EpWidgetCatalogParameter> epWidgetCatalogParameter;
index 424f61b..a10cc3e 100644 (file)
@@ -51,6 +51,7 @@ import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.OneToMany;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.FutureOrPresent;
@@ -91,7 +92,8 @@ CREATE TABLE `ep_notification` (
 @Entity
 public class EpNotification implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "notification_ID", length = 11, nullable = false)
        @Digits(integer = 11, fraction = 0)
        private Long notificationID;
@@ -145,14 +147,14 @@ public class EpNotification implements Serializable {
        @OneToMany(
                targetEntity = EpRoleNotification.class,
                mappedBy = "notificationID",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<EpRoleNotification> epRoleNotifications;
        @OneToMany(
                targetEntity = EpUserNotification.class,
                mappedBy = "notificationId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<EpUserNotification> epUserNotifications;
index 1976533..a6bf71a 100644 (file)
@@ -53,12 +53,14 @@ import javax.persistence.JoinColumn;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
 import javax.persistence.OneToOne;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.Valid;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -88,23 +90,23 @@ CREATE TABLE `ep_pers_user_app_sort` (
 })
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
 public class EpPersUserAppSort implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
        @Digits(integer = 11, fraction = 0)
        private Long id;
-       @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "user_id", unique = true, nullable = false)
+       @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+       @JoinColumn(name = "user_id", unique = true, nullable = false, columnDefinition = "bigint")
        @NotNull
        @Valid
        private FnUser userID;
-       @Column(name = "sort_pref", length = 1, nullable = false)
-       @Size(max = 1)
+       @Column(name = "sort_pref", nullable = false)
        @NotNull
-       @SafeHtml
-       private String sortPref;
+       private Integer sortPref;
 }
index b1e472f..7dbb483 100644 (file)
@@ -53,6 +53,7 @@ import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.Valid;
 import javax.validation.constraints.Digits;
@@ -83,7 +84,7 @@ CREATE TABLE `ep_pers_user_widget_placement` (
 @NamedQueries({
         @NamedQuery(
                 name = "EpPersUserWidgetPlacement.retrieveByUserId",
-                query = "from EpPersUserWidgetPlacement where USER_ID =:userId"
+                query = "from EpPersUserWidgetPlacement where userId =:userId"
         )
 })
 
@@ -98,16 +99,17 @@ CREATE TABLE `ep_pers_user_widget_placement` (
 @Entity
 public class EpPersUserWidgetPlacement implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
        @Digits(integer = 11, fraction = 0)
        private Long id;
-       @ManyToOne(fetch = FetchType.LAZY,cascade = CascadeType.ALL)
-       @JoinColumn(name = "user_id", nullable = false)
+       @ManyToOne(fetch = FetchType.LAZY,cascade = CascadeType.MERGE)
+       @JoinColumn(name = "user_id", nullable = false, columnDefinition = "bigint")
        @NotNull
        @Valid
        private FnUser userId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "widget_id", nullable = false)
        @NotNull
        @Valid
index 4b2785f..2d4c76f 100644 (file)
@@ -45,9 +45,6 @@ import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
 import javax.persistence.NamedQueries;
@@ -55,7 +52,6 @@ import javax.persistence.NamedQuery;
 import javax.persistence.Table;
 import javax.persistence.UniqueConstraint;
 import javax.validation.Valid;
-import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
@@ -64,7 +60,7 @@ import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.hibernate.validator.constraints.SafeHtml;
 import org.onap.portal.domain.db.fn.FnUser;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 /*
 CREATE TABLE `ep_pers_user_widget_sel` (
@@ -82,7 +78,7 @@ CREATE TABLE `ep_pers_user_widget_sel` (
 @NamedQueries({
         @NamedQuery(
                 name = "EpPersUserWidgetSel.getEpPersUserWidgetSelForUserIdAndWidgetId",
-                query = "FROM EpPersUserWidgetSel WHERE userId.userId = :USERID and widgetId.widgetId = :WIDGETID")
+                query = "FROM EpPersUserWidgetSel WHERE userId.id = :USERID and widgetId.widgetId = :WIDGETID")
 })
 @Table(name = "ep_pers_user_widget_sel", uniqueConstraints = {
         @UniqueConstraint(columnNames = {"user_id", "widget_id"})
@@ -94,17 +90,12 @@ CREATE TABLE `ep_pers_user_widget_sel` (
 @Entity
 public class EpPersUserWidgetSel extends DomainVo implements Serializable {
 
-       @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
-       @Column(name = "id", length = 11, nullable = false)
-       @Digits(integer = 11, fraction = 0)
-       private Long id;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "user_id", nullable = false)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+       @JoinColumn(name = "user_id", nullable = false, columnDefinition = "bigint")
        @NotNull
        @Valid
        private FnUser userId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "widget_id", nullable = false)
        @NotNull
        @Valid
index 94df52d..53e4807 100644 (file)
@@ -51,6 +51,7 @@ import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.Valid;
 import javax.validation.constraints.Digits;
@@ -87,16 +88,17 @@ CREATE TABLE `ep_role_notification` (
 @Entity
 public class EpRoleNotification implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "ID", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
        @Digits(integer = 11, fraction = 0)
        private Long id;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "notification_ID")
        @Valid
        private EpNotification notificationID;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "role_ID")
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+       @JoinColumn(name = "role_ID", columnDefinition = "bigint")
        @Valid
        private FnRole roleID;
        @Column(name = "recv_user_id", length = 11, columnDefinition = "int(11) DEFAULT NULL")
index 15bb2b9..441eb52 100644 (file)
@@ -52,6 +52,7 @@ import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.Valid;
 import javax.validation.constraints.Digits;
@@ -91,15 +92,16 @@ CREATE TABLE `ep_user_notification` (
 @Entity
 public class EpUserNotification implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "ID", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
        @Digits(integer = 11, fraction = 0)
        private Integer id;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "User_ID")
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+       @JoinColumn(name = "User_ID", columnDefinition = "bigint")
        @Valid
        private FnUser userId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "notification_ID")
        @Valid
        private EpNotification notificationId;
index 52d06b2..113863c 100644 (file)
@@ -52,7 +52,10 @@ import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
 import javax.persistence.OneToMany;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.Valid;
 import javax.validation.constraints.Digits;
@@ -83,6 +86,13 @@ CREATE TABLE `ep_user_roles_request` (
         )
 */
 
+@NamedQueries({
+    @NamedQuery(
+        name = "EpUserRolesRequest.userAppRolesRequestList",
+        query = "FROM EpUserRolesRequest where userId.id =:userId and appId.id =:appId and requestStatus = 'P'"
+    )
+})
+
 @Table(name = "ep_user_roles_request")
 @NoArgsConstructor
 @AllArgsConstructor
@@ -91,17 +101,18 @@ CREATE TABLE `ep_user_roles_request` (
 @Entity
 public class EpUserRolesRequest implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "req_id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
        @Digits(integer = 11, fraction = 0)
        private Long reqId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "user_id", nullable = false)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+       @JoinColumn(name = "user_id", nullable = false, columnDefinition = "bigint")
        @NotNull
        @Valid
        private FnUser userId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "app_id", nullable = false)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+       @JoinColumn(name = "app_id", nullable = false, columnDefinition = "bigint")
        @NotNull
        @Valid
        private FnApp appId;
@@ -119,8 +130,12 @@ public class EpUserRolesRequest implements Serializable {
        @OneToMany(
                targetEntity = EpUserRolesRequestDet.class,
                mappedBy = "reqId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<EpUserRolesRequestDet> epUserRolesRequestDets;
+
+       public void setEpRequestIdDetail(Set<EpUserRolesRequestDet> epMyLoginsDetail) {
+              this.epUserRolesRequestDets = epMyLoginsDetail;
+       }
 }
index 7604453..4d2fcae 100644 (file)
@@ -51,7 +51,10 @@ import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
 import javax.persistence.OneToOne;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.Valid;
 import javax.validation.constraints.Digits;
@@ -78,6 +81,13 @@ CREATE TABLE `ep_user_roles_request_det` (
         )
 */
 
+@NamedQueries({
+    @NamedQuery(
+        name = "EpUserRolesRequestDet.appRolesRequestDetailList",
+        query = "FROM EpUserRolesRequestDet where reqId.reqId = :reqId"
+    )
+})
+
 @Table(name = "ep_user_roles_request_det", indexes = {
         @Index(name = "fk_user_roles_req_fn_req_id", columnList = "req_id"),
         @Index(name = "fk_user_roles_req_fn_role_id", columnList = "requested_role_id")
@@ -90,16 +100,17 @@ CREATE TABLE `ep_user_roles_request_det` (
 public class EpUserRolesRequestDet implements Serializable {
 
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
        @Digits(integer = 11, fraction = 0)
        private Long id;
-       @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "req_id", columnDefinition = "int(11) default null")
        @Valid
        private EpUserRolesRequest reqId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "requested_role_id", nullable = false)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+       @JoinColumn(name = "requested_role_id", nullable = false, columnDefinition = "bigint")
        @NotNull
        @Valid
        private FnRole requestedRoleId;
index 429bac1..4b27a21 100644 (file)
@@ -51,6 +51,7 @@ import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.Valid;
 import javax.validation.constraints.Digits;
@@ -85,12 +86,13 @@ CREATE TABLE `ep_web_analytics_source` (
 @Entity
 public class EpWebAnalyticsSource implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "resource_id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
        @Digits(integer = 11, fraction = 0)
        private Integer resourceId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "app_id", nullable = false)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+       @JoinColumn(name = "app_id", nullable = false, columnDefinition = "bigint")
        @NotNull
        @Valid
        private FnApp appId;
index 061aafc..0aee615 100644 (file)
@@ -57,7 +57,6 @@ import javax.persistence.OneToMany;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
@@ -87,7 +86,7 @@ CREATE TABLE `ep_widget_catalog` (
 @Builder
 public class EpWidgetCatalog implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.IDENTITY)
+       @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "widget_id", nullable = false)
        private Long widgetId;
        @Column(name = "wdg_name", length = 100, columnDefinition = "varchar(100) default '?'", nullable = false)
@@ -107,10 +106,10 @@ public class EpWidgetCatalog implements Serializable {
        @NotNull
        @SafeHtml
        private String wdgFileLoc;
-       @Column(name = "all_user_flag", length = 1, columnDefinition = "boolean default '0'", nullable = false)
+       @Column(name = "all_user_flag", length = 1, columnDefinition = "boolean default false", nullable = false)
        @NotNull
        private Boolean allUserFlag;
-       @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+       @ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
        @JoinTable(
                name = "ep_widget_microservice",
                joinColumns = {@JoinColumn(name = "widget_id", referencedColumnName = "widget_id")},
@@ -124,35 +123,35 @@ public class EpWidgetCatalog implements Serializable {
        @OneToMany(
                targetEntity = EpWidgetCatalogRole.class,
                mappedBy = "widgetId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<EpWidgetCatalogRole> widgetCatalogRoles;
        @OneToMany(
                targetEntity = EpPersUserWidgetSel.class,
                mappedBy = "widgetId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<EpPersUserWidgetSel> epPersUserWidgetSels;
        @OneToMany(
                targetEntity = EpPersUserWidgetSel.class,
                mappedBy = "widgetId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<EpPersUserWidgetSel> persUserWidgetSels;
        @OneToMany(
                targetEntity = EpPersUserWidgetPlacement.class,
                mappedBy = "widgetId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<EpPersUserWidgetPlacement> epPersUserWidgetPlacements;
        @OneToMany(
                targetEntity = EpWidgetCatalogParameter.class,
                mappedBy = "widgetId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<EpWidgetCatalogParameter> epWidgetCatalogParameters;
index fe91d23..82ee9f1 100644 (file)
@@ -46,11 +46,13 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -72,12 +74,14 @@ CREATE TABLE `ep_widget_catalog_files` (
 @Table(name = "ep_widget_catalog_files")
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
 public class EpWidgetCatalogFiles implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "file_id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
        @Digits(integer = 11, fraction = 0)
        private Long fileId;
index ec6bb56..ababeab 100644 (file)
@@ -45,9 +45,6 @@ import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
@@ -55,7 +52,6 @@ import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
 import javax.persistence.Table;
 import javax.validation.Valid;
-import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
@@ -65,7 +61,7 @@ import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.hibernate.validator.constraints.SafeHtml;
 import org.onap.portal.domain.db.fn.FnUser;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 /*
 CREATE TABLE `ep_widget_catalog_parameter` (
@@ -94,7 +90,7 @@ CREATE TABLE `ep_widget_catalog_parameter` (
                 query = "DELETE FROM EpWidgetCatalogParameter WHERE paramId.id = :PARAMID"),
         @NamedQuery(
                 name = "EpWidgetCatalogParameter.getUserParamById",
-                query = "FROM EpWidgetCatalogParameter WHERE paramId.id = :PARAMID and userId.userId = :USERID and widgetId.widgetId = :WIDGETID"
+                query = "FROM EpWidgetCatalogParameter WHERE paramId.id = :PARAMID and userId.id = :USERID and widgetId.widgetId = :WIDGETID"
         )
 })
 
@@ -111,23 +107,17 @@ CREATE TABLE `ep_widget_catalog_parameter` (
 @NoArgsConstructor
 @AllArgsConstructor
 public class EpWidgetCatalogParameter extends DomainVo implements Serializable {
-
-       @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
-       @Column(name = "id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
-       @Digits(integer = 11, fraction = 0)
-       private Long id;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "widget_id", nullable = false)
        @NotNull
        @Valid
        private EpWidgetCatalog widgetId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "user_id", nullable = false)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+       @JoinColumn(name = "user_id", nullable = false, columnDefinition = "bigint")
        @NotNull
        @Valid
        private FnUser userId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "param_id", nullable = false)
        @NotNull
        @Valid
index b226b92..f512429 100644 (file)
@@ -89,17 +89,17 @@ public class EpWidgetCatalogRole implements Serializable {
        @Column(name = "id", length = 11, nullable = false)
        @Digits(integer = 11, fraction = 0)
        private Long id;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "widget_id", nullable = false)
        @NotNull
        @Valid
        private EpWidgetCatalog widgetId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "app_id", columnDefinition = "bigint default '1'")
        @Valid
        private FnApp appId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "role_id", nullable = false)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+       @JoinColumn(name = "role_id", nullable = false, columnDefinition = "bigint")
        @NotNull
        @Valid
        private FnRole roleId;
index d96524e..ece3896 100644 (file)
@@ -46,6 +46,7 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import lombok.AllArgsConstructor;
@@ -72,6 +73,7 @@ CREATE TABLE `ep_widget_preview_files` (
 @Entity
 public class EpWidgetPreviewFiles implements Serializable {
        @Id
+       @SequenceGenerator(name="portal_generator", sequenceName = "portal_generator", initialValue = 1000)
        @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "preview_id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
        @Digits(integer = 11, fraction = 0)
index bada8e1..307abeb 100644 (file)
 package org.onap.portal.domain.db.fn;
 
 import java.io.Serializable;
+import java.time.LocalDateTime;
 import java.util.Set;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
-import javax.persistence.Embeddable;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
 import javax.persistence.OneToMany;
@@ -59,6 +56,7 @@ import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Pattern;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
@@ -71,7 +69,7 @@ import org.onap.portal.domain.db.ep.EpMicroservice;
 import org.onap.portal.domain.db.ep.EpUserRolesRequest;
 import org.onap.portal.domain.db.ep.EpWebAnalyticsSource;
 import org.onap.portal.domain.db.ep.EpWidgetCatalogRole;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 /*
 CREATE TABLE `fn_app` (
@@ -102,177 +100,236 @@ CREATE TABLE `fn_app` (
 */
 
 @NamedQueries({
-        @NamedQuery(
-                name = "FnApp.retrieveWhereAuthCentralIsYAndOpenIsNAndAuthNamespaceIsNotNull",
-                query = "from FnApp where auth_central = 'Y' and open = 'N' and auth_namespace is not null")
+    @NamedQuery(
+        name = "FnApp.retrieveWhereAuthCentralIsYAndOpenIsNAndAuthNamespaceIsNotNull",
+        query = "from FnApp where authCentral = 'Y' and open = 'N' and authNamespace is not null"),
+    @NamedQuery(
+        name = "FnApp.getByUebKey",
+        query = "from FnApp where uebKey = :uebKey"),
+    @NamedQuery(
+        name = "FnApp.getCentralizedApps",
+        query = "from FnApp where authCentral = 'Y' and open = 'N' and authNamespace is not null"
+    )
 })
 
 @Table(name = "fn_app")
 @NoArgsConstructor
 @AllArgsConstructor
 @EqualsAndHashCode(callSuper = true)
-@Embeddable
 @Getter
 @Setter
 @Entity
 public class FnApp extends DomainVo implements Serializable {
 
-       @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
-       @Column(name = "app_Id", length = 11, nullable = false)
-       @Digits(integer = 11, fraction = 0)
-       private Long appId;
-       @Column(name = "app_name", length = 100, nullable = false, columnDefinition = "varchar(100) not null default '?'")
-       @Size(max = 100)
-       @SafeHtml
-       @NotNull
-       private String appName;
-       @Column(name = "app_image_url", length = 256)
-       @Size(max = 256)
-       @SafeHtml
-       private String appImageUrl;
-       @Column(name = "app_description", length = 512)
-       @Size(max = 256)
-       @SafeHtml
-       private String appDescription;
-       @Column(name = "app_notes", length = 4096)
-       @Size(max = 4096)
-       @SafeHtml
-       private String appNotes;
-       @Column(name = "app_url", length = 256)
-       @Size(max = 256)
-       @SafeHtml
-       //TODO URL
-       @URL
-       private String appUrl;
-       @Column(name = "app_alternate_url", length = 256)
-       @Size(max = 256)
-       @SafeHtml
-       private String appAlternateUrl;
-       @Column(name = "app_rest_endpoint", length = 2000)
-       @Size(max = 2000)
-       @SafeHtml
-       private String appRestEndpoint;
-       @Column(name = "ml_app_name", length = 50, nullable = false, columnDefinition = "varchar(50) not null default '?'")
-       @Size(max = 50)
-       @SafeHtml
-       @NotNull
-       private String ml_app_name;
-       @Column(name = "ml_app_admin_id", length = 7, nullable = false, columnDefinition = "varchar(7) not null default '?'")
-       @Size(max = 7)
-       @SafeHtml
-       @NotNull
-       private String mlAppAdminId;
-       @Column(name = "mots_id", length = 11)
-       @Digits(integer = 11, fraction = 0)
-       private Long motsId;
-       @Column(name = "app_password", length = 256, nullable = false, columnDefinition = "varchar(256) not null default '?'")
-       @Size(max = 256)
-       @SafeHtml
-       @NotNull
-       private String appPassword;
-       @Column(name = "_open", length = 1, columnDefinition = "char(1) default 'N'")
-       private Boolean open;
-       @Column(name = "_enabled", length = 1, columnDefinition = "char(1) default 'N'")
-       private Boolean enabled;
-       @Column(name = "active_yn", length = 1, columnDefinition = "char(1) default 'Y'")
-       @Pattern(regexp = "[YNyn]")
-       @Size(max = 1)
-       @NotNull
-       @SafeHtml
-       private String activeYn;
-       @Column(name = "_thumbnail", columnDefinition = "mediumblob null default null")
-       private byte[] thumbnail;
-       @Column(name = "app_username", length = 50)
-       @Size(max = 50)
-       @SafeHtml
-       private String appUsername;
-       @Column(name = "ueb_key", length = 256)
-       @Size(max = 256)
-       @SafeHtml
-       private String uebKey;
-       @Column(name = "ueb_secret", length = 256)
-       @Size(max = 256)
-       @SafeHtml
-       private String uebSecret;
-       @Column(name = "ueb_topic_name", length = 256)
-       @Size(max = 256)
-       @SafeHtml
-       private String uebTopicName;
-       @Column(name = "app_type", length = 11, columnDefinition = "int(11) not null default 1")
-       @Digits(integer = 11, fraction = 0)
-       private Long appType;
-       @Column(name = "auth_central", length = 1, columnDefinition = "char(1) not null default 'N'", nullable = false)
-       private Boolean authCentral;
-       @Column(name = "auth_namespace", length = 100)
-       @Size(max = 100)
-       @SafeHtml
-       private String authNamespace;
-       @OneToMany(
-               targetEntity = FnMenuFunctionalRoles.class,
-               mappedBy = "appId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<FnMenuFunctionalRoles> fnMenuFunctionalRoles;
-       @OneToMany(
-               targetEntity = EpUserRolesRequest.class,
-               mappedBy = "appId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<EpUserRolesRequest> epUserRolesRequests;
-       @OneToMany(
-               targetEntity = EpAppFunction.class,
-               mappedBy = "appId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<EpAppFunction> epAppFunctions;
-       @OneToMany(
-               targetEntity = EpAppRoleFunction.class,
-               mappedBy = "appId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<EpAppRoleFunction> epAppRoleFunctions;
-       @OneToMany(
-               targetEntity = FnUserRole.class,
-               mappedBy = "appId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<FnUserRole> fnUserRoles;
-       @OneToMany(
-               targetEntity = EpWebAnalyticsSource.class,
-               mappedBy = "appId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<EpWebAnalyticsSource> epWebAnalyticsSources;
-       @OneToMany(
-               targetEntity = EpWidgetCatalogRole.class,
-               mappedBy = "appId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<EpWidgetCatalogRole> epWidgetCatalogRoles;
-       @OneToMany(
-               targetEntity = EpMicroservice.class,
-               mappedBy = "appId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<EpMicroservice> epMicroservices;
-       @OneToMany(
-               targetEntity = FnPersUserAppSel.class,
-               mappedBy = "appId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<FnPersUserAppSel> fnPersUserAppSels;
+  @Column(name = "app_name", length = 100, nullable = false, columnDefinition = "varchar(100) not null default '?'")
+  @Size(max = 100)
+  @SafeHtml
+  @NotNull
+  private String appName = "?";
+  @Column(name = "app_image_url", length = 256)
+  @Size(max = 256)
+  @SafeHtml
+  private String appImageUrl;
+  @Column(name = "app_description", length = 512)
+  @Size(max = 256)
+  @SafeHtml
+  private String appDescription;
+  @Column(name = "app_notes", length = 4096)
+  @Size(max = 4096)
+  @SafeHtml
+  private String appNotes;
+  @Column(name = "app_url", length = 256)
+  @Size(max = 256)
+  @SafeHtml
+  //TODO URL
+  @URL
+  private String appUrl;
+  @Column(name = "app_alternate_url", length = 256)
+  @Size(max = 256)
+  @SafeHtml
+  private String appAlternateUrl;
+  @Column(name = "app_rest_endpoint", length = 2000)
+  @Size(max = 2000)
+  @SafeHtml
+  private String appRestEndpoint;
+  @Column(name = "ml_app_name", length = 50, nullable = false, columnDefinition = "varchar(50) not null default '?'")
+  @Size(max = 50)
+  @SafeHtml
+  @NotNull
+  private String mlAppName = "?";
+  @Column(name = "ml_app_admin_id", length = 7, nullable = false, columnDefinition = "varchar(7) not null default '?'")
+  @Size(max = 7)
+  @SafeHtml
+  private String mlAppAdminId = "?";
+  @Column(name = "mots_id", length = 11)
+  @Digits(integer = 11, fraction = 0)
+  private Long motsId;
+  @Column(name = "app_password", length = 256, nullable = false, columnDefinition = "varchar(256) not null default '?'")
+  @Size(max = 256)
+  @SafeHtml
+  @NotNull
+  private String appPassword = "?";
+  @Column(name = "open")
+  private Boolean open = false;
+  @Column(name = "enabled")
+  private Boolean enabled = false;
+  @Column(name = "active_yn")
+  @NotNull
+  private Boolean activeYn = true;
+  @Column(name = "_thumbnail", columnDefinition = "mediumblob null default null")
+  private byte[] thumbnail;
+  @Column(name = "app_username", length = 50)
+  @Size(max = 50)
+  @SafeHtml
+  private String appUsername;
+  @Column(name = "ueb_key", length = 256)
+  @Size(max = 256)
+  @SafeHtml
+  private String uebKey;
+  @Column(name = "ueb_secret", length = 256)
+  @Size(max = 256)
+  @SafeHtml
+  private String uebSecret;
+  @Column(name = "ueb_topic_name", length = 256)
+  @Size(max = 256)
+  @SafeHtml
+  private String uebTopicName;
+  @Column(name = "app_type", length = 11, columnDefinition = "int(11) not null default 1")
+  @Digits(integer = 11, fraction = 0)
+  private Long appType = 1L;
+  @Column(name = "auth_central", length = 1, nullable = false)
+  private Boolean authCentral;
+  @Column(name = "auth_namespace", length = 100)
+  @Size(max = 100)
+  @SafeHtml
+  private String authNamespace;
+  @OneToMany(
+      targetEntity = FnMenuFunctionalRoles.class,
+      mappedBy = "appId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<FnMenuFunctionalRoles> fnMenuFunctionalRoles;
+  @OneToMany(
+      targetEntity = EpUserRolesRequest.class,
+      mappedBy = "appId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<EpUserRolesRequest> epUserRolesRequests;
+  @OneToMany(
+      targetEntity = EpAppFunction.class,
+      mappedBy = "appId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<EpAppFunction> epAppFunctions;
+  @OneToMany(
+      targetEntity = EpAppRoleFunction.class,
+      mappedBy = "appId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<EpAppRoleFunction> epAppRoleFunctions;
+  @OneToMany(
+      targetEntity = FnUserRole.class,
+      mappedBy = "fnAppId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<FnUserRole> fnUserRoles;
+  @OneToMany(
+      targetEntity = EpWebAnalyticsSource.class,
+      mappedBy = "appId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<EpWebAnalyticsSource> epWebAnalyticsSources;
+  @OneToMany(
+      targetEntity = EpWidgetCatalogRole.class,
+      mappedBy = "appId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<EpWidgetCatalogRole> epWidgetCatalogRoles;
+  @OneToMany(
+      targetEntity = EpMicroservice.class,
+      mappedBy = "appId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<EpMicroservice> epMicroservices;
+  @OneToMany(
+      targetEntity = FnPersUserAppSel.class,
+      mappedBy = "appId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<FnPersUserAppSel> fnPersUserAppSels;
 
-       public Boolean isRestrictedApp() {
-              return (this.appType == 2);
-       }
+  public Boolean isRestrictedApp() {
+    return (this.appType == 2);
+  }
+
+  @Builder
+  public FnApp(@Digits(integer = 11, fraction = 0) Long id, LocalDateTime created,
+      LocalDateTime modified, Long rowNum, Serializable auditUserId,
+      DomainVo createdId, DomainVo modifiedId, Set<DomainVo> fnUsersCreatedId,
+      Set<DomainVo> fnUsersModifiedId,
+      @Size(max = 100) @SafeHtml @NotNull String appName,
+      @Size(max = 256) @SafeHtml String appImageUrl,
+      @Size(max = 256) @SafeHtml String appDescription,
+      @Size(max = 4096) @SafeHtml String appNotes,
+      @Size(max = 256) @SafeHtml @URL String appUrl,
+      @Size(max = 256) @SafeHtml String appAlternateUrl,
+      @Size(max = 2000) @SafeHtml String appRestEndpoint,
+      @Size(max = 50) @SafeHtml @NotNull String mlAppName,
+      @Size(max = 7) @SafeHtml @NotNull String mlAppAdminId,
+      @Digits(integer = 11, fraction = 0) Long motsId,
+      @Size(max = 256) @SafeHtml @NotNull String appPassword, Boolean open, Boolean enabled, Boolean activeYn, byte[] thumbnail,
+      @Size(max = 50) @SafeHtml String appUsername,
+      @Size(max = 256) @SafeHtml String uebKey,
+      @Size(max = 256) @SafeHtml String uebSecret,
+      @Size(max = 256) @SafeHtml String uebTopicName,
+      @Digits(integer = 11, fraction = 0) Long appType, Boolean authCentral,
+      @Size(max = 100) @SafeHtml String authNamespace,
+      Set<FnMenuFunctionalRoles> fnMenuFunctionalRoles,
+      Set<EpUserRolesRequest> epUserRolesRequests,
+      Set<EpAppFunction> epAppFunctions, Set<EpAppRoleFunction> epAppRoleFunctions,
+      Set<FnUserRole> fnUserRoles, Set<EpWebAnalyticsSource> epWebAnalyticsSources,
+      Set<EpWidgetCatalogRole> epWidgetCatalogRoles,
+      Set<EpMicroservice> epMicroservices, Set<FnPersUserAppSel> fnPersUserAppSels) {
+    super(id, created, modified, rowNum, auditUserId, createdId, modifiedId, fnUsersCreatedId, fnUsersModifiedId);
+    this.appName = appName;
+    this.appImageUrl = appImageUrl;
+    this.appDescription = appDescription;
+    this.appNotes = appNotes;
+    this.appUrl = appUrl;
+    this.appAlternateUrl = appAlternateUrl;
+    this.appRestEndpoint = appRestEndpoint;
+    this.mlAppName = mlAppName;
+    this.mlAppAdminId = mlAppAdminId;
+    this.motsId = motsId;
+    this.appPassword = appPassword;
+    this.open = open;
+    this.enabled = enabled;
+    this.activeYn = activeYn;
+    this.thumbnail = thumbnail;
+    this.appUsername = appUsername;
+    this.uebKey = uebKey;
+    this.uebSecret = uebSecret;
+    this.uebTopicName = uebTopicName;
+    this.appType = appType;
+    this.authCentral = authCentral;
+    this.authNamespace = authNamespace;
+    this.fnMenuFunctionalRoles = fnMenuFunctionalRoles;
+    this.epUserRolesRequests = epUserRolesRequests;
+    this.epAppFunctions = epAppFunctions;
+    this.epAppRoleFunctions = epAppRoleFunctions;
+    this.fnUserRoles = fnUserRoles;
+    this.epWebAnalyticsSources = epWebAnalyticsSources;
+    this.epWidgetCatalogRoles = epWidgetCatalogRoles;
+    this.epMicroservices = epMicroservices;
+    this.fnPersUserAppSels = fnPersUserAppSels;
+  }
 }
index 26fd466..ef51b7e 100644 (file)
@@ -47,7 +47,6 @@ import javax.persistence.Entity;
 import javax.persistence.EntityResult;
 import javax.persistence.FetchType;
 import javax.persistence.FieldResult;
-import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.MapsId;
 import javax.persistence.NamedNativeQueries;
@@ -59,13 +58,14 @@ import javax.validation.Valid;
 import javax.validation.constraints.Pattern;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.hibernate.validator.constraints.SafeHtml;
 import org.hibernate.validator.constraints.URL;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 /*
 CREATE TABLE `fn_app_contact_us` (
@@ -137,17 +137,14 @@ CREATE TABLE `fn_app_contact_us` (
 @NoArgsConstructor
 @AllArgsConstructor
 @EqualsAndHashCode(callSuper = true)
+@Builder
 @Getter
 @Setter
 @Entity
 public class FnAppContactUs extends DomainVo implements Serializable {
-       @Id
-       @Column(name = "app_id")
-       private Long appId;
 
-       @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
-       @JoinColumn(name = "app_id")
-       @MapsId
+       @OneToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
+       @JoinColumn(name = "app_id", columnDefinition = "bigint")
        @Valid
        private FnApp fnApp;
        @Column(name = "contact_name", length = 128, columnDefinition = "varchar(128) default null")
index da60049..1ae1898 100644 (file)
@@ -46,6 +46,7 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Pattern;
@@ -76,7 +77,8 @@ CREATE TABLE `fn_audit_action` (
 @Entity
 public class FnAuditAction implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "role_id", nullable = false)
        private Integer roleId;
        @Column(name = "class_name", length = 500, nullable = false)
index df73f42..f7f07ea 100644 (file)
@@ -47,6 +47,7 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.PastOrPresent;
@@ -80,7 +81,8 @@ CREATE TABLE `fn_audit_action_log` (
 public class FnAuditActionLog implements Serializable {
 
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "audit_log_id", nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
        private Integer auditLogId;
        @Column(name = "audit_action_cd", length = 200)
index 911f32a..1094462 100644 (file)
@@ -52,12 +52,14 @@ import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.Valid;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -86,6 +88,7 @@ CREATE TABLE `fn_audit_log` (
 })
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
@@ -95,12 +98,12 @@ public class FnAuditLog implements Serializable {
        @Column(name = "log_id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
        @Digits(integer = 11, fraction = 0)
        private Integer logId;
-       @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
-       @JoinColumn(name = "user_id", nullable = false)
+       @ManyToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
+       @JoinColumn(name = "user_id", nullable = false, columnDefinition = "bigint")
        @NotNull
        @Valid
        private FnUser userId;
-       @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+       @ManyToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
        @JoinColumn(name = "activity_cd", nullable = false)
        @NotNull
        @Valid
index e9cfc20..9d5d6d7 100644 (file)
@@ -47,6 +47,7 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
@@ -81,7 +82,8 @@ CREATE TABLE `fn_broadcast_message` (
 public class FnBroadcastMessage implements Serializable {
 
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "message_id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
        @Digits(integer = 11, fraction = 0)
        private Long messageId;
index abf9653..a663c1c 100644 (file)
@@ -47,6 +47,7 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.PastOrPresent;
@@ -77,7 +78,8 @@ CREATE TABLE `fn_chat_room` (
 @Entity
 public class FnChatRoom implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "chat_room_id", nullable = false)
        @NotNull
        private Integer chatRoomId;
index 1255aa1..5215acf 100644 (file)
@@ -46,11 +46,13 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.Pattern;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -71,6 +73,7 @@ CREATE TABLE `fn_common_widget_data` (
 @Table(name = "fn_common_widget_data")
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
index 87ee359..ec045cf 100644 (file)
@@ -46,6 +46,7 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.Max;
@@ -84,7 +85,8 @@ CREATE TABLE `fn_datasource` (
 @Entity
 public class FnDatasource implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "message_id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
        @Digits(integer = 11, fraction = 0)
        private Long messageId;
index 348cf9e..8946e83 100644 (file)
@@ -46,11 +46,13 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -69,13 +71,15 @@ CREATE TABLE `fn_display_text` (
 @Table(name = "fn_display_text")
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
 public class FnDisplayText implements Serializable {
 
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
        @Digits(integer = 11, fraction = 0)
        private Long id;
index 3375fd0..8ceb12f 100644 (file)
@@ -52,6 +52,7 @@ import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -68,38 +69,41 @@ CREATE TABLE `fn_function` (
 @Table(name = "fn_function")
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
 public class FnFunction implements Serializable {
        @Id
-       @Column(name = "function_cd", length = 30, nullable = false)
-       @Size(max = 30)
-       @SafeHtml
+       @Column(name = "function_cd", nullable = false)
        private String functionCd;
        @Column(name = "function_name", length = 50, nullable = false)
        @Size(max = 50)
        @SafeHtml
        @NotNull
        private String functionName;
+       private String code;
+       private String name;
+       private String type;
+       private String action;
        @OneToMany(
                targetEntity = FnRestrictedUrl.class,
                mappedBy = "functionCd",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<FnRestrictedUrl> fnRestrictedUrls;
        @OneToMany(
                targetEntity = FnRoleFunction.class,
                mappedBy = "functionCd",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<FnRoleFunction> fnRoleFunctions;
        @OneToMany(
                targetEntity = FnTab.class,
                mappedBy = "functionCd",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<FnTab> fnTabs;
index ad976fc..531157f 100644 (file)
@@ -51,10 +51,9 @@ import javax.persistence.FetchType;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.NamedQuery;
 import javax.persistence.OneToMany;
-import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
-import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
@@ -73,6 +72,10 @@ CREATE TABLE `fn_language` (
 */
 
 @Table(name = "fn_language")
+
+@NamedQuery(name = "FnLanguage.getByLanguageAlias",
+query = "FROM FnLanguage WHERE languageAlias =: alias")
+
 @NoArgsConstructor
 @AllArgsConstructor
 @Builder
@@ -83,7 +86,7 @@ CREATE TABLE `fn_language` (
 public class FnLanguage implements Serializable {
 
        @Id
-       @GeneratedValue(strategy = GenerationType.IDENTITY)
+       @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "language_id", length = 11, nullable = false)
        private Long languageId;
        @Column(name = "language_name", length = 100, nullable = false)
@@ -99,7 +102,7 @@ public class FnLanguage implements Serializable {
        @OneToMany(
                targetEntity = FnUser.class,
                mappedBy = "languageId",
-               cascade = CascadeType.PERSIST,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.EAGER
        )
        private Set<FnUser> fnUsers = new HashSet<>();
@@ -112,4 +115,11 @@ public class FnLanguage implements Serializable {
                       + '}';
               return sb;
        }
+
+       public FnLanguage(
+           @Size(max = 100) @NotNull(message = "languageName must not be null") @SafeHtml String languageName,
+           @Size(max = 100) @NotNull(message = "languageAlias must not be null") @SafeHtml String languageAlias) {
+              this.languageName = languageName;
+              this.languageAlias = languageAlias;
+       }
 }
index f4d0d70..ad8e627 100644 (file)
@@ -52,6 +52,7 @@ import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -68,6 +69,7 @@ CREATE TABLE `fn_lu_activity` (
 @Table(name = "fn_lu_activity")
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
@@ -86,7 +88,7 @@ public class FnLuActivity implements Serializable {
        @OneToMany(
                targetEntity = FnAuditLog.class,
                mappedBy = "activityCd",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<FnAuditLog> fnAuditLogs;
index 740f052..b9b40b3 100644 (file)
@@ -52,6 +52,7 @@ import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -68,6 +69,7 @@ CREATE TABLE `fn_lu_alert_method` (
 @Table(name = "fn_lu_alert_method")
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
@@ -86,7 +88,7 @@ public class FnLuAlertMethod implements Serializable {
        @OneToMany(
                targetEntity = FnUser.class,
                mappedBy = "alertMethodCd",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<FnUser> fnUsers;
index ff5e473..5e71405 100644 (file)
@@ -54,6 +54,7 @@ import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -70,13 +71,13 @@ CREATE TABLE `fn_lu_menu_set` (
 @Table(name = "fn_lu_menu_set")
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
 public class FnLuMenuSet implements Serializable {
 
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "menu_set_cd", length = 10, nullable = false)
        @Size(max = 10)
        @NotNull
@@ -90,7 +91,7 @@ public class FnLuMenuSet implements Serializable {
        @OneToMany(
                targetEntity = FnMenu.class,
                mappedBy = "menuSetCd",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<FnMenu> fnMenus;
index 4e5e233..e1e46bd 100644 (file)
@@ -46,12 +46,14 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Pattern;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -70,6 +72,7 @@ CREATE TABLE `fn_lu_priority` (
 @Table(name = "fn_lu_priority")
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
@@ -84,12 +87,9 @@ public class FnLuPriority implements Serializable {
        @NotNull
        @SafeHtml
        private String priority;
-       @Column(name = "active_yn", length = 1, columnDefinition = "character varying(1) default 'y'", nullable = false)
-       @Pattern(regexp = "[YNyn]")
-       @Size(max = 1)
+       @Column(name = "active_yn", length = 1, columnDefinition = "boolean default true", nullable = false)
        @NotNull
-       @SafeHtml
-       private String activeYn;
+       private Boolean activeYn;
        @Column(name = "sort_order", nullable = false, length = 5)
        @Digits(integer = 5, fraction = 0)
        private Long sortOrder;
index 06e982c..fe59c74 100644 (file)
@@ -52,6 +52,7 @@ import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -68,6 +69,7 @@ CREATE TABLE `fn_lu_tab_set` (
 @Table(name = "fn_lu_tab_set")
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
@@ -84,8 +86,8 @@ public class FnLuTabSet implements Serializable {
        private String tabSetName;
        @OneToMany(
                targetEntity = FnTab.class,
-               mappedBy = "fnLuTabSet",
-               cascade = CascadeType.ALL,
+               mappedBy = "tabSetCd",
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<FnTab> fnTabs;
index 54b4bc5..c3b8843 100644 (file)
@@ -50,10 +50,12 @@ import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.OneToMany;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -71,6 +73,7 @@ CREATE TABLE `fn_lu_timezone` (
 @Table(name = "fn_lu_timezone")
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
@@ -83,17 +86,17 @@ public class FnLuTimezone implements Serializable {
        @Size(max = 100)
        @SafeHtml
        @NotNull
-       private String timezone_name;
+       private String timezoneName;
        @Column(name = "timezone_value", length = 100, nullable = false)
        @Size(max = 100)
        @SafeHtml
        @NotNull
-       private String timezone_value;
+       private String timezoneValue;
 
        @OneToMany(
                targetEntity = FnUser.class,
                mappedBy = "timezone",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<FnUser> fnUsers;
index 7407213..8e14625 100644 (file)
@@ -54,6 +54,7 @@ import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
 import javax.persistence.OneToMany;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.Valid;
 import javax.validation.constraints.Digits;
@@ -61,6 +62,7 @@ import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Pattern;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -99,6 +101,7 @@ CREATE TABLE `fn_menu` (
 })
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
@@ -112,7 +115,7 @@ public class FnMenu implements Serializable {
        @Size(max = 100)
        @SafeHtml
        private String label;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "parent_Id", columnDefinition = "int(11) DEFAULT NULL")
        @Valid
        private FnMenu parentId;
@@ -127,12 +130,9 @@ public class FnMenu implements Serializable {
        @Size(max = 30)
        @SafeHtml
        private String functionCd;
-       @Column(name = "active_yn", length = 1, columnDefinition = "character varying(1) default 'y'", nullable = false)
-       @Pattern(regexp = "[YNyn]")
-       @Size(max = 1)
+       @Column(name = "active_yn", length = 1, columnDefinition = "boolean default true", nullable = false)
        @NotNull
-       @SafeHtml
-       private String activeYn;
+       private Boolean activeYn = true;
        @Column(name = "servlet", length = 50, columnDefinition = "varchar(50) DEFAULT NULL")
        @Size(max = 50)
        @SafeHtml
@@ -151,16 +151,13 @@ public class FnMenu implements Serializable {
        @Size(max = 25)
        @SafeHtml
        private String target;
-       @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+       @ManyToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
        @JoinColumn(name = "menu_set_cd", columnDefinition = "character varying(10) default 'app'", foreignKey = @ForeignKey(name = "fk_fn_menu_menu_set_cd"))
        @Valid
        private FnLuMenuSet menuSetCd;
-       @Column(name = "separator_yn", length = 1, columnDefinition = "character varying(1) default 'n'")
-       @Pattern(regexp = "[YNyn]")
-       @Size(max = 1)
+       @Column(name = "separator_yn", length = 1, columnDefinition = "boolean default false")
        @NotNull
-       @SafeHtml
-       private String separatorYn;
+       private Boolean separatorYn = false;
        @Column(name = "image_src", length = 100, columnDefinition = "varchar(100) DEFAULT NULL")
        @Size(max = 100)
        @SafeHtml
@@ -168,7 +165,7 @@ public class FnMenu implements Serializable {
        @OneToMany(
                targetEntity = FnMenu.class,
                mappedBy = "parentId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<FnMenu> fnMenus;
index e348a01..0e376f7 100644 (file)
@@ -54,7 +54,10 @@ import javax.persistence.JoinColumn;
 import javax.persistence.JoinTable;
 import javax.persistence.ManyToMany;
 import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
 import javax.persistence.OneToMany;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.Valid;
 import javax.validation.constraints.Digits;
@@ -62,6 +65,7 @@ import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Pattern;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -83,10 +87,19 @@ CREATE TABLE `fn_menu_functional` (
 )
 */
 
+@NamedQueries({
+    @NamedQuery(
+        name = "FnMenuFunctional.retrieveByMenuId",
+        query = "from FnMenuFunctionalRoles where menuId =:menuId"
+    )
+}
+)
+
 @Table(name = "fn_menu_functional", indexes = {@Index(columnList = "parent_menu_id", name = "fk_fn_menu_func_parent_menu_id_idx")
 })
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
@@ -104,7 +117,7 @@ public class FnMenuFunctional implements Serializable {
        @SafeHtml
        @NotNull
        private String text;
-       @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+       @ManyToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
        @JoinColumn(name = "parent_menu_id")
        @Valid
        private FnMenuFunctional parentMenuId;
@@ -115,21 +128,18 @@ public class FnMenuFunctional implements Serializable {
        //TODO URL
        @URL
        private String url;
-       @Column(name = "active_yn", length = 1, columnDefinition = "varchar(1) default 'Y'", nullable = false)
-       @Pattern(regexp = "[YNyn]")
-       @Size(max = 1)
+       @Column(name = "active_yn", length = 1, columnDefinition = "boolean default true", nullable = false)
        @NotNull
-       @SafeHtml
-       private String activeYn;
+       private Boolean activeYn = true;
        @Column(name = "image_src", length = 100, columnDefinition = "varchar(100) default null")
        @Size(max = 100)
        @SafeHtml
        private String imageSrc;
-       @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+       @ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
        @JoinTable(
                name = "fn_menu_favorites",
                joinColumns = {@JoinColumn(name = "menu_id", referencedColumnName = "menu_id")},
-               inverseJoinColumns = {@JoinColumn(name = "role_Id", referencedColumnName = "user_id")},
+               inverseJoinColumns = {@JoinColumn(name = "role_Id", referencedColumnName = "id", columnDefinition = "bigint")},
                indexes = {
                        @Index(name = "sys_c0014619", columnList = "menu_id")
                }
@@ -138,21 +148,21 @@ public class FnMenuFunctional implements Serializable {
        @OneToMany(
                targetEntity = FnMenuFunctionalAncestors.class,
                mappedBy = "menuId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<FnMenuFunctionalAncestors> fnMenuFunctionalAncestorsMenuId;
        @OneToMany(
                targetEntity = FnMenuFunctionalAncestors.class,
                mappedBy = "ancestorMenuId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<FnMenuFunctionalAncestors> fnMenuFunctionalsAncestorMenuId;
        @OneToMany(
                targetEntity = FnMenuFunctionalRoles.class,
                mappedBy = "menuId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<FnMenuFunctionalRoles> fnMenuFunctionalRoles;
index 309f11e..00eddf0 100644 (file)
@@ -51,10 +51,12 @@ import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -79,6 +81,7 @@ CREATE TABLE `fn_menu_functional_ancestors` (
 })
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
@@ -88,11 +91,11 @@ public class FnMenuFunctionalAncestors implements Serializable {
        @Column(name = "id", nullable = false, length = 11, columnDefinition = "int(11)  AUTO_INCREMENT")
        @Digits(integer = 11, fraction = 0)
        private Integer id;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "menu_id", nullable = false)
        @NotNull
        private FnMenuFunctional menuId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade =CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade =CascadeType.MERGE)
        @JoinColumn(name = "ancestor_menu_id", nullable = false)
        @NotNull
        private FnMenuFunctional ancestorMenuId;
index 3e9ae0e..373f1ac 100644 (file)
@@ -51,11 +51,15 @@ import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.Valid;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -76,6 +80,17 @@ CREATE TABLE `fn_menu_functional_roles` (
         )
 */
 
+@NamedQueries({
+    @NamedQuery(
+        name = "FnMenuFunctionalRoles.retrieveByRoleId",
+        query = "from FnMenuFunctionalRoles where roleId.id =:roleId"),
+    @NamedQuery(
+        name = "FnMenuFunctionalRoles.retrieveByMenuId",
+        query = "from FnMenuFunctionalRoles where menuId.menuId =:menuId"
+    )
+}
+)
+
 @Table(name = "fn_menu_functional_roles", indexes = {
         @Index(columnList = "menu_id", name = "fk_fn_menu_func_roles_menu_id_idx"),
         @Index(columnList = "app_id", name = "fk_fn_menu_func_roles_app_id_idx"),
@@ -83,27 +98,29 @@ CREATE TABLE `fn_menu_functional_roles` (
 })
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
 public class FnMenuFunctionalRoles implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "id", nullable = false, length = 11, columnDefinition = "int(11) AUTO_INCREMENT")
        @Digits(integer = 11, fraction = 0)
        private Long id;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "menu_id", nullable = false)
        @Valid
        @NotNull
        private FnMenuFunctional menuId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "role_id", nullable = false)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+       @JoinColumn(name = "role_id", nullable = false, columnDefinition = "bigint")
        @Valid
        @NotNull
        private FnRole roleId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "app_Id", nullable = false)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+       @JoinColumn(name = "app_Id", nullable = false, columnDefinition = "bigint")
        @Valid
        @NotNull
        private FnApp appId;
index 9dea65e..0fd61b7 100644 (file)
@@ -51,6 +51,7 @@ import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.OneToMany;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
@@ -81,7 +82,8 @@ CREATE TABLE `fn_org` (
 @Entity
 public class FnOrg implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "org_id", nullable = false, length = 11)
        @Digits(integer = 11, fraction = 0)
        private Long orgId;
@@ -98,7 +100,7 @@ public class FnOrg implements Serializable {
        @OneToMany(
                targetEntity = FnUser.class,
                mappedBy = "orgId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<FnUser> fnUsers;
index 1da9c21..2a3fd9b 100644 (file)
@@ -45,23 +45,20 @@ import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
 import javax.persistence.Table;
 import javax.validation.Valid;
-import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.hibernate.validator.constraints.SafeHtml;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 /*
 CREATE TABLE `fn_pers_user_app_sel` (
@@ -83,22 +80,19 @@ CREATE TABLE `fn_pers_user_app_sel` (
 })
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
 public class FnPersUserAppSel extends DomainVo implements Serializable {
-       @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
-       @Column(name = "id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
-       @Digits(integer = 11, fraction = 0)
-       private Long id;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "user_id", nullable = false)
+
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+       @JoinColumn(name = "user_id", nullable = false, columnDefinition = "bigint")
        @NotNull
        @Valid
        private FnUser userId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "app_id", nullable = false)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+       @JoinColumn(name = "app_id", nullable = false, columnDefinition = "bigint")
        @Valid
        private FnApp appId;
        @Column(name = "status_cd", length = 1, nullable = false)
@@ -108,9 +102,9 @@ public class FnPersUserAppSel extends DomainVo implements Serializable {
        private String statusCd;
 
        public FnPersUserAppSel(final Long id, final Long userId, final Long appId, final String statusCode) {
-              super.id = id;
-              this.userId.setUserId(userId);
-              this.appId.setAppId(appId);
+              super.setId(id);
+              this.userId.setId(userId);
+              this.appId.setId(appId);
               this.statusCd = statusCode;
        }
 }
index 84c1162..6db1fb0 100644 (file)
@@ -52,6 +52,7 @@ import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -73,7 +74,7 @@ CREATE TABLE `fn_qz_cron_triggers` (
 @Table(name = "fn_qz_cron_triggers")
 @NoArgsConstructor
 @AllArgsConstructor
-
+@Builder
 @Getter
 @Setter
 @Entity
index 5da7b4f..0ea1245 100644 (file)
@@ -54,6 +54,7 @@ import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
@@ -85,7 +86,7 @@ CREATE TABLE `fn_qz_job_details` (
 })
 @NoArgsConstructor
 @AllArgsConstructor
-
+@Builder
 @Getter
 @Setter
 @Entity
@@ -115,33 +116,25 @@ public class FnQzJobDetails implements Serializable{
        @SafeHtml
        @NotNull
        private String jobClassName;
-       @Column(name = "IS_DURABLE", length = 1, nullable = false)
-       @Size(max = 1)
-       @SafeHtml
+       @Column(name = "IS_DURABLE", nullable = false)
        @NotNull
-       private String isDurable;
-       @Column(name = "IS_NONCONCURRENT", length = 1, nullable = false)
-       @Size(max = 1)
-       @SafeHtml
+       private Boolean isDurable;
+       @Column(name = "IS_NONCONCURRENT", nullable = false)
        @NotNull
-       private String isNonconcurrent;
-       @Column(name = "IS_UPDATE_DATA", length = 1, nullable = false)
-       @Size(max = 1)
-       @SafeHtml
+       private Boolean isNonconcurrent;
+       @Column(name = "IS_UPDATE_DATA", nullable = false)
        @NotNull
-       private String isUpdateData;
-       @Column(name = "REQUESTS_RECOVERY", length = 1, nullable = false)
-       @Size(max = 1)
-       @SafeHtml
+       private Boolean isUpdateData;
+       @Column(name = "REQUESTS_RECOVERY", nullable = false)
        @NotNull
-       private String requestsRecovery;
+       private Boolean requestsRecovery;
        @Column(name = "JOB_DATA", columnDefinition = "blob DEFAULT NULL")
        private byte[] jobData;
 
        @OneToMany(
                targetEntity = FnQzTriggers.class,
                mappedBy = "fnQzJobDetails",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<FnQzTriggers> selectedTabCd;
index 3c00f95..1ce373b 100644 (file)
@@ -51,6 +51,7 @@ import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
@@ -71,7 +72,7 @@ CREATE TABLE `fn_qz_scheduler_state` (
 @Table(name = "fn_qz_scheduler_state")
 @NoArgsConstructor
 @AllArgsConstructor
-
+@Builder
 @Getter
 @Setter
 @Entity
index 35fb130..d7f3dec 100644 (file)
@@ -56,6 +56,7 @@ import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -113,6 +114,7 @@ CREATE TABLE `fn_qz_triggers` (
 })
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
@@ -124,7 +126,6 @@ public class FnQzTriggers implements Serializable {
                @JoinColumn(name = "JOB_NAME", referencedColumnName = "JOB_NAME"),
                @JoinColumn(name = "JOB_GROUP", referencedColumnName = "JOB_GROUP")
        })
-       @NotNull
        private FnQzJobDetails fnQzJobDetails;
        @Id
        @Valid
index 74e81eb..4323818 100644 (file)
@@ -53,6 +53,7 @@ import javax.validation.Valid;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
@@ -75,7 +76,7 @@ CREATE TABLE `fn_restricted_url` (
 })
 @NoArgsConstructor
 @AllArgsConstructor
-
+@Builder
 @Getter
 @Setter
 @Entity
@@ -85,11 +86,9 @@ public class FnRestrictedUrl implements Serializable{
        @Size(max = 250)
        @SafeHtml
        @Id
-       private String restricted_url;
+       private String restrictedUrl;
        @ManyToOne()
-       @JoinColumn(name = "function_cd", nullable = false)
-       @Valid
-       @NotNull
+       @JoinColumn(name = "function_cd")
        @Id
        private FnFunction functionCd;
 
@@ -101,8 +100,7 @@ public class FnRestrictedUrl implements Serializable{
        public static class FnRestrictedUrlId implements Serializable {
               @Size(max = 250)
               @SafeHtml
-              private String restricted_url;
-              @Valid
+              private String restrictedUrl;
               @NotNull
               private FnFunction functionCd;
        }
index edd843a..2c16d00 100644 (file)
 package org.onap.portal.domain.db.fn;
 
 import java.io.Serializable;
+import java.time.LocalDateTime;
 import java.util.Set;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
+import javax.persistence.DiscriminatorValue;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
 import javax.persistence.GeneratedValue;
@@ -53,26 +55,25 @@ import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.JoinTable;
 import javax.persistence.ManyToMany;
-import javax.persistence.NamedNativeQueries;
-import javax.persistence.NamedNativeQuery;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
 import javax.persistence.OneToMany;
 import javax.persistence.Table;
-import javax.persistence.UniqueConstraint;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.hibernate.validator.constraints.SafeHtml;
+import org.onap.portal.domain.db.DomainVo;
 import org.onap.portal.domain.db.ep.EpAppRoleFunction;
 import org.onap.portal.domain.db.ep.EpRoleNotification;
 import org.onap.portal.domain.db.ep.EpUserRolesRequestDet;
 import org.onap.portal.domain.db.ep.EpWidgetCatalogRole;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.dto.transport.Role;
 
 /*
 CREATE TABLE `fn_role` (
@@ -88,136 +89,149 @@ CREATE TABLE `fn_role` (
 */
 
 @NamedQueries({
-        @NamedQuery(
-                name = "FnRole.retrieveAppRolesByRoleNameAndByAppId",
-                query = "FROM FnRole where role_name =:roleName and app_id =:appId"),
-        @NamedQuery(
-                name = "FnRole.retrieveAppRolesByAppId",
-                query = "FROM FnRole where app_id =:appId"),
-        @NamedQuery(
-                name = "FnRole.retrieveAppRolesWhereAppIdIsNull",
-                query = "FROM FnRole where app_id is null"),
-        @NamedQuery(
-                name = "FnRole.retrieveAppRoleByRoleIdWhereAppIdIsNull",
-                query = "FROM FnRole where role_id =:roleId and app_id is null"),
-        @NamedQuery(
-                name = "FnRole.retrieveAppRoleByAppRoleIdAndByAppId",
-                query = "FROM FnRole where appRoleId =:appRoleId and appId =:appId"),
-        @NamedQuery(
-                name = "FnRole.retrieveAppRoleByRoleIdAndAppId",
-                query = "FROM FnRole where role_id =:roleId and app_id =:appId"),
-        @NamedQuery(
-                name = "FnRole.retrieveAppRolesByRoleNameAndWhereAppIdIsNull",
-                query = "FROM FnRole where role_name =:roleName and app_id is null"),
-        @NamedQuery(
-                name = "FnRole.retrieveActiveRolesOfApplication",
-                query = "from FnRole where active_yn = 'Y' and app_id=:appId"),
-        @NamedQuery(name = "FnRole.retrieveRoleToUpdateInExternalAuthSystem",
-                query = "FROM FnRole where role_name =:roleName and app_id =:appId")
+    @NamedQuery(
+        name = "FnRole.retrieveAppRolesByRoleNameAndByAppId",
+        query = "FROM FnRole where roleName =:roleName and appId =:appId"),
+    @NamedQuery(
+        name = "FnRole.retrieveAppRolesByAppId",
+        query = "FROM FnRole where appId =:appId"),
+    @NamedQuery(
+        name = "FnRole.retrieveAppRolesWhereAppIdIsNull",
+        query = "FROM FnRole where appId is null"),
+    @NamedQuery(
+        name = "FnRole.retrieveAppRoleByRoleIdWhereAppIdIsNull",
+        query = "FROM FnRole where id =:roleId and appId is null"),
+    @NamedQuery(
+        name = "FnRole.retrieveAppRoleByAppRoleIdAndByAppId",
+        query = "FROM FnRole where appRoleId =:appRoleId and appId =:appId"),
+    @NamedQuery(
+        name = "FnRole.retrieveAppRoleByRoleIdAndAppId",
+        query = "FROM FnRole where id =:roleId and appId =:appId"),
+    @NamedQuery(
+        name = "FnRole.retrieveAppRolesByRoleNameAndWhereAppIdIsNull",
+        query = "FROM FnRole where roleName =:roleName and appId is null"),
+    @NamedQuery(
+        name = "FnRole.retrieveActiveRolesOfApplication",
+        query = "from FnRole where activeYn = 'Y' and appId=:appId"),
+    @NamedQuery(
+        name = "FnRole.getUserRoleOnUserIdAndAppId",
+        query = " FROM"
+            + "  FnRole fr,\n"
+            + "  FnUserRole fur\n"
+            + " WHERE\n"
+            + "  fr.id = fur.roleId\n"
+            + "  AND fur.userId = :userId"
+            + "  AND fur.fnAppId.id = :appId\n"
+            + "  AND fr.activeYn = 'y'"),
+    @NamedQuery(
+        name = "FnRole.getGlobalRolesOfPortal",
+        query = "from"
+            + "  FnRole"
+            + " where"
+            + "  roleName like 'global_%'"
+            + "  and appId is null"
+            + "  and activeYn = 'Y'"),
+    @NamedQuery(
+        name = "FnRole.getSysAdminRoleId",
+        query = "FROM FnRole WHERE roleName = 'System_Administrator' and activeYn = 'true' and priority = 1 and appId is null and appRoleId is null"
+    )
 })
 
-@Table(name = "fn_role", indexes = {
-        @Index(name = "fn_role_name_app_id_idx", columnList = "role_name, app_id", unique = true)
-})
+@Table(name = "fn_role")
 @NoArgsConstructor
-@AllArgsConstructor
 @Getter
 @Setter
 @Entity
-public class FnRole extends DomainVo implements Serializable {
+public class FnRole extends Role {
+
+  @Column(name = "app_role_id", length = 11, columnDefinition = "int(11) default null")
+  @Digits(integer = 11, fraction = 0)
+  private Long appRoleId;
+  @ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
+  @JoinTable(
+      name = "fn_user_pseudo_role",
+      joinColumns = {@JoinColumn(name = "pseudo_role_Id", referencedColumnName = "id", columnDefinition = "bigint not null")},
+      inverseJoinColumns = {@JoinColumn(name = "user_id", referencedColumnName = "id", columnDefinition = "bigint not null")},
+      indexes = {
+          @Index(name = "fk_pseudo_role_user_id", columnList = "user_id")
+      }
+  )
+  private Set<FnUser> fnUsers;
+  @ManyToMany(cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY, mappedBy = "role")
+  private Set<FnRoleFunction> roleFunctions;
+  @OneToMany(
+      targetEntity = EpRoleNotification.class,
+      mappedBy = "notificationID",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<EpRoleNotification> epRoleNotifications;
+  @OneToMany(
+      targetEntity = FnMenuFunctionalRoles.class,
+      mappedBy = "roleId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<FnMenuFunctionalRoles> fnMenuFunctionalRoles;
+  @OneToMany(
+      targetEntity = EpWidgetCatalogRole.class,
+      mappedBy = "roleId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<EpWidgetCatalogRole> epWidgetCatalogRoles;
+  @OneToMany(
+      targetEntity = EpAppRoleFunction.class,
+      mappedBy = "fnRole",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<EpAppRoleFunction> epAppRoleFunctions;
+  @OneToMany(
+      targetEntity = EpUserRolesRequestDet.class,
+      mappedBy = "requestedRoleId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<EpUserRolesRequestDet> epUserRolesRequestDets;
+  @OneToMany(
+      targetEntity = FnUserRole.class,
+      mappedBy = "roleId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<FnUserRole> fnUserRoles;
 
-       @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
-       @Column(name = "role_id", length = 11, nullable = false)
-       @Digits(integer = 11, fraction = 0)
-       private Long roleId;
-       @Column(name = "role_name", length = 300, nullable = false)
-       @Size(max = 300)
-       @NotNull
-       @SafeHtml
-       private String roleName;
-       @Column(name = "active_yn", length = 1, columnDefinition = "character varying(1) default 'y'", nullable = false)
-       @NotNull
-       private Boolean activeYn;
-       @Column(name = "priority", length = 4, columnDefinition = "decimal(4,0) DEFAULT NULL")
-       @Digits(integer = 4, fraction = 0)
-       private Long priority;
-       @Column(name = "app_Id", length = 11, columnDefinition = "int(11) default null")
-       @Digits(integer = 11, fraction = 0)
-       private Long appId;
-       @Column(name = "app_role_id", length = 11, columnDefinition = "int(11) default null")
-       @Digits(integer = 11, fraction = 0)
-       private Long appRoleId;
-       @OneToMany(
-               targetEntity = FnRoleFunction.class,
-               mappedBy = "roleId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<FnRoleFunction> fnRoleFunctions;
-       @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
-       @JoinTable(
-               name = "fn_user_pseudo_role",
-               joinColumns = {@JoinColumn(name = "pseudo_role_Id", referencedColumnName = "role_id")},
-               inverseJoinColumns = {@JoinColumn(name = "user_id", referencedColumnName = "user_id")},
-               indexes = {
-                       @Index(name = "fk_pseudo_role_user_id", columnList = "user_id")
-               }
-       )
-       private Set<FnUser> fnUsers;
-       @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
-       @JoinTable(
-               name = "fn_role_composite",
-               joinColumns = {@JoinColumn(name = "parent_role_id", referencedColumnName = "role_id")},
-               inverseJoinColumns = {@JoinColumn(name = "child_role_id", referencedColumnName = "role_id")},
-               indexes = {
-                       @Index(name = "fk_fn_role_composite_child", columnList = "child_role_id")
-               }
-       )
-       private Set<FnRole> fnRoles;
-       @ManyToMany(cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY)
-       private Set<FnRole> fnRoleList;
-       @OneToMany(
-               targetEntity = EpRoleNotification.class,
-               mappedBy = "notificationID",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<EpRoleNotification> epRoleNotifications;
-       @OneToMany(
-               targetEntity = FnMenuFunctionalRoles.class,
-               mappedBy = "roleId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<FnMenuFunctionalRoles> fnMenuFunctionalRoles;
-       @OneToMany(
-               targetEntity = EpWidgetCatalogRole.class,
-               mappedBy = "roleId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<EpWidgetCatalogRole> epWidgetCatalogRoles;
-       @OneToMany(
-               targetEntity = EpAppRoleFunction.class,
-               mappedBy = "fnRole",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<EpAppRoleFunction> epAppRoleFunctions;
-       @OneToMany(
-               targetEntity = EpUserRolesRequestDet.class,
-               mappedBy = "requestedRoleId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<EpUserRolesRequestDet> epUserRolesRequestDets;
-       @OneToMany(
-               targetEntity = FnUserRole.class,
-               mappedBy = "roleId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<FnUserRole> fnUserRoles;
+  @Builder
+  public FnRole(@Digits(integer = 11, fraction = 0) Long id, LocalDateTime created,
+      LocalDateTime modified, Long rowNum, Serializable auditUserId,
+      DomainVo createdId, DomainVo modifiedId,
+      Set<DomainVo> fnUsersCreatedId,
+      Set<DomainVo> fnUsersModifiedId,
+      @Size(max = 300) @NotNull @SafeHtml String roleName,
+      @Digits(integer = 11, fraction = 0) Long appId, @NotNull Boolean activeYn,
+      @Digits(integer = 4, fraction = 0) Integer priority,
+      Set<FnRoleFunction> fnRoleFunctions, Set<FnRoleComposite> childRoles,
+      Set<FnRoleComposite> parentRoles,
+      @Digits(integer = 11, fraction = 0) Long appRoleId, Set<FnUser> fnUsers,
+      Set<FnRoleFunction> roleFunctions,
+      Set<EpRoleNotification> epRoleNotifications,
+      Set<FnMenuFunctionalRoles> fnMenuFunctionalRoles,
+      Set<EpWidgetCatalogRole> epWidgetCatalogRoles,
+      Set<EpAppRoleFunction> epAppRoleFunctions,
+      Set<EpUserRolesRequestDet> epUserRolesRequestDets,
+      Set<FnUserRole> fnUserRoles) {
+    super(id, created, modified, rowNum, auditUserId, createdId, modifiedId, fnUsersCreatedId, fnUsersModifiedId,
+        roleName, appId, activeYn, priority, fnRoleFunctions, childRoles, parentRoles);
+    this.appRoleId = appRoleId;
+    this.fnUsers = fnUsers;
+    this.roleFunctions = roleFunctions;
+    this.epRoleNotifications = epRoleNotifications;
+    this.fnMenuFunctionalRoles = fnMenuFunctionalRoles;
+    this.epWidgetCatalogRoles = epWidgetCatalogRoles;
+    this.epAppRoleFunctions = epAppRoleFunctions;
+    this.epUserRolesRequestDets = epUserRolesRequestDets;
+    this.fnUserRoles = fnUserRoles;
+  }
 }
diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRoleComposite.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRoleComposite.java
new file mode 100644 (file)
index 0000000..a729e76
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.domain.db.fn;
+
+import java.io.Serializable;
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.Index;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.validation.Valid;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.onap.portal.domain.db.fn.compositePK.FnRoleCompositeId;
+import org.onap.portal.domain.dto.transport.Role;
+
+@Table(name = "fn_role_composite", indexes = {
+    @Index(name = "fk_fn_role_composite_child", columnList = "child_role_id")
+})
+@Getter
+@Setter
+@Entity
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+@IdClass(FnRoleCompositeId.class)
+public class FnRoleComposite implements Serializable{
+
+  @Id
+  @Valid
+  @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+  @JoinColumn(name = "parent_role_id", nullable = false, columnDefinition = "bigint")
+  private Role parentRoles;
+  @Id
+  @Valid
+  @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+  @JoinColumn(name = "child_role_id", nullable = false, columnDefinition = "bigint")
+  private Role childRoles;
+
+}
index 944d739..d98687a 100644 (file)
 package org.onap.portal.domain.db.fn;
 
 import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.Set;
 import javax.persistence.CascadeType;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
 import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
 import javax.persistence.Table;
 import javax.validation.Valid;
+import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
 import lombok.AllArgsConstructor;
-import lombok.EqualsAndHashCode;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.onap.portal.domain.db.fn.FnRoleFunction.FnRoleFunctionId;
+import org.onap.portal.domain.db.DomainVo;
+import org.onap.portal.domain.dto.transport.Role;
 
 /*
 CREATE TABLE `fn_role_function` (
@@ -72,39 +74,37 @@ CREATE TABLE `fn_role_function` (
 */
 
 @Table(name = "fn_role_function", indexes = {
-        @Index(name = "fn_role_function_function_cd", columnList = "function_cd"),
-        @Index(name = "fn_role_function_role_id", columnList = "role_id")
-})
+    @Index(name = "fn_role_function_function_cd", columnList = "function_cd"),
+    @Index(name = "fn_role_function_role_id", columnList = "role"),
+    @Index(name = "fn_role_function_roleId_functionCd", columnList = "role, function_cd", unique = true)})
+
 @NoArgsConstructor
 @AllArgsConstructor
 @Getter
 @Setter
 @Entity
-@IdClass(FnRoleFunctionId.class)
-public class FnRoleFunction implements Serializable{
+public class FnRoleFunction extends DomainVo implements Serializable {
 
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "role_Id", nullable = false)
-       @Valid
-       @NotNull
-       @Id
-       private FnRole roleId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "function_cd", nullable = false)
-       @Valid
-       @NotNull
-       @Id
-       private FnFunction functionCd;
+  @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+  @JoinColumn(name = "role", nullable = false, columnDefinition = "bigint")
+  @Valid
+  @NotNull
+  private FnRole role;
+  @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+  @JoinColumn(name = "function_cd", nullable = false, columnDefinition = "varchar(255) not null")
+  @Valid
+  @NotNull
+  private FnFunction functionCd;
 
-       @Getter
-       @Setter
-       @NoArgsConstructor
-       @EqualsAndHashCode
-       @AllArgsConstructor
-       public static class FnRoleFunctionId implements Serializable {
-              @Valid
-              private FnRole roleId;
-              @Valid
-              private FnFunction functionCd;
-       }
+  @Builder
+  public FnRoleFunction(@Digits(integer = 11, fraction = 0) Long id,
+      LocalDateTime created, LocalDateTime modified, Long rowNum, Serializable auditUserId,
+      DomainVo createdId, DomainVo modifiedId, Set<DomainVo> fnUsersCreatedId,
+      Set<DomainVo> fnUsersModifiedId,
+      @Valid @NotNull FnRole role,
+      @Valid @NotNull FnFunction functionCd) {
+    super(id, created, modified, rowNum, auditUserId, createdId, modifiedId, fnUsersCreatedId, fnUsersModifiedId);
+    this.role = role;
+    this.functionCd = functionCd;
+  }
 }
index e1c4cde..ad9c2cc 100644 (file)
@@ -70,7 +70,7 @@ public class FnRoleV implements Serializable {
        @Column(name = "role_name")
        private String roleName;
        @Column(name = "active_yn")
-       private String activeYn;
+       private Boolean activeYn;
        @Column(name = "priority")
        private BigInteger priority;
        @Column(name = "app_Id")
index 620532e..d4e2dd3 100644 (file)
@@ -48,6 +48,7 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
@@ -82,7 +83,8 @@ CREATE TABLE `fn_schedule_workflows` (
 @Entity
 public class FnScheduleWorkflows implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "id_schedule_workflows", nullable = false, length = 25, columnDefinition = "bigint(25) AUTO_INCREMENT")
        @Digits(integer = 25, fraction = 0)
        private BigInteger idScheduleWorkflows;
index 7c02183..ca16d34 100644 (file)
@@ -47,6 +47,7 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.persistence.UniqueConstraint;
 import javax.validation.constraints.Digits;
@@ -54,6 +55,7 @@ import javax.validation.constraints.NotNull;
 import javax.validation.constraints.PastOrPresent;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -76,6 +78,7 @@ CREATE TABLE `fn_shared_context` (
 })
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
index 634fb64..fa4be7f 100644 (file)
@@ -59,6 +59,7 @@ import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Pattern;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -89,6 +90,7 @@ CREATE TABLE `fn_tab` (
 })
 @NoArgsConstructor
 @AllArgsConstructor
+@Builder
 @Getter
 @Setter
 @Entity
@@ -112,34 +114,31 @@ public class FnTab implements Serializable {
        @SafeHtml
        @NotNull
        private String action;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "function_cd", nullable = false)
        @NotNull
        @Valid
        private FnFunction functionCd;
-       @Column(name = "active_yn", length = 1, nullable = false)
-       @Pattern(regexp = "[YNyn]")
-       @Size(max = 1)
+       @Column(name = "active_yn", nullable = false)
        @NotNull
-       @SafeHtml
-       private String activeYn;
+       private Boolean activeYn;
        @Column(name = "sort_order", length = 11, nullable = false)
        @Digits(integer = 11, fraction = 0)
        @NotNull
-       private BigInteger sortDrder;
+       private Long sortDrder;
        @Column(name = "parent_tab_cd", length = 30, columnDefinition = "varchar(30) DEFAULT NULL")
        @Size(max = 30)
        @SafeHtml
        private String parentTabCd;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "tab_set_cd", nullable = false)
        @NotNull
        @Valid
-       private FnLuTabSet fnLuTabSet;
+       private FnLuTabSet tabSetCd;
        @OneToMany(
                targetEntity = FnTabSelected.class,
                mappedBy = "selectedTabCd",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<FnTabSelected> selectedTabCd;
index 14b243d..1369fbd 100644 (file)
@@ -54,6 +54,7 @@ import javax.validation.Valid;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
@@ -73,13 +74,13 @@ CREATE TABLE `fn_tab_selected` (
 @Table(name = "fn_tab_selected")
 @NoArgsConstructor
 @AllArgsConstructor
-
+@Builder
 @Getter
 @Setter
 @Entity
 @IdClass(FnTabSelectedId.class)
 public class FnTabSelected implements Serializable{
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
        @JoinColumn(name = "selected_tab_cd", nullable = false)
        @NotNull
        @Valid
index c5a9719..277b04d 100644 (file)
@@ -44,15 +44,15 @@ import java.io.Serializable;
 import java.time.LocalDateTime;
 import java.util.Collection;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
 import java.util.stream.Collectors;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToMany;
@@ -60,7 +60,6 @@ import javax.persistence.ManyToOne;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
 import javax.persistence.OneToMany;
-import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.persistence.UniqueConstraint;
 import javax.validation.constraints.Digits;
@@ -75,13 +74,14 @@ import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.hibernate.annotations.DynamicUpdate;
 import org.hibernate.validator.constraints.SafeHtml;
+import org.onap.portal.domain.db.DomainVo;
 import org.onap.portal.domain.db.cr.CrReportFileHistory;
 import org.onap.portal.domain.db.ep.EpPersUserWidgetPlacement;
 import org.onap.portal.domain.db.ep.EpPersUserWidgetSel;
 import org.onap.portal.domain.db.ep.EpUserNotification;
 import org.onap.portal.domain.db.ep.EpUserRolesRequest;
 import org.onap.portal.domain.db.ep.EpWidgetCatalogParameter;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.authority.SimpleGrantedAuthority;
 import org.springframework.security.core.userdetails.UserDetails;
@@ -151,327 +151,477 @@ CREATE TABLE `fn_user` (
 */
 
 @NamedQueries({
-        @NamedQuery(
-                name = "FnUser.getUserWithOrgUserId",
-                query = "FROM FnUser WHERE orgUserId = :orgId"),
-        @NamedQuery(
-                name = "FnUser.getActiveUsers",
-                query = "FROM FnUser WHERE activeYn = 'Y'"),
-        @NamedQuery(
-                name = "FnUser.getUsersByOrgIds",
-                query = "FROM FnUser WHERE orgUserId IN :orgIds"
-        )
+    @NamedQuery(
+        name = "FnUser.getUserWithOrgUserId",
+        query = "FROM FnUser WHERE orgUserId = :orgId"),
+    @NamedQuery(
+        name = "FnUser.findByLoginId",
+        query = "FROM FnUser WHERE loginId = :loginId"),
+    @NamedQuery(
+        name = "FnUser.getActiveUsers",
+        query = "FROM FnUser WHERE activeYn = 'Y'"),
+    @NamedQuery(
+        name = "FnUser.getUsersByOrgIds",
+        query = "FROM FnUser WHERE orgUserId IN :orgIds"
+    )
 })
+
 @Table(name = "fn_user", indexes = {
-        @Index(name = "fn_user_address_id", columnList = "address_id"),
-        @Index(name = "fn_user_alert_method_cd", columnList = "alert_method_cd"),
-        @Index(name = "fn_user_org_id", columnList = "org_id"),
-        @Index(name = "fk_fn_user_ref_197_fn_user", columnList = "manager_id"),
-        @Index(name = "fk_fn_user_ref_198_fn_user", columnList = "created_id"),
-        @Index(name = "fk_fn_user_ref_199_fn_user", columnList = "modified_id"),
-        @Index(name = "fk_timezone", columnList = "timezone")
+    @Index(name = "fn_user_address_id", columnList = "address_id"),
+    @Index(name = "fn_user_alert_method_cd", columnList = "alert_method_cd"),
+    @Index(name = "fn_user_org_id", columnList = "org_id"),
+//    @Index(name = "fk_fn_user_ref_197_fn_user", columnList = "manager_id"),
+    @Index(name = "fk_fn_user_ref_198_fn_user", columnList = "created_id"),
+    @Index(name = "fk_fn_user_ref_199_fn_user", columnList = "modified_id"),
+    @Index(name = "fk_timezone", columnList = "timezone")
 },
-        uniqueConstraints = {
-                @UniqueConstraint(name = "fn_user_hrid", columnNames = "hrid"),
-                @UniqueConstraint(name = "fn_user_login_id", columnNames = "login_id")
+    uniqueConstraints = {
+        @UniqueConstraint(name = "fn_user_hrid", columnNames = "hrid"),
+        @UniqueConstraint(name = "fn_user_login_id", columnNames = "login_id")
 
-        })
+    })
 
 @Getter
 @Setter
 @Entity
-@Builder
 @NoArgsConstructor
 @AllArgsConstructor
 @DynamicUpdate
 public class FnUser extends DomainVo implements UserDetails, Serializable {
 
-       @Id
-       @GeneratedValue(strategy = GenerationType.IDENTITY)
-       @Column(name = "user_id", nullable = false)
-       private Long userId;
-       @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
-       @JoinColumn(name = "org_id")
-       private FnOrg orgId;
-       @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
-       @JoinColumn(name = "manager_id")
-       private FnUser managerId;
-       @Column(name = "first_name", length = 50)
-       @Size(max = 50)
-       @SafeHtml
-       private String firstName;
-       @Column(name = "middle_name", length = 50)
-       @Size(max = 50)
-       @SafeHtml
-       private String middleName;
-       @Column(name = "last_name", length = 50)
-       @Size(max = 50)
-       @SafeHtml
-       private String lastName;
-       @Column(name = "phone", length = 25)
-       @Size(max = 25)
-       @SafeHtml
-       private String phone;
-       @Column(name = "fax", length = 25)
-       @Size(max = 25)
-       @SafeHtml
-       private String fax;
-       @Column(name = "cellular", length = 25)
-       @Size(max = 25)
-       @SafeHtml
-       private String cellular;
-       @Column(name = "email", length = 50)
-       @Size(max = 50)
-       @Email
-       @SafeHtml
-       private String email;
-       @Column(name = "address_id")
-       @Digits(integer = 11, fraction = 0)
-       private Long addressId;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "alert_method_cd")
-       private FnLuAlertMethod alertMethodCd;
-       @Column(name = "hrid", length = 20)
-       @Size(max = 20)
-       @SafeHtml
-       private String hrid;
-       @Column(name = "org_user_id", length = 20)
-       @Size(max = 20)
-       @SafeHtml
-       private String orgUserId;
-       @Column(name = "org_code", length = 30)
-       @Size(max = 30)
-       @SafeHtml
-       private String org_code;
-       @Column(name = "login_id", length = 25)
-       @Size(max = 25)
-       @SafeHtml
-       private String loginId;
-       @Column(name = "login_pwd", length = 100)
-       @Size(max = 100)
-       @SafeHtml
-       private String loginPwd;
-       @Column(name = "last_login_date", nullable = false, columnDefinition = "datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()")
-       @PastOrPresent
-       protected LocalDateTime lastLoginDate;
-       @Column(name = "active_yn", nullable = false)
-       private Boolean activeYn;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "created_id")
-       private FnUser createdId;
-       @Column(name = "created_date", columnDefinition = "datetime DEFAULT current_timestamp()", nullable = false)
-       @PastOrPresent
-       protected LocalDateTime createdDate;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "modified_id")
-       private FnUser modifiedId;
-       @Column(name = "modified_date", nullable = false, columnDefinition = "datetime default now()")
-       @PastOrPresent
-       protected LocalDateTime modifiedDate;
-       @Column(name = "is_internal_yn", nullable = false, columnDefinition = "bit DEFAULT 0")
-       private Boolean isInternalYn;
-       @Column(name = "address_line_1", length = 100)
-       @Size(max = 100)
-       @SafeHtml
-       private String addressLine1;
-       @Column(name = "address_line_2", length = 100)
-       @Size(max = 100)
-       @SafeHtml
-       private String addressLine2;
-       @Column(name = "city", length = 50)
-       @Size(max = 50)
-       @SafeHtml
-       private String city;
-       @Column(name = "state_cd", length = 3)
-       @Size(max = 3)
-       @SafeHtml
-       private String stateCd;
-       @Column(name = "zip_code", length = 11)
-       @Size(max = 11)
-       @SafeHtml
-       private String zipCode;
-       @Column(name = "country_cd", length = 3)
-       @Size(max = 3)
-       @SafeHtml
-       private String countryCd;
-       @Column(name = "location_clli", length = 8)
-       @Size(max = 8)
-       @SafeHtml
-       private String locationClli;
-       @Column(name = "org_manager_userid", length = 20)
-       @Size(max = 20)
-       @SafeHtml
-       private String orgManagerUserId;
-       @Column(name = "company", length = 100)
-       @Size(max = 100)
-       @SafeHtml
-       private String company;
-       @Column(name = "department_name", length = 200)
-       @Size(max = 200)
-       @SafeHtml
-       private String departmentName;
-       @Column(name = "job_title", length = 100)
-       @Size(max = 100)
-       @SafeHtml
-       private String jobTitle;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "timezone")
-       private FnLuTimezone timezone;
-       @Column(name = "department", length = 25)
-       @Size(max = 25)
-       @SafeHtml
-       private String department;
-       @Column(name = "business_unit", length = 25)
-       @Size(max = 25)
-       @SafeHtml
-       private String businessUnit;
-       @Column(name = "business_unit_name", length = 100)
-       @Size(max = 100)
-       @SafeHtml
-       private String businessUnitName;
-       @Column(name = "cost_center", length = 25)
-       @Size(max = 25)
-       @SafeHtml
-       private String cost_center;
-       @Column(name = "fin_loc_code", length = 10)
-       @Size(max = 10)
-       @SafeHtml
-       private String finLocCode;
-       @Column(name = "silo_status", length = 10)
-       @Size(max = 10)
-       @SafeHtml
-       private String siloStatus;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "language_id", nullable = false, columnDefinition = "bigint DEFAULT 1")
-       @NotNull(message = "languageId must not be null")
-       private FnLanguage languageId;
-       @Column(name = "is_guest", nullable = false, columnDefinition = "bit DEFAULT 0")
-       @NotNull(message = "guest must not be null")
-       private Boolean guest;
-       @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "fnUserList")
-       private Set<CrReportFileHistory> crReportFileHistorie;
-       @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
-       private Set<FnRole> fnRoles;
-       @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
-       private Set<FnMenuFunctional> fnRoleList;
-       @OneToMany(
-               targetEntity = FnAuditLog.class,
-               mappedBy = "userId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<FnAuditLog> fnAuditLogs;
-       @OneToMany(
-               targetEntity = FnUser.class,
-               mappedBy = "createdId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<FnUser> fnUsersCreatedId;
-       @OneToMany(
-               targetEntity = FnUser.class,
-               mappedBy = "managerId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<FnUser> fnUsersManagerId;
-       @OneToMany(
-               targetEntity = FnUser.class,
-               mappedBy = "modifiedId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<FnUser> fnUsersModifiedId;
-       @OneToMany(
-               targetEntity = EpUserRolesRequest.class,
-               mappedBy = "userId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<EpUserRolesRequest> epUserRolesRequests;
-       @OneToMany(
-               targetEntity = FnPersUserAppSel.class,
-               mappedBy = "userId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<FnPersUserAppSel> persUserAppSels;
-       @OneToMany(
-               targetEntity = EpWidgetCatalogParameter.class,
-               mappedBy = "userId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<EpWidgetCatalogParameter> epWidgetCatalogParameters;
-       @OneToMany(
-               targetEntity = EpPersUserWidgetPlacement.class,
-               mappedBy = "userId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<EpPersUserWidgetPlacement> epPersUserWidgetPlacements;
-       @OneToMany(
-               targetEntity = EpPersUserWidgetSel.class,
-               mappedBy = "userId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<EpPersUserWidgetSel> epPersUserWidgetSels;
-       @OneToMany(
-               targetEntity = FnUserRole.class,
-               mappedBy = "userId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<FnUserRole> fnUserRoles;
-       @OneToMany(
-               targetEntity = EpUserNotification.class,
-               mappedBy = "userId",
-               cascade = CascadeType.ALL,
-               fetch = FetchType.LAZY
-       )
-       private Set<EpUserNotification> epUserNotifications;
-
-       @Override
-       public Collection<? extends GrantedAuthority> getAuthorities() {
-              return fnRoles
-                      .stream()
-                      .map(fnRole -> new SimpleGrantedAuthority("ROLE_" + fnRole.getRoleName()))
-                      .collect(Collectors.toList());
-       }
-
-       @Override
-       public String getPassword() {
-              return this.getLoginPwd();
-       }
-
-       @Override
-       public String getUsername() {
-              return this.getLoginId();
-       }
-
-       @Override
-       public boolean isAccountNonExpired() {
-              return true;
-       }
-
-       @Override
-       public boolean isAccountNonLocked() {
-              return true;
-       }
-
-       @Override
-       public boolean isCredentialsNonExpired() {
-              return true;
-       }
-
-       @Override
-       public boolean isEnabled() {
-              return true;
-       }
-
-       public String getFullName() {
-              return this.firstName + " " + this.lastName;
-       }
+  private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnUser.class);
+
+/*  @ManyToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
+  @JoinColumn(name = "manager_id")
+  private FnUser managerId;*/
+  @ManyToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
+  @JoinColumn(name = "org_id")
+  private FnOrg orgId;
+  @Column(name = "first_name", length = 50)
+  @Size(max = 50)
+  @SafeHtml
+  private String firstName;
+  @Column(name = "middle_name", length = 50)
+  @Size(max = 50)
+  @SafeHtml
+  private String middleName;
+  @Column(name = "last_name", length = 50)
+  @Size(max = 50)
+  @SafeHtml
+  private String lastName;
+  @Column(name = "phone", length = 25)
+  @Size(max = 25)
+  @SafeHtml
+  private String phone;
+  @Column(name = "fax", length = 25)
+  @Size(max = 25)
+  @SafeHtml
+  private String fax;
+  @Column(name = "cellular", length = 25)
+  @Size(max = 25)
+  @SafeHtml
+  private String cellular;
+  @Column(name = "email", length = 50)
+  @Size(max = 50)
+  @Email
+  @SafeHtml
+  private String email;
+  @Column(name = "address_id")
+  @Digits(integer = 11, fraction = 0)
+  private Long addressId;
+  @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+  @JoinColumn(name = "alert_method_cd")
+  private FnLuAlertMethod alertMethodCd;
+  @Column(name = "hrid", length = 20)
+  @Size(max = 20)
+  @SafeHtml
+  private String hrid;
+  @Column(name = "org_user_id", length = 20)
+  @Size(max = 20)
+  @SafeHtml
+  private String orgUserId;
+  @Column(name = "org_code", length = 30)
+  @Size(max = 30)
+  @SafeHtml
+  private String org_code;
+  @Column(name = "login_id", length = 25)
+  @Size(max = 25)
+  @SafeHtml
+  private String loginId;
+  @Column(name = "login_pwd", length = 100)
+  @Size(max = 100)
+  @SafeHtml
+  private String loginPwd;
+  @Column(name = "last_login_date", nullable = false, columnDefinition = "datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()")
+  @PastOrPresent
+  protected LocalDateTime lastLoginDate;
+  @Column(name = "active_yn", nullable = false)
+  private Boolean activeYn;
+  @Column(name = "created_date", columnDefinition = "datetime DEFAULT current_timestamp()", nullable = false)
+  @PastOrPresent
+  protected LocalDateTime createdDate;
+  @Column(name = "modified_date", nullable = false, columnDefinition = "datetime default now()")
+  @PastOrPresent
+  protected LocalDateTime modifiedDate;
+  @Column(name = "is_internal_yn", nullable = false, columnDefinition = "boolean DEFAULT false")
+  private Boolean isInternalYn = false;
+  @Column(name = "is_system_user", nullable = false, columnDefinition = "boolean DEFAULT false")
+  private Boolean isSystemUser = false;
+  @Column(name = "address_line_1", length = 100)
+  @Size(max = 100)
+  @SafeHtml
+  private String addressLine1;
+  @Column(name = "address_line_2", length = 100)
+  @Size(max = 100)
+  @SafeHtml
+  private String addressLine2;
+  @Column(name = "city", length = 50)
+  @Size(max = 50)
+  @SafeHtml
+  private String city;
+  @Column(name = "state_cd", length = 3)
+  @Size(max = 3)
+  @SafeHtml
+  private String stateCd;
+  @Column(name = "zip_code", length = 11)
+  @Size(max = 11)
+  @SafeHtml
+  private String zipCode;
+  @Column(name = "country_cd", length = 3)
+  @Size(max = 3)
+  @SafeHtml
+  private String countryCd;
+  @Column(name = "location_clli", length = 8)
+  @Size(max = 8)
+  @SafeHtml
+  private String locationClli;
+  @Column(name = "org_manager_userid", length = 20)
+  @Size(max = 20)
+  @SafeHtml
+  private String orgManagerUserId;
+  @Column(name = "company", length = 100)
+  @Size(max = 100)
+  @SafeHtml
+  private String company;
+  @Column(name = "department_name", length = 200)
+  @Size(max = 200)
+  @SafeHtml
+  private String departmentName;
+  @Column(name = "job_title", length = 100)
+  @Size(max = 100)
+  @SafeHtml
+  private String jobTitle;
+  @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+  @JoinColumn(name = "timezone")
+  private FnLuTimezone timezone;
+  @Column(name = "department", length = 25)
+  @Size(max = 25)
+  @SafeHtml
+  private String department;
+  @Column(name = "business_unit", length = 25)
+  @Size(max = 25)
+  @SafeHtml
+  private String businessUnit;
+  @Column(name = "business_unit_name", length = 100)
+  @Size(max = 100)
+  @SafeHtml
+  private String businessUnitName;
+  @Column(name = "cost_center", length = 25)
+  @Size(max = 25)
+  @SafeHtml
+  private String cost_center;
+  @Column(name = "fin_loc_code", length = 10)
+  @Size(max = 10)
+  @SafeHtml
+  private String finLocCode;
+  @Column(name = "silo_status", length = 10)
+  @Size(max = 10)
+  @SafeHtml
+  private String siloStatus;
+  @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+  @JoinColumn(name = "language_id", nullable = false)
+  @NotNull(message = "languageId must not be null")
+  private FnLanguage languageId;
+  @Column(name = "is_guest", nullable = false, columnDefinition = "boolean DEFAULT false")
+  @NotNull(message = "guest must not be null")
+  private Boolean guest = false;
+  @ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY, mappedBy = "fnUserList")
+  private Set<CrReportFileHistory> crReportFileHistorie;
+  @ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.EAGER, mappedBy = "fnUsers")
+  private Set<FnRole> fnRoles;
+  @ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
+  private Set<FnMenuFunctional> fnRoleList;
+  @OneToMany(
+      targetEntity = FnAuditLog.class,
+      mappedBy = "userId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<FnAuditLog> fnAuditLogs;
+  @OneToMany(
+      targetEntity = EpUserRolesRequest.class,
+      mappedBy = "userId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<EpUserRolesRequest> epUserRolesRequests;
+  @OneToMany(
+      targetEntity = FnPersUserAppSel.class,
+      mappedBy = "userId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<FnPersUserAppSel> persUserAppSels;
+  @OneToMany(
+      targetEntity = EpWidgetCatalogParameter.class,
+      mappedBy = "userId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<EpWidgetCatalogParameter> epWidgetCatalogParameters;
+  @OneToMany(
+      targetEntity = EpPersUserWidgetPlacement.class,
+      mappedBy = "userId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<EpPersUserWidgetPlacement> epPersUserWidgetPlacements;
+  @OneToMany(
+      targetEntity = EpPersUserWidgetSel.class,
+      mappedBy = "userId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<EpPersUserWidgetSel> epPersUserWidgetSels;
+  @OneToMany(
+      targetEntity = FnUserRole.class,
+      mappedBy = "userId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<FnUserRole> userApps;
+  @OneToMany(
+      targetEntity = EpUserNotification.class,
+      mappedBy = "userId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<EpUserNotification> epUserNotifications;
+/*  @OneToMany(
+      targetEntity = FnUser.class,
+      mappedBy = "managerId",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<FnUser> fnUsersManagerId;*/
+
+  @Override
+  public Collection<? extends GrantedAuthority> getAuthorities() {
+    return fnRoles
+        .stream()
+        .map(fnRole -> new SimpleGrantedAuthority("ROLE_" + fnRole.getRoleName()))
+        .collect(Collectors.toList());
+  }
+
+  @Override
+  public String getPassword() {
+    return this.getLoginPwd();
+  }
+
+  @Override
+  public String getUsername() {
+    return this.getLoginId();
+  }
+
+  @Override
+  public boolean isAccountNonExpired() {
+    return true;
+  }
+
+  @Override
+  public boolean isAccountNonLocked() {
+    return true;
+  }
+
+  @Override
+  public boolean isCredentialsNonExpired() {
+    return true;
+  }
+
+  @Override
+  public boolean isEnabled() {
+    return true;
+  }
+
+  public String getFullName() {
+    return this.firstName + " " + this.lastName;
+  }
+
+  public SortedSet<FnRole> getAppEPRoles(FnApp app) {
+
+    logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - app = {}", app.getAppName());
+
+    SortedSet<FnRole> roles = new TreeSet<>();
+    Set<FnUserRole> userAppRoles = getUserApps();
+
+    logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - userApps = {} ", userAppRoles.size());
+
+    Iterator<FnUserRole> userAppRolesIterator = userAppRoles.iterator();
+
+    FnUserRole userAppRole;
+    // getting default app
+    while (userAppRolesIterator.hasNext()) {
+      FnUserRole tempUserApp = userAppRolesIterator.next();
+      if (tempUserApp.getFnAppId().getId().equals(app.getId())) {
+
+        logger.debug(EELFLoggerDelegate.debugLogger,
+            "In EPUser.getAppEPRoles() - for user {}, found application {}", this.getFullName(),
+            app.getAppName());
+
+        userAppRole = tempUserApp;
+
+        FnRole role = userAppRole.getRoleId();
+        if (role.getActiveYn()) {
+          logger.debug(EELFLoggerDelegate.debugLogger,
+              "In EPUser.getAppEPRoles() - Role {} is active - adding for user {} and app {}",
+              role.getRoleName(), this.getFullName(), app.getAppName());
+          roles.add(role);
+        } else {
+          logger.debug(EELFLoggerDelegate.debugLogger,
+              "In EPUser.getAppEPRoles() - Role {} is NOT active - NOT adding for user {} and app {}",
+              role.getRoleName(), this.getFullName(), app.getAppName());
+        }
+      }
+    }
+    logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - roles = {}", roles.size());
+
+    return roles;
+  }
+
+  public void setRoles(Set<FnRole> roles) {
+    FnApp app = new FnApp();
+    app.setId(1L);
+    app.setAppName("Default");
+    this.addAppRoles(app, roles);
+  }
+
+  private void addAppRoles(FnApp app, Set<FnRole> roles) {
+    if (roles != null) {
+      Set<FnUserRole> newUserApps = new HashSet<>();
+      for (FnRole role : roles) {
+        FnUserRole userApp = new FnUserRole();
+        userApp.setUserId(this);
+        userApp.setFnAppId(app);
+        userApp.setRoleId(role);
+        newUserApps.add(userApp);
+      }
+
+      this.setUserApps(newUserApps);
+    } else {
+      this.userApps.clear();
+    }
+  }
+
+  @Builder
 
+  public FnUser(@Digits(integer = 11, fraction = 0) Long id, LocalDateTime created, LocalDateTime modified,
+      Long rowNum, Serializable auditUserId, DomainVo createdId, DomainVo modifiedId,
+      Set<DomainVo> fnUsersCreatedId, Set<DomainVo> fnUsersModifiedId, FnOrg orgId,
+      @Size(max = 50) @SafeHtml String firstName,
+      @Size(max = 50) @SafeHtml String middleName,
+      @Size(max = 50) @SafeHtml String lastName,
+      @Size(max = 25) @SafeHtml String phone,
+      @Size(max = 25) @SafeHtml String fax,
+      @Size(max = 25) @SafeHtml String cellular,
+      @Size(max = 50) @Email @SafeHtml String email,
+      @Digits(integer = 11, fraction = 0) Long addressId, FnLuAlertMethod alertMethodCd,
+      @Size(max = 20) @SafeHtml String hrid,
+      @Size(max = 20) @SafeHtml String orgUserId,
+      @Size(max = 30) @SafeHtml String org_code,
+      @Size(max = 25) @SafeHtml String loginId,
+      @Size(max = 100) @SafeHtml String loginPwd,
+      @PastOrPresent LocalDateTime lastLoginDate, Boolean activeYn,
+      @PastOrPresent LocalDateTime createdDate,
+      @PastOrPresent LocalDateTime modifiedDate, Boolean isInternalYn, Boolean isSystemUser,
+      @Size(max = 100) @SafeHtml String addressLine1,
+      @Size(max = 100) @SafeHtml String addressLine2,
+      @Size(max = 50) @SafeHtml String city,
+      @Size(max = 3) @SafeHtml String stateCd,
+      @Size(max = 11) @SafeHtml String zipCode,
+      @Size(max = 3) @SafeHtml String countryCd,
+      @Size(max = 8) @SafeHtml String locationClli,
+      @Size(max = 20) @SafeHtml String orgManagerUserId,
+      @Size(max = 100) @SafeHtml String company,
+      @Size(max = 200) @SafeHtml String departmentName,
+      @Size(max = 100) @SafeHtml String jobTitle, FnLuTimezone timezone,
+      @Size(max = 25) @SafeHtml String department,
+      @Size(max = 25) @SafeHtml String businessUnit,
+      @Size(max = 100) @SafeHtml String businessUnitName,
+      @Size(max = 25) @SafeHtml String cost_center,
+      @Size(max = 10) @SafeHtml String finLocCode,
+      @Size(max = 10) @SafeHtml String siloStatus,
+      @NotNull(message = "languageId must not be null") FnLanguage languageId,
+      @NotNull(message = "guest must not be null") Boolean guest,
+      Set<CrReportFileHistory> crReportFileHistorie, Set<FnRole> fnRoles,
+      Set<FnMenuFunctional> fnRoleList, Set<FnAuditLog> fnAuditLogs,
+      Set<EpUserRolesRequest> epUserRolesRequests,
+      Set<FnPersUserAppSel> persUserAppSels,
+      Set<EpWidgetCatalogParameter> epWidgetCatalogParameters,
+      Set<EpPersUserWidgetPlacement> epPersUserWidgetPlacements,
+      Set<EpPersUserWidgetSel> epPersUserWidgetSels, Set<FnUserRole> userApps,
+      Set<EpUserNotification> epUserNotifications) {
+    super(id, created, modified, rowNum, auditUserId, createdId, modifiedId, fnUsersCreatedId, fnUsersModifiedId);
+    this.orgId = orgId;
+    this.firstName = firstName;
+    this.middleName = middleName;
+    this.lastName = lastName;
+    this.phone = phone;
+    this.fax = fax;
+    this.cellular = cellular;
+    this.email = email;
+    this.addressId = addressId;
+    this.alertMethodCd = alertMethodCd;
+    this.hrid = hrid;
+    this.orgUserId = orgUserId;
+    this.org_code = org_code;
+    this.loginId = loginId;
+    this.loginPwd = loginPwd;
+    this.lastLoginDate = lastLoginDate;
+    this.activeYn = activeYn;
+    this.createdDate = createdDate;
+    this.modifiedDate = modifiedDate;
+    this.isInternalYn = isInternalYn;
+    this.isSystemUser = isSystemUser;
+    this.addressLine1 = addressLine1;
+    this.addressLine2 = addressLine2;
+    this.city = city;
+    this.stateCd = stateCd;
+    this.zipCode = zipCode;
+    this.countryCd = countryCd;
+    this.locationClli = locationClli;
+    this.orgManagerUserId = orgManagerUserId;
+    this.company = company;
+    this.departmentName = departmentName;
+    this.jobTitle = jobTitle;
+    this.timezone = timezone;
+    this.department = department;
+    this.businessUnit = businessUnit;
+    this.businessUnitName = businessUnitName;
+    this.cost_center = cost_center;
+    this.finLocCode = finLocCode;
+    this.siloStatus = siloStatus;
+    this.languageId = languageId;
+    this.guest = guest;
+    this.crReportFileHistorie = crReportFileHistorie;
+    this.fnRoles = fnRoles;
+    this.fnRoleList = fnRoleList;
+    this.fnAuditLogs = fnAuditLogs;
+    this.epUserRolesRequests = epUserRolesRequests;
+    this.persUserAppSels = persUserAppSels;
+    this.epWidgetCatalogParameters = epWidgetCatalogParameters;
+    this.epPersUserWidgetPlacements = epPersUserWidgetPlacements;
+    this.epPersUserWidgetSels = epPersUserWidgetSels;
+    this.userApps = userApps;
+    this.epUserNotifications = epUserNotifications;
+  }
 }
index 06320c4..e2913e0 100644 (file)
@@ -58,6 +58,7 @@ import javax.persistence.NamedNativeQuery;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
 import javax.persistence.OneToOne;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.SqlResultSetMapping;
 import javax.persistence.Table;
 import javax.persistence.UniqueConstraint;
@@ -87,76 +88,80 @@ CREATE TABLE `fn_user_role` (
 */
 
 @NamedNativeQueries({
-        @NamedNativeQuery(
-                name = "FnUserRole.retrieveUserRoleOnUserIdAndRoleIdAndAppId",
-                query = "FROM FnUserRole where user_id= :userId"
-                        + " and role_id= :roleId"
-                        + " and app_id= :appId"),
-        @NamedNativeQuery(
-                name = "FnUserRole.retrieveCachedAppRolesForUser",
-                query = "FROM FnUserRole where user_id= :userId"
-                        + " and user_id= :userId"
-                        + " and app_id= :appId"),
-        @NamedNativeQuery(
-                name = "FnUserRole.isSuperAdmin",
-                query = "SELECT"
-                        + "  user.USER_ID as userId,"
-                        + "  user.org_user_id as orgUserId,"
-                        + "  userrole.ROLE_ID as roleId,"
-                        + "  userrole.APP_ID as appId"
-                        + " FROM"
-                        + "  fn_user_role userrole"
-                        + "  INNER JOIN fn_user user ON user.USER_ID = userrole.USER_ID"
-                        + " WHERE"
-                        + "  user.org_user_id = :orgUserId"
-                        + "  AND userrole.ROLE_ID =:roleId"
-                        + "  AND userrole.APP_ID =:appId",
-                resultSetMapping = "UserRole",
-                resultClass = UserRole.class
-        )
+    @NamedNativeQuery(
+        name = "FnUserRole.retrieveUserRoleOnUserIdAndRoleIdAndAppId",
+        query = "FROM FnUserRole where userId= :userId"
+            + " and role_id= :roleId"
+            + " and app_id= :appId"),
+    @NamedNativeQuery(
+        name = "FnUserRole.retrieveCachedAppRolesForUser",
+        query = "FROM FnUserRole where userId= :userId"
+            + " and userId= :userId"
+            + " and app_id= :appId"),
+    @NamedNativeQuery(
+        name = "FnUserRole.isSuperAdmin",
+        query = "SELECT"
+            + "  userId.id as userId,"
+            + "  userId.org_user_id as orgUserId,"
+            + "  userrole.ROLE_ID as roleId,"
+            + "  userrole.APP_ID as appId"
+            + " FROM"
+            + "  fn_user_role userrole"
+            + "  INNER JOIN fn_user user ON user.USER_ID = userrole.USER_ID"
+            + " WHERE"
+            + "  user.org_user_id = :orgUserId"
+            + "  AND userrole.ROLE_ID =:roleId"
+            + "  AND userrole.APP_ID =:appId",
+        resultSetMapping = "UserRole",
+        resultClass = UserRole.class
+    )
 })
 
 @SqlResultSetMapping(
-        name = "UserRole",
-        classes = {
-                @ConstructorResult(
-                        targetClass = UserRole.class,
-                        columns = {
-                                @ColumnResult(name = "userId", type = Long.class),
-                                @ColumnResult(name = "orgUserId", type = String.class),
-                                @ColumnResult(name = "roleId", type = Long.class),
-                                @ColumnResult(name = "appId", type = Long.class)
-                        }
-                )
-        }
+    name = "UserRole",
+    classes = {
+        @ConstructorResult(
+            targetClass = UserRole.class,
+            columns = {
+                @ColumnResult(name = "userId", type = Long.class),
+                @ColumnResult(name = "orgUserId", type = String.class),
+                @ColumnResult(name = "roleId", type = Long.class),
+                @ColumnResult(name = "appId", type = Long.class)
+            }
+        )
+    }
 )
 
 @NamedQueries({
-        @NamedQuery(
-                name = "FnUserRole.getAdminUserRoles",
-                query = "FROM FnUserRole fn "
-                        + "WHERE  fn.userId.userId = :userId "
-                        + "AND fn.roleId.roleId = :roleId "
-                        + "AND fn.appId.appId = :appId"),
-        @NamedQuery(
-                name = "FnUserRole.getUserRolesForRoleIdAndAppId",
-                query = "FROM\n"
-                        + "  FnUserRole userrole\n"
-                        + "WHERE\n"
-                        + "  userrole.roleId.roleId = :roleId\n"
-                        + "  AND userrole.appId.appId = :appId"
-        )
+    @NamedQuery(
+        name = "FnUserRole.getAdminUserRoles",
+        query = "FROM FnUserRole "
+            + " WHERE  userId.id = :userId "
+            + " AND roleId.id = :roleId "
+            + " AND fnAppId.id = :appId"),
+    @NamedQuery(
+        name = "FnUserRole.retrieveByAppIdAndUserId",
+        query = "from FnUserRole where fnAppId.id =:appId and userId.id =:userId"
+    ),
+    @NamedQuery(
+        name = "FnUserRole.retrieveByAppIdAndRoleId",
+        query = "from FnUserRole where fnAppId.id =:appId and roleId.id =:roleId"
+    ),
+    @NamedQuery(
+        name = "FnUserRole.retrieveByUserIdAndRoleId",
+        query = "from FnUserRole where userId.id =:userId and roleId.id =:roleId"
+    )
 })
 
 @Table(
-        name = "fn_user_role",
-        indexes = {
-                @Index(name = "fn_user_role_role_id", columnList = "role_id"),
-                @Index(name = "fn_user_role_user_id", columnList = "user_id"),
-                @Index(name = "fk_fn_user__ref_178_fn_app_idx", columnList = "app_id")},
-        uniqueConstraints = {
-                @UniqueConstraint(name = "fn_user_role_id", columnNames = {"role_id", "user_id", "app_id"})
-        })
+    name = "fn_user_role",
+    indexes = {
+        @Index(name = "fn_user_role_role_id", columnList = "role_id"),
+        @Index(name = "fn_user_role_user_id", columnList = "user_id"),
+        @Index(name = "fk_fn_user__ref_178_fn_app_idx", columnList = "fn_App_Id")},
+    uniqueConstraints = {
+        @UniqueConstraint(name = "fn_user_role_id", columnNames = {"role_id", "user_id", "fn_App_Id"})
+    })
 @NoArgsConstructor
 @AllArgsConstructor
 @Builder
@@ -164,24 +169,24 @@ CREATE TABLE `fn_user_role` (
 @Setter
 @Entity
 public class FnUserRole implements Serializable {
-
-       @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
-       @Column(name = "id", columnDefinition = "int(11) auto_increment")
-       private Long id;
-       @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "user_id")
-       @Valid
-       private FnUser userId;
-       @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-       @JoinColumn(name = "role_id")
-       @Valid
-       private FnRole roleId;
-       @Column(name = "priority", length = 4, columnDefinition = "decimal(4,0) DEFAULT NULL")
-       @Digits(integer = 4, fraction = 0)
-       private Long priority;
-       @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
-       @JoinColumn(name = "app_Id")
-       @Valid
-       private FnApp appId;
+  @Id
+  @SequenceGenerator(name = "portal_generator", sequenceName = "portal_generator", initialValue = 1000)
+  @GeneratedValue(strategy = GenerationType.AUTO)
+  @Column(name = "id", columnDefinition = "int(11) auto_increment")
+  private Long id;
+  @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+  @JoinColumn(name = "user_id", columnDefinition = "bigint")
+  @Valid
+  private FnUser userId;
+  @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
+  @JoinColumn(name = "role_id", columnDefinition = "bigint")
+  @Valid
+  private FnRole roleId;
+  @Column(name = "priority", length = 4, columnDefinition = "decimal(4,0) DEFAULT NULL")
+  @Digits(integer = 4, fraction = 0)
+  private Long priority;
+  @ManyToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
+  @JoinColumn(name = "fn_App_Id", columnDefinition = "bigint")
+  @Valid
+  private FnApp fnAppId;
 }
\ No newline at end of file
index f595536..b42100d 100644 (file)
@@ -45,8 +45,6 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
-import javax.persistence.NamedNativeQueries;
-import javax.persistence.NamedNativeQuery;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
 import javax.persistence.Table;
index b5a4ecb..0baaa74 100644 (file)
@@ -46,6 +46,7 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 import javax.persistence.UniqueConstraint;
 import javax.validation.constraints.Digits;
@@ -85,7 +86,8 @@ CREATE TABLE `fn_workflow` (
 @Entity
 public class FnWorkflow implements Serializable {
        @Id
-       @GeneratedValue(strategy = GenerationType.AUTO)
+
+  @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "id", nullable = false, length = 9, columnDefinition = "mediumint(9) AUTO_INCREMENT")
        @Digits(integer = 9, fraction = 0)
        private Integer id;
diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/compositePK/FnRoleCompositeId.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/compositePK/FnRoleCompositeId.java
new file mode 100644 (file)
index 0000000..a03c9cf
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.domain.db.fn.compositePK;
+
+import java.io.Serializable;
+import javax.validation.Valid;
+import lombok.AllArgsConstructor;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.onap.portal.domain.dto.transport.Role;
+
+@Getter
+@Setter
+@EqualsAndHashCode
+@NoArgsConstructor
+@AllArgsConstructor
+public class FnRoleCompositeId implements Serializable {
+
+  @Valid
+  private Role parentRoles;
+  @Valid
+  private Role childRoles;
+
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/DomainVo.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/DomainVo.java
deleted file mode 100644 (file)
index 230da91..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * ============LICENSE_START==========================================
- * ONAP Portal
- * ===================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ===================================================================
- *
- * 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.portal.domain.dto;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.time.LocalDateTime;
-import java.util.Set;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import org.onap.portal.domain.db.fn.FnUser;
-import org.onap.portal.utils.EcompPortalUtils;
-import org.onap.portalsdk.core.domain.FusionVo;
-import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
-
-@Getter
-@Setter
-@NoArgsConstructor
-@AllArgsConstructor
-@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
-public class DomainVo extends FusionVo implements Serializable, Cloneable, Comparable {
-
-       private static final long serialVersionUID = 1L;
-
-       protected Long id;
-       protected LocalDateTime created;
-       protected LocalDateTime modified;
-       protected FnUser createdId;
-       protected FnUser modifiedId;
-       protected Long rowNum;
-       protected Serializable auditUserId;
-       protected Set auditTrail = null;
-       private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(DomainVo.class);
-
-       public DomainVo(Long id) {
-              this.id = id;
-       }
-
-       @Override
-       public int compareTo(Object obj) {
-              Long c1 = this.getId();
-              Long c2 = ((org.onap.portalsdk.core.domain.support.DomainVo) obj).getId();
-              return c1 != null && c2 != null ? c1.compareTo(c2) : 1;
-       }
-
-       public Object copy(boolean isIdNull) {
-              ByteArrayOutputStream baos = null;
-              ByteArrayInputStream bais = null;
-              ObjectOutputStream oos = null;
-              ObjectInputStream ois = null;
-              DomainVo newVo = null;
-
-              try {
-                     baos = new ByteArrayOutputStream();
-                     oos = new ObjectOutputStream(baos);
-                     oos.writeObject(this);
-                     bais = new ByteArrayInputStream(baos.toByteArray());
-                     ois = new ObjectInputStream(bais);
-                     newVo = (DomainVo) ois.readObject();
-                     if (isIdNull) {
-                            newVo.setId(null);
-                     }
-              } catch (Exception var8) {
-                  logger.error("exception occured",var8);
-              }
-
-              return newVo;
-       }
-
-       public Object clone() throws CloneNotSupportedException {
-              return super.clone();
-       }
-
-       public boolean equals(Object other) {
-              if (this == other) {
-                     return true;
-              } else if (other == null) {
-                     return false;
-              } else if (!(other instanceof DomainVo)) {
-                     return false;
-              } else {
-                     DomainVo castOther = (DomainVo)other;
-                     return this.getId().equals(castOther.getId())
-                             && this.getCreated().equals(castOther.getCreated())
-                             && this.getCreatedId().equals(castOther.getCreatedId())
-                             && this.getModified().equals(castOther.getModified())
-                             && this.getModifiedId() == castOther.getModifiedId();
-              }
-       }
-
-}
index f75cb54..182c080 100644 (file)
@@ -45,7 +45,7 @@ public enum PortalRestStatusEnum{
        WARN("WARNING"),
        ERROR("error");
        
-       private String value;
+       private final String value;
        PortalRestStatusEnum(String value){
                this.value = value;
        }
index a7be217..7e2f885 100644 (file)
@@ -46,7 +46,7 @@ import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
@@ -58,7 +58,6 @@ public class AppCatalogItem extends DomainVo {
 
        private static final long serialVersionUID = 6619663784935017846L;
 
-       private Long id;
        private String name;
        private String mlAppName;
        private String imageUrl;
index 706c3a3..5f604b8 100644 (file)
@@ -47,7 +47,7 @@ import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 import lombok.ToString;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
index 9f215a0..d0c8cee 100644 (file)
@@ -47,7 +47,7 @@ import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.hibernate.validator.constraints.SafeHtml;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
index 491a82d..ac490e5 100644 (file)
@@ -46,7 +46,7 @@ import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.hibernate.validator.constraints.SafeHtml;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
index 23d11a3..e218fd8 100644 (file)
@@ -45,7 +45,7 @@ import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
@@ -55,7 +55,6 @@ public class BasicAuthCredentials extends DomainVo {
        
        private static final long serialVersionUID = 1L;
 
-       private Long id;
        private String applicationName;
        private String username;
        private String password;
@@ -64,7 +63,7 @@ public class BasicAuthCredentials extends DomainVo {
 
        @Override
        public String toString() {
-               return "BasicAuthCredentials [id=" + id + ", applicationName=" + applicationName + ", username=" + username
+               return "BasicAuthCredentials [id=" + super.getId() + ", applicationName=" + applicationName + ", username=" + username
                                + ", password=" + password + ", isActive=" + isActive + "]";
        }
 
index de19cbd..68f0ff0 100644 (file)
@@ -48,7 +48,7 @@ import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.hibernate.validator.constraints.SafeHtml;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
@@ -76,7 +76,7 @@ public class CentralV2RoleFunction extends DomainVo implements Serializable, Com
        public CentralV2RoleFunction(Long id, String code, String name, Long appId, String type, String action,
                String editUrl) {
               super();
-              this.id = id;
+              super.setId(id);
               this.code = code;
               this.name = name;
               this.appId = appId;
@@ -87,7 +87,7 @@ public class CentralV2RoleFunction extends DomainVo implements Serializable, Com
 
        public CentralV2RoleFunction(Long id, String code, String name, Long appId, String editUrl) {
               super();
-              this.id = id;
+              super.setId(id);
               this.code = code;
               this.name = name;
               this.appId = appId;
index cda6622..8b0884b 100644 (file)
@@ -45,7 +45,7 @@ public enum CommonWidgetsEnum{
        EVENTS("events"),
        RESOURCES("resources");
        
-       private String value;
+       private final String value;
        CommonWidgetsEnum(String value){
                this.value = value;
        }
index def3e68..5f24436 100644 (file)
@@ -48,7 +48,7 @@ import lombok.Getter;
 import lombok.Setter;
 import org.apache.commons.lang.StringUtils;
 import org.hibernate.validator.constraints.SafeHtml;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
index 254a0e6..0b4f795 100644 (file)
@@ -44,7 +44,7 @@ import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
index 8c6052c..42aa1d1 100644 (file)
@@ -45,7 +45,7 @@ import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 import lombok.ToString;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
index 535470c..ce4a57d 100644 (file)
@@ -44,7 +44,7 @@ import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
index dff4876..9ef4ce2 100644 (file)
@@ -50,7 +50,7 @@ import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.hibernate.validator.constraints.SafeHtml;
 import org.onap.portalsdk.core.domain.RoleFunction;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
@@ -152,7 +152,7 @@ public class EPRole extends DomainVo {
 
        @Override
        public String toString() {
-              return "[Id = " + id + ", name = " + name + "]";
+              return "[Id = " + super.getId() + ", name = " + name + "]";
        }
 
 }
index 52d42fb..8bf9b72 100644 (file)
@@ -45,7 +45,7 @@ import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
index aa57cb8..8196429 100644 (file)
@@ -46,7 +46,7 @@ import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 import lombok.ToString;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
index 12cad85..05bfcd4 100644 (file)
@@ -47,7 +47,7 @@ import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 import lombok.ToString;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
index 6158535..e02420b 100644 (file)
@@ -47,7 +47,7 @@ import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
index 61e746a..b58d919 100644 (file)
@@ -44,7 +44,8 @@ import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.ep.EpUserRolesRequest;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
@@ -56,6 +57,6 @@ public class EPUserAppRolesRequestDetail extends DomainVo {
 
        private Long reqRoleId;
        private String reqType;
-       private EPUserAppRolesRequest epRequestIdData;
+       private EpUserRolesRequest epRequestIdData;
 
 }
index 67779ce..17a3e37 100644 (file)
@@ -44,7 +44,7 @@ import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
index ad821a2..d3a47de 100644 (file)
@@ -44,7 +44,7 @@ import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
index 85146c1..64953dc 100644 (file)
@@ -44,7 +44,7 @@ import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
index 232c8d1..b61e0ec 100644 (file)
@@ -48,7 +48,7 @@ import lombok.NoArgsConstructor;
 import lombok.Setter;
 import lombok.ToString;
 import org.hibernate.validator.constraints.SafeHtml;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
@@ -59,7 +59,6 @@ public class MicroserviceData extends DomainVo {
 
        private static final long serialVersionUID = 1L;
 
-       private Long id;
        @SafeHtml
        private String name;
        @SafeHtml
index 9978295..67bb932 100644 (file)
@@ -46,7 +46,7 @@ import lombok.NoArgsConstructor;
 import lombok.Setter;
 import lombok.ToString;
 import org.hibernate.validator.constraints.SafeHtml;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
@@ -55,13 +55,18 @@ import org.onap.portal.domain.dto.DomainVo;
 @AllArgsConstructor
 public class MicroserviceParameter extends DomainVo {
 
-       private static final long serialVersionUID = 1L;
+  private static final long serialVersionUID = 1L;
 
-       private Long id;
-       private long serviceId;
-       @SafeHtml
-       private String para_key;
-       @SafeHtml
-       private String para_value;
+  private long serviceId;
+  @SafeHtml
+  private String para_key;
+  @SafeHtml
+  private String para_value;
 
+  public MicroserviceParameter(Long id, long serviceId, String para_key, String para_value) {
+    super(id);
+    this.serviceId = serviceId;
+    this.para_key = para_key;
+    this.para_value = para_value;
+  }
 }
index b2d322b..def7c99 100644 (file)
@@ -44,7 +44,7 @@ import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
@@ -59,7 +59,7 @@ public class PersUserAppSelection extends DomainVo {
        private String statusCode;
 
        public PersUserAppSelection(final Long id, final Long userId, final Long appId, final String statusCode) {
-              super.id = id;
+              super.setId(id);
               this.userId = userId;
               this.appId = appId;
               this.statusCode = statusCode;
index 54eba6a..83b8648 100644 (file)
@@ -44,7 +44,7 @@ import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
@@ -59,7 +59,7 @@ public class PersUserWidgetSelection extends DomainVo {
        private String statusCode;
 
        public PersUserWidgetSelection(final Long id, final Long userId, final Long widgetId, final String statusCode) {
-               super.id = id;
+               super.setId(id);
                this.userId = userId;
                this.widgetId = widgetId;
                this.statusCode = statusCode;
index d8b69fc..d89b84f 100644 (file)
@@ -45,7 +45,7 @@ public enum PortalRestStatusEnum{
        WARN("WARNING"),
        ERROR("error");
        
-       private String value;
+       private final String value;
        PortalRestStatusEnum(String value){
                this.value = value;
        }
index 4d4b6d5..bedb0f7 100644 (file)
@@ -46,7 +46,7 @@ import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
index 2a31d1c..6127c5f 100644 (file)
@@ -49,7 +49,7 @@ import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.hibernate.validator.constraints.SafeHtml;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
index 206484f..d3e0f40 100644 (file)
@@ -44,7 +44,7 @@ import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.Setter;
 import org.apache.commons.lang.StringUtils;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
index e5e7255..3a12e8e 100644 (file)
@@ -44,7 +44,7 @@ import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
@@ -54,7 +54,6 @@ public class WidgetCatalogParameter extends DomainVo{
        
        private static final long serialVersionUID = 1L;
 
-       private Long id;
        private Long widgetId;
        private Long userId;
        private Long paramId;
index 25cc66f..742fe93 100644 (file)
 package org.onap.portal.domain.dto.transport;
 
 import java.io.Serializable;
-import java.util.Date;
+import java.time.LocalDateTime;
 import java.util.SortedSet;
 import java.util.TreeSet;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
+import org.onap.portal.domain.db.fn.FnRoleFunction;
 
 @Getter
 @Setter
+@Builder
 @EqualsAndHashCode
 @NoArgsConstructor
 @AllArgsConstructor
 public class CentralV2Role implements Serializable, Comparable {
 
-       private static final long serialVersionUID = -4332644961113063714L;
+  private static final long serialVersionUID = -4332644961113063714L;
 
-       private Long id;
-       private Date created;
-       private Date modified;
-       private Long createdId;
-       private Long modifiedId;
-       private Long rowNum;
-       private String name;
-       private boolean active;
-       private Integer priority;
-       private SortedSet<CentralV2RoleFunction> roleFunctions = new TreeSet<>();
-       private SortedSet<CentralV2Role> childRoles = new TreeSet<>();
-       private SortedSet<CentralV2Role> parentRoles = new TreeSet<>();
+  private Long id;
+  private LocalDateTime created;
+  private LocalDateTime modified;
+  private Long createdId;
+  private Long modifiedId;
+  private Long rowNum;
+  private String name;
+  private boolean active;
+  private Integer priority;
+  @Builder.Default
+  private SortedSet<FnRoleFunction> roleFunctions = new TreeSet<>();
+  @Builder.Default
+  private SortedSet<CentralV2Role> childRoles = new TreeSet<>();
+  @Builder.Default
+  private SortedSet<CentralV2Role> parentRoles = new TreeSet<>();
 
-       public CentralV2Role(Long id, String name) {
-              this.id = id;
-              this.name = name;
-       }
+  public CentralV2Role(Long id, String name) {
+    this.id = id;
+    this.name = name;
+  }
 
-       public void addRoleFunction(CentralV2RoleFunction roleFunction) {
-              this.roleFunctions.add(roleFunction);
-       }
+  public void addRoleFunction(FnRoleFunction roleFunction) {
+    this.roleFunctions.add(roleFunction);
+  }
 
-       public void addChildRole(CentralV2Role role) {
-              this.childRoles.add(role);
-       }
+  public void addChildRole(CentralV2Role role) {
+    this.childRoles.add(role);
+  }
 
-       public void addParentRole(CentralV2Role role) {
-              this.parentRoles.add(role);
-       }
+  public void addParentRole(CentralV2Role role) {
+    this.parentRoles.add(role);
+  }
 
-       @Override
-       public int compareTo(Object obj) {
-              CentralV2Role other = (CentralV2Role) obj;
+  @Override
+  public int compareTo(Object obj) {
+    CentralV2Role other = (CentralV2Role) obj;
 
-              String c1 = getName();
-              String c2 = other.getName();
+    String c1 = getName();
+    String c2 = other.getName();
 
-              return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2);
-       }
+    return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2);
+  }
 
 }
index 4aa79cc..db12201 100644 (file)
@@ -46,11 +46,11 @@ import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
-@EqualsAndHashCode
+@EqualsAndHashCode(callSuper = true)
 @NoArgsConstructor
 @AllArgsConstructor
 public class CentralV2RoleFunction extends DomainVo implements Serializable, Comparable {
@@ -68,7 +68,7 @@ public class CentralV2RoleFunction extends DomainVo implements Serializable, Com
        public CentralV2RoleFunction(Long id, String code, String name, Long appId, String type, String action,
                String editUrl) {
               super();
-              this.id = id;
+              super.setId(id);
               this.code = code;
               this.name = name;
               this.appId = appId;
@@ -79,7 +79,7 @@ public class CentralV2RoleFunction extends DomainVo implements Serializable, Com
 
        public CentralV2RoleFunction(Long id, String code, String name, Long appId, String editUrl) {
               super();
-              this.id = id;
+              super.setId(id);
               this.code = code;
               this.name = name;
               this.appId = appId;
index c9fce6d..c837ae4 100644 (file)
@@ -50,7 +50,7 @@ import lombok.NoArgsConstructor;
 import lombok.Setter;
 import lombok.ToString;
 import org.hibernate.validator.constraints.SafeHtml;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 
 @Getter
index 249aee1..d994f6a 100644 (file)
@@ -42,11 +42,47 @@ package org.onap.portal.domain.dto.transport;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
 import java.io.Serializable;
+import javax.persistence.ColumnResult;
+import javax.persistence.ConstructorResult;
+import javax.persistence.NamedNativeQuery;
+import javax.persistence.SqlResultSetMapping;
 import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 
+@NamedNativeQuery(
+               name = "EPUserAppCurrentRoles",
+               query = "select\n"
+                               + "  distinct fu.role_id,\n"
+                               + "  fr.user_id,\n"
+                               + "  fu.role_name,\n"
+                               + "  fu.priority\n"
+                               + " from\n"
+                               + "  fn_role fu\n"
+                               + "  left outer join fn_user_role fr ON fu.role_id = fr.role_id\n"
+                               + "  and fu.app_id = fr.app_id\n"
+                               + "  and fr.role_id != 999\n"
+                               + " where\n"
+                               + "  fu.app_id = :appId\n"
+                               + "  and fr.user_id = :userId\n"
+                               + "  and fu.active_yn = 'Y'\n",
+               resultSetMapping = "EPUserAppCurrentRoles"
+)
+
+@SqlResultSetMapping(
+               name = "EPUserAppCurrentRoles",
+               classes = @ConstructorResult(
+                               targetClass = EPUserAppCurrentRoles.class,
+                               columns = {
+                                               @ColumnResult(name = "roleName"),
+                                               @ColumnResult(name = "userId"),
+                                               @ColumnResult(name = "priority"),
+                                               @ColumnResult(name = "roleId")
+                               }
+               )
+)
+
 @Getter
 @Setter
 @NoArgsConstructor
index ebf8fe8..bb110ec 100644 (file)
@@ -61,5 +61,4 @@ public class EcompUserAppRoles implements Serializable {
        private Integer priority;
        private Long roleId;
        private String roleName;
-
 }
index 3c80e16..e405487 100644 (file)
@@ -45,7 +45,7 @@ import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
index 1f6f161..947d6ab 100644 (file)
@@ -45,7 +45,7 @@ import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.onap.portal.domain.dto.DomainVo;
+import org.onap.portal.domain.db.DomainVo;
 
 @Getter
 @Setter
@@ -55,8 +55,6 @@ public class EpRoleNotificationItem extends DomainVo {
 
        private static final long serialVersionUID = 1L;
 
-       @Digits(integer = 11, fraction = 0)
-       private Long id;
        @Digits(integer = 11, fraction = 0)
        private Long notificationId;
        @Digits(integer = 11, fraction = 0)
index c8b92f9..07a1f51 100644 (file)
@@ -42,6 +42,7 @@ package org.onap.portal.domain.dto.transport;
 
 import java.io.Serializable;
 import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -50,19 +51,20 @@ import lombok.ToString;
 @Getter
 @Setter
 @ToString
+@Builder
 @NoArgsConstructor
 @AllArgsConstructor
 public class GlobalRoleWithApplicationRoleFunction implements Serializable {
 
-       private static final long serialVersionUID = 1L;
+  private static final long serialVersionUID = 1L;
 
-       private Long roleId;
-       private String  roleName;
-    private boolean active;
-    private Integer priority;
-    private String functionCd;
-    private String functionName;
-    private long appId;
-       private long roleAppId;
+  private Long roleId;
+  private String roleName;
+  private Boolean active;
+  private Integer priority;
+  private String functionCd;
+  private String functionName;
+  private Long appId;
+  private Long roleAppId;
 
 }
index ccc9a78..85a155b 100644 (file)
@@ -42,13 +42,13 @@ package org.onap.portal.domain.dto.transport;
 
 import java.io.Serializable;
 import javax.validation.constraints.Min;
+import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Positive;
 import lombok.Builder;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.hibernate.validator.constraints.NotBlank;
 import org.hibernate.validator.constraints.SafeHtml;
 
 @Getter
diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/Role.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/Role.java
new file mode 100644 (file)
index 0000000..e7ba856
--- /dev/null
@@ -0,0 +1,188 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.domain.dto.transport;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.Set;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Index;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.validation.constraints.Digits;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.hibernate.validator.constraints.SafeHtml;
+import org.onap.portal.domain.db.fn.FnRoleComposite;
+import org.onap.portal.domain.db.fn.FnRoleFunction;
+import org.onap.portal.domain.db.DomainVo;
+import org.onap.portalsdk.core.domain.RoleFunction;
+
+@Table(name = "role", indexes = {
+    @Index(name = "fn_role_name_app_id_idx", columnList = "role_name, app_id", unique = true)
+})
+@Getter
+@Setter
+@Entity
+@NoArgsConstructor
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+public class Role extends DomainVo {
+
+  private static final long serialVersionUID = 1L;
+
+  @Column(name = "role_name", length = 300, nullable = false)
+  @Size(max = 300)
+  @NotNull
+  @SafeHtml
+  private String roleName;
+  @Column(name = "app_Id", length = 11, columnDefinition = "int(11) default null")
+  @Digits(integer = 11, fraction = 0)
+  private Long appId;
+  @Column(name = "active_yn", length = 1, columnDefinition = "boolean default true", nullable = false)
+  @NotNull
+  private Boolean activeYn = true;
+  @Column(name = "priority", length = 4, columnDefinition = "decimal(4,0) DEFAULT NULL")
+  @Digits(integer = 4, fraction = 0)
+  private Integer priority;
+  @OneToMany(
+      targetEntity = FnRoleFunction.class,
+      mappedBy = "role",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<FnRoleFunction> fnRoleFunctions;
+  @OneToMany(
+      targetEntity = FnRoleComposite.class,
+      mappedBy = "childRoles",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<FnRoleComposite> childRoles;
+  @JsonIgnore
+  @OneToMany(
+      targetEntity = FnRoleComposite.class,
+      mappedBy = "parentRoles",
+      cascade = CascadeType.MERGE,
+      fetch = FetchType.LAZY
+  )
+  private Set<FnRoleComposite> parentRoles;
+
+  public String getEditUrl() {
+    return "/role.htm?role_id=" + this.getId();
+  }
+
+  public String getToggleActiveImage() {
+    return "/static/fusion/images/" + (this.activeYn ? "active.png" : "inactive.png");
+  }
+
+  public String getToggleActiveAltText() {
+    return this.activeYn ? "Click to Deactivate Role" : "Click to Activate Role";
+  }
+
+  public void removeChildRole(Long roleId) {
+
+    for (FnRoleComposite role : this.childRoles) {
+      Role childRole = role.getChildRoles();
+      if (childRole.getId().equals(roleId)) {
+        this.childRoles.remove(childRole);
+        break;
+      }
+    }
+
+  }
+
+  public void removeParentRole(Long roleId) {
+
+    for (Object role : this.parentRoles) {
+      org.onap.portalsdk.core.domain.Role parentRole = (org.onap.portalsdk.core.domain.Role) role;
+      if (parentRole.getId().equals(roleId)) {
+        this.parentRoles.remove(parentRole);
+        break;
+      }
+    }
+
+  }
+
+  public void removeRoleFunction(String roleFunctionCd) {
+
+    for (Object function : this.fnRoleFunctions) {
+      RoleFunction roleFunction = (RoleFunction) function;
+      if (roleFunction.getCode().equals(roleFunctionCd)) {
+        this.fnRoleFunctions.remove(roleFunction);
+        break;
+      }
+    }
+
+  }
+
+  public int compareTo(Object obj) {
+    String c1 = this.getRoleName();
+    String c2 = ((org.onap.portalsdk.core.domain.Role) obj).getName();
+    return c1 != null && c2 != null ? c1.compareTo(c2) : 1;
+  }
+
+  public Role( Long id, LocalDateTime created,
+      LocalDateTime modified, Long rowNum, Serializable auditUserId,
+      DomainVo createdId, DomainVo modifiedId, Set<DomainVo> fnUsersCreatedId,
+      Set<DomainVo> fnUsersModifiedId, String roleName, Long appId, Boolean activeYn, Integer priority,
+      Set<FnRoleFunction> fnRoleFunctions, Set<FnRoleComposite> childRoles,
+      Set<FnRoleComposite> parentRoles) {
+    super(id, created, modified, rowNum, auditUserId, createdId, modifiedId, fnUsersCreatedId, fnUsersModifiedId);
+    this.roleName = roleName;
+    this.appId = appId;
+    this.activeYn = activeYn;
+    this.priority = priority;
+    this.fnRoleFunctions = fnRoleFunctions;
+    this.childRoles = childRoles;
+    this.parentRoles = parentRoles;
+  }
+}
index 869ba81..0a71850 100644 (file)
@@ -50,9 +50,8 @@ import org.springframework.stereotype.Component;
 public class FnUserMapper {
               public FnUserDto fnUserToFnUserDto(final FnUser fnUser){
               return FnUserDto.builder()
-                      .userId(fnUser.getUserId())
+                      .userId(fnUser.getId())
                       .orgId(fnUser.getOrgId().getOrgId())
-                      .managerId(fnUser.getManagerId().getUserId())
                       .firstName(fnUser.getFirstName())
                       .middleName(fnUser.getMiddleName())
                       .lastName(fnUser.getLastName())
@@ -69,9 +68,7 @@ public class FnUserMapper {
                       .loginPwd(fnUser.getLoginPwd())
                       .lastLoginDate(fnUser.getLastLoginDate())
                       .activeYn(fnUser.getActiveYn())
-                      .createdId(fnUser.getCreatedId().getUserId())
                       .createdDate(fnUser.getCreatedDate())
-                      .modifiedId(fnUser.getModifiedId().getUserId())
                       .modifiedDate(fnUser.getModifiedDate())
                       .isInternalYn(fnUser.getIsInternalYn())
                       .addressLine1(fnUser.getAddressLine1())
@@ -100,9 +97,8 @@ public class FnUserMapper {
 
        public FnUser fnUserToFnUser(final FnUser fnUser){
               return FnUser.builder()
-                      .userId(fnUser.getUserId())
+                      .id(fnUser.getId())
                       .orgId(fnUser.getOrgId())
-                      .managerId(fnUser.getManagerId())
                       .firstName(fnUser.getFirstName())
                       .middleName(fnUser.getMiddleName())
                       .lastName(fnUser.getLastName())
@@ -119,9 +115,7 @@ public class FnUserMapper {
                       .loginPwd(fnUser.getLoginPwd())
                       .lastLoginDate(fnUser.getLastLoginDate())
                       .activeYn(fnUser.getActiveYn())
-                      .createdId(fnUser.getCreatedId())
                       .createdDate(fnUser.getCreatedDate())
-                      .modifiedId(fnUser.getModifiedId())
                       .modifiedDate(fnUser.getModifiedDate())
                       .isInternalYn(fnUser.getIsInternalYn())
                       .addressLine1(fnUser.getAddressLine1())
diff --git a/portal-BE/src/main/java/org/onap/portal/exception/DeleteDomainObjectFailedException.java b/portal-BE/src/main/java/org/onap/portal/exception/DeleteDomainObjectFailedException.java
new file mode 100644 (file)
index 0000000..135ab08
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.exception;
+
+public class DeleteDomainObjectFailedException extends Exception{
+
+  private static final long serialVersionUID = -4591508985449251121L;
+
+  public DeleteDomainObjectFailedException(String msg) {
+    super(msg);
+  }
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/exception/SyncUserRolesException.java b/portal-BE/src/main/java/org/onap/portal/exception/SyncUserRolesException.java
new file mode 100644 (file)
index 0000000..604689a
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.exception;
+
+public class SyncUserRolesException extends Exception{
+
+  public SyncUserRolesException(String msg) {
+    super(msg);
+  }
+
+}
+
index fa8ab5d..2c7151a 100644 (file)
@@ -49,8 +49,8 @@ import java.util.UUID;
 import javax.servlet.http.HttpServletRequest;
 import org.onap.portal.domain.db.fn.FnApp;
 import org.onap.portal.domain.db.fn.FnUser;
+import org.onap.portal.service.AppsCacheService;
 import org.onap.portal.service.fn.FnUserService;
-import org.onap.portal.service.fn.old.AppsCacheService;
 import org.onap.portal.utils.EPCommonSystemProperties;
 import org.onap.portal.utils.EcompPortalUtils;
 import org.onap.portalsdk.core.exception.SessionExpiredException;
@@ -66,7 +66,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 @org.springframework.context.annotation.Configuration
 public class EPEELFLoggerAdvice {
 
-       private EELFLoggerDelegate adviceLogger = EELFLoggerDelegate.getLogger(EPEELFLoggerAdvice.class);
+       private final EELFLoggerDelegate adviceLogger = EELFLoggerDelegate.getLogger(EPEELFLoggerAdvice.class);
 
        private final AppsCacheService appCacheService;
        private final FnUserService fnUserService;
index d4bd55f..8fb70c5 100644 (file)
@@ -321,14 +321,14 @@ public enum EPAppMessagesEnum implements EELFResolvableErrorEnum {
 
        ;
 
-       ErrorTypeEnum eType;
-       AlarmSeverityEnum alarmSeverity;
-       EPErrorCodesEnum messageCode;
-       ErrorSeverityEnum errorSeverity;
-       String errorCode;
-       String errorDescription;
-       String details;
-       String resolution;
+       final ErrorTypeEnum eType;
+       final AlarmSeverityEnum alarmSeverity;
+       final EPErrorCodesEnum messageCode;
+       final ErrorSeverityEnum errorSeverity;
+       final String errorCode;
+       final String errorDescription;
+       final String details;
+       final String resolution;
 
        EPAppMessagesEnum(EPErrorCodesEnum messageCode, ErrorTypeEnum eType, AlarmSeverityEnum alarmSeverity,
                ErrorSeverityEnum errorSeverity, String errorCode, String errorDescription,
index 00de83d..9c4799e 100644 (file)
@@ -55,7 +55,7 @@ import org.springframework.http.HttpStatus;
 public class EPLogUtil {
 
        // This class has no logger of its own; it uses loggers passed to it.
-       private static EELFLogger errorLogger = EELFManager.getInstance().getErrorLogger();
+       private static final EELFLogger errorLogger = EELFManager.getInstance().getErrorLogger();
 
        /**
         * Formats and writes a message to the error log with the class name and the
index c2d88bc..8049cd6 100644 (file)
 
 package org.onap.portal.service;
 
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import java.util.stream.Collectors;
+import javax.annotation.PostConstruct;
 import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import javax.persistence.Tuple;
+import org.apache.commons.lang.StringUtils;
+import org.apache.cxf.transport.http.HTTPException;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.onap.portal.domain.db.ep.EpAppFunction;
+import org.onap.portal.domain.db.ep.EpUserRolesRequest;
+import org.onap.portal.domain.db.ep.EpUserRolesRequestDet;
+import org.onap.portal.domain.db.fn.FnApp;
+import org.onap.portal.domain.db.fn.FnFunction;
+import org.onap.portal.domain.db.fn.FnMenuFunctional;
+import org.onap.portal.domain.db.fn.FnMenuFunctionalRoles;
 import org.onap.portal.domain.db.fn.FnRole;
+import org.onap.portal.domain.db.fn.FnRoleFunction;
 import org.onap.portal.domain.db.fn.FnUser;
 import org.onap.portal.domain.db.fn.FnUserRole;
+import org.onap.portal.domain.dto.transport.AppNameIdIsAdmin;
+import org.onap.portal.domain.dto.transport.AppWithRolesForUser;
+import org.onap.portal.domain.dto.transport.AppsListWithAdminRole;
+import org.onap.portal.domain.dto.transport.CentralV2Role;
+import org.onap.portal.domain.dto.transport.EPUserAppCurrentRoles;
+import org.onap.portal.domain.dto.transport.EcompUserAppRoles;
+import org.onap.portal.domain.dto.transport.ExternalAccessUser;
+import org.onap.portal.domain.dto.transport.ExternalAccessUserRoleDetail;
+import org.onap.portal.domain.dto.transport.ExternalRequestFieldsValidator;
+import org.onap.portal.domain.dto.transport.ExternalRoleDescription;
+import org.onap.portal.domain.dto.transport.RemoteRoleV1;
+import org.onap.portal.domain.dto.transport.Role;
+import org.onap.portal.domain.dto.transport.RoleInAppForUser;
+import org.onap.portal.domain.dto.transport.RolesInAppForUser;
+import org.onap.portal.exception.DeleteDomainObjectFailedException;
+import org.onap.portal.exception.SyncUserRolesException;
 import org.onap.portal.logging.format.EPAppMessagesEnum;
 import org.onap.portal.logging.logic.EPLogUtil;
+import org.onap.portal.service.ep.EpAppFunctionService;
+import org.onap.portal.service.ep.EpUserRolesRequestDetService;
+import org.onap.portal.service.ep.EpUserRolesRequestService;
+import org.onap.portal.service.fn.FnAppService;
+import org.onap.portal.service.fn.FnMenuFunctionalRolesService;
+import org.onap.portal.service.fn.FnMenuFunctionalService;
+import org.onap.portal.service.fn.FnRoleService;
 import org.onap.portal.service.fn.FnUserRoleService;
 import org.onap.portal.service.fn.FnUserService;
+import org.onap.portal.utils.EPCommonSystemProperties;
+import org.onap.portal.utils.EPUserUtils;
+import org.onap.portal.utils.EcompPortalUtils;
+import org.onap.portal.utils.PortalConstants;
+import org.onap.portalsdk.core.domain.RoleFunction;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.portalsdk.core.restful.domain.EcompRole;
+import org.onap.portalsdk.core.util.SystemProperties;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.client.HttpClientErrorException;
+import org.springframework.web.client.RestTemplate;
 
 @Service
 @Transactional
 public class AdminRolesService {
 
-       private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AdminRolesService.class);
-
-       private final Long SYS_ADMIN_ROLE_ID = 1L;
-       private final Long ACCOUNT_ADMIN_ROLE_ID = 999L;
-       private final Long ECOMP_APP_ID = 1L;
-       private final String ADMIN_ACCOUNT = "Is account admin for user {}";
-
-       private final EntityManager entityManager;
-       private final FnUserService fnUserService;
-       private final FnUserRoleService fnUserRoleService;
-
-       @Autowired
-       public AdminRolesService(final EntityManager entityManager,
-               final FnUserService fnUserService, final FnUserRoleService fnUserRoleService) {
-              this.entityManager = entityManager;
-              this.fnUserService = fnUserService;
-              this.fnUserRoleService = fnUserRoleService;
-       }
-
-       public boolean isSuperAdmin(final String orgUserId) {
-              boolean isSuperAdmin;
-              try {
-                     isSuperAdmin = fnUserRoleService
-                             .isSuperAdmin(orgUserId, SYS_ADMIN_ROLE_ID, ECOMP_APP_ID);
-              } catch (Exception e) {
-                     logger.error("isSuperAdmin exception: " + e.toString());
-                     throw e;
+  private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AdminRolesService.class);
+  private static final Object syncRests = new Object();
+  private final RestTemplate template = new RestTemplate();
+
+  private Long SYS_ADMIN_ROLE_ID = 38L;
+  private final Long ACCOUNT_ADMIN_ROLE_ID = 999L;
+  private final Long ECOMP_APP_ID = 1L;
+  private final String ADMIN_ACCOUNT = "Is account admin for user {}";
+
+  private final AppsCacheService appsCacheService;
+  private final EntityManager entityManager;
+  private final FnUserService fnUserService;
+  private final FnRoleService fnRoleService;
+  private final FnAppService fnAppService;
+  private final FnMenuFunctionalService fnMenuFunctionalService;
+  private final FnUserRoleService fnUserRoleService;
+  private final EpAppFunctionService epAppFunctionService;
+  private final EcompUserAppRolesService ecompUserAppRolesService;
+  private final FnMenuFunctionalRolesService fnMenuFunctionalRolesService;
+  private final ApplicationsRestClientService applicationsRestClientService;
+  private final EpUserRolesRequestDetService epUserRolesRequestDetService;
+  private final ExternalAccessRolesService externalAccessRolesService;
+  private final EpUserRolesRequestService epUserRolesRequestService;
+
+  @Autowired
+  public AdminRolesService(AppsCacheService appsCacheService,
+      final EntityManager entityManager,
+      final FnUserService fnUserService, FnRoleService fnRoleService,
+      FnAppService fnAppService,
+      FnMenuFunctionalService fnMenuFunctionalService,
+      final FnUserRoleService fnUserRoleService,
+      EpAppFunctionService epAppFunctionService,
+      EcompUserAppRolesService ecompUserAppRolesService,
+      FnMenuFunctionalRolesService fnMenuFunctionalRolesService,
+      ApplicationsRestClientService applicationsRestClientService,
+      EpUserRolesRequestDetService epUserRolesRequestDetService,
+      ExternalAccessRolesService externalAccessRolesService,
+      EpUserRolesRequestService epUserRolesRequestService) {
+    this.appsCacheService = appsCacheService;
+    this.entityManager = entityManager;
+    this.fnUserService = fnUserService;
+    this.fnRoleService = fnRoleService;
+    this.fnAppService = fnAppService;
+    this.fnMenuFunctionalService = fnMenuFunctionalService;
+    this.fnUserRoleService = fnUserRoleService;
+    this.epAppFunctionService = epAppFunctionService;
+    this.ecompUserAppRolesService = ecompUserAppRolesService;
+    this.fnMenuFunctionalRolesService = fnMenuFunctionalRolesService;
+    this.applicationsRestClientService = applicationsRestClientService;
+    this.epUserRolesRequestDetService = epUserRolesRequestDetService;
+    this.externalAccessRolesService = externalAccessRolesService;
+    this.epUserRolesRequestService = epUserRolesRequestService;
+  }
+
+  public boolean isSuperAdmin(final String loginId) {
+    boolean isSuperAdmin;
+    try {
+      isSuperAdmin = fnUserRoleService
+          .isSuperAdmin(loginId, SYS_ADMIN_ROLE_ID, ECOMP_APP_ID);
+    } catch (Exception e) {
+      logger.error("isSuperAdmin exception: " + e.toString());
+      throw e;
+    }
+    logger.info("isSuperAdmin " + isSuperAdmin);
+    return isSuperAdmin;
+  }
+
+  public boolean isAccountAdmin(FnUser user) {
+    try {
+      logger.debug(EELFLoggerDelegate.debugLogger, ADMIN_ACCOUNT, user.getId());
+      List<Integer> userAdminApps = getAdminAppsForTheUser(user.getId());
+      logger.debug(EELFLoggerDelegate.debugLogger,
+          "Is account admin for userAdminApps() - for user {}, found userAdminAppsSize {}",
+          user.getOrgUserId(), userAdminApps.size());
+
+      if (user.getId() != null) {
+        for (FnUserRole userApp : user.getUserApps()) {
+          if (userApp.getRoleId().getId().equals(ACCOUNT_ADMIN_ROLE_ID) || (
+              userAdminApps.size() > 1)) {
+            logger.debug(EELFLoggerDelegate.debugLogger,
+                "Is account admin for userAdminApps() - for user {}, found Id {}",
+                user.getOrgUserId(), userApp.getRoleId().getId());
+            return true;
+          }
+        }
+      }
+    } catch (Exception e) {
+      EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e);
+      logger.error(EELFLoggerDelegate.errorLogger,
+          "Exception occurred while executing isAccountAdmin operation",
+          e);
+    }
+    return false;
+  }
+
+  boolean isUser(FnUser user) {
+    try {
+      FnUser currentUser = fnUserService.getUser(user.getId()).orElseThrow(Exception::new);
+      if (currentUser != null && currentUser.getId() != null) {
+        for (FnUserRole userApp : currentUser.getUserApps()) {
+          if (!userApp.getFnAppId().getId().equals(ECOMP_APP_ID)) {
+            FnRole role = userApp.getRoleId();
+            if (!role.getId().equals(SYS_ADMIN_ROLE_ID) && !role.getId()
+                .equals(ACCOUNT_ADMIN_ROLE_ID)) {
+              if (role.getActiveYn()) {
+                return true;
               }
-              logger.info("isSuperAdmin " + isSuperAdmin);
-              return isSuperAdmin;
-       }
-
-       public boolean isAccountAdmin(FnUser user) {
-              try {
-                     final Map<String, Long> userParams = new HashMap<>();
-                     userParams.put("userId", user.getId());
-                     logger.debug(EELFLoggerDelegate.debugLogger, ADMIN_ACCOUNT, user.getId());
-                     List<Integer> userAdminApps;
-                     String query = "select fa.app_id from fn_user_role ur,fn_app fa where ur.user_id =:userId and ur.app_id=fa.app_id and ur.role_id= 999 and (fa.enabled = 'Y' || fa.app_id=1)";
-                     userAdminApps = entityManager.createQuery(query, Integer.class)
-                             .setParameter("userId", user.getId()).getResultList();
-                     logger.debug(EELFLoggerDelegate.debugLogger,
-                             "Is account admin for userAdminApps() - for user {}, found userAdminAppsSize {}",
-                             user.getOrgUserId(), userAdminApps.size());
-
-                     if (user.getId() != null) {
-                            for (FnUserRole userApp : user.getFnUserRoles()) {
-                                   if (userApp.getRoleId().getId().equals(ACCOUNT_ADMIN_ROLE_ID) || (
-                                           userAdminApps.size() > 1)) {
-                                          logger.debug(EELFLoggerDelegate.debugLogger,
-                                                  "Is account admin for userAdminApps() - for user {}, found Id {}",
-                                                  user.getOrgUserId(), userApp.getRoleId().getId());
-                                          return true;
-                                   }
-                            }
-                     }
-              } catch (Exception e) {
-                     EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e);
-                     logger.error(EELFLoggerDelegate.errorLogger,
-                             "Exception occurred while executing isAccountAdmin operation",
-                             e);
+            }
+          }
+        }
+      }
+    } catch (Exception e) {
+      EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e);
+      logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while executing isUser operation",
+          e);
+    }
+    return false;
+  }
+
+  public boolean isRoleAdmin(Long userId) {
+    try {
+      logger.debug(EELFLoggerDelegate.debugLogger, "Checking if user has isRoleAdmin access");
+      List getRoleFuncListOfUser = fnUserRoleService.getRoleFunctionsOfUserforAlltheApplications(userId);
+      logger.debug(EELFLoggerDelegate.debugLogger,
+          "Checking if user has isRoleAdmin access :: getRoleFuncListOfUser", getRoleFuncListOfUser);
+      Set<String> getRoleFuncListOfPortalSet = new HashSet<>(getRoleFuncListOfUser);
+      Set<String> getRoleFuncListOfPortalSet1 = new HashSet<>();
+      Set<String> roleFunSet;
+      roleFunSet = getRoleFuncListOfPortalSet.stream().filter(x -> x.contains("|"))
+          .collect(Collectors.toSet());
+      if (!roleFunSet.isEmpty()) {
+        for (String roleFunction : roleFunSet) {
+          String type = externalAccessRolesService.getFunctionCodeType(roleFunction);
+          getRoleFuncListOfPortalSet1.add(type);
+        }
+      }
+
+      boolean checkIfFunctionsExits = getRoleFuncListOfPortalSet1.stream()
+          .anyMatch(roleFunction -> roleFunction.equalsIgnoreCase("Approver"));
+      logger.debug(EELFLoggerDelegate.debugLogger, "Checking if user has approver rolefunction",
+          checkIfFunctionsExits);
+
+      return checkIfFunctionsExits;
+
+    } catch (Exception e) {
+      EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e);
+      logger.error(EELFLoggerDelegate.errorLogger,
+          "Exception occurred while executing isRoleAdmin operation",
+          e);
+    }
+    return false;
+  }
+
+  private boolean isAccountAdminOfApplication(Long userId, FnApp app) {
+    boolean isApplicationAccountAdmin = false;
+    try {
+      logger.debug(EELFLoggerDelegate.debugLogger, ADMIN_ACCOUNT, userId);
+      List<Integer> userAdminApps = getAdminAppsForTheUser(userId);
+      if (!userAdminApps.isEmpty()) {
+        isApplicationAccountAdmin = userAdminApps.contains(app.getId());
+        logger.debug(EELFLoggerDelegate.debugLogger, "Is account admin for user is true{} ,appId {}", userId,
+            app.getId());
+      }
+    } catch (Exception e) {
+      EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e);
+      logger.error(EELFLoggerDelegate.errorLogger,
+          "Exception occurred while executing isAccountAdminOfApplication operation", e);
+    }
+    logger.debug(EELFLoggerDelegate.debugLogger,
+        "In AdminRolesServiceImpl() - isAccountAdminOfApplication = {} and userId ={} ", isApplicationAccountAdmin,
+        userId);
+    return isApplicationAccountAdmin;
+
+  }
+
+  private List<Integer> getAdminAppsForTheUser(final Long userId) {
+    String query = "select fa.app_id from fn_user_role ur,fn_app fa where ur.user_id =:userId and ur.app_id=fa.app_id and ur.role_id= 999 and (fa.enabled = 'Y' || fa.app_id=1)";
+    return entityManager.createQuery(query, Integer.class)
+        .setParameter("userId", userId).getResultList();
+  }
+
+  public ExternalRequestFieldsValidator setAppWithUserRoleStateForUser(FnUser user,
+      AppWithRolesForUser newAppRolesForUser) {
+    boolean result = false;
+    boolean epRequestValue = false;
+    String userId = "";
+    String reqMessage = "";
+    if (newAppRolesForUser != null && newAppRolesForUser.getOrgUserId() != null) {
+      userId = newAppRolesForUser.getOrgUserId().trim();
+    }
+    Long appId = newAppRolesForUser.getAppId();
+    List<RoleInAppForUser> roleInAppForUserList = newAppRolesForUser.getAppRoles();
+
+    if (userId.length() > 0) {
+      ObjectMapper mapper = new ObjectMapper();
+      mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+
+      try {
+        FnApp app = fnAppService.getById(appId);
+
+        boolean checkIfUserisApplicationAccAdmin = isAccountAdminOfApplication(user.getId(),
+            app);
+        Set<EcompRole> rolesGotDeletedFromApprover = new TreeSet<>();
+
+        boolean checkIfUserIsOnlyRoleAdmin =
+            isRoleAdmin(user.getId()) && !checkIfUserisApplicationAccAdmin;
+        if (checkIfUserIsOnlyRoleAdmin) {
+          for (RoleInAppForUser roleInAppForUser : roleInAppForUserList) {
+            if (!roleInAppForUser.getIsApplied()) {
+              EcompRole ecompRole = new EcompRole();
+              ecompRole.setId(roleInAppForUser.getRoleId());
+              ecompRole.setName(roleInAppForUser.getRoleName());
+              rolesGotDeletedFromApprover.add(ecompRole);
+            }
+          }
+        }
+
+        applyChangesToUserAppRolesForMyLoginsRequest(user, appId);
+
+        boolean systemUser = newAppRolesForUser.isSystemUser();
+
+        if ((app.getAuthCentral() || app.getId().equals(PortalConstants.PORTAL_APP_ID))
+            && systemUser) {
+
+          Set<EcompRole> userRolesInLocalApp = postUsersRolesToLocalApp(roleInAppForUserList);
+          RolesInAppForUser rolesInAppForUser = constructRolesInAppForUserUpdate(userId, appId,
+              userRolesInLocalApp);
+          List<RoleInAppForUser> roleAppUserList = rolesInAppForUser.getRoles();
+          Set<EcompRole> rolesGotDeletedByApprover = new TreeSet<>();
+          if (EcompPortalUtils.checkIfRemoteCentralAccessAllowed()) {
+            // Apply changes in external Access system
+
+            updateUserRolesInExternalSystem(app, rolesInAppForUser.getOrgUserId(),
+                roleAppUserList,
+                epRequestValue, systemUser, rolesGotDeletedByApprover, false);
+          }
+          result = applyChangesInUserRolesForAppToEcompDB(rolesInAppForUser, epRequestValue,
+              "Portal",
+              systemUser, rolesGotDeletedByApprover, false);
+
+        } else if (!app.getAuthCentral() && systemUser) {
+          throw new Exception("For non-centralized application we cannot add systemUser");
+        } else {    // if centralized app
+          if (app.getAuthCentral()) {
+            if (!app.getId().equals(PortalConstants.PORTAL_APP_ID)) {
+              pushRemoteUser(roleInAppForUserList, userId, app, mapper,
+                  applicationsRestClientService, false);
+            }
+
+            Set<EcompRole> userRolesInLocalApp = postUsersRolesToLocalApp(
+                roleInAppForUserList);
+            RolesInAppForUser rolesInAppForUser = constructRolesInAppForUserUpdate(userId,
+                appId,
+                userRolesInLocalApp);
+            List<RoleInAppForUser> roleAppUserList = rolesInAppForUser.getRoles();
+            if (EcompPortalUtils.checkIfRemoteCentralAccessAllowed()) {
+
+              // Apply changes in external Access system
+              updateUserRolesInExternalSystem(app, rolesInAppForUser.getOrgUserId(),
+                  roleAppUserList,
+                  epRequestValue, false, rolesGotDeletedFromApprover,
+                  checkIfUserIsOnlyRoleAdmin);
+            }
+            result = applyChangesInUserRolesForAppToEcompDB(rolesInAppForUser,
+                epRequestValue, "Portal", systemUser, rolesGotDeletedFromApprover,
+                checkIfUserIsOnlyRoleAdmin);
+          }
+          // In case if portal is not centralized then follow existing approach
+          else if (!app.getAuthCentral() && app.getId()
+              .equals(PortalConstants.PORTAL_APP_ID)) {
+            Set<EcompRole> userRolesInLocalApp = postUsersRolesToLocalApp(
+                roleInAppForUserList);
+            RolesInAppForUser rolesInAppForUser = constructRolesInAppForUserUpdate(userId,
+                appId,
+                userRolesInLocalApp);
+            Set<EcompRole> rolesGotDeletedByApprover = new TreeSet<>();
+            result = applyChangesInUserRolesForAppToEcompDB(rolesInAppForUser,
+                epRequestValue, "Portal", false, rolesGotDeletedByApprover, false);
+          } else {// remote app
+            FnUser remoteAppUser;
+            if (!app.getAuthCentral() && !app.getId()
+                .equals(PortalConstants.PORTAL_APP_ID)) {
+
+              remoteAppUser = checkIfRemoteUserExits(userId, app,
+                  applicationsRestClientService);
+
+              if (remoteAppUser == null) {
+                addRemoteUser(roleInAppForUserList, userId, app,
+                    mapper, applicationsRestClientService);
+              }
+              Set<EcompRole> userRolesInRemoteApp = postUsersRolesToRemoteApp(
+                  roleInAppForUserList, mapper,
+                  applicationsRestClientService, appId, userId);
+              RolesInAppForUser rolesInAppForUser = constructRolesInAppForUserUpdate(
+                  userId, appId,
+                  userRolesInRemoteApp);
+              Set<EcompRole> rolesGotDeletedByApprover = new TreeSet<>();
+              result = applyChangesInUserRolesForAppToEcompDB(rolesInAppForUser,
+                  epRequestValue, null, false, rolesGotDeletedByApprover, false);
+
+              // If no roles remain, request app to set user inactive.
+              if (userRolesInRemoteApp.size() == 0) {
+                logger.debug(EELFLoggerDelegate.debugLogger,
+                    "setAppWithUserRoleStateForUser: no roles in app {}, set user {} to inactive",
+                    app,
+                    userId);
+                postUserToRemoteApp(userId, app,
+                    applicationsRestClientService);
               }
-              return false;
-       }
-
-       public boolean isUser(FnUser user) {
-              try {
-                     FnUser currentUser = fnUserService.getUser(user.getId()).orElseThrow(Exception::new);
-                     if (currentUser != null && currentUser.getId() != null) {
-                            for (FnUserRole userApp : currentUser.getFnUserRoles()) {
-                                   if (!userApp.getAppId().getId().equals(ECOMP_APP_ID)) {
-                                          FnRole role = userApp.getRoleId();
-                                          if (!role.getId().equals(SYS_ADMIN_ROLE_ID) && !role.getId()
-                                                  .equals(ACCOUNT_ADMIN_ROLE_ID)) {
-                                                 if (role.getActiveYn()) {
-                                                        return true;
-                                                 }
-                                          }
-                                   }
-                            }
-                     }
-              } catch (Exception e) {
-                     EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e);
-                     logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while executing isUser operation",
-                             e);
+            }
+          }
+        }
+      } catch (Exception e) {
+        String message = String.format(
+            "Failed to create user or update user roles for User %s, AppId %s",
+            userId, Long.toString(appId));
+        logger.error(EELFLoggerDelegate.errorLogger, message, e);
+        result = false;
+        reqMessage = e.getMessage();
+      }
+    }
+    //return result;
+    return new ExternalRequestFieldsValidator(result, reqMessage);
+
+  }
+
+  private void pushRemoteUser(List<RoleInAppForUser> roleInAppForUserList, String userId, FnApp app,
+      ObjectMapper mapper, ApplicationsRestClientService applicationsRestClientService, boolean appRoleIdUsed)
+      throws Exception {
+    pushUserOnRemoteApp(userId, app, applicationsRestClientService, mapper,
+        roleInAppForUserList, appRoleIdUsed);
+  }
+
+
+  private void postUserToRemoteApp(String userId, FnApp app,
+      ApplicationsRestClientService applicationsRestClientService) throws HTTPException {
+
+    getUser(userId, app, applicationsRestClientService);
+
+  }
+
+  private FnUser getUser(String userId, FnApp app, ApplicationsRestClientService applicationsRestClientService)
+      throws HTTPException {
+    return applicationsRestClientService.get(FnUser.class, app.getId(), String.format("/user/%s", userId), true);
+
+  }
+
+  private void pushUserOnRemoteApp(String userId, FnApp app,
+      ApplicationsRestClientService applicationsRestClientService,
+      ObjectMapper mapper, List<RoleInAppForUser> roleInAppForUserList, boolean appRoleIdUsed)
+      throws Exception {
+
+    FnUser client;
+    client = fnUserService.loadUserByUsername(userId);
+
+    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+    if (client == null) {
+      String msg = "cannot create user " + userId + ", because he/she cannot be found in directory.";
+      logger.error(EELFLoggerDelegate.errorLogger, msg);
+      List<FnUser> userList = fnUserService.getUserWithOrgUserId(userId);
+      if (!userList.isEmpty()) {
+        logger.debug(EELFLoggerDelegate.debugLogger,
+            userList.get(0).getOrgUserId() + " User was found in Portal");
+        client = userList.get(0);
+        client.setUserApps(Collections.EMPTY_SET);
+        client.setIsSystemUser(false);
+      } else {
+        logger.error(EELFLoggerDelegate.errorLogger, "user cannot be found be in directory or in portal");
+        throw new Exception(msg);
+      }
+
+    }
+
+    client.setLoginId(userId);
+    client.setActiveYn(true);
+    client.setOrgUserId(userId);
+
+    roleInAppForUserList.removeIf(role -> role.getIsApplied().equals(false));
+    SortedSet<Role> roles = new TreeSet<>();
+
+    List<FnRole> getAppRoles = fnRoleService.getAppRoles(app.getId());
+    List<FnApp> appList = new ArrayList<>();
+    appList.add(app);
+    List<CentralV2Role> roleList = new ArrayList<>();
+
+    List<FnRole> userRoles = new ArrayList<>();
+
+    for (RoleInAppForUser roleInappForUser : roleInAppForUserList) {
+      FnRole role = new FnRole();
+      role.setId(roleInappForUser.getRoleId());
+      role.setRoleName(roleInappForUser.getRoleName());
+      userRoles.add(role);
+    }
+
+    if (appRoleIdUsed) {
+      List<FnRole> userAppRoles = new ArrayList<>();
+      for (FnRole role : userRoles) {
+        FnRole appRole = getAppRoles.stream()
+            .filter(applicationRole -> role.getId().equals(applicationRole.getAppRoleId())).findAny()
+            .orElse(null);
+        FnRole epRole = new FnRole();
+        if (appRole != null) {
+          epRole.setId(appRole.getId());
+          epRole.setRoleName(appRole.getRoleName());
+        }
+        userAppRoles.add(epRole);
+      }
+      userRoles = new ArrayList<>(userAppRoles);
+    }
+    roleList = externalAccessRolesService.createCentralRoleObject(appList, userRoles, roleList);
+
+    for (CentralV2Role epRole : roleList) {
+      Role role = new Role();
+      FnRole appRole = getAppRoles.stream()
+          .filter(applicationRole -> epRole.getId().equals(applicationRole.getId())).findAny().orElse(null);
+      if (appRole != null) {
+        role.setId(appRole.getAppRoleId());
+        role.setRoleName(epRole.getName());
+        role.setFnRoleFunctions(epRole.getRoleFunctions());
+      }
+      roles.add(role);
+    }
+    client.setRoles(roles.stream().map(this::roleToFnRole).collect(Collectors.toSet()));
+    String userInString;
+    userInString = mapper.writerFor(FnUser.class).writeValueAsString(client);
+    logger.debug(EELFLoggerDelegate.debugLogger,
+        "about to post a client to remote application, users json = " + userInString);
+    applicationsRestClientService.post(FnUser.class, app.getId(), userInString, String.format("/user/%s", userId));
+  }
+
+  private FnRole roleToFnRole(Role role) {
+    return FnRole.builder()
+        .id(role.getId())
+        .roleName(role.getRoleName())
+        .activeYn(role.getActiveYn())
+        .priority(role.getPriority())
+        .fnRoleFunctions(role.getFnRoleFunctions())
+        .childRoles(role.getChildRoles())
+        .parentRoles(role.getParentRoles())
+        .build();
+  }
+
+  private Set<EcompRole> postUsersRolesToRemoteApp(List<RoleInAppForUser> roleInAppForUserList, ObjectMapper mapper,
+      ApplicationsRestClientService applicationsRestClientService, Long appId, String userId)
+      throws JsonProcessingException, HTTPException {
+    Set<EcompRole> updatedUserRolesinRemote = constructUsersRemoteAppRoles(roleInAppForUserList);
+    Set<EcompRole> updateUserRolesInEcomp = constructUsersEcompRoles(roleInAppForUserList);
+    String userRolesAsString = mapper.writeValueAsString(updatedUserRolesinRemote);
+    FnApp externalApp;
+    externalApp = appsCacheService.getApp(appId);
+    String appBaseUri = null;
+    Set<RemoteRoleV1> updatedUserRolesinRemoteV1 = new TreeSet<>();
+    if (externalApp != null) {
+      appBaseUri = 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));
+    return updateUserRolesInEcomp;
+  }
+
+  private void addRemoteUser(List<RoleInAppForUser> roleInAppForUserList, String userId, FnApp app,
+      ObjectMapper mapper, ApplicationsRestClientService applicationsRestClientService) throws Exception {
+    if (remoteUserShouldBeCreated(roleInAppForUserList)) {
+      createNewUserOnRemoteApp(userId, app, applicationsRestClientService, mapper);
+    }
+  }
+
+  private void createNewUserOnRemoteApp(String userId, FnApp app,
+      ApplicationsRestClientService applicationsRestClientService, ObjectMapper mapper)
+      throws Exception {
+
+    FnUser client = fnUserService.loadUserByUsername(userId);
+
+    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+
+    if (client == null) {
+      String msg = "cannot create user " + userId + ", because he/she cannot be found in phonebook.";
+      logger.error(EELFLoggerDelegate.errorLogger, msg);
+      throw new Exception(msg);
+    }
+
+    client.setLoginId(userId);
+    client.setActiveYn(true);
+
+    String userInString;
+    userInString = mapper.writerFor(FnUser.class).writeValueAsString(client);
+    logger.debug(EELFLoggerDelegate.debugLogger,
+        "about to post new client to remote application, users json = " + userInString);
+    applicationsRestClientService.post(FnUser.class, app.getId(), userInString, String.format("/user", userId));
+
+  }
+
+  private boolean remoteUserShouldBeCreated(List<RoleInAppForUser> roleInAppForUserList) {
+    for (RoleInAppForUser roleInAppForUser : roleInAppForUserList) {
+      if (roleInAppForUser.getIsApplied()) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  private Set<EcompRole> constructUsersRemoteAppRoles(List<RoleInAppForUser> roleInAppForUserList) {
+    Set<EcompRole> existingUserRoles = new TreeSet<>();
+    for (RoleInAppForUser roleInAppForUser : roleInAppForUserList) {
+      if (roleInAppForUser.getIsApplied() && !roleInAppForUser.getRoleId()
+          .equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID)) {
+        EcompRole ecompRole = new EcompRole();
+        ecompRole.setId(roleInAppForUser.getRoleId());
+        ecompRole.setName(roleInAppForUser.getRoleName());
+        existingUserRoles.add(ecompRole);
+      }
+    }
+    return existingUserRoles;
+  }
+
+  private void applyChangesToUserAppRolesForMyLoginsRequest(FnUser user, Long appId) {
+    List<EpUserRolesRequest> epRequestIdVal;
+    try {
+      epRequestIdVal = epUserRolesRequestService.userAppRolesRequestList(user.getId(), appId);
+      if (epRequestIdVal.size() > 0) {
+        EpUserRolesRequest epAppRolesRequestData = epRequestIdVal.get(0);
+        epAppRolesRequestData.setUpdatedDate(LocalDateTime.now());
+        epAppRolesRequestData.setRequestStatus("O");
+        epAppRolesRequestData.setUserId(user);
+        epUserRolesRequestService.saveOne(epAppRolesRequestData);
+        List<EpUserRolesRequestDet> epUserAppRolesDetailList = epUserRolesRequestDetService
+            .appRolesRequestDetailList(epAppRolesRequestData.getReqId());
+        if (epUserAppRolesDetailList.size() > 0) {
+          for (EpUserRolesRequestDet epRequestUpdateList : epUserAppRolesDetailList) {
+            epRequestUpdateList.setRequestType("O");
+            epRequestUpdateList.setReqId(epAppRolesRequestData);
+            epRequestUpdateList.setReqId(epAppRolesRequestData);
+            epUserRolesRequestDetService.saveOne(epRequestUpdateList);
+          }
+          logger.debug(EELFLoggerDelegate.debugLogger,
+              "User App roles request from User Page is overridden");
+        }
+      }
+
+    } catch (Exception e) {
+      logger.error(EELFLoggerDelegate.errorLogger, "applyChangesToUserAppRolesRequest failed", e);
+    }
+  }
+
+  private Set<EcompRole> postUsersRolesToLocalApp(List<RoleInAppForUser> roleInAppForUserList) {
+    return constructUsersEcompRoles(roleInAppForUserList);
+  }
+
+  private Set<EcompRole> constructUsersEcompRoles(List<RoleInAppForUser> roleInAppForUserList) {
+    Set<EcompRole> existingUserRoles = new TreeSet<>();
+    for (RoleInAppForUser roleInAppForUser : roleInAppForUserList) {
+      if (roleInAppForUser.getIsApplied()) {
+        EcompRole ecompRole = new EcompRole();
+        ecompRole.setId(roleInAppForUser.getRoleId());
+        ecompRole.setName(roleInAppForUser.getRoleName());
+        existingUserRoles.add(ecompRole);
+      }
+    }
+    return existingUserRoles;
+  }
+
+  public RolesInAppForUser constructRolesInAppForUserUpdate(String userId, Long appId,
+      Set<EcompRole> userRolesInRemoteApp) {
+    RolesInAppForUser result;
+    result = new RolesInAppForUser();
+    result.setAppId(appId);
+    result.setOrgUserId(userId);
+
+    for (EcompRole role : userRolesInRemoteApp) {
+      RoleInAppForUser roleInAppForUser = new RoleInAppForUser();
+      roleInAppForUser.setRoleId(role.getId());
+      roleInAppForUser.setRoleName(role.getName());
+      roleInAppForUser.setIsApplied(true);
+      result.getRoles().add(roleInAppForUser);
+    }
+    return result;
+  }
+
+  private void updateUserRolesInExternalSystem(FnApp app, String orgUserId, List<RoleInAppForUser> roleInAppUser,
+      boolean isPortalRequest, boolean isSystemUser, Set<EcompRole> deletedRolesByApprover,
+      boolean isLoggedInUserRoleAdminofApp) throws Exception {
+    try {
+      List<FnUser> userInfo = checkIfUserExists(orgUserId);
+      if (userInfo.isEmpty()) {
+        createLocalUserIfNecessary(orgUserId, isSystemUser);
+      }
+      String name;
+      if (EPCommonSystemProperties
+          .containsProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN)
+          && !isSystemUser) {
+        name = orgUserId
+            + SystemProperties
+            .getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN);
+      } else {
+        name = orgUserId;
+      }
+      ObjectMapper mapper = new ObjectMapper();
+      HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth();
+      HttpEntity<String> getUserRolesEntity = new HttpEntity<>(headers);
+      ResponseEntity<String> getResponse = externalAccessRolesService
+          .getUserRolesFromExtAuthSystem(name, getUserRolesEntity);
+
+      List<ExternalAccessUserRoleDetail> userRoleDetailList = new ArrayList<>();
+      String res = getResponse.getBody();
+      JSONObject jsonObj;
+      JSONArray extRoles = null;
+      if (!res.equals("{}")) {
+        jsonObj = new JSONObject(res);
+        extRoles = jsonObj.getJSONArray("role");
+      }
+      ExternalAccessUserRoleDetail userRoleDetail;
+      if (extRoles != null) {
+        for (int i = 0; i < extRoles.length(); i++) {
+          if (extRoles.getJSONObject(i).getString("name").startsWith(app.getAuthNamespace() + ".")
+              && !extRoles.getJSONObject(i).getString("name")
+              .equals(app.getAuthNamespace() + ".admin")
+              && !extRoles.getJSONObject(i).getString("name")
+              .equals(app.getAuthNamespace() + ".owner")) {
+            if (extRoles.getJSONObject(i).has("description")) {
+              ExternalRoleDescription desc = new ExternalRoleDescription(
+                  extRoles.getJSONObject(i).getString("description"));
+              userRoleDetail = new ExternalAccessUserRoleDetail(
+                  extRoles.getJSONObject(i).getString("name"), desc);
+              userRoleDetailList.add(userRoleDetail);
+            } else {
+              userRoleDetail = new ExternalAccessUserRoleDetail(
+                  extRoles.getJSONObject(i).getString("name"), null);
+              userRoleDetailList.add(userRoleDetail);
+            }
+
+          }
+        }
+      }
+
+      List<ExternalAccessUserRoleDetail> userRoleListMatchingInExtAuthAndLocal = checkIfRoleAreMatchingInUserRoleDetailList(
+          userRoleDetailList, app);
+
+      List<EcompUserAppRoles> userAppList;
+      // If request coming from portal not from external role approval system then we have to check if user already
+      // have account admin or system admin as GUI will not send these roles
+      if (!isPortalRequest) {
+        FnUser user = fnUserService.getUserWithOrgUserId(orgUserId).get(0);
+        userAppList = ecompUserAppRolesService.getUserAppExistingRoles(app.getId(), user.getId());
+        if (!roleInAppUser.isEmpty()) {
+          for (EcompUserAppRoles userApp : userAppList) {
+            if (userApp.getRoleId().equals(PortalConstants.SYS_ADMIN_ROLE_ID)
+                || userApp.getRoleId()
+                .equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID)) {
+              RoleInAppForUser addSpecialRole = new RoleInAppForUser();
+              addSpecialRole.setIsApplied(true);
+              addSpecialRole.setRoleId(userApp.getRoleId());
+              addSpecialRole.setRoleName(userApp.getRoleName());
+              roleInAppUser.add(addSpecialRole);
+            }
+          }
+        }
+      }
+      List<RoleInAppForUser> roleInAppUserNonDupls = roleInAppUser.stream().distinct()
+          .collect(Collectors.toList());
+      Map<String, RoleInAppForUser> currentUserRolesToUpdate = new HashMap<>();
+      for (RoleInAppForUser roleInAppUserNew : roleInAppUserNonDupls) {
+        currentUserRolesToUpdate.put(roleInAppUserNew.getRoleName()
+            .replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS,
+                "_"), roleInAppUserNew);
+      }
+      final Map<String, ExternalAccessUserRoleDetail> currentUserRolesInExternalSystem = new HashMap<>();
+      for (ExternalAccessUserRoleDetail extAccessUserRole : userRoleListMatchingInExtAuthAndLocal) {
+        currentUserRolesInExternalSystem.put(extAccessUserRole.getName(), extAccessUserRole);
+      }
+
+      if (isLoggedInUserRoleAdminofApp) {
+        if (deletedRolesByApprover.size() > 0) {
+          List<ExternalAccessUserRoleDetail> newUpdatedRoles = new ArrayList<>();
+          for (ExternalAccessUserRoleDetail userRole : userRoleListMatchingInExtAuthAndLocal) {
+            for (EcompRole role : deletedRolesByApprover) {
+              if ((userRole.getName().substring(app.getAuthNamespace().length() + 1))
+                  .equals(role.getName())) {
+                newUpdatedRoles.add(userRole);
+              }
+            }
+          }
+          if (newUpdatedRoles.size() > 0) {
+            userRoleListMatchingInExtAuthAndLocal = new ArrayList<>(newUpdatedRoles);
+          } else {
+            userRoleListMatchingInExtAuthAndLocal = new ArrayList<>();
+            currentUserRolesToUpdate = new HashMap<>();
+
+          }
+
+        } else {
+          userRoleListMatchingInExtAuthAndLocal = new ArrayList<>();
+          currentUserRolesToUpdate = new HashMap<>();
+
+        }
+      }
+
+      // Check if user roles does not exists in local but still there in External Central Auth System delete them all
+      for (ExternalAccessUserRoleDetail userRole : userRoleListMatchingInExtAuthAndLocal) {
+        if (!(currentUserRolesToUpdate
+            .containsKey(userRole.getName().substring(app.getAuthNamespace().length() + 1)))) {
+          HttpEntity<String> entity = new HttpEntity<>(headers);
+          logger.debug(EELFLoggerDelegate.debugLogger,
+              "updateUserRolesInExternalSystem: Connecting to external system to DELETE user role {}",
+              userRole.getName());
+          ResponseEntity<String> deleteResponse = template.exchange(
+              SystemProperties
+                  .getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL)
+                  + "userRole/" + name + "/" + userRole.getName(),
+              HttpMethod.DELETE, entity, String.class);
+          logger.debug(EELFLoggerDelegate.debugLogger,
+              "updateUserRolesInExternalSystem: Finished DELETE operation in external system for user role {} and the response is {}",
+              userRole.getName(), deleteResponse.getBody());
+        }
+      }
+      // Check if user roles does not exists in External Central Auth System add them all
+      for (RoleInAppForUser addUserRole : roleInAppUserNonDupls) {
+        if (!(currentUserRolesInExternalSystem
+            .containsKey(app.getAuthNamespace() + "." + addUserRole.getRoleName().replaceAll(
+                EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS,
+                "_")))) {
+          ExternalAccessUser extUser = new ExternalAccessUser(name,
+              app.getAuthNamespace() + "." + addUserRole.getRoleName().replaceAll(
+                  EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS,
+                  "_"));
+          String formattedUserRole = mapper.writeValueAsString(extUser);
+          HttpEntity<String> entity = new HttpEntity<>(formattedUserRole, headers);
+          logger.debug(EELFLoggerDelegate.debugLogger,
+              "updateUserRolesInExternalSystem: Connecting to external system for user {} and POST {}",
+              name, addUserRole.getRoleName());
+          ResponseEntity<String> addResponse = template
+              .exchange(SystemProperties
+                  .getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL)
+                  + "userRole", HttpMethod.POST, entity, String.class);
+          logger.debug(EELFLoggerDelegate.debugLogger,
+              "updateUserRolesInExternalSystem: Finished adding user role in external system {} and added user role {}",
+              addResponse.getBody(), addUserRole.getRoleName());
+          if (addResponse.getStatusCode().value() != 201
+              && addResponse.getStatusCode().value() != 404) {
+            logger.debug(EELFLoggerDelegate.debugLogger,
+                "Finished POST operation in external system but unable to save user role",
+                addResponse.getBody(),
+                addUserRole.getRoleName());
+            throw new Exception(addResponse.getBody());
+          }
+        }
+      }
+    } catch (HttpClientErrorException e) {
+      logger.error(EELFLoggerDelegate.errorLogger,
+          "updateUserRolesInExternalSystem: Failed to add user role for application {} due to {}",
+          app.getId(), e);
+      if (e.getStatusCode() == HttpStatus.FORBIDDEN) {
+        logger.error(EELFLoggerDelegate.errorLogger, "Please enter the valid systemUser",
+            orgUserId);
+        throw new HttpClientErrorException(HttpStatus.FORBIDDEN,
+            "Please enter the valid systemUser");
+      }
+      if (e.getStatusCode() == HttpStatus.NOT_FOUND) {
+        logger.error(EELFLoggerDelegate.errorLogger, "Please enter the valid role");
+        throw new HttpClientErrorException(HttpStatus.NOT_FOUND, "Please enter the valid role");
+      }
+      EPLogUtil.logExternalAuthAccessAlarm(logger, HttpStatus.BAD_REQUEST);
+      throw e;
+    } catch (Exception e) {
+      logger.error(EELFLoggerDelegate.errorLogger,
+          "updateUserRolesInExternalSystem: Failed to add user role for application {} due to {}",
+          app.getId(), e);
+      EPLogUtil.logExternalAuthAccessAlarm(logger, HttpStatus.BAD_REQUEST);
+      throw e;
+    }
+  }
+
+  private List<ExternalAccessUserRoleDetail> checkIfRoleAreMatchingInUserRoleDetailList(
+      List<ExternalAccessUserRoleDetail> userRoleDetailList, FnApp app) {
+    Map<String, FnRole> epRoleList = externalAccessRolesService.getAppRoleNamesWithUnderscoreMap(app);
+    //Add Account Admin role for partner app to prevent conflict
+    if (!PortalConstants.PORTAL_APP_ID.equals(app.getId())) {
+      FnRole role = new FnRole();
+      role.setRoleName(PortalConstants.ADMIN_ROLE
+          .replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"));
+      epRoleList.put(role.getRoleName(), role);
+    }
+    userRoleDetailList.removeIf(
+        userRoleDetail -> !epRoleList
+            .containsKey(userRoleDetail.getName().substring(app.getAuthNamespace().length() + 1)));
+    return userRoleDetailList;
+  }
+
+  private List<FnUser> checkIfUserExists(String userParams) {
+    return fnUserService.getUserWithOrgUserId(userParams);
+  }
+
+  @Transactional
+  private void createLocalUserIfNecessary(String userId, boolean isSystemUser) {
+    if (StringUtils.isEmpty(userId)) {
+      logger.error(EELFLoggerDelegate.errorLogger, "createLocalUserIfNecessary : empty userId!");
+      return;
+    }
+    try {
+      List<FnUser> userList = fnUserService.getUserWithOrgUserId(userId);
+      if (userList.size() == 0) {
+        FnUser client;
+        if (!isSystemUser) {
+          client = fnUserService.loadUserByUsername(userId);
+        } else {
+          client = new FnUser();
+          client.setOrgUserId(userId);
+          client.setIsSystemUser(true);
+          client.setFirstName(userId.substring(0, userId.indexOf("@")));
+        }
+        if (client == null) {
+          String msg = "createLocalUserIfNecessary: cannot create user " + userId
+              + ", because not found in phonebook";
+          logger.error(EELFLoggerDelegate.errorLogger, msg);
+        } else {
+          client.setLoginId(userId);
+          client.setActiveYn(true);
+        }
+        fnUserService.saveFnUser(client);
+      }
+    } catch (Exception e) {
+      EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e);
+    }
+
+  }
+
+  private FnUser checkIfRemoteUserExits(String userId, FnApp app,
+      ApplicationsRestClientService applicationsRestClientService) throws HTTPException {
+    FnUser checkRemoteUser = null;
+    try {
+      checkRemoteUser = getUserFromApp(userId, app, applicationsRestClientService);
+    } catch (HTTPException e) {
+      // Some apps are returning 400 if user is not found.
+      if (e.getResponseCode() == 400) {
+        logger.debug(EELFLoggerDelegate.debugLogger,
+            "setAppWithUserRoleStateForUser: getuserFromApp threw exception with response code 400; continuing",
+            e);
+      } else if (e.getResponseCode() == 404) {
+        logger.debug(EELFLoggerDelegate.debugLogger,
+            "setAppWithUserRoleStateForUser: getuserFromApp threw exception with response code 404; continuing",
+            e);
+      } else {
+        // Other response code, let it come thru.
+        throw e;
+      }
+    }
+    return checkRemoteUser;
+  }
+
+  private FnUser getUserFromApp(String userId, FnApp app, ApplicationsRestClientService applicationsRestClientService)
+      throws HTTPException {
+    if (PortalConstants.PORTAL_APP_ID.equals(app.getId())) {
+      List<FnUser> userList = fnUserService.getUserWithOrgUserId(userId);
+      if (userList != null && !userList.isEmpty()) {
+        return userList.get(0);
+      } else {
+        return null;
+      }
+    }
+    return getUser(userId, app, applicationsRestClientService);
+  }
+
+  private boolean applyChangesInUserRolesForAppToEcompDB(RolesInAppForUser rolesInAppForUser,
+      boolean externalSystemRequest, String reqType, boolean isSystemUser,
+      Set<EcompRole> rolesDeletedByApprover, boolean isLoggedInUserRoleAdminOfApp) throws Exception {
+    boolean result = false;
+    String userId = rolesInAppForUser.getOrgUserId();
+    Long appId = rolesInAppForUser.getAppId();
+    synchronized (syncRests) {
+      createLocalUserIfNecessary(userId, isSystemUser);
+
+      EcompRole[] userAppRoles = new EcompRole[(int) rolesInAppForUser.getRoles().stream().distinct().count()];
+      for (int i = 0;
+          i < rolesInAppForUser.getRoles().stream().distinct().count(); i++) {
+        RoleInAppForUser roleInAppForUser = rolesInAppForUser.getRoles().get(i);
+        EcompRole role = new EcompRole();
+        role.setId(roleInAppForUser.getRoleId());
+        role.setName(roleInAppForUser.getRoleName());
+        userAppRoles[i] = role;
+      }
+      try {
+        EcompRole[] applicationRoles = null;
+
+        if (isLoggedInUserRoleAdminOfApp) {
+          List<EcompRole> roles = Arrays.stream(userAppRoles)
+              .collect(Collectors.toList());
+          List<EcompRole> roles1 = new ArrayList<>(rolesDeletedByApprover);
+          roles.addAll(roles1);
+          applicationRoles = roles.toArray(new EcompRole[0]);
+        }
+
+        syncUserRoles(userId, appId, userAppRoles, externalSystemRequest,
+            reqType, isLoggedInUserRoleAdminOfApp, applicationRoles);
+        result = true;
+      } catch (Exception e) {
+        logger.error(EELFLoggerDelegate.errorLogger,
+            "applyChangesInUserRolesForAppToEcompDB: failed to syncUserRoles for orgUserId "
+                + userId, e);
+        if ("DELETE".equals(reqType)) {
+          throw new Exception(e.getMessage());
+        }
+      }
+    }
+    return result;
+  }
+
+  private void syncUserRoles(String userId, Long appId,
+      EcompRole[] userAppRoles, Boolean extRequestValue, String reqType, boolean checkIfUserisRoleAdmin,
+      EcompRole[] appRoles) throws Exception {
+
+    Transaction transaction = null;
+    String roleActive;
+    HashMap<Long, EcompRole> newUserAppRolesMap = hashMapFromEcompRoles(userAppRoles);
+    List<FnRole> roleInfo = externalAccessRolesService
+        .getPortalAppRoleInfo(PortalConstants.ACCOUNT_ADMIN_ROLE_ID);
+    FnRole adminRole = new FnRole();
+    if (roleInfo.size() > 0) {
+      adminRole = roleInfo.get(0);
+      logger.debug(EELFLoggerDelegate.debugLogger, "Admin RoleName form DB: " + adminRole.getRoleName());
+    }
+    try {
+      List<FnUser> userList = fnUserService.getUserWithOrgUserId(userId);
+      if (userList.size() > 0) {
+        FnUser client = userList.get(0);
+        roleActive = ("DELETE".equals(reqType)) ? "" : " and role.active = 'Y'";
+        List<FnUserRole> userRoles = fnUserRoleService.retrieveByAppIdAndUserId(appId, userId);
+        entityManager
+            .createQuery("from EPUserApp where app.id=:appId and userId=:userId" + roleActive)
+            .setParameter("appId", appId)
+            .setParameter("userId", client.getId())
+            .getResultList();
+
+        if ("DELETE".equals(reqType)) {
+          for (FnUserRole userAppRoleList : userRoles) {
+            List<FnRole> rolesList =
+                (!userAppRoleList.getRoleId().getRoleName()
+                    .equals(adminRole.getRoleName()))
+                    ? fnRoleService.retrieveAppRolesByRoleNameAndByAppId
+                    (userAppRoleList.getRoleId().getRoleName(), appId)
+                    : fnRoleService.retrieveAppRolesWhereAppIdIsNull();
+            if (!rolesList.isEmpty()) {
+              checkIfRoleInactive(rolesList.get(0));
+            }
+          }
+        }
+
+        if (appRoles != null) {
+          List<EcompRole> appRolesList = Arrays.stream(appRoles).collect(Collectors.toList());
+          List<FnUserRole> finalUserRolesList = new ArrayList<>();
+          if (checkIfUserisRoleAdmin) {
+            for (EcompRole role : appRolesList) {
+              for (FnUserRole userAppRoleList : userRoles) {
+                if (userAppRoleList.getRoleId().getRoleName()
+                    .equals(role.getName())) {
+                  finalUserRolesList.add(userAppRoleList);
+                }
+
+              }
+            }
+            userRoles = new ArrayList<>(finalUserRolesList);
+          }
+        }
+
+        for (FnUserRole userRole : userRoles) {
+          if (!PortalConstants.ACCOUNT_ADMIN_ROLE_ID.equals(userRole.getRoleId().getId())
+              && !PortalConstants.SYS_ADMIN_ROLE_ID
+              .equals(userRole.getRoleId().getId())
+              && !extRequestValue) {
+            syncUserRolesExtension(userRole, appId,
+                newUserAppRolesMap);
+          } else if (extRequestValue && ("PUT".equals(reqType) || "POST".equals(reqType)
+              || "DELETE".equals(reqType))) {
+            syncUserRolesExtension(userRole, appId,
+                newUserAppRolesMap);
+          } else if (extRequestValue && !PortalConstants.ACCOUNT_ADMIN_ROLE_ID
+              .equals(userRole.getRoleId().getId())) {
+            syncUserRolesExtension(userRole, appId,
+                newUserAppRolesMap);
+          }
+        }
+
+        Collection<EcompRole> newRolesToAdd = newUserAppRolesMap.values();
+        if (newRolesToAdd.size() > 0) {
+          FnApp app = fnAppService.getById(appId);
+
+          HashMap<Long, FnRole> rolesMap = new HashMap<>();
+          if (appId.equals(PortalConstants.PORTAL_APP_ID)) { // local app
+            String appIdValue = "";
+            if (!extRequestValue) {
+              appIdValue = "and id != " + PortalConstants.SYS_ADMIN_ROLE_ID;
+            }
+            @SuppressWarnings("unchecked")
+            List<FnRole> roles = entityManager
+                .createQuery(
+                    "from " + FnRole.class.getName() + " where appId is null "
+                        + appIdValue).getResultList();
+            for (FnRole role : roles) {
+              role.setAppId(1L);
+              rolesMap.put(role.getId(), role);
+            }
+          } else { // remote app
+            @SuppressWarnings("unchecked")
+            List<FnRole> roles = entityManager
+                .createQuery("from EPRole where appId=:appId")
+                .setParameter("appId", appId)
+                .getResultList();
+            for (FnRole role : roles) {
+              if (!extRequestValue && app.getAuthCentral()) {
+                rolesMap.put(role.getId(), role);
+              } else {
+                rolesMap.put(role.getAppRoleId(), role);
+              }
+            }
+          }
+
+          FnRole role;
+          for (EcompRole userRole : newRolesToAdd) {
+            FnUserRole userApp = new FnUserRole();
+            if (("PUT".equals(reqType) || "POST".equals(reqType)) && userRole.getName()
+                .equals(adminRole.getRoleName())) {
+              role = fnRoleService.getById(PortalConstants.ACCOUNT_ADMIN_ROLE_ID);
+              userApp.setRoleId(role);
+            } else if ((userRole.getId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID))
+                && !extRequestValue) {
+              continue;
+            } else if ((userRole.getId().equals(PortalConstants.SYS_ADMIN_ROLE_ID)) && app
+                .getId().equals(PortalConstants.PORTAL_APP_ID) && !extRequestValue) {
+              continue;
+            } else {
+              userApp.setRoleId(rolesMap.get(userRole.getId()));
+            }
+
+            userApp.setUserId(client);
+            userApp.setFnAppId(app);
+            fnUserRoleService.saveOne(userApp);
+          }
+
+          if (PortalConstants.PORTAL_APP_ID.equals(appId)) {
+            /*
+             * for local app -- hack - always make sure fn_role
+             * table's app_id is null and not 1 for primary app in
+             * this case being onap portal app; reason: hibernate
+             * is rightly setting this to 1 while persisting to
+             * fn_role as per the mapping but SDK role management
+             * code expects the app_id to be null as there is no
+             * concept of App_id in SDK
+             */
+            Query query = entityManager.createQuery("update fn_role set app_id = null where app_id = 1 ");
+            query.executeUpdate();
+          }
+        }
+      }
+      transaction.commit();
+    } catch (Exception e) {
+      logger.error(EELFLoggerDelegate.errorLogger, "syncUserRoles failed", e);
+      EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e);
+      EcompPortalUtils.rollbackTransaction(transaction,
+          "Exception occurred in syncUserRoles, Details: " + e.toString());
+      if ("DELETE".equals(reqType)) {
+        throw new SyncUserRolesException(e.getMessage());
+      }
+    }
+  }
+
+  private static HashMap<Long, EcompRole> hashMapFromEcompRoles(EcompRole[] ecompRoles) {
+    HashMap<Long, EcompRole> result = new HashMap<>();
+    if (ecompRoles != null) {
+      for (EcompRole ecompRole : ecompRoles) {
+        if (ecompRole.getId() != null) {
+          result.put(ecompRole.getId(), ecompRole);
+        }
+      }
+    }
+    return result;
+  }
+
+  private void syncUserRolesExtension(FnUserRole userRole, Long appId,
+      HashMap<Long, EcompRole> newUserAppRolesMap) {
+
+    Long userAppRoleId;
+    if (PortalConstants.PORTAL_APP_ID.equals(appId)) { // local app
+      userAppRoleId = userRole.getRoleId().getId();
+    } else { // remote app
+      userAppRoleId = userRole.getId();
+    }
+
+    if (!newUserAppRolesMap.containsKey(userAppRoleId)) {
+      fnUserRoleService.deleteById(userRole.getId());
+    } else {
+      newUserAppRolesMap.remove(userAppRoleId);
+    }
+  }
+
+  private Role fnRoleToRole(final FnRole role) {
+    return new Role(null, null, null, null, null, null, null, null, null, role.getRoleName(), null, role.getActiveYn(),
+        role.getPriority(), role.getFnRoleFunctions(), role.getChildRoles(), role.getParentRoles());
+  }
+
+  @SuppressWarnings("unchecked")
+  public List<RoleInAppForUser> getAppRolesForUser(Long appId, String orgUserId, Boolean extRequestValue, Long userId) {
+    List<RoleInAppForUser> rolesInAppForUser = null;
+    FnApp app = fnAppService.getById(appId);
+    logger.debug(EELFLoggerDelegate.debugLogger, "In getAppRolesForUser() - app = {}", app);
+    try {
+      // for onap portal app, no need to make a remote call
+      List<Role> roleList = new ArrayList<>();
+      if (!PortalConstants.PORTAL_APP_ID.equals(appId)) {
+        if (app.getAuthCentral()) {
+          List<CentralV2Role> cenRoleList = externalAccessRolesService.getRolesForApp(app.getUebKey());
+          for (CentralV2Role cenRole : cenRoleList) {
+            Role role = new Role();
+            role.setActiveYn(cenRole.isActive());
+            role.setId(cenRole.getId());
+            role.setRoleName(cenRole.getName());
+            role.setPriority(cenRole.getPriority());
+            roleList.add(role);
+          }
+        } else {
+          Optional<FnUser> user = fnUserService.getUser(userId);
+          if (user.isPresent()) {
+            roleList = user.get().getFnRoles().stream().map(this::fnRoleToRole).collect(Collectors.toList());
+          }
+        }
+        List<Role> activeRoleList = new ArrayList<>();
+        for (Role role : roleList) {
+          if (role.getActiveYn()) {
+            if (role.getId() != 1) { // prevent portal admin from being added
+              activeRoleList.add(role);
+            } else if (extRequestValue) {
+              activeRoleList.add(role);
+            }
+          }
+
+        }
+        FnUser localUser = getUserFromApp(Long.toString(userId), app, applicationsRestClientService);
+        // If localUser does not exists return roles
+        Set<FnRole> roleSet = null;
+        FnRole[] roleSetList = null;
+        if (localUser != null) {
+          roleSet = localUser.getAppEPRoles(app);
+          roleSetList = roleSet.toArray(new FnRole[0]);
+        }
+        rolesInAppForUser = fnUserRoleService
+            .constructRolesInAppForUserGet(activeRoleList, roleSetList, extRequestValue);
+        return rolesInAppForUser;
+      }
+
+      EcompRole[] appRoles = null;
+      boolean checkIfUserIsApplicationAccAdmin = false;
+      List<EcompRole> roles = new ArrayList<>();
+      if (app.getAuthCentral()) {
+        List<FnRole> applicationRoles = fnRoleService.retrieveActiveRolesOfApplication(app.getId());
+        FnApp application = fnAppService.getById(appId);
+        checkIfUserIsApplicationAccAdmin = isAccountAdminOfApplication(userId,
+            application);
+
+        List<FnRole> roleSetWithFunctioncds = new ArrayList<>();
+        for (FnRole role : applicationRoles) {
+          List<EpAppFunction> cenRoleFuncList = epAppFunctionService.getAppRoleFunctionList(role.getId(), app.getId());
+          for (EpAppFunction roleFunc : cenRoleFuncList) {
+
+            String functionCode = EcompPortalUtils.getFunctionCode(roleFunc.getFunctionCd());
+            functionCode = EPUserUtils.decodeFunctionCode(functionCode);
+            String type = externalAccessRolesService.getFunctionCodeType(roleFunc.getFunctionCd());
+            String action = externalAccessRolesService.getFunctionCodeAction(roleFunc.getFunctionCd());
+            String name = roleFunc.getFunctionName();
+
+            FnFunction function = new FnFunction();
+            function.setAction(action);
+            function.setType(type);
+            function.setCode(functionCode);
+            function.setName(name);
+            role.getFnRoleFunctions().add(new FnRoleFunction(role, function));
+
+          }
+          roleSetWithFunctioncds.add(role);
+
+
+        }
+
+        for (FnRole role1 : roleSetWithFunctioncds) {
+          EcompRole ecompRole = new EcompRole();
+          ecompRole.setId(role1.getId());
+          ecompRole.setName(role1.getRoleName());
+          ecompRole.setRoleFunctions(role1.getRoleFunctions());
+          roles.add(ecompRole);
+
+        }
+        if (checkIfUserIsApplicationAccAdmin) {
+          appRoles = roles.toArray(new EcompRole[roles.size()]);
+          logger.debug(EELFLoggerDelegate.debugLogger,
+              "In getAppRolesForUser() If Logged in user checkIfUserisApplicationAccAdmin- appRoles = {}", appRoles);
+        } else if (isRoleAdmin(userId) && !checkIfUserIsApplicationAccAdmin) {
+          List<EcompRole> roleAdminAppRoles = new ArrayList<>();
+          List<String> roleAdminAppRolesNames = new ArrayList<>();
+          String QUERY =
+              "select distinct fr.role_name as roleName from fn_user_role fu, ep_app_role_function ep, ep_app_function ea, fn_role fr"
+                  + " where fu.role_id = ep.role_id"
+                  + " and fu.app_id = ep.app_id"
+                  + " and fu.user_id = :userId"
+                  + " and fu.role_id = fr.role_id and fr.active_yn='Y'"
+                  + " and ea.function_cd = ep.function_cd and ea.function_cd like 'approver|%'"
+                  + " and exists"
+                  + " ("
+                  + " select fa.app_id from fn_user fu, fn_user_role ur, fn_app fa where fu.user_id =:userId and fu.user_id = ur.user_id"
+                  + " and ur.app_id = fa.app_id and fa.enabled = 'Y')";
+          List<Tuple> tuples = entityManager.createNativeQuery(QUERY, Tuple.class)
+              .setParameter("userId", userId)
+              .getResultList();
+          List<String> getUserApproverRoles = tuples.stream().map(tuple -> (String) tuple.get("roleName"))
+              .collect(Collectors.toList());
+
+          List<EcompRole> userapproverRolesList = new ArrayList<>();
+          for (String str : getUserApproverRoles) {
+            EcompRole epRole = roles.stream().filter(x -> str.equals(x.getName())).findAny().orElse(null);
+            if (epRole != null) {
+              userapproverRolesList.add(epRole);
+            }
+          }
+          for (EcompRole role : userapproverRolesList) {
+
+            List<RoleFunction> roleFunList = new ArrayList<>(role.getRoleFunctions());
+            boolean checkIfFunctionsExits = roleFunList.stream()
+                .anyMatch(roleFunction -> roleFunction.getType().equalsIgnoreCase("Approver"));
+            if (checkIfFunctionsExits) {
+              roleAdminAppRoles.add(role);
+              List<RoleFunction> filteredList = roleFunList.stream()
+                  .filter(x -> "Approver".equalsIgnoreCase(x.getType())).collect(Collectors.toList());
+              roleAdminAppRolesNames.addAll(filteredList.stream().map(RoleFunction::getCode)
+                  .collect(Collectors.toList()));
+            }
+          }
+          for (String name : roleAdminAppRolesNames) {
+            roles.stream().filter(x -> name.equals(x.getName())).findAny().ifPresent(roleAdminAppRoles::add);
+
+          }
+          appRoles = roleAdminAppRoles.toArray(new EcompRole[0]);
+
+        }
+      } else {
+        appRoles = applicationsRestClientService.get(EcompRole[].class, appId, "/roles");
+      }
+      // Test this error case, for generating an internal ONAP Portal
+      // error
+      // EcompRole[] appRoles = null;
+      // If there is an exception in the rest client api, then null will
+      // be returned.
+      if (appRoles != null) {
+        if (!app.getAuthCentral()) {
+          syncAppRoles(appId, appRoles);
+        }
+        EcompRole[] userAppRoles = null;
+        try {
+          try {
+            if (app.getAuthCentral()) {
+              List<FnUser> actualUser = fnUserService.getUserWithOrgUserId(Long.toString(userId));
+              List<EPUserAppCurrentRoles> userAppsRolesList = entityManager
+                  .createNamedQuery("EPUserAppCurrentRoles")
+                  .setParameter("appId", app.getId())
+                  .setParameter("userId", actualUser.get(0).getId())
+                  .getResultList();
+              List<EcompRole> setUserRoles = new ArrayList<>();
+              for (EPUserAppCurrentRoles role : userAppsRolesList) {
+                logger.debug(EELFLoggerDelegate.debugLogger,
+                    "In getAppRolesForUser() - userAppsRolesList get userRolename = {}", role.getRoleName());
+                EcompRole ecompRole = new EcompRole();
+                ecompRole.setId(role.getRoleId());
+                ecompRole.setName(role.getRoleName());
+                setUserRoles.add(ecompRole);
+              }
+
+              boolean checkIfUserisAccAdmin = setUserRoles.stream()
+                  .anyMatch(ecompRole -> ecompRole.getId() == 999L);
+
+              if (!checkIfUserisAccAdmin) {
+                List<EcompRole> appRolesList = Arrays.asList(appRoles);
+                Set<EcompRole> finalUserAppRolesList = new HashSet<>();
+
+                List<String> roleNames = new ArrayList<>();
+                for (EcompRole role : setUserRoles) {
+                  EcompRole epRole = appRolesList.stream()
+                      .filter(x -> role.getName().equals(x.getName())).findAny().orElse(null);
+                  List<RoleFunction> roleFunList = new ArrayList<>();
+
+                  if (epRole != null) {
+                    if (epRole.getRoleFunctions().size() > 0) {
+                      roleFunList.addAll(epRole.getRoleFunctions());
+                    }
+                    boolean checkIfFunctionsExits = roleFunList.stream().anyMatch(
+                        roleFunction -> roleFunction.getType().equalsIgnoreCase("Approver"));
+                    if (checkIfFunctionsExits) {
+                      finalUserAppRolesList.add(role);
+                      List<RoleFunction> filteredList = roleFunList.stream()
+                          .filter(x -> "Approver".equalsIgnoreCase(x.getType()))
+                          .collect(Collectors.toList());
+                      roleNames = filteredList.stream().map(RoleFunction::getCode)
+                          .collect(Collectors.toList());
+                    } else {
+                      roleNames.add(epRole.getName());
+                    }
+                  }
+                  for (String name : roleNames) {
+                    EcompRole ecompRole = appRolesList.stream()
+                        .filter(x -> name.equals(x.getName())).findAny().orElse(null);
+                    if (ecompRole != null) {
+                      finalUserAppRolesList.add(ecompRole);
+                    }
+                  }
+                }
+                for (String name : roleNames) {
+                  boolean checkIfFunctionsExits = userAppsRolesList.stream().anyMatch(
+                      role -> role.getRoleName().equalsIgnoreCase(name));
+                  if (checkIfFunctionsExits) {
+                    appRolesList.stream().filter(x -> name.equals(x.getName()))
+                        .findAny().ifPresent(setUserRoles::add);
+                  }
+                }
+                userAppRoles = setUserRoles.toArray(new EcompRole[0]);
+              }
+            } else {
+              userAppRoles = applicationsRestClientService.get(EcompRole[].class, appId,
+                  String.format("/user/%s/roles", userId));
+            }
+          } catch (HTTPException e) {
+            // Some apps are returning 400 if user is not found.
+            if (e.getResponseCode() == 400) {
+              logger.debug(EELFLoggerDelegate.debugLogger,
+                  "getAppRolesForUser caught exception with response code 400; continuing", e);
+            } else {
+              // Other response code, let it come thru.
+              throw e;
+            }
+          }
+          if (userAppRoles == null) {
+            if (EcompPortalUtils.getExternalAppResponseCode() == 400) {
+              EcompPortalUtils.setExternalAppResponseCode(200);
+              String message = String.format(
+                  "getAppRolesForUser: App %s, User %, endpoint /user/{userid}/roles returned 400, "
+                      + "assuming user doesn't exist, app is framework SDK based, and things are ok. "
+                      + "Overriding to 200 until framework SDK returns a useful response.",
+                  Long.toString(appId), userId);
+              logger.warn(EELFLoggerDelegate.applicationLogger, message);
+            }
+          }
+
+          HashMap<Long, EcompRole> appRolesActiveMap = hashMapFromEcompRoles(appRoles);
+          ArrayList<EcompRole> activeRoles = new ArrayList<>();
+          if (userAppRoles != null) {
+            for (EcompRole userAppRole : userAppRoles) {
+              if (appRolesActiveMap.containsKey(userAppRole.getId())) {
+                EcompRole role = new EcompRole();
+                role.setId(userAppRole.getId());
+                role.setName(userAppRole.getName());
+                activeRoles.add(role);
+              }
+            }
+          }
+          EcompRole[] userAppRolesActive = activeRoles.toArray(new EcompRole[0]);
+
+          boolean checkIfUserisRoleAdmin = isRoleAdmin(userId) && !checkIfUserIsApplicationAccAdmin;
+
+          // If the remote application isn't down we MUST sync user
+          // roles here in case we have this user here!
+          syncUserRoles(Long.toString(userId), appId, userAppRolesActive, extRequestValue, null, checkIfUserisRoleAdmin,
+              appRoles);
+        } catch (Exception e) {
+          // TODO: we may need to check if user exists, maybe remote
+          // app is down.
+          String message = String.format(
+              "getAppRolesForUser: user %s does not exist in remote application %s", userId,
+              Long.toString(appId));
+          logger.error(EELFLoggerDelegate.errorLogger, message, e);
+          userAppRoles = new EcompRole[0];
+        }
+        rolesInAppForUser = fnUserRoleService.constructRolesInAppForUserGet(appRoles, userAppRoles);
+      }
+    } catch (Exception e) {
+      String message = String.format("getAppRolesForUser: failed for User %s, AppId %s", userId,
+          Long.toString(appId));
+      logger.error(EELFLoggerDelegate.errorLogger, message, e);
+    }
+    return rolesInAppForUser;
+  }
+
+  private void syncAppRoles(Long appId, EcompRole[] appRoles) throws Exception {
+    logger.debug(EELFLoggerDelegate.debugLogger, "entering syncAppRoles for appId: " + appId);
+    HashMap<Long, EcompRole> newRolesMap = hashMapFromEcompRoles(appRoles);
+    try {
+      List<FnRole> currentAppRoles = fnRoleService.retrieveAppRolesByAppId(appId);
+
+      List<FnRole> obsoleteRoles = new ArrayList<>();
+      for (FnRole oldAppRole : currentAppRoles) {
+        if (oldAppRole.getAppRoleId() != null) {
+          EcompRole role;
+          role = newRolesMap.get(oldAppRole.getAppRoleId());
+          if (role != null) {
+            if (!(role.getName() == null || oldAppRole.getRoleName().equals(role.getName()))) {
+              oldAppRole.setRoleName(role.getName());
+            }
+            oldAppRole.setActiveYn(true);
+            newRolesMap.remove(oldAppRole.getAppRoleId());
+          } else {
+            obsoleteRoles.add(oldAppRole);
+          }
+        } else {
+          obsoleteRoles.add(oldAppRole);
+        }
+      }
+      Collection<EcompRole> newRolesToAdd = newRolesMap.values();
+      if (obsoleteRoles.size() > 0) {
+        logger.debug(EELFLoggerDelegate.debugLogger, "syncAppRoles: we have obsolete roles to delete");
+        for (FnRole role : obsoleteRoles) {
+          logger.debug(EELFLoggerDelegate.debugLogger, "syncAppRoles: obsolete role: " + role.toString());
+          Long roleId = role.getId();
+          List<FnUserRole> userRoles = fnUserRoleService.getUserRolesForRoleIdAndAppId(roleId, appId);
+
+          logger.debug(EELFLoggerDelegate.debugLogger,
+              "syncAppRoles: number of userRoles to delete: " + userRoles.size());
+          for (FnUserRole userRole : userRoles) {
+            logger.debug(EELFLoggerDelegate.debugLogger,
+                "syncAppRoles: about to delete userRole: " + userRole.toString());
+            fnUserRoleService.deleteById(userRole.getId());
+            logger.debug(EELFLoggerDelegate.debugLogger,
+                "syncAppRoles: finished deleting userRole: " + userRole.toString());
+          }
+          List<FnMenuFunctionalRoles> funcMenuRoles = fnMenuFunctionalRolesService.retrieveByroleId(roleId);
+          int numMenuRoles = funcMenuRoles.size();
+          logger.debug(EELFLoggerDelegate.debugLogger,
+              "syncAppRoles: number of funcMenuRoles for roleId: " + roleId + ": " + numMenuRoles);
+          for (FnMenuFunctionalRoles funcMenuRole : funcMenuRoles) {
+            Long menuId = funcMenuRole.getMenuId().getMenuId();
+            // If this is the only role for this menu item, then the
+            // app and roles will be gone,
+            // so must null out the url too, to be consistent
+            List<FnMenuFunctionalRoles> funcMenuRoles2 = fnMenuFunctionalRolesService.retrieveByMenuId(menuId);
+            int numMenuRoles2 = funcMenuRoles2.size();
+            logger.debug(EELFLoggerDelegate.debugLogger,
+                "syncAppRoles: number of funcMenuRoles for menuId: " + menuId + ": " + numMenuRoles2);
+            fnMenuFunctionalRolesService.delete(funcMenuRole);
+
+            if (numMenuRoles2 == 1) {
+              // If this is the only role for this menu item, then
+              // the app and roles will be gone,
+              // so must null out the url too, to be consistent
+              logger.debug(EELFLoggerDelegate.debugLogger,
+                  "syncAppRoles: There is exactly 1 menu item for this role, so emptying the url");
+              List<FnMenuFunctional> funcMenuItems = fnMenuFunctionalService.retrieveByMenuId(menuId);
+              if (funcMenuItems.size() > 0) {
+                logger.debug(EELFLoggerDelegate.debugLogger, "got the menu item");
+                FnMenuFunctional funcMenuItem = funcMenuItems.get(0);
+                funcMenuItem.setUrl("");
+              }
+            }
+          }
+          boolean isPortalRequest = true;
+          deleteRoleDependencyRecords(roleId, appId, isPortalRequest);
+          logger.debug(EELFLoggerDelegate.debugLogger, "syncAppRoles: about to delete the role: " + role.toString());
+          fnRoleService.delete(role);
+          logger.debug(EELFLoggerDelegate.debugLogger, "syncAppRoles: deleted the role");
+        }
+      }
+      for (EcompRole role : newRolesToAdd) {
+        logger.debug(EELFLoggerDelegate.debugLogger, "syncAppRoles: about to add missing role: " + role.toString());
+        FnRole newRole = new FnRole();
+        // Attention! All roles from remote application supposed to be
+        // active!
+        newRole.setActiveYn(true);
+        newRole.setRoleName(role.getName());
+        newRole.setAppId(appId);
+        newRole.setAppRoleId(role.getId());
+        fnRoleService.saveOne(newRole);
+      }
+      logger.debug(EELFLoggerDelegate.debugLogger, "syncAppRoles: about to commit the transaction");
+      logger.debug(EELFLoggerDelegate.debugLogger, "syncAppRoles: committed the transaction");
+    } catch (Exception e) {
+      logger.error(EELFLoggerDelegate.errorLogger, "syncAppRoles failed", e);
+      EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e);
+      throw new Exception(e);
+    }
+  }
+
+  private void deleteRoleDependencyRecords(Long roleId, Long appId, boolean isPortalRequest)
+      throws Exception {
+    Session localSession = entityManager.unwrap(Session.class);
+    try {
+      String sql;
+      Query query;
+      // It should delete only when it portal's roleId
+      if (appId.equals(PortalConstants.PORTAL_APP_ID)) {
+        // Delete from fn_role_function
+        sql = "DELETE FROM fn_role_function WHERE role_id=" + roleId;
+        logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql);
+        query = localSession.createSQLQuery(sql);
+        query.executeUpdate();
+        // Delete from fn_role_composite
+        sql = "DELETE FROM fn_role_composite WHERE parent_role_id=" + roleId + " OR child_role_id=" + roleId;
+        logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql);
+        query = localSession.createSQLQuery(sql);
+        query.executeUpdate();
+      }
+      // Delete from ep_app_role_function
+      sql = "DELETE FROM ep_app_role_function WHERE role_id=" + roleId;
+      logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql);
+      query = localSession.createSQLQuery(sql);
+      query.executeUpdate();
+      // Delete from ep_role_notification
+      sql = "DELETE FROM ep_role_notification WHERE role_id=" + roleId;
+      logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql);
+      query = localSession.createSQLQuery(sql);
+      query.executeUpdate();
+      // Delete from fn_user_pseudo_role
+      sql = "DELETE FROM fn_user_pseudo_role WHERE pseudo_role_id=" + roleId;
+      logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql);
+      query = localSession.createSQLQuery(sql);
+      query.executeUpdate();
+      // Delete form EP_WIDGET_CATALOG_ROLE
+      sql = "DELETE FROM EP_WIDGET_CATALOG_ROLE WHERE role_id=" + roleId;
+      logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql);
+      query = localSession.createSQLQuery(sql);
+      query.executeUpdate();
+      // Delete form EP_WIDGET_CATALOG_ROLE
+      sql = "DELETE FROM ep_user_roles_request_det WHERE requested_role_id=" + roleId;
+      logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql);
+      query = localSession.createSQLQuery(sql);
+      query.executeUpdate();
+      if (!isPortalRequest) {
+        // Delete form fn_menu_functional_roles
+        sql = "DELETE FROM fn_menu_functional_roles WHERE role_id=" + roleId;
+        logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql);
+        query = localSession.createSQLQuery(sql);
+        query.executeUpdate();
+      }
+    } catch (Exception e) {
+      logger.debug(EELFLoggerDelegate.debugLogger, "deleteRoleDependeciesRecord: failed ", e);
+      throw new DeleteDomainObjectFailedException("delete Failed" + e.getMessage());
+    }
+  }
+
+  private void checkIfRoleInactive(FnRole epRole) throws Exception {
+    if (!epRole.getActiveYn()) {
+      throw new Exception(epRole.getRoleName() + " role is unavailable");
+    }
+  }
+
+  public boolean setAppsWithAdminRoleStateForUser(AppsListWithAdminRole newAppsListWithAdminRoles) {
+    boolean result = false;
+    // No changes if no new roles list or no userId.
+    if (!org.apache.cxf.common.util.StringUtils.isEmpty(newAppsListWithAdminRoles.getOrgUserId())
+        && newAppsListWithAdminRoles.getAppsRoles() != null) {
+      synchronized (syncRests) {
+        List<FnApp> apps = fnAppService.getAppsFullList();
+        HashMap<Long, FnApp> enabledApps = new HashMap<>();
+        for (FnApp app : apps) {
+          enabledApps.put(app.getId(), app);
+        }
+        List<AppNameIdIsAdmin> newAppsWhereUserIsAdmin = new ArrayList<>();
+        for (AppNameIdIsAdmin adminRole : newAppsListWithAdminRoles.getAppsRoles()) {
+          // user Admin role may be added only for enabled apps
+          if (adminRole.getIsAdmin() && enabledApps.containsKey(adminRole.getId())) {
+            newAppsWhereUserIsAdmin.add(adminRole);
+          }
+        }
+        FnUser user = null;
+        boolean createNewUser = false;
+        String orgUserId = newAppsListWithAdminRoles.getOrgUserId().trim();
+        List<FnUser> localUserList = fnUserService.getUserWithOrgUserId(orgUserId);
+        List<FnUserRole> oldAppsWhereUserIsAdmin = new ArrayList<>();
+        if (localUserList.size() > 0) {
+          FnUser tmpUser = localUserList.get(0);
+          oldAppsWhereUserIsAdmin = fnUserRoleService.retrieveByUserIdAndRoleId(tmpUser.getId(), ACCOUNT_ADMIN_ROLE_ID);
+          if (oldAppsWhereUserIsAdmin.size() > 0 || newAppsWhereUserIsAdmin.size() > 0) {
+            user = tmpUser;
+          }
+        } else if (newAppsWhereUserIsAdmin.size() > 0) {
+          // we create new user only if he has Admin Role for any App
+          createNewUser = true;
+        }
+        result = isResult(result, enabledApps, newAppsWhereUserIsAdmin, user, createNewUser, orgUserId,
+            oldAppsWhereUserIsAdmin);
+      }
+    }
+
+    return result;
+  }
+
+  @Transactional
+  public boolean isResult(boolean result, HashMap<Long, FnApp> enabledApps,
+      List<AppNameIdIsAdmin> newAppsWhereUserIsAdmin, FnUser user, boolean createNewUser, String orgUserId,
+      List<FnUserRole> oldAppsWhereUserIsAdmin) {
+    if (user != null || createNewUser) {
+      if (createNewUser) {
+        user = fnUserService.getUserWithOrgUserId(orgUserId).stream().findFirst().get();
+        if (user != null) {
+          user.setActiveYn(true);
+        }
+      }
+      for (FnUserRole oldUserApp : oldAppsWhereUserIsAdmin) {
+        // user Admin role may be deleted only for enabled
+        // apps
+        if (enabledApps.containsKey(oldUserApp.getFnAppId())) {
+          fnUserRoleService.saveOne(oldUserApp);
+        }
+      }
+      for (AppNameIdIsAdmin appNameIdIsAdmin : newAppsWhereUserIsAdmin) {
+        FnApp app = fnAppService.getById(appNameIdIsAdmin.getId());
+        FnRole role = fnRoleService.getById(ACCOUNT_ADMIN_ROLE_ID);
+        FnUserRole newUserApp = new FnUserRole();
+        newUserApp.setUserId(user);
+        newUserApp.setFnAppId(app);
+        newUserApp.setRoleId(role);
+        fnUserRoleService.saveOne(newUserApp);
+      }
+      if (EcompPortalUtils.checkIfRemoteCentralAccessAllowed()) {
+        addAdminRoleInExternalSystem(user, newAppsWhereUserIsAdmin);
+        result = true;
+      }
+    }
+    return result;
+  }
+
+  @Transactional()
+  public boolean addAdminRoleInExternalSystem(FnUser user, List<AppNameIdIsAdmin> newAppsWhereUserIsAdmin) {
+    boolean result = false;
+    try {
+      // Reset All admin role for centralized applications
+      List<FnApp> appList = fnAppService.getCentralizedApps();
+      HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth();
+      for (FnApp app : appList) {
+        String name = "";
+        if (EPCommonSystemProperties
+            .containsProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN)) {
+          name = user.getOrgUserId() + SystemProperties
+              .getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN);
+        }
+        String extRole = app.getAuthNamespace() + "." + PortalConstants.ADMIN_ROLE.replaceAll(" ", "_");
+        HttpEntity<String> entity = new HttpEntity<>(headers);
+        logger.debug(EELFLoggerDelegate.debugLogger, "Connecting to External Access system");
+        try {
+          ResponseEntity<String> getResponse = template
+              .exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL)
+                  + "roles/" + extRole, HttpMethod.GET, entity, String.class);
+
+          if (getResponse.getBody().equals("{}")) {
+            String addDesc = "{\"name\":\"" + extRole + "\"}";
+            HttpEntity<String> roleEntity = new HttpEntity<>(addDesc, headers);
+            template.exchange(
+                SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL)
+                    + "role",
+                HttpMethod.POST, roleEntity, String.class);
+          } else {
+            try {
+              HttpEntity<String> deleteUserRole = new HttpEntity<>(headers);
+              template.exchange(
+                  SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL)
+                      + "userRole/" + name + "/" + extRole,
+                  HttpMethod.DELETE, deleteUserRole, String.class);
+            } catch (Exception e) {
+              logger.error(EELFLoggerDelegate.errorLogger,
+                  " Role not found for this user may be it gets deleted before", e);
+            }
+          }
+        } catch (Exception e) {
+          if (e.getMessage().equalsIgnoreCase("404 Not Found")) {
+            logger.debug(EELFLoggerDelegate.debugLogger, "Application Not found for app {}",
+                app.getAuthNamespace(), e.getMessage());
+          } else {
+            logger.error(EELFLoggerDelegate.errorLogger, "Application Not found for app {}",
+                app.getAuthNamespace(), e);
+          }
+        }
+      }
+      for (AppNameIdIsAdmin appNameIdIsAdmin : newAppsWhereUserIsAdmin) {
+        FnApp app = fnAppService.getById(appNameIdIsAdmin.getId());
+        try {
+          if (app.getAuthCentral()) {
+            String extRole = app.getAuthNamespace() + "." + PortalConstants.ADMIN_ROLE.replaceAll(" ", "_");
+            HttpEntity<String> entity = new HttpEntity<>(headers);
+            String name = "";
+            if (EPCommonSystemProperties
+                .containsProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN)) {
+              name = user.getOrgUserId() + SystemProperties
+                  .getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN);
+            }
+            logger.debug(EELFLoggerDelegate.debugLogger, "Connecting to External Access system");
+            ResponseEntity<String> getUserRolesResponse = template.exchange(
+                SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL)
+                    + "userRoles/user/" + name,
+                HttpMethod.GET, entity, String.class);
+            logger.debug(EELFLoggerDelegate.debugLogger, "Connected to External Access system");
+            if (!getUserRolesResponse.getBody().equals("{}")) {
+              JSONObject jsonObj = new JSONObject(getUserRolesResponse.getBody());
+              JSONArray extRoles = jsonObj.getJSONArray("userRole");
+              final Map<String, JSONObject> extUserRoles = new HashMap<>();
+              for (int i = 0; i < extRoles.length(); i++) {
+                String userRole = extRoles.getJSONObject(i).getString("role");
+                if (userRole.startsWith(app.getAuthNamespace() + ".")
+                    && !userRole.equals(app.getAuthNamespace() + ".admin")
+                    && !userRole.equals(app.getAuthNamespace() + ".owner")) {
+
+                  extUserRoles.put(userRole, extRoles.getJSONObject(i));
+                }
+              }
+              if (!extUserRoles.containsKey(extRole)) {
+                // Assign with new apps user admin
+                try {
+                  ExternalAccessUser extUser = new ExternalAccessUser(name, extRole);
+                  // Assign user role for an application in external access system
+                  ObjectMapper addUserRoleMapper = new ObjectMapper();
+                  String userRole = addUserRoleMapper.writeValueAsString(extUser);
+                  HttpEntity<String> addUserRole = new HttpEntity<>(userRole, headers);
+                  template.exchange(
+                      SystemProperties.getProperty(
+                          EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "userRole",
+                      HttpMethod.POST, addUserRole, String.class);
+                } catch (Exception e) {
+                  logger.error(EELFLoggerDelegate.errorLogger, "Failed to add user admin role", e);
+                }
+
               }
-              return false;
-       }
+            }
+          }
+          result = true;
+        } catch (Exception e) {
+          if (e.getMessage().equalsIgnoreCase("404 Not Found")) {
+            logger.debug(EELFLoggerDelegate.errorLogger,
+                "Application name space not found in External system for app {} due to bad rquest name space ",
+                app.getAuthNamespace(), e.getMessage());
+          } else {
+            logger.error(EELFLoggerDelegate.errorLogger, "Failed to assign admin role for application {}",
+                app.getAuthNamespace(), e);
+            result = false;
+          }
+        }
+      }
+    } catch (Exception e) {
+      result = false;
+      logger.error(EELFLoggerDelegate.errorLogger, "Failed to assign admin roles operation", e);
+    }
+    return result;
+  }
 }
diff --git a/portal-BE/src/main/java/org/onap/portal/service/ApplicationsRestClientService.java b/portal-BE/src/main/java/org/onap/portal/service/ApplicationsRestClientService.java
new file mode 100644 (file)
index 0000000..1c66c6d
--- /dev/null
@@ -0,0 +1,410 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.service;
+
+import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.gson.Gson;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Base64;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.commons.lang.StringUtils;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.cxf.transport.http.HTTPException;
+import org.onap.portal.domain.db.fn.FnApp;
+import org.onap.portal.logging.aop.EPMetricsLog;
+import org.onap.portal.logging.format.EPAppMessagesEnum;
+import org.onap.portal.logging.logic.EPLogUtil;
+import org.onap.portal.utils.EPCommonSystemProperties;
+import org.onap.portal.utils.EcompPortalUtils;
+import org.onap.portal.utils.SystemType;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.portalsdk.core.onboarding.exception.CipherUtilException;
+import org.onap.portalsdk.core.onboarding.util.CipherUtil;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class ApplicationsRestClientService {
+
+  private static final String PASSWORD_HEADER = "password";
+  private static final String APP_USERNAME_HEADER = "username";
+  private static final String BASIC_AUTHENTICATION_HEADER = "Authorization";
+
+  private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ApplicationsRestClientService.class);
+
+  private final Gson gson = null;
+
+  private final ObjectMapper mapper = new ObjectMapper();
+
+  private final AppsCacheService appsCacheService;
+
+  @Autowired
+  public ApplicationsRestClientService(AppsCacheService appsCacheService) {
+    this.appsCacheService = appsCacheService;
+  }
+
+  private static boolean isHttpSuccess(int status) {
+    return status / 100 == 2;
+  }
+
+  @EPMetricsLog
+  private void verifyResponse(Response response, String restPath) throws HTTPException {
+    int status = response.getStatus();
+    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 + restPath + "; [" + response.getStatusInfo()
+              .getReasonPhrase()
+              + "]";
+      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();
+        }
+      } catch (MalformedURLException e) {
+        // never mind. it is only for the debug message.
+        logger.warn(EELFLoggerDelegate.errorLogger, "Failed to build URL", e);
+      }
+      logger.error(EELFLoggerDelegate.errorLogger,
+          "http response failed. " + restPath + errMsg + "; url=" + url);
+      EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeIncorrectHttpStatusError);
+      throw new HTTPException(status, errMsg, url);
+    }
+  }
+
+  private WebClient createClientForApp(long appId, String restPath) {
+    return createClientFor(appId, restPath, SystemType.APPLICATION);
+  }
+
+  private static WebClient createClientForPath(String baseUri, String path) {
+    logger.info(EELFLoggerDelegate.debugLogger, "Creating web client for " + baseUri + "   +   " + path);
+    WebClient client = WebClient.create(baseUri);
+    client.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON);
+    client.path(path);
+    return client;
+  }
+
+  //TODO Need to implement the mylogins once the endpoint is confirmed
+  @EPMetricsLog
+  private WebClient createClientFor(long appSystemId, String restPath, SystemType type) {
+    logger.debug(EELFLoggerDelegate.debugLogger,
+        "creating client for appId=" + appSystemId + "; restPath=" + restPath);
+    FnApp externalApp = null;
+
+    if (type == SystemType.APPLICATION) {
+      externalApp = appsCacheService.getApp(appSystemId);
+    }
+
+    if (externalApp != null) {
+      String appBaseUri = (type == SystemType.APPLICATION) ? externalApp.getAppRestEndpoint() : "";
+      String username = (type == SystemType.APPLICATION) ? externalApp.getAppUsername() : "";
+      String encriptedPwd = (type == SystemType.APPLICATION) ? externalApp.getAppPassword() : "";
+
+      String appName = (type == SystemType.APPLICATION) ? externalApp.getAppName() : "";
+      String decreptedAppPwd = StringUtils.EMPTY;
+
+      // Set local context
+      MDC.put(EPCommonSystemProperties.PROTOCOL, EPCommonSystemProperties.HTTP);
+      if (appBaseUri != null && appBaseUri.contains("https")) {
+        MDC.put(EPCommonSystemProperties.PROTOCOL, EPCommonSystemProperties.HTTPS);
+      }
+      MDC.put(EPCommonSystemProperties.FULL_URL, appBaseUri + restPath);
+      MDC.put(EPCommonSystemProperties.TARGET_ENTITY, appName);
+      MDC.put(EPCommonSystemProperties.TARGET_SERVICE_NAME, restPath);
+
+      try {
+        decreptedAppPwd = CipherUtil.decryptPKC(encriptedPwd,
+            SystemProperties.getProperty(SystemProperties.Decryption_Key));
+      } catch (Exception e) {
+        logger.error(EELFLoggerDelegate.errorLogger, "createClientFor failed to decrypt", e);
+      }
+      WebClient client = createClientForPath(appBaseUri, restPath);
+
+      if (externalApp.getAppPassword().isEmpty() || externalApp.getAppPassword() == null) {
+        logger.debug(EELFLoggerDelegate.debugLogger,
+            "Entering in the externalApp get app password contains null : {}");
+
+        externalApp = appsCacheService.getApp(1L);
+        logger.debug(EELFLoggerDelegate.debugLogger, "external App Information : {}", externalApp);
+
+        String mechidUsername = externalApp.getAppUsername();
+        logger.debug(EELFLoggerDelegate.debugLogger, "external App mechidUsername Information : {}",
+            mechidUsername);
+
+        String password = externalApp.getAppPassword();
+        String decreptedexternalAppPwd = StringUtils.EMPTY;
+        try {
+          decreptedexternalAppPwd = CipherUtil.decryptPKC(password,
+              SystemProperties.getProperty(SystemProperties.Decryption_Key));
+        } catch (CipherUtilException e) {
+          logger.error(EELFLoggerDelegate.errorLogger,
+              "failed to decreptedexternalAppPwd when external app pwd is null", e);
+        }
+
+        username = mechidUsername;
+        decreptedAppPwd = decreptedexternalAppPwd;
+
+      } else {
+        logger.debug(EELFLoggerDelegate.debugLogger,
+            "Entering in the externalApp get app password  is not null : {}");
+
+        // support basic authentication for some partners
+        String encoding = Base64.getEncoder()
+            .encodeToString((username + ":" + decreptedAppPwd).getBytes());
+        String encodingStr = "Basic " + encoding;
+        client.header(BASIC_AUTHENTICATION_HEADER, encodingStr);
+      }
+
+      // But still keep code downward compatible for non compliant apps
+      client.header(APP_USERNAME_HEADER, username);
+      client.header(PASSWORD_HEADER, decreptedAppPwd);
+
+      String encoding = Base64.getEncoder()
+          .encodeToString((username + ":" + decreptedAppPwd).getBytes());
+      String encodingStr = "Basic " + encoding;
+      client.header(BASIC_AUTHENTICATION_HEADER, encodingStr);
+      client.header(SystemProperties.ECOMP_REQUEST_ID, MDC.get(MDC_KEY_REQUEST_ID));
+      client.header(SystemProperties.USERAGENT_NAME, EPCommonSystemProperties.ECOMP_PORTAL_BE);
+      logger.debug(EELFLoggerDelegate.debugLogger,
+          String.format(
+              "check the partner application URL App %d found, baseUri=[%s], Headers: [%s=%s]",
+              appSystemId, appBaseUri,
+              APP_USERNAME_HEADER, username));
+      return client;
+    }
+    return null;
+  }
+
+  public <T> T post(Class<T> clazz, long appId, Object payload, String restPath, SystemType type)
+      throws HTTPException {
+    WebClient client;
+    Response response = null;
+    T t = null;
+
+    client = createClientFor(appId, restPath, type);
+    EcompPortalUtils.logAndSerializeObject(logger, restPath, "POST request =", payload);
+
+    try {
+      if (client != null) {
+        response = client.post(payload);
+      } else {
+        logger.error(EELFLoggerDelegate.errorLogger,
+            "Unable to create the Webclient to make the '" + restPath + "' API call.");
+      }
+    } catch (Exception e) {
+      MDC.put(EPCommonSystemProperties.EXTERNAL_API_RESPONSE_CODE,
+          Integer.toString(HttpServletResponse.SC_INTERNAL_SERVER_ERROR));
+      EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeRestApiGeneralError, e);
+      logger.error(EELFLoggerDelegate.errorLogger,
+          "Exception occurred while making the POST REST API call", e);
+    }
+
+    if (response != null) {
+      verifyResponse(response, restPath);
+      if (clazz != null) {
+        String str = response.readEntity(String.class);
+        EcompPortalUtils.logAndSerializeObject(logger, restPath, "POST result =", str);
+        try {
+          t = gson.fromJson(str, clazz);
+        } catch (Exception e) {
+          EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeInvalidJsonInput, e);
+        }
+      }
+    }
+    return t;
+  }
+
+  public <T> T post(Class<T> clazz, long appId, Object payload, String restPath) throws HTTPException {
+    return post(clazz, appId, payload, restPath, SystemType.APPLICATION);
+  }
+
+  public <T> T put(Class<T> clazz, long appId, Object payload, String restPath) throws HTTPException {
+    WebClient client;
+    Response response = null;
+    T t = null;
+
+    logger.debug(EELFLoggerDelegate.debugLogger,
+        "Entering to createClientForApp method for payload: {} and restPath: {} and appId: {}",
+        payload.toString(), restPath, appId);
+
+    client = createClientForApp(appId, restPath);
+    EcompPortalUtils.logAndSerializeObject(logger, restPath, "PUT request =", payload);
+
+    logger.debug(EELFLoggerDelegate.debugLogger,
+        "Finished createClientForApp method for payload: {} and restPath: {} and appId: {}",
+        payload.toString(), restPath, appId);
+
+    try {
+      if (client != null) {
+        logger.debug(EELFLoggerDelegate.debugLogger,
+            "Entering to PUT for payload: {} and restPath: {} and appId: {}",
+            payload.toString(), restPath, appId);
+
+        response = client.put(payload);
+
+        logger.debug(EELFLoggerDelegate.debugLogger,
+            "Finished to PUT for payload: {} and restPath: {} and appId: {}",
+            payload.toString(), restPath, appId);
+
+      } else {
+        logger.error(EELFLoggerDelegate.errorLogger,
+            "Unable to create the Webclient to make the '" + restPath + "' API call.");
+      }
+    } catch (Exception e) {
+      MDC.put(EPCommonSystemProperties.EXTERNAL_API_RESPONSE_CODE,
+          Integer.toString(HttpServletResponse.SC_INTERNAL_SERVER_ERROR));
+      EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeRestApiGeneralError, e);
+      logger.error(EELFLoggerDelegate.errorLogger,
+          "Exception occurred while making the PUT REST API call", e);
+    }
+
+    if (response != null) {
+      verifyResponse(response, restPath);
+      String str = response.readEntity(String.class);
+      EcompPortalUtils.logAndSerializeObject(logger, restPath, "PUT result =", str);
+      try {
+        t = gson.fromJson(str, clazz);
+      } catch (Exception e) {
+        EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeInvalidJsonInput, e);
+      }
+    }
+    return t;
+  }
+
+  private Response getResponse(long appId, String restPath) {
+    WebClient webClient;
+    Response response = null;
+
+    webClient = createClientForApp(appId, restPath);
+    EcompPortalUtils.logAndSerializeObject(logger, restPath, "GET request =", "no-payload");
+
+    try {
+      if (webClient != null) {
+        response = webClient.get();
+      } else {
+        logger.error(EELFLoggerDelegate.errorLogger,
+            "Unable to create the Webclient to make the '" + restPath + "' API call.");
+      }
+    } catch (Exception e) {
+      MDC.put(EPCommonSystemProperties.EXTERNAL_API_RESPONSE_CODE,
+          Integer.toString(HttpServletResponse.SC_INTERNAL_SERVER_ERROR));
+      EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeRestApiGeneralError, e);
+      logger.error(EELFLoggerDelegate.errorLogger,
+          "Exception occurred while making the GET REST API call", e);
+    }
+    return response;
+  }
+
+  public <T> T get(Class<T> clazz, long appId, String restPath) throws HTTPException {
+    T t = null;
+    Response response = getResponse(appId, restPath);
+
+    if (response != null) {
+      //verifyResponse(response);
+      verifyResponse(response, restPath);
+                       /* 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 = response.readEntity(String.class);
+
+      EcompPortalUtils.logAndSerializeObject(logger, restPath, "GET result =", str);
+      try {
+        t = gson.fromJson(str, clazz);
+      } catch (Exception e) {
+        EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeInvalidJsonInput, e);
+      }
+    }
+
+    return t;
+  }
+
+  public String getIncomingJsonString(final Long appId, final String restPath) throws HTTPException {
+    Response response = getResponse(appId, restPath);
+
+    if (response != null) {
+      //verifyResponse(response);
+      verifyResponse(response, restPath);
+                       /* 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  */
+      return (response).readEntity(String.class);
+    }
+
+    return "";
+  }
+
+  public <T> T get(Class<T> clazz, Long appId, String restPath, boolean useJacksonMapper) throws HTTPException {
+
+    if (!useJacksonMapper) {
+      return get(clazz, appId, restPath);
+    }
+
+    T t = null;
+    Response response = getResponse(appId, restPath);
+
+    if (response != null) {
+      //verifyResponse(response);
+      verifyResponse(response, restPath);
+      String str = (response).readEntity(String.class);
+      EcompPortalUtils.logAndSerializeObject(logger, restPath, "GET result =", str);
+
+      try {
+        t = mapper.readValue(str, clazz);
+      } catch (Exception e) {
+        e.printStackTrace();
+        EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeInvalidJsonInput, e);
+      }
+    }
+
+    return t;
+  }
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/service/AppsCacheService.java b/portal-BE/src/main/java/org/onap/portal/service/AppsCacheService.java
new file mode 100644 (file)
index 0000000..83b5df9
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import javax.annotation.PostConstruct;
+import org.onap.portal.domain.db.fn.FnApp;
+import org.onap.portal.domain.dto.transport.OnboardingApp;
+import org.onap.portal.service.fn.FnAppService;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class AppsCacheService {
+
+
+  private final FnAppService appsService;
+
+  private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AppsCacheService.class);
+
+  @Autowired
+  public AppsCacheService(FnAppService appsService) {
+    this.appsService = appsService;
+  }
+
+  final class CacheConfiguration {
+
+    private long updateTime;
+    private final int updateInterval;
+
+    CacheConfiguration(long updateTime, int updateInterval) {
+      this.updateTime = updateTime;
+      this.updateInterval = updateInterval;
+    }
+  }
+
+  private CacheConfiguration quickRefreshCacheConf = null;
+  private CacheConfiguration slowRefreshCacheConf = null;
+
+
+  private static volatile Map<Long, FnApp> appsMap;
+  private static volatile Map<String, FnApp> uebAppsMap;
+
+  @PostConstruct
+  public void init() {
+    quickRefreshCacheConf = new CacheConfiguration(0, 120);
+    slowRefreshCacheConf = new CacheConfiguration(0, 3600);
+
+    this.refreshAppsMap(quickRefreshCacheConf);
+  }
+
+  private void refreshAppsMap(CacheConfiguration conf) {
+    long now = System.currentTimeMillis();
+
+    if (noNeedToUpdate(now, conf)) {
+      return;
+    }
+
+    synchronized (this) {
+      if (noNeedToUpdate(now, conf)) {
+        return;
+      }
+      List<FnApp> allApps = appsService.getAppsFullList();
+      Map<Long, FnApp> newAppsMap = new HashMap<>();
+      for (FnApp app : allApps) {
+        newAppsMap.put(app.getId(), app);
+      }
+
+      Map<String, FnApp> newUebAppsMap = new HashMap<>();
+      for (FnApp app : allApps) {
+        newUebAppsMap.put(app.getUebKey(), app);
+      }
+      // Switch cache with the new one.
+      appsMap = newAppsMap;
+      uebAppsMap = newUebAppsMap;
+      conf.updateTime = now;
+    }
+
+  }
+
+  private boolean noNeedToUpdate(long now, CacheConfiguration conf) {
+    long secondsPassed = (now - conf.updateTime) / 1000;
+    if (secondsPassed < conf.updateInterval) {
+      logger.debug(EELFLoggerDelegate.debugLogger,
+          "no need to refresh yet, seconds since last refresh: " + secondsPassed + ", refresh interval (sec) = "
+              + conf.updateInterval);
+      return true; // no need to update cache
+    }
+    return false; // its time to update
+  }
+
+  public String getAppEndpoint(Long appId) {
+    refreshAppsMap(quickRefreshCacheConf);
+    FnApp app = appsMap.get(appId);
+    if (app != null) {
+      return app.getAppRestEndpoint();
+    }
+    return null;
+  }
+
+  public List<OnboardingApp> getAppsFullList() {
+    refreshAppsMap(quickRefreshCacheConf);
+    List<FnApp> appList = new ArrayList<>(appsMap.values());
+    appList.removeIf(app -> app.getId() == 1);
+    List<FnApp> appsFinalList = appList.stream()
+        .filter(app -> app.getEnabled() && !app.getOpen()).collect(Collectors.toList());
+
+    List<OnboardingApp> onboardingAppsList = new ArrayList<>();
+    for (FnApp app : appsFinalList) {
+      OnboardingApp onboardingApp = new OnboardingApp();
+      appsService.createOnboardingFromApp(app, onboardingApp);
+      onboardingAppsList.add(onboardingApp);
+    }
+    return onboardingAppsList;
+  }
+
+  public FnApp getApp(Long appId) {
+    refreshAppsMap(quickRefreshCacheConf);
+    return appsMap.get(appId);
+  }
+
+  public FnApp getAppFromUeb(String appKey) {
+    return getAppFromUeb(appKey, 0);
+  }
+
+  public FnApp getAppFromUeb(String appKey, Integer quickCacheRefresh) {
+    refreshAppsMap(quickCacheRefresh == 1 ? quickRefreshCacheConf : slowRefreshCacheConf);
+    return uebAppsMap.get(appKey);
+  }
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/service/EcompUserAppRolesService.java b/portal-BE/src/main/java/org/onap/portal/service/EcompUserAppRolesService.java
new file mode 100644 (file)
index 0000000..2a8415c
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.service;
+
+import java.util.List;
+import java.util.stream.Collectors;
+import javax.persistence.EntityManager;
+import javax.persistence.Tuple;
+import org.onap.portal.domain.dto.transport.EcompUserAppRoles;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class EcompUserAppRolesService {
+
+  private final static String QUERY = "select\n"
+      + "  fr.role_name as roleName,\n"
+      + "  fu.app_id as appId,\n"
+      + "  fu.user_id as userId,\n"
+      + "  fu.priority as priority,\n"
+      + "  fu.role_id as roleId\n"
+      + " from\n"
+      + "  fn_user_role fu\n"
+      + "  left outer join fn_role fr on fu.role_id = fr.role_id\n"
+      + " where\n"
+      + "  fu.user_id = :userId\n"
+      + "  and fu.app_id = :appId";
+
+  private final EntityManager entityManager;
+
+  @Autowired
+  public EcompUserAppRolesService(EntityManager entityManager) {
+    this.entityManager = entityManager;
+  }
+
+
+  public List<EcompUserAppRoles> getUserAppExistingRoles(final Long appId, final Long userId){
+    List<Tuple> tuples = entityManager.createQuery(QUERY, Tuple.class)
+        .setParameter("appId", appId)
+        .setParameter("userId", userId)
+        .getResultList();
+    return tuples.stream().map(this::tupleToEcompUserAppRoles).collect(Collectors.toList());
+  }
+
+  private EcompUserAppRoles tupleToEcompUserAppRoles(Tuple tuple){
+    return new EcompUserAppRoles((String)tuple.get("appId"), (Long) tuple.get("userId"), (Integer) tuple.get("priority"), (Long) tuple.get("roleId"), (String) tuple.get("roleName"));
+  }
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/service/ExternalAccessRolesService.java b/portal-BE/src/main/java/org/onap/portal/service/ExternalAccessRolesService.java
new file mode 100644 (file)
index 0000000..b673923
--- /dev/null
@@ -0,0 +1,371 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import java.util.stream.Collectors;
+import javax.persistence.EntityManager;
+import javax.persistence.Tuple;
+import org.onap.portal.domain.db.ep.EpAppFunction;
+import org.onap.portal.domain.db.fn.FnApp;
+import org.onap.portal.domain.db.fn.FnFunction;
+import org.onap.portal.domain.db.fn.FnRole;
+import org.onap.portal.domain.db.fn.FnRoleFunction;
+import org.onap.portal.domain.dto.transport.CentralV2Role;
+import org.onap.portal.domain.dto.transport.GlobalRoleWithApplicationRoleFunction;
+import org.onap.portal.exception.RoleFunctionException;
+import org.onap.portal.logging.logic.EPLogUtil;
+import org.onap.portal.service.ep.EpAppFunctionService;
+import org.onap.portal.service.fn.FnAppService;
+import org.onap.portal.service.fn.FnRoleService;
+import org.onap.portal.utils.EPCommonSystemProperties;
+import org.onap.portal.utils.EPUserUtils;
+import org.onap.portal.utils.EcompPortalUtils;
+import org.onap.portal.utils.PortalConstants;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+@Service
+public class ExternalAccessRolesService {
+
+  private static final String APP_ROLE_NAME_PARAM = "appRoleName";
+  private static final String GET_ROLE_TO_UPDATE_IN_EXTERNAL_AUTH_SYSTEM = "getRoletoUpdateInExternalAuthSystem";
+  private static final String GET_PORTAL_APP_ROLES_QUERY = "getPortalAppRoles";
+  private static final String GET_ROLE_FUNCTION_QUERY = "getRoleFunction";
+  private static final String FUNCTION_CODE_PARAMS = "functionCode";
+  private static final String AND_FUNCTION_CD_EQUALS = " and function_cd = '";
+  private static final String OWNER = ".owner";
+  private static final String ADMIN = ".admin";
+  private static final String ACCOUNT_ADMINISTRATOR = ".Account_Administrator";
+  private static final String FUNCTION_PIPE = "|";
+  private static final String EXTERNAL_AUTH_PERMS = "perms";
+  private static final String EXTERNAL_AUTH_ROLE_DESCRIPTION = "description";
+  private static final String IS_EMPTY_JSON_STRING = "{}";
+  private static final String CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE = "Connecting to External Auth system";
+  private static final String APP_ID = "appId";
+  private static final String ROLE_NAME = "name";
+  private static final String APP_ID_EQUALS = " app_id = ";
+
+  private static final String GET_GLOBAL_ROLE_WITH_APPLICATION_ROLE_FUNCTIONS = "select"
+      + "  distinct d.roleId as roleId,"
+      + "  d.roleName as roleName,"
+      + "  d.activeYn as active,"
+      + "  d.priority as priority,"
+      + "  c.epAppFunction.functionCd as functionCd,"
+      + "  e.functionName as functionName,"
+      + "  c.epAppFunction.appId as appId,"
+      + "  c.roleAppId as roleAppId"
+      + " from"
+      + "  FnUserRole a,"
+      + "  FnApp b,"
+      + "  EpAppRoleFunction c,"
+      + "  FnRole d,"
+      + "  EpAppFunction e"
+      + " where"
+      + "  b.appId = c.appId.appId"
+      + "  and a.appId = c.roleAppId"
+      + "  and b.enabled = 'Y'"
+      + "  and c.fnRole.roleId = d.roleId"
+      + "  and d.activeYn = 'Y'"
+      + "  and e.functionCd = c.epAppFunction.functionCd"
+      + "  and c.appId.appId = :appId"
+      + "  and e.appId.appId = c.appId.appId";
+
+  private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ExternalAccessRolesService.class);
+  private final RestTemplate template = new RestTemplate();
+
+  private final FnRoleService fnRoleService;
+  private final FnAppService fnAppService;
+  private final EntityManager entityManager;
+  private final EpAppFunctionService epAppFunctionService;
+
+  @Autowired
+  public ExternalAccessRolesService(FnRoleService fnRoleService,
+      FnAppService fnAppService, EntityManager entityManager,
+      EpAppFunctionService epAppFunctionService) {
+    this.fnRoleService = fnRoleService;
+    this.fnAppService = fnAppService;
+    this.entityManager = entityManager;
+    this.epAppFunctionService = epAppFunctionService;
+  }
+
+  String getFunctionCodeType(String roleFuncItem) {
+    String type = null;
+    if ((roleFuncItem.contains(FUNCTION_PIPE) && roleFuncItem.contains("menu"))
+        || (!roleFuncItem.contains(FUNCTION_PIPE) && roleFuncItem.contains("menu"))) {
+      type = "menu";
+    } else if (checkIfCodeHasNoPipesAndHasTypeUrl(roleFuncItem) || checkIfCodeHasPipesAndHasTypeUrl(roleFuncItem)
+        || checkIfCodeHasNoPipesAndHasNoTypeUrl(roleFuncItem)) {
+      type = "url";
+    } else if (roleFuncItem.contains(FUNCTION_PIPE)
+        && (!roleFuncItem.contains("menu") || roleFuncItem.contains("url"))) {
+      type = EcompPortalUtils.getFunctionType(roleFuncItem);
+    }
+    return type;
+  }
+
+  private boolean checkIfCodeHasNoPipesAndHasTypeUrl(String roleFuncItem) {
+    return !roleFuncItem.contains(FUNCTION_PIPE) && roleFuncItem.contains("url");
+  }
+
+  private boolean checkIfCodeHasPipesAndHasTypeUrl(String roleFuncItem) {
+    return roleFuncItem.contains(FUNCTION_PIPE) && roleFuncItem.contains("url");
+  }
+
+  private boolean checkIfCodeHasNoPipesAndHasNoTypeUrl(String roleFuncItem) {
+    return !roleFuncItem.contains(FUNCTION_PIPE) && !roleFuncItem.contains("url");
+  }
+
+  List<FnRole> getPortalAppRoleInfo(Long roleId) {
+    return fnRoleService.retrieveAppRoleByRoleIdWhereAppIdIsNull(roleId);
+  }
+
+  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;
+  }
+
+  Map<String, FnRole> getAppRoleNamesWithUnderscoreMap(FnApp app) {
+    final Map<String, FnRole> currentRolesInDB = new HashMap<>();
+    List<FnRole> getCurrentRoleList = null;
+    final Map<String, Long> appParams = new HashMap<>();
+    if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) {
+      getCurrentRoleList = fnRoleService.retrieveAppRolesWhereAppIdIsNull();
+    } else {
+      appParams.put("appId", app.getId());
+      getCurrentRoleList = fnRoleService.retrieveAppRolesByAppId(app.getId());
+    }
+    for (FnRole role : getCurrentRoleList) {
+      currentRolesInDB.put(role.getRoleName()
+          .replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"), role);
+    }
+    return currentRolesInDB;
+  }
+
+  List<CentralV2Role> createCentralRoleObject(List<FnApp> app, List<FnRole> roleInfo,
+      List<CentralV2Role> roleList) throws RoleFunctionException {
+    for (FnRole role : roleInfo) {
+      List<EpAppFunction> cenRoleFuncList = epAppFunctionService
+          .getAppRoleFunctionList(role.getId(), app.get(0).getId());
+      SortedSet<FnRoleFunction> roleFunctionSet = new TreeSet<>();
+      for (EpAppFunction roleFunc : cenRoleFuncList) {
+        String functionCode = EcompPortalUtils.getFunctionCode(roleFunc.getFunctionCd());
+        functionCode = EPUserUtils.decodeFunctionCode(functionCode);
+        String type = getFunctionCodeType(roleFunc.getFunctionCd());
+        String action = getFunctionCodeAction(roleFunc.getFunctionCd());
+        FnRoleFunction cenRoleFunc = new FnRoleFunction(role, FnFunction.builder().code(functionCode).name(roleFunc.getFunctionName()).type(type).action(action).build());
+      }
+      SortedSet<CentralV2Role> childRoles = new TreeSet<>();
+      SortedSet<CentralV2Role> parentRoles = new TreeSet<>();
+      CentralV2Role cenRole;
+      if (role.getAppRoleId() == null) {
+        cenRole = CentralV2Role.builder().id(role.getId()).created(role.getCreated())
+            .modified(role.getModified())
+.rowNum(role.getRowNum()).name(role.getRoleName())
+            .active(role.getActiveYn()).priority(role.getPriority()).roleFunctions(roleFunctionSet)
+            .childRoles(childRoles).parentRoles(parentRoles).build();
+      } else {
+        cenRole = CentralV2Role.builder().id(role.getAppRoleId())
+            .created(role.getCreated()).modified(role.getModified())
+.rowNum(role.getRowNum()).name(role.getRoleName())
+            .active(role.getActiveYn()).priority(role.getPriority()).roleFunctions(roleFunctionSet)
+            .childRoles(childRoles).parentRoles(parentRoles).build();
+      }
+      roleList.add(cenRole);
+    }
+    return roleList;
+  }
+
+  String getFunctionCodeAction(String roleFuncItem) {
+    return (!roleFuncItem.contains(FUNCTION_PIPE)) ? "*" : EcompPortalUtils.getFunctionAction(roleFuncItem);
+  }
+
+  List<CentralV2Role> getRolesForApp(String uebkey) throws Exception {
+    logger.debug(EELFLoggerDelegate.debugLogger, "getRolesForApp: Entering into getRolesForApp");
+    List<CentralV2Role> roleList = new ArrayList<>();
+    try {
+      List<FnApp> app = fnAppService.getByUebKey(uebkey);
+      List<FnRole> appRolesList = fnRoleService.getAppRoles(app.get(0).getId());
+      roleList = createCentralRoleObject(app, appRolesList, roleList);
+      if (!Objects.equals(app.get(0).getId(), PortalConstants.PORTAL_APP_ID)) {
+        List<CentralV2Role> globalRoleList = getGlobalRolesOfApplication(app.get(0).getId());
+        List<FnRole> globalRolesList = fnRoleService.getGlobalRolesOfPortal();
+        List<CentralV2Role> portalsGlobalRolesFinlaList = new ArrayList<>();
+        if (!globalRolesList.isEmpty()) {
+          for (FnRole eprole : globalRolesList) {
+            CentralV2Role cenRole = convertRoleToCentralV2Role(eprole);
+            portalsGlobalRolesFinlaList.add(cenRole);
+          }
+          roleList.addAll(globalRoleList);
+          for (CentralV2Role role : portalsGlobalRolesFinlaList) {
+            CentralV2Role result = roleList.stream().filter(x -> role.getId().equals(x.getId())).findAny()
+                .orElse(null);
+            if (result == null) {
+              roleList.add(role);
+            }
+          }
+        } else {
+          for (FnRole role : globalRolesList) {
+            CentralV2Role cenRole = convertRoleToCentralV2Role(role);
+            roleList.add(cenRole);
+          }
+        }
+      }
+    } catch (Exception e) {
+      logger.error(EELFLoggerDelegate.errorLogger, "getRolesForApp: Failed!", e);
+      throw e;
+    }
+    logger.debug(EELFLoggerDelegate.debugLogger, "getRolesForApp: Finished!");
+    return roleList.stream().distinct().collect(Collectors.toList());
+  }
+
+  private CentralV2Role convertRoleToCentralV2Role(FnRole role) {
+    return CentralV2Role.builder().id(role.getId()).created(role.getCreated())
+        .modified(role.getModified())
+        .rowNum(role.getRowNum()).name(role.getRoleName()).active(role.getActiveYn())
+        .priority(role.getPriority()).roleFunctions(new TreeSet<>()).childRoles(new TreeSet<>())
+        .parentRoles(new TreeSet<>()).build();
+  }
+
+  private List<CentralV2Role> getGlobalRolesOfApplication(Long appId) {
+    List<GlobalRoleWithApplicationRoleFunction> globalRoles = new ArrayList<>();
+    try {
+      List<Tuple> tuples = entityManager.createQuery(GET_GLOBAL_ROLE_WITH_APPLICATION_ROLE_FUNCTIONS, Tuple.class)
+          .setParameter("appId", appId)
+          .getResultList();
+      globalRoles = tuples.stream().map(this::tupleToGlobalRoleWithApplicationRoleFunction).collect(Collectors.toList());
+    } catch (Exception e) {
+      logger.error(EELFLoggerDelegate.errorLogger, "getCentralizedAppsOfUser failed", e);
+    }
+    List<CentralV2Role> roleList = new ArrayList<>();
+    if (globalRoles.size() > 0) {
+      roleList = finalListOfCentralRoles(globalRoles);
+    }
+    return roleList;
+  }
+
+  private GlobalRoleWithApplicationRoleFunction tupleToGlobalRoleWithApplicationRoleFunction(Tuple tuple) {
+    return GlobalRoleWithApplicationRoleFunction.builder().roleId((Long) tuple.get("roleId"))
+        .roleName((String) tuple.get("roleName"))
+        .functionCd((String) tuple.get("functionCd")).functionName((String) tuple.get("functionName"))
+        .active((Boolean) tuple.get("active")).priority((Integer) tuple.get("priority"))
+        .appId((Long) tuple.get("appId")).roleAppId((Long) tuple.get("roleAppId")).build();
+  }
+
+  private List<CentralV2Role> finalListOfCentralRoles(List<GlobalRoleWithApplicationRoleFunction> globalRoles) {
+    List<CentralV2Role> rolesfinalList = new ArrayList<>();
+    for (GlobalRoleWithApplicationRoleFunction role : globalRoles) {
+      boolean found = false;
+      for (CentralV2Role cenRole : rolesfinalList) {
+        if (role.getRoleId().equals(cenRole.getId())) {
+          SortedSet<FnRoleFunction> roleFunctions = cenRole.getRoleFunctions();
+          FnRoleFunction cenRoleFun = createCentralRoleFunctionForGlobalRole(role);
+          roleFunctions.add(cenRoleFun);
+          cenRole.setRoleFunctions(roleFunctions);
+          found = true;
+          break;
+        }
+      }
+      if (!found) {
+        CentralV2Role cenrole = new CentralV2Role();
+        cenrole.setName(role.getRoleName());
+        cenrole.setId(role.getRoleId());
+        cenrole.setActive(role.getActive());
+        cenrole.setPriority(role.getPriority());
+        SortedSet<FnRoleFunction> roleFunctions = new TreeSet<>();
+        FnRoleFunction cenRoleFun = createCentralRoleFunctionForGlobalRole(role);
+        roleFunctions.add(cenRoleFun);
+        cenrole.setRoleFunctions(roleFunctions);
+        rolesfinalList.add(cenrole);
+      }
+    }
+    return rolesfinalList;
+  }
+
+  private FnRoleFunction createCentralRoleFunctionForGlobalRole(GlobalRoleWithApplicationRoleFunction role) {
+    String instance;
+    String type;
+    String action;
+    FnRoleFunction cenRoleFun = null;
+    if (role.getFunctionCd().contains(FUNCTION_PIPE)) {
+      instance = EcompPortalUtils.getFunctionCode(role.getFunctionCd());
+      type = EcompPortalUtils.getFunctionType(role.getFunctionCd());
+      action = EcompPortalUtils.getFunctionAction(role.getFunctionCd());
+      cenRoleFun = FnRoleFunction.builder().build();
+      FnRole fnRole = new FnRole();
+      FnFunction fnFunction = FnFunction.builder().functionCd(instance).name(role.getFunctionName()).type(type).action(action).build();
+      cenRoleFun.setRole(fnRole);
+      cenRoleFun.setFunctionCd(fnFunction);
+    } else {
+      type = getFunctionCodeType(role.getFunctionCd());
+      action = getFunctionCodeAction(role.getFunctionCd());
+      FnFunction fnFunction = FnFunction.builder().functionCd(role.getFunctionCd()).name(role.getFunctionName()).type(type).action(action).build();
+      cenRoleFun.setRole(new FnRole());
+      cenRoleFun.setFunctionCd(fnFunction);
+    }
+    return cenRoleFun;
+  }
+}
index 38a0a40..28d63eb 100644 (file)
@@ -50,7 +50,6 @@ import org.onap.portal.domain.db.ep.EpWidgetCatalog;
 import org.onap.portal.domain.db.fn.FnUser;
 import org.onap.portal.domain.dto.ecomp.PersUserWidgetSelection;
 import org.onap.portal.domain.dto.transport.WidgetCatalogPersonalization;
-import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -80,7 +79,7 @@ public class PersUserWidgetService {
               if (persList.size() == 1) {
                      persRow = persList.get(0);
               } else {
-                     persRow = new PersUserWidgetSelection(null, user.getUserId(), personalization.getWidgetId(), null);
+                     persRow = new PersUserWidgetSelection(null, user.getId(), personalization.getWidgetId(), null);
               }
 
               if (persRow.getId() != null) {
index 624beed..d25727b 100644 (file)
@@ -47,7 +47,7 @@ import org.springframework.stereotype.Service;
 @Service
 public class WidgetMService {
 
-       private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetMService.class);
+       private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetMService.class);
 
        public String getServiceLocation(String service, String fallbackPortOnLocalHost) {
               logger.debug(EELFLoggerDelegate.debugLogger, "Requested Service: " + service);
index 4b03791..6f8440e 100644 (file)
@@ -48,7 +48,6 @@ import org.onap.portal.dao.fn.FnWidgetDao;
 import org.onap.portal.domain.db.fn.FnUser;
 import org.onap.portal.domain.db.fn.FnUserRole;
 import org.onap.portal.domain.db.fn.FnWidget;
-import org.onap.portal.domain.dto.ecomp.EPUserApp;
 import org.onap.portal.domain.dto.transport.FieldsValidator;
 import org.onap.portal.domain.dto.transport.OnboardingWidget;
 import org.onap.portal.service.fn.FnUserRoleService;
@@ -68,7 +67,7 @@ public class WidgetService {
        private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetService.class);
        private final Long ACCOUNT_ADMIN_ROLE_ID = 999L;
 
-       private static String baseSqlToken =
+       private static final String baseSqlToken =
                " new org.onap.portal.domain.dto.transport.OnboardingWidget("
                        + "widget.WIDGET_ID,widget.WDG_NAME,widget.APP_ID,"
                        + "app.APP_NAME,widget.WDG_WIDTH,widget.WDG_HEIGHT,"
@@ -232,7 +231,7 @@ public class WidgetService {
               synchronized (syncRests) {
                      FnWidget widget = fnWidgetDao.getOne(onboardingWidgetId);
                      if (widget != null && widget.getAppId() != null) { // widget exists
-                            if (!this.isUserAdminOfAppForWidget(adminRolesService.isSuperAdmin(user.getOrgUserId()), user.getUserId(),
+                            if (!this.isUserAdminOfAppForWidget(adminRolesService.isSuperAdmin(user.getOrgUserId()), user.getId(),
                                     widget.getAppId())) {
                                    fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_FORBIDDEN);
                             } else {
diff --git a/portal-BE/src/main/java/org/onap/portal/service/ep/EpAppFunctionService.java b/portal-BE/src/main/java/org/onap/portal/service/ep/EpAppFunctionService.java
new file mode 100644 (file)
index 0000000..012983d
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.service.ep;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+import org.onap.portal.dao.ep.EpAppFunctionDao;
+import org.onap.portal.domain.db.ep.EpAppFunction;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class EpAppFunctionService {
+
+  private final EpAppFunctionDao epAppFunctionDao;
+
+  @Autowired
+  public EpAppFunctionService(EpAppFunctionDao epAppFunctionDao) {
+    this.epAppFunctionDao = epAppFunctionDao;
+  }
+
+  public List<EpAppFunction> getAppRoleFunctionList(final Long roleId, final Long appId) {
+
+    return Optional.of(epAppFunctionDao.getAppRoleFunctionList(roleId, appId))
+        .orElse(new ArrayList<>())
+        .stream()
+        .filter(distinctByKey(EpAppFunction::getAppId))
+        .filter(distinctByKey(EpAppFunction::getFunctionCd))
+        .filter(distinctByKey(EpAppFunction::getFunctionName))
+        .collect(Collectors.toList());
+  }
+
+  private <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
+    List<Object> seen = new ArrayList<>();
+    return t -> seen.add(keyExtractor.apply(t));
+  }
+}
index 6fa8b7d..ea0e69b 100644 (file)
@@ -57,7 +57,7 @@ import org.springframework.transaction.annotation.Transactional;
 @Transactional
 public class EpMicroserviceParameterService {
 
-       EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EpWidgetCatalogParameterService.class);
+       final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EpWidgetCatalogParameterService.class);
 
        private final EpMicroserviceParameterDao epMicroserviceParameterDao;
 
diff --git a/portal-BE/src/main/java/org/onap/portal/service/ep/EpUserRolesRequestDetService.java b/portal-BE/src/main/java/org/onap/portal/service/ep/EpUserRolesRequestDetService.java
new file mode 100644 (file)
index 0000000..11c78b4
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.service.ep;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import org.onap.portal.dao.ep.EpUserRolesRequestDetDao;
+import org.onap.portal.domain.db.ep.EpUserRolesRequestDet;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional
+public class EpUserRolesRequestDetService {
+       private final EpUserRolesRequestDetDao epUserRolesRequestDetDao;
+
+       @Autowired
+       public EpUserRolesRequestDetService(EpUserRolesRequestDetDao epUserRolesRequestDetDao) {
+              this.epUserRolesRequestDetDao = epUserRolesRequestDetDao;
+       }
+
+       public EpUserRolesRequestDet saveOne(EpUserRolesRequestDet epUserRolesRequestDet){
+              return epUserRolesRequestDetDao.save(epUserRolesRequestDet);
+       }
+
+       public List<EpUserRolesRequestDet> appRolesRequestDetailList(final Long reqId){
+              return Optional.of(epUserRolesRequestDetDao.appRolesRequestDetailList(reqId)).orElse(new ArrayList<>());
+       }
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/service/ep/EpUserRolesRequestService.java b/portal-BE/src/main/java/org/onap/portal/service/ep/EpUserRolesRequestService.java
new file mode 100644 (file)
index 0000000..4f5326d
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.service.ep;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import org.onap.portal.dao.ep.EpUserRolesRequestDao;
+import org.onap.portal.domain.db.ep.EpUserRolesRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional
+public class EpUserRolesRequestService {
+       private final EpUserRolesRequestDao epUserRolesRequestDao;
+
+       @Autowired
+       public EpUserRolesRequestService(EpUserRolesRequestDao epUserRolesRequestDao) {
+              this.epUserRolesRequestDao = epUserRolesRequestDao;
+       }
+
+       public EpUserRolesRequest saveOne(EpUserRolesRequest epUserRolesRequest){
+              return epUserRolesRequestDao.save(epUserRolesRequest);
+       }
+
+       public List<EpUserRolesRequest> userAppRolesRequestList(final Long userId, final Long appId){
+              return Optional.of(epUserRolesRequestDao.userAppRolesRequestList(userId, appId)).orElse(new ArrayList<>());
+       }
+}
index d43acc0..029c316 100644 (file)
@@ -53,7 +53,7 @@ import org.springframework.transaction.annotation.Transactional;
 @Transactional
 public class EpWidgetCatalogParameterService {
 
-       EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EpWidgetCatalogParameterService.class);
+       final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EpWidgetCatalogParameterService.class);
 
        private final EpWidgetCatalogParameterDao epWidgetCatalogParameterDao;
        private final EpMicroserviceParameterService epMicroserviceParameterService;
index d8d88c9..6e3c287 100644 (file)
 
 package org.onap.portal.service.fn;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 import javax.persistence.EntityExistsException;
+import javax.persistence.EntityManager;
 import org.onap.portal.dao.fn.FnAppDao;
 import org.onap.portal.domain.db.fn.FnApp;
 import org.onap.portal.domain.dto.transport.OnboardingApp;
@@ -56,56 +58,80 @@ import org.springframework.stereotype.Service;
 @Service
 public class FnAppService {
 
-       private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnAppService.class);
+  private static final String SUPER_ADMIN_ROLE_ID = "1";
 
-       private final FnAppDao fnAppDao;
+  private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnAppService.class);
 
-       @Autowired
-       public FnAppService(final FnAppDao fnAppDao) {
-              this.fnAppDao = fnAppDao;
-       }
+  private final FnAppDao fnAppDao;
+  private final EntityManager entityManager;
 
-       public List<FnApp> getAppsFullList() {
-              return fnAppDao.findAll();
-       }
+  @Autowired
+  public FnAppService(final FnAppDao fnAppDao, EntityManager entityManager) {
+    this.fnAppDao = fnAppDao;
+    this.entityManager = entityManager;
+  }
 
-       public FnApp getById(final Long id){
-              return Optional.of(fnAppDao.getOne(id)).orElseThrow(EntityExistsException::new);
-       }
+  public List<FnApp> getAppsFullList() {
+    return fnAppDao.findAll();
+  }
 
-       public void createOnboardingFromApp(FnApp app, OnboardingApp onboardingApp) {
-              onboardingApp.setId(app.getId());
-              onboardingApp.setName(app.getAppName());
-              onboardingApp.setImageUrl(app.getAppImageUrl());
-              onboardingApp.setDescription(app.getAppDescription());
-              onboardingApp.setNotes(app.getAppNotes());
-              onboardingApp.setUrl(app.getAppUrl());
-              onboardingApp.setAlternateUrl(app.getAppAlternateUrl());
-              onboardingApp.setRestUrl(app.getAppRestEndpoint());
-              onboardingApp.setIsOpen(app.getOpen());
-              onboardingApp.setIsEnabled(app.getEnabled());
-              onboardingApp.setUsername(app.getAppUsername());
-              onboardingApp.setAppPassword((app.getAppPassword().equals(EPCommonSystemProperties.APP_DISPLAY_PASSWORD))
-                      ? EPCommonSystemProperties.APP_DISPLAY_PASSWORD : decryptedPassword(app.getAppPassword(), app));
-              onboardingApp.setUebTopicName(app.getUebTopicName());
-              onboardingApp.setUebKey(app.getUebKey());
-              onboardingApp.setUebSecret(app.getUebSecret());
-              onboardingApp.setIsCentralAuth(app.getAuthCentral());
-              onboardingApp.setNameSpace(app.getAuthNamespace());
-              onboardingApp.setRestrictedApp(app.isRestrictedApp());
-       }
+  public FnApp getById(final Long id) {
+    return Optional.of(fnAppDao.getOne(id)).orElseThrow(EntityExistsException::new);
+  }
 
-       private String decryptedPassword(String encryptedAppPwd, FnApp app) {
-              String result = "";
-              if (encryptedAppPwd != null && !encryptedAppPwd.isEmpty()) {
-                     try {
-                            result = CipherUtil.decryptPKC(encryptedAppPwd,
-                                    SystemProperties.getProperty(SystemProperties.Decryption_Key));
-                     } catch (Exception e) {
-                            logger.error(EELFLoggerDelegate.errorLogger,
-                                    "decryptedPassword failed for app " + app.getAppName(), e);
-                     }
-              }
-              return result;
-       }
+  public List<FnApp> getByUebKey(final String uebKey){
+    return Optional.of(fnAppDao.getByUebKey(uebKey)).orElse(new ArrayList<>());
+  }
+
+  public List<FnApp> getCentralizedApps(){
+    return Optional.of(fnAppDao.getCentralizedApps()).orElse(new ArrayList<>());
+  }
+
+  public void createOnboardingFromApp(FnApp app, OnboardingApp onboardingApp) {
+    onboardingApp.setId(app.getId());
+    onboardingApp.setName(app.getAppName());
+    onboardingApp.setImageUrl(app.getAppImageUrl());
+    onboardingApp.setDescription(app.getAppDescription());
+    onboardingApp.setNotes(app.getAppNotes());
+    onboardingApp.setUrl(app.getAppUrl());
+    onboardingApp.setAlternateUrl(app.getAppAlternateUrl());
+    onboardingApp.setRestUrl(app.getAppRestEndpoint());
+    onboardingApp.setIsOpen(app.getOpen());
+    onboardingApp.setIsEnabled(app.getEnabled());
+    onboardingApp.setUsername(app.getAppUsername());
+    onboardingApp.setAppPassword((app.getAppPassword().equals(EPCommonSystemProperties.APP_DISPLAY_PASSWORD))
+        ? EPCommonSystemProperties.APP_DISPLAY_PASSWORD : decryptedPassword(app.getAppPassword(), app));
+    onboardingApp.setUebTopicName(app.getUebTopicName());
+    onboardingApp.setUebKey(app.getUebKey());
+    onboardingApp.setUebSecret(app.getUebSecret());
+    onboardingApp.setIsCentralAuth(app.getAuthCentral());
+    onboardingApp.setNameSpace(app.getAuthNamespace());
+    onboardingApp.setRestrictedApp(app.isRestrictedApp());
+  }
+
+  private String decryptedPassword(String encryptedAppPwd, FnApp app) {
+    String result = "";
+    if (encryptedAppPwd != null && !encryptedAppPwd.isEmpty()) {
+      try {
+        result = CipherUtil.decryptPKC(encryptedAppPwd,
+            SystemProperties.getProperty(SystemProperties.Decryption_Key));
+      } catch (Exception e) {
+        logger.error(EELFLoggerDelegate.errorLogger,
+            "decryptedPassword failed for app " + app.getAppName(), e);
+      }
+    }
+    return result;
+  }
+
+  List<FnApp> getUserRemoteApps(String id) {
+/*    StringBuilder sb = new StringBuilder();
+    sb.append("SELECT * FROM FnApp join FN_USER_ROLE ON FN_USER_ROLE.APP_ID = FN_APP.APP_ID where ");
+    sb.append("FN_USER_ROLE.USER_ID = ").append(id).append(" AND FN_USER_ROLE.ROLE_ID != ")
+        .append(SUPER_ADMIN_ROLE_ID);
+    sb.append(" AND FN_APP.ENABLED = 'Y'");
+
+    Query query = entityManager.createQuery(sb.toString());
+    List<FnApp> adminApps = query.getResultList();*/
+    return new ArrayList<>();
+  }
 }
index c58bf09..c39a12b 100644 (file)
@@ -67,7 +67,7 @@ public class FnLanguageService {
        public List<FnLanguage> getLanguages(Principal principal){
               return fnLanguageDao.findAll();
        }
-       public FnLanguage save(final Principal principal, final FnLanguage fnLanguage){
-              return fnLanguageDao.save(fnLanguage);
+       public FnLanguage save(final FnLanguage fnLanguage){
+              return fnLanguageDao.saveAndFlush(fnLanguage);
        }
 }
diff --git a/portal-BE/src/main/java/org/onap/portal/service/fn/FnMenuFunctionalRolesService.java b/portal-BE/src/main/java/org/onap/portal/service/fn/FnMenuFunctionalRolesService.java
new file mode 100644 (file)
index 0000000..c1747da
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.service.fn;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import org.onap.portal.dao.fn.FnMenuFunctionalRolesDao;
+import org.onap.portal.domain.db.fn.FnMenuFunctionalRoles;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class FnMenuFunctionalRolesService {
+  private final FnMenuFunctionalRolesDao fnMenuFunctionalRolesDao;
+
+  @Autowired
+  public FnMenuFunctionalRolesService(FnMenuFunctionalRolesDao fnMenuFunctionalRolesDao) {
+    this.fnMenuFunctionalRolesDao = fnMenuFunctionalRolesDao;
+  }
+
+  public void deleteById(final Long id){
+    fnMenuFunctionalRolesDao.deleteById(id);
+  }
+
+  public void delete(final FnMenuFunctionalRoles id){
+    fnMenuFunctionalRolesDao.delete(id);
+  }
+
+  public List<FnMenuFunctionalRoles> retrieveByroleId(final Long roleId){
+    return Optional.of(fnMenuFunctionalRolesDao.retrieveByRoleId(roleId)).orElse(new ArrayList<>());
+  }
+
+  public List<FnMenuFunctionalRoles> retrieveByMenuId(final Long menuId){
+    return Optional.of(fnMenuFunctionalRolesDao.retrieveByMenuId(menuId)).orElse(new ArrayList<>());
+  }
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/service/fn/FnMenuFunctionalService.java b/portal-BE/src/main/java/org/onap/portal/service/fn/FnMenuFunctionalService.java
new file mode 100644 (file)
index 0000000..97f3188
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.service.fn;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import org.onap.portal.dao.fn.FnMenuFunctionalDao;
+import org.onap.portal.domain.db.fn.FnMenuFunctional;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class FnMenuFunctionalService {
+
+  private final FnMenuFunctionalDao fnMenuFunctionalDao;
+
+  @Autowired
+  public FnMenuFunctionalService(FnMenuFunctionalDao fnMenuFunctionalDao) {
+    this.fnMenuFunctionalDao = fnMenuFunctionalDao;
+  }
+
+  public List<FnMenuFunctional> retrieveByMenuId(final Long menuId) {
+    return Optional.of(fnMenuFunctionalDao.retrieveByMenuId(menuId)).orElse(new ArrayList<>());
+  }
+
+}
index 45867b4..39a886c 100644 (file)
@@ -54,34 +54,99 @@ import org.springframework.transaction.annotation.Transactional;
 @Service
 @Transactional
 public class FnRoleService {
-       private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnRoleService.class);
 
+  private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnRoleService.class);
 
-       private final FnRoleDao fnRoleDao;
 
-       @Autowired
-       public FnRoleService(FnRoleDao fnRoleDao) {
-              this.fnRoleDao = fnRoleDao;
-       }
+  private final FnRoleDao fnRoleDao;
 
-       public FnRole getById(final Long id) {
-              return fnRoleDao.findById(id).orElseThrow(EntityExistsException::new);
-       }
+  @Autowired
+  public FnRoleService(FnRoleDao fnRoleDao) {
+    this.fnRoleDao = fnRoleDao;
+  }
 
-       public FnRole getRole(final Long appId, final Long appRoleId) {
+  public FnRole getById(final Long id) {
+    return fnRoleDao.findById(id).orElseThrow(EntityExistsException::new);
+  }
 
-              String sql = "SELECT * FROM fn_role where APP_ID = :appId AND APP_ROLE_ID = :appRoleId";
+  public FnRole getRole(final Long appId, final Long appRoleId) {
+    List<FnRole> roles = Optional.of(fnRoleDao.retrieveAppRoleByAppRoleIdAndByAppId(appId, appRoleId))
+        .orElse(new ArrayList<>());
+    if (!roles.isEmpty()) {
+      logger.error(EELFLoggerDelegate.errorLogger,
+          String.format(
+              "search by appId=%s, appRoleid=%s should have returned 0 or 1 results. Got %d. This is an internal server error.",
+              appId, appRoleId, roles.size()));
+      logger.error(EELFLoggerDelegate.errorLogger,
+          "Trying to recover from duplicates by returning the first search result. This issue should be treated, it is probably not critical because duplicate roles should be similar.");
+      return roles.get(0);
+    }
+    return null;
+  }
 
-              List<FnRole> roles = Optional.of(fnRoleDao.retrieveAppRoleByAppRoleIdAndByAppId(appId, appRoleId)).orElse(new ArrayList<>());
-              if (!roles.isEmpty()) {
-                     logger.error(EELFLoggerDelegate.errorLogger,
-                             String.format(
-                                     "search by appId=%s, appRoleid=%s should have returned 0 or 1 results. Got %d. This is an internal server error.",
-                                     appId, appRoleId, roles.size()));
-                     logger.error(EELFLoggerDelegate.errorLogger,
-                             "Trying to recover from duplicates by returning the first search result. This issue should be treated, it is probably not critical because duplicate roles should be similar.");
-                     return roles.get(0);
-              }
-              return null;
-       }
+  public List<FnRole> getAppRoles(Long appId) {
+    List<FnRole> applicationRoles;
+    try {
+      if (appId == 1) {
+        applicationRoles = retrieveAppRolesWhereAppIdIsNull();
+      } else {
+        applicationRoles = retrieveAppRolesByAppId(appId);
+      }
+    } catch (Exception e) {
+      logger.error(EELFLoggerDelegate.errorLogger, "getAppRoles: failed", e);
+      throw e;
+    }
+    return applicationRoles;
+  }
+
+  public List<FnRole> retrieveAppRoleByAppRoleIdAndByAppId(final Long appId, final Long appRoleId) {
+    return Optional.of(fnRoleDao.retrieveAppRoleByAppRoleIdAndByAppId(appId, appRoleId)).orElse(new ArrayList<>());
+  }
+
+  public List<FnRole> getUserRoleOnUserIdAndAppId(final Long userId, final Long appId) {
+    return Optional.of(fnRoleDao.getUserRoleOnUserIdAndAppId(userId, appId)).orElse(new ArrayList<>());
+  }
+
+  public List<FnRole> retrieveAppRoleByRoleIdWhereAppIdIsNull(final Long roleId) {
+    return Optional.of(fnRoleDao.retrieveAppRoleByRoleIdWhereAppIdIsNull(roleId)).orElse(new ArrayList<>());
+  }
+
+  public List<FnRole> retrieveAppRolesWhereAppIdIsNull() {
+    return Optional.of(fnRoleDao.retrieveAppRolesWhereAppIdIsNull()).orElse(new ArrayList<>());
+  }
+
+  public List<FnRole> retrieveAppRolesByAppId(final Long id) {
+    return Optional.of(fnRoleDao.retrieveAppRolesByAppId(id)).orElse(new ArrayList<>());
+  }
+
+  public List<FnRole> retrieveAppRolesByRoleNameAndByAppId(final String roleName, final Long appId) {
+    return Optional.of(fnRoleDao.retrieveAppRolesByRoleNameAndByAppId(roleName, appId)).orElse(new ArrayList<>());
+  }
+
+  public List<FnRole> retrieveActiveRolesOfApplication(final Long appId) {
+    return Optional.of(fnRoleDao.retrieveActiveRolesOfApplication(appId)).orElse(new ArrayList<>());
+  }
+
+  public List<FnRole> getGlobalRolesOfPortal() {
+    List<FnRole> globalRoles = new ArrayList<>();
+    try {
+      globalRoles = Optional.of(fnRoleDao.getGlobalRolesOfPortal()).orElse(new ArrayList<>());
+    } catch (Exception e) {
+      logger.error(EELFLoggerDelegate.errorLogger, "getGlobalRolesOfPortal failed", e);
+    }
+    return globalRoles;
+  }
+
+  public Long getSysAdminRoleId(){
+    FnRole role = fnRoleDao.getSysAdminRoleId();
+    return role.getId();
+  }
+
+  public void delete(FnRole role) {
+    fnRoleDao.delete(role);
+  }
+
+  public FnRole saveOne(final FnRole role){
+    return fnRoleDao.save(role);
+  }
 }
index 9f136df..fac4b14 100644 (file)
 
 package org.onap.portal.service.fn;
 
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.time.LocalDateTime;
 import java.util.ArrayList;
-import java.util.Collections;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Optional;
+import java.util.Set;
+import java.util.SortedSet;
 import java.util.stream.Collectors;
+import javax.persistence.EntityManager;
+import javax.persistence.Tuple;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.cxf.transport.http.HTTPException;
 import org.onap.portal.dao.fn.FnUserRoleDao;
+import org.onap.portal.domain.db.ep.EpUserRolesRequest;
+import org.onap.portal.domain.db.ep.EpUserRolesRequestDet;
+import org.onap.portal.domain.db.fn.FnApp;
+import org.onap.portal.domain.db.fn.FnRole;
+import org.onap.portal.domain.db.fn.FnUser;
 import org.onap.portal.domain.db.fn.FnUserRole;
+import org.onap.portal.domain.dto.ecomp.EPUserAppCatalogRoles;
+import org.onap.portal.domain.dto.ecomp.ExternalSystemAccess;
+import org.onap.portal.domain.dto.transport.AppWithRolesForUser;
+import org.onap.portal.domain.dto.transport.FieldsValidator;
+import org.onap.portal.domain.dto.transport.RemoteRole;
+import org.onap.portal.domain.dto.transport.RemoteUserWithRoles;
+import org.onap.portal.domain.dto.transport.Role;
+import org.onap.portal.domain.dto.transport.RoleInAppForUser;
+import org.onap.portal.domain.dto.transport.UserApplicationRoles;
+import org.onap.portal.service.ApplicationsRestClientService;
+import org.onap.portal.service.ep.EpAppFunctionService;
+import org.onap.portal.service.ep.EpUserRolesRequestDetService;
+import org.onap.portal.service.ep.EpUserRolesRequestService;
+import org.onap.portal.utils.EPCommonSystemProperties;
+import org.onap.portal.utils.PortalConstants;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.portalsdk.core.restful.domain.EcompRole;
+import org.onap.portalsdk.core.util.SystemProperties;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -55,28 +90,450 @@ import org.springframework.transaction.annotation.Transactional;
 @Service
 @Transactional
 public class FnUserRoleService {
-       private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnUserRoleService.class);
-       private final FnUserRoleDao fnUserRoleDao;
-
-       @Autowired
-       public FnUserRoleService(FnUserRoleDao fnUserRoleDao) {
-              this.fnUserRoleDao = fnUserRoleDao;
-       }
-
-       public List<FnUserRole> getAdminUserRoles(final Long userId, final Long roleId, final Long appId) {
-              return fnUserRoleDao.getAdminUserRoles(userId, roleId, appId).orElse(new ArrayList<>());
-       }
-
-       public boolean isSuperAdmin(final String orgUserId, final Long roleId, final Long appId){
-              List<FnUserRole> roles = getUserRolesForRoleIdAndAppId(roleId, appId).stream().filter(role -> role.getUserId().getOrgUserId().equals(orgUserId)).collect(Collectors.toList());
-              return !roles.isEmpty();
-       }
-
-       private List<FnUserRole> getUserRolesForRoleIdAndAppId(final Long roleId, final Long appId){
-              return Optional.of(fnUserRoleDao.getUserRolesForRoleIdAndAppId(roleId, appId)).orElse(new ArrayList<>());
-       }
-
-       public FnUserRole saveOne(final FnUserRole fnUserRole){
-              return fnUserRoleDao.save(fnUserRole);
-       }
+
+  private static final String GET_ROLE_FUNCTIONS_OF_USERFOR_ALLTHE_APPLICATIONS =
+      "select\n"
+          + "  distinct ep.function_cd functionCd\n"
+          + "from\n"
+          + "  fn_user_role fu,\n"
+          + "  ep_app_role_function ep,\n"
+          + "  ep_app_function ea\n"
+          + "where\n"
+          + "  fu.role_id = ep.role_id\n"
+          + "  and fu.app_id = ep.app_id\n"
+          + "  and fu.user_id = 'userId'\n"
+          + "  and ea.function_cd = ep.function_cd\n"
+          + "  and exists (\n"
+          + "    select\n"
+          + "      fa.app_id\n"
+          + "    from\n"
+          + "      fn_user fu,\n"
+          + "      fn_user_role ur,\n"
+          + "      fn_app fa\n"
+          + "    where\n"
+          + "      fu.user_id = 'userId'\n"
+          + "      and fu.user_id = ur.user_id\n"
+          + "      and ur.app_id = fa.app_id\n"
+          + "      and fa.enabled = 'Y'\n"
+          + "  )";
+
+  private static final String USER_APP_CATALOG_ROLES =
+      "select\n"
+          + "  A.reqId as reqId,\n"
+          + "  B.requestedRoleId.id as requestedRoleId,\n"
+          + "  A.requestStatus as requestStatus,\n"
+          + "  A.appId.id as appId,\n"
+          + "  (\n"
+          + "    select\n"
+          + "      roleName\n"
+          + "    from\n"
+          + "      FnRole\n"
+          + "    where\n"
+          + "      id = B.requestedRoleId.id\n"
+          + "  ) as roleName\n"
+          + "from\n"
+          + "  EpUserRolesRequest A\n"
+          + "  left join EpUserRolesRequestDet B on A.reqId = B.reqId.reqId\n"
+          + "where\n"
+          + "  A.userId.id = :userid\n"
+          + "  and A.appId IN (\n"
+          + "    select\n"
+          + "      id\n"
+          + "    from\n"
+          + "      FnApp\n"
+          + "    where\n"
+          + "      appName = :appName\n"
+          + "  )\n"
+          + "  and A.requestStatus = 'P'\n";
+
+  private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnUserRoleService.class);
+
+  private final FnUserRoleDao fnUserRoleDao;
+  private final FnAppService fnAppService;
+  private final FnRoleService fnRoleService;
+  private final FnUserService fnUserService;
+  private final EpUserRolesRequestService epUserRolesRequestService;
+  private final EpUserRolesRequestDetService epUserRolesRequestDetService;
+  private final EntityManager entityManager;
+  private final ApplicationsRestClientService applicationsRestClientService;
+
+  @Autowired
+  public FnUserRoleService(FnUserRoleDao
+      fnUserRoleDao,
+      FnAppService fnAppService,
+      FnRoleService fnRoleService,
+      FnUserService fnUserService,
+      EpUserRolesRequestService epUserRolesRequestService,
+      EpUserRolesRequestDetService epUserRolesRequestDetService,
+      EntityManager entityManager,
+      ApplicationsRestClientService applicationsRestClientService) {
+    this.fnUserRoleDao = fnUserRoleDao;
+    this.fnAppService = fnAppService;
+    this.fnRoleService = fnRoleService;
+    this.fnUserService = fnUserService;
+    this.epUserRolesRequestService = epUserRolesRequestService;
+    this.epUserRolesRequestDetService = epUserRolesRequestDetService;
+    this.entityManager = entityManager;
+    this.applicationsRestClientService = applicationsRestClientService;
+  }
+
+  public List<FnUserRole> getAdminUserRoles(final Long userId, final Long roleId, final Long appId) {
+    return fnUserRoleDao.getAdminUserRoles(userId, roleId, appId).orElse(new ArrayList<>());
+  }
+
+  public boolean isSuperAdmin(final String loginId, final Long roleId, final Long appId) {
+    List<FnUserRole> roles = getUserRolesForRoleIdAndAppId(roleId, appId).stream()
+        .filter(role -> role.getUserId().getOrgUserId().equals(loginId)).collect(Collectors.toList());
+    return !roles.isEmpty();
+  }
+
+  public List<FnUserRole> getUserRolesForRoleIdAndAppId(final Long roleId, final Long appId) {
+    return Optional.of(fnUserRoleDao.retrieveByAppIdAndRoleId(appId, roleId)).orElse(new ArrayList<>());
+  }
+
+  public List<FnUserRole> retrieveByUserIdAndRoleId(final Long userId, final Long roleId){
+    return Optional.of(fnUserRoleDao.retrieveByUserIdAndRoleId(userId, roleId)).orElse(new ArrayList<>());
+  }
+
+  public FnUserRole saveOne(final FnUserRole fnUserRole) {
+    return fnUserRoleDao.save(fnUserRole);
+  }
+
+  public ExternalSystemAccess getExternalRequestAccess() {
+    ExternalSystemAccess res = null;
+    try {
+      res = new ExternalSystemAccess(EPCommonSystemProperties.EXTERNAL_ACCESS_ENABLE,
+          Boolean.parseBoolean(
+              SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_ACCESS_ENABLE)));
+    } catch (Exception e) {
+      logger.error(EELFLoggerDelegate.errorLogger, "getExternalRequestAccess failed" + e.getMessage());
+    }
+    return res;
+  }
+
+  public List<EPUserAppCatalogRoles> getUserAppCatalogRoles(FnUser userid, String appName) {
+    List<Tuple> tuples = entityManager.createQuery(USER_APP_CATALOG_ROLES, Tuple.class)
+        .setParameter("userid", userid.getId())
+        .setParameter("appName", appName)
+        .getResultList();
+    return Optional.of(tuples.stream().map(this::tupleToEPUserAppCatalogRoles).collect(Collectors.toList()))
+        .orElse(new ArrayList<>());
+  }
+
+  private EPUserAppCatalogRoles tupleToEPUserAppCatalogRoles(Tuple tuple) {
+    return new EPUserAppCatalogRoles((Long) tuple.get("reqId"), (Long) tuple.get("requestedRoleId"),
+        (String) tuple.get("roleName"), (String) tuple.get("requestStatus"), (Long) tuple.get("appId"));
+  }
+
+  private boolean postUserRolesToMylogins(AppWithRolesForUser userAppRolesData,
+      ApplicationsRestClientService applicationsRestClientService, Long appId, Long userId)
+      throws JsonProcessingException, HTTPException {
+    boolean result = false;
+    ObjectMapper mapper = new ObjectMapper();
+    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+    String userRolesAsString = mapper.writeValueAsString(userAppRolesData);
+    logger.error(EELFLoggerDelegate.errorLogger,
+        "Should not be reached here, as the endpoint is not defined yet from the Mylogins");
+    applicationsRestClientService.post(AppWithRolesForUser.class, appId, userRolesAsString,
+        String.format("/user/%s/myLoginroles", userId));
+    return result;
+  }
+
+  public FieldsValidator putUserAppRolesRequest(AppWithRolesForUser newAppRolesForUser, FnUser user) {
+    FieldsValidator fieldsValidator = new FieldsValidator();
+    List<FnRole> appRole;
+    try {
+      logger.error(EELFLoggerDelegate.errorLogger,
+          "Should not be reached here, still the endpoint is yet to be defined");
+      boolean result = postUserRolesToMylogins(newAppRolesForUser, applicationsRestClientService,
+          newAppRolesForUser.getAppId(), user.getId());
+      logger.debug(EELFLoggerDelegate.debugLogger, "putUserAppRolesRequest: result {}", result);
+      FnApp app = fnAppService.getById(newAppRolesForUser.getAppId());
+      EpUserRolesRequest epUserRolesRequest = new EpUserRolesRequest();
+      epUserRolesRequest.setCreatedDate(LocalDateTime.now());
+      epUserRolesRequest.setUpdatedDate(LocalDateTime.now());
+      epUserRolesRequest.setUserId(user);
+      epUserRolesRequest.setAppId(app);
+      epUserRolesRequest.setRequestStatus("P");
+      List<RoleInAppForUser> appRoleIdList = newAppRolesForUser.getAppRoles();
+      Set<EpUserRolesRequestDet> appRoleDetails = new LinkedHashSet<>();
+      epUserRolesRequestService.saveOne(epUserRolesRequest);
+      for (RoleInAppForUser userAppRoles : appRoleIdList) {
+        Boolean isAppliedVal = userAppRoles.getIsApplied();
+        if (isAppliedVal) {
+          appRole = fnRoleService
+              .retrieveAppRoleByAppRoleIdAndByAppId(newAppRolesForUser.getAppId(),
+                  userAppRoles.getRoleId());
+          if (!appRole.isEmpty()) {
+            EpUserRolesRequestDet epAppRoleDetail = new EpUserRolesRequestDet();
+            epAppRoleDetail.setRequestedRoleId(appRole.get(0));
+            epAppRoleDetail.setRequestType("P");
+            epAppRoleDetail.setReqId(epUserRolesRequest);
+            epUserRolesRequestDetService.saveOne(epAppRoleDetail);
+          }
+        }
+      }
+      epUserRolesRequest.setEpRequestIdDetail(appRoleDetails);
+      fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_OK);
+
+    } catch (Exception e) {
+      logger.error(EELFLoggerDelegate.errorLogger, "putUserAppRolesRequest failed", e);
+      fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+    }
+    return fieldsValidator;
+  }
+
+  public List<FnRole> importRolesFromRemoteApplication(Long appId) throws HTTPException {
+    FnRole[] appRolesFull = applicationsRestClientService.get(FnRole[].class, appId, "/rolesFull");
+    List<FnRole> rolesList = Arrays.asList(appRolesFull);
+    for (FnRole externalAppRole : rolesList) {
+
+      // Try to find an existing extern role for the app in the local
+      // onap DB. If so, then use its id to update the existing external
+      // application role record.
+      Long externAppId = externalAppRole.getId();
+      FnRole existingAppRole = fnRoleService.getRole(appId, externAppId);
+      if (existingAppRole != null) {
+        logger.debug(EELFLoggerDelegate.debugLogger,
+            String.format(
+                "ecomp role already exists for app=%s; appRoleId=%s. No need to import this one.",
+                appId, externAppId));
+      }
+    }
+
+    return rolesList;
+  }
+
+  public List<UserApplicationRoles> getUsersFromAppEndpoint(Long appId) throws HTTPException {
+    ArrayList<UserApplicationRoles> userApplicationRoles = new ArrayList<>();
+
+    FnApp app = fnAppService.getById(appId);
+    //If local or centralized application
+    if (PortalConstants.PORTAL_APP_ID.equals(appId) || app.getAuthCentral()) {
+      List<FnUser> userList = fnUserService.getActiveUsers();
+      for (FnUser user : userList) {
+        UserApplicationRoles userWithAppRoles = convertToUserApplicationRoles(appId, user, app);
+        if (userWithAppRoles.getRoles() != null && userWithAppRoles.getRoles().size() > 0) {
+          userApplicationRoles.add(userWithAppRoles);
+        }
+      }
+
+    }
+    // remote app
+    else {
+      RemoteUserWithRoles[] remoteUsers;
+      String remoteUsersString = applicationsRestClientService.getIncomingJsonString(appId, "/users");
+
+      remoteUsers = doGetUsers(remoteUsersString);
+
+      userApplicationRoles = new ArrayList<>();
+      for (RemoteUserWithRoles remoteUser : remoteUsers) {
+        UserApplicationRoles userWithRemoteAppRoles = convertToUserApplicationRoles(appId,
+            remoteUser);
+        if (userWithRemoteAppRoles.getRoles() != null
+            && userWithRemoteAppRoles.getRoles().size() > 0) {
+          userApplicationRoles.add(userWithRemoteAppRoles);
+        } else {
+          logger.debug(EELFLoggerDelegate.debugLogger,
+              "User " + userWithRemoteAppRoles.getOrgUserId()
+                  + " doesn't have any roles assigned to any app.");
+        }
+      }
+    }
+
+    return userApplicationRoles;
+  }
+
+  private UserApplicationRoles convertToUserApplicationRoles(Long appId, RemoteUserWithRoles remoteUser) {
+    UserApplicationRoles userWithRemoteAppRoles = new UserApplicationRoles();
+    userWithRemoteAppRoles.setAppId(appId);
+    userWithRemoteAppRoles.setOrgUserId(remoteUser.getOrgUserId());
+    userWithRemoteAppRoles.setFirstName(remoteUser.getFirstName());
+    userWithRemoteAppRoles.setLastName(remoteUser.getLastName());
+    userWithRemoteAppRoles.setRoles(remoteUser.getRoles());
+    return userWithRemoteAppRoles;
+  }
+
+  private RemoteUserWithRoles[] doGetUsers(String remoteUsersString) {
+
+    ObjectMapper mapper = new ObjectMapper();
+    try {
+      return mapper.readValue(remoteUsersString, RemoteUserWithRoles[].class);
+    } catch (IOException e) {
+      logger.error(EELFLoggerDelegate.errorLogger,
+          "doGetUsers : Failed : Unexpected property in incoming JSON",
+          e);
+      logger.error(EELFLoggerDelegate.errorLogger,
+          "doGetUsers : Incoming JSON that caused it --> " + remoteUsersString);
+    }
+
+    return new RemoteUserWithRoles[0];
+  }
+
+  private UserApplicationRoles convertToUserApplicationRoles(Long appId, FnUser user, FnApp app) {
+    UserApplicationRoles userWithRemoteAppRoles = new UserApplicationRoles();
+    userWithRemoteAppRoles.setAppId(appId);
+    userWithRemoteAppRoles.setOrgUserId(user.getOrgUserId());
+    userWithRemoteAppRoles.setFirstName(user.getFirstName());
+    userWithRemoteAppRoles.setLastName(user.getLastName());
+    userWithRemoteAppRoles.setRoles(convertToRemoteRoleList(user, app));
+    return userWithRemoteAppRoles;
+  }
+
+  private List<RemoteRole> convertToRemoteRoleList(FnUser user, FnApp app) {
+    List<RemoteRole> roleList = new ArrayList<>();
+    SortedSet<FnRole> roleSet = user.getAppEPRoles(app);
+    for (FnRole role : roleSet) {
+      logger.debug(EELFLoggerDelegate.debugLogger,
+          "In convertToRemoteRoleList() - for user {}, found Name {}", user.getOrgUserId(),
+          role.getRoleName());
+      RemoteRole rRole = new RemoteRole();
+      rRole.setId(role.getId());
+      rRole.setName(role.getRoleName());
+      roleList.add(rRole);
+    }
+
+    //Get the active roles of user for that application using query
+    List<FnRole> userEpRoleList = fnRoleService.getUserRoleOnUserIdAndAppId(user.getId(), app.getId());
+
+    for (FnRole remoteUserRoleList : userEpRoleList) {
+
+      RemoteRole remoteRoleListId = roleList.stream()
+          .filter(x -> remoteUserRoleList.getId().equals(x.getId()))
+          .findAny().orElse(null);
+      if (remoteRoleListId == null) {
+        logger.debug(EELFLoggerDelegate.debugLogger,
+            "Adding the role to the rolelist () - for user {}, found Name {}",
+            user.getOrgUserId(),
+
+            remoteUserRoleList.getRoleName());
+        RemoteRole role = new RemoteRole();
+        role.setId(remoteUserRoleList.getId());
+        role.setName(remoteUserRoleList.getRoleName());
+
+        roleList.add(role);
+      }
+
+    }
+
+    logger.debug(EELFLoggerDelegate.debugLogger,
+        "rolelist size of the USER() - for user {}, found RoleListSize {}", user.getOrgUserId(),
+        roleList.size());
+    return roleList;
+  }
+
+  public List getRoleFunctionsOfUserforAlltheApplications(Long userId) {
+    List<Tuple> tuples = entityManager
+        .createQuery(GET_ROLE_FUNCTIONS_OF_USERFOR_ALLTHE_APPLICATIONS, Tuple.class)
+        .setParameter("userid", userId)
+        .getResultList();
+    return Optional.of(tuples.stream().map(tuple -> tuple.get("functionCd")).collect(Collectors.toList()))
+        .orElse(new ArrayList<>());
+  }
+
+  public List<FnUserRole> retrieveByAppIdAndUserId(final Long appId, final String userId) {
+    return Optional.of(fnUserRoleDao.retrieveByAppIdAndUserId(appId, userId)).orElse(new ArrayList<>());
+  }
+
+  public String updateRemoteUserProfile(String orgUserId, long appId) {
+    ObjectMapper mapper = new ObjectMapper();
+    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+    FnUser client = fnUserService.loadUserByUsername(orgUserId);
+    FnUser newUser = new FnUser();
+    newUser.setActiveYn(client.getActiveYn());
+    newUser.setFirstName(client.getFirstName());
+    newUser.setLastName(client.getLastName());
+    newUser.setLoginId(client.getLoginId());
+    newUser.setLoginPwd(client.getLoginPwd());
+    newUser.setMiddleName(client.getMiddleName());
+    newUser.setEmail(client.getEmail());
+    newUser.setOrgUserId(client.getLoginId());
+    try {
+      String userAsString = mapper.writeValueAsString(newUser);
+      List<FnApp> appList = fnAppService.getUserRemoteApps(client.getId().toString());
+      // applicationsRestClientService.post(EPUser.class, appId,
+      // userAsString, String.format("/user", orgUserId));
+      for (FnApp eachApp : appList) {
+        try {
+          applicationsRestClientService.post(FnUser.class, eachApp.getId(), userAsString,
+              String.format("/user/%s", orgUserId));
+        } catch (Exception e) {
+          logger.error(EELFLoggerDelegate.errorLogger, "Failed to update user: " + client.getOrgUserId()
+              + " in remote app. appId = " + eachApp.getId());
+        }
+      }
+    } catch (Exception e) {
+      logger.error(EELFLoggerDelegate.errorLogger, "updateRemoteUserProfile failed", e);
+      return "failure";
+    }
+    return "success";
+  }
+
+  public void deleteById(final Long id) {
+    fnUserRoleDao.deleteById(id);
+  }
+
+  public List<RoleInAppForUser> constructRolesInAppForUserGet(List<Role> appRoles, FnRole[] userAppRoles,
+      Boolean extRequestValue) {
+    List<RoleInAppForUser> rolesInAppForUser = new ArrayList<>();
+
+    Set<Long> userAppRolesMap = new HashSet<>();
+    if (userAppRoles != null) {
+      for (FnRole ecompRole : userAppRoles) {
+        userAppRolesMap.add(ecompRole.getAppId());
+      }
+      logger.debug(EELFLoggerDelegate.debugLogger, "In constructRolesInAppForUserGet() - userAppRolesMap = {}",
+          userAppRolesMap);
+
+    } else {
+      logger.error(EELFLoggerDelegate.errorLogger,
+          "constructRolesInAppForUserGet has received userAppRoles list empty.");
+    }
+
+    if (appRoles != null) {
+      for (Role ecompRole : appRoles) {
+        logger.debug(EELFLoggerDelegate.debugLogger, "In constructRolesInAppForUserGet() - appRoles not null = {}",
+            ecompRole);
+
+        if (ecompRole.getId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID) && !extRequestValue) {
+          continue;
+        }
+        RoleInAppForUser roleForUser = new RoleInAppForUser(ecompRole.getId(), ecompRole.getRoleName());
+        roleForUser.setIsApplied(userAppRolesMap.contains(ecompRole.getId()));
+        rolesInAppForUser.add(roleForUser);
+        logger.debug(EELFLoggerDelegate.debugLogger, "In constructRolesInAppForUserGet() - rolesInAppForUser = {}",
+            rolesInAppForUser);
+
+      }
+    } else {
+      logger.error(EELFLoggerDelegate.errorLogger,
+          "constructRolesInAppForUser has received appRoles list empty.");
+    }
+    return rolesInAppForUser;
+  }
+
+  public List<RoleInAppForUser> constructRolesInAppForUserGet(EcompRole[] appRoles, EcompRole[] userAppRoles) {
+    List<RoleInAppForUser> rolesInAppForUser = new ArrayList<>();
+
+    Set<Long> userAppRolesMap = new HashSet<>();
+    if (userAppRoles != null) {
+      for (EcompRole ecompRole : userAppRoles) {
+        userAppRolesMap.add(ecompRole.getId());
+      }
+    } else {
+      logger.error(EELFLoggerDelegate.errorLogger,
+          "constructRolesInAppForUserGet has received userAppRoles list empty");
+    }
+
+    if (appRoles != null) {
+      for (EcompRole ecompRole : appRoles) {
+        RoleInAppForUser roleForUser = new RoleInAppForUser(ecompRole.getId(), ecompRole.getName());
+        roleForUser.setIsApplied(userAppRolesMap.contains(ecompRole.getId()));
+        rolesInAppForUser.add(roleForUser);
+      }
+    } else {
+      logger.error(EELFLoggerDelegate.errorLogger, "constructRolesInAppForUser has received appRoles list empty");
+    }
+    return rolesInAppForUser;
+  }
 }
index 5c1c84b..16d32a6 100644 (file)
 
 package org.onap.portal.service.fn;
 
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import java.security.Principal;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
-import org.onap.portal.controller.UserRolesController;
 import org.onap.portal.dao.fn.FnUserDao;
 import org.onap.portal.domain.db.fn.FnUser;
-import org.onap.portal.domain.dto.transport.UserWithNameSurnameTitle;
-import org.onap.portal.utils.EcompPortalUtils;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.EnableAspectJAutoProxy;
@@ -66,14 +60,14 @@ public class FnUserService implements UserDetailsService {
 
        private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnUserService.class);
 
-       private FnUserDao fnUserDao;
+       private final FnUserDao fnUserDao;
 
        @Autowired
        public FnUserService(FnUserDao fnUserDao) {
               this.fnUserDao = fnUserDao;
        }
 
-       public FnUser saveFnUser(final Principal principal, final FnUser fnUser) {
+       public FnUser saveFnUser(final FnUser fnUser) {
               return fnUserDao.save(fnUser);
        }
 
@@ -91,7 +85,7 @@ public class FnUserService implements UserDetailsService {
               return Optional.of(fnUserDao.getOne(id));
        }
 
-       List<FnUser> getUserWithOrgUserId(final String orgUserIdValue) {
+       public List<FnUser> getUserWithOrgUserId(final String orgUserIdValue) {
               return fnUserDao.getUserWithOrgUserId(orgUserIdValue).orElse(new ArrayList<>());
        }
 
diff --git a/portal-BE/src/main/java/org/onap/portal/service/fn/old/AppsCacheService.java b/portal-BE/src/main/java/org/onap/portal/service/fn/old/AppsCacheService.java
deleted file mode 100644 (file)
index 7703420..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * ============LICENSE_START==========================================
- * ONAP Portal
- * ===================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ===================================================================
- *
- * 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.portal.service.fn.old;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-import javax.annotation.PostConstruct;
-import org.onap.portal.domain.db.fn.FnApp;
-import org.onap.portal.domain.dto.transport.OnboardingApp;
-import org.onap.portal.service.fn.FnAppService;
-import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.EnableAspectJAutoProxy;
-import org.springframework.stereotype.Service;
-
-@Service("appsCacheService")
-@Configuration
-@EnableAspectJAutoProxy
-public class AppsCacheService {
-       @Autowired
-       private
-       FnAppService appsService;
-       
-       private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AppsCacheService.class);
-       
-       final class CacheConfiguration {
-               
-               private long updateTime = 0;
-               private int updateInterval = 10;
-               
-               public CacheConfiguration (long _updateTime, int _updateInterval) {
-                       updateTime = _updateTime;
-                       updateInterval = _updateInterval;
-               }
-       }
-       
-       private CacheConfiguration quickRefreshCacheConf = null;
-       private CacheConfiguration slowRefreshCacheConf = null;
-       
-       
-       private static volatile Map<Long, FnApp> appsMap;
-       private static volatile Map<String, FnApp> uebAppsMap;
-       
-       @PostConstruct
-       public void init() {
-               quickRefreshCacheConf = new CacheConfiguration(0, 120);
-               slowRefreshCacheConf = new CacheConfiguration(0, 3600);
-               
-               this.refreshAppsMap(quickRefreshCacheConf);
-       }
-
-       private void refreshAppsMap(CacheConfiguration conf) {
-               long now = System.currentTimeMillis();
-               
-               if(noNeedToUpdate(now, conf))
-                       return;
-               
-               synchronized (this) {
-                       if(noNeedToUpdate(now, conf))
-                               return;
-                       List<FnApp> allApps = appsService.getAppsFullList();
-                       Map<Long, FnApp> newAppsMap = new HashMap<>();
-                       for (FnApp app : allApps) {
-                               newAppsMap.put(app.getId(), app);
-                       }
-                       
-                       Map<String, FnApp> newUebAppsMap = new HashMap<>();
-                       for (FnApp app : allApps) {
-                               newUebAppsMap.put(app.getUebKey(), app);
-                       }
-                       // Switch cache with the new one.
-                       appsMap = newAppsMap;
-                       uebAppsMap = newUebAppsMap;
-                       conf.updateTime = now;
-               }
-               
-       }
-
-       private boolean noNeedToUpdate(long now, CacheConfiguration conf) {
-               long secondsPassed = (now - conf.updateTime)/1000;
-               if(secondsPassed < conf.updateInterval){
-                       logger.debug(EELFLoggerDelegate.debugLogger, "no need to refresh yet, seconds since last refresh: " + secondsPassed + ", refresh interval (sec) = " + conf.updateInterval);
-                       return true; // no need to update cache
-               }
-               return false; // its time to update
-       }
-
-       public String getAppEndpoint(Long appId) {
-               refreshAppsMap(quickRefreshCacheConf);
-               FnApp app = appsMap.get(appId);
-               if(app != null)
-                       return app.getAppRestEndpoint();
-               return null;
-       }
-
-       public List<OnboardingApp> getAppsFullList() {
-               refreshAppsMap(quickRefreshCacheConf);
-               List<FnApp> appList = new ArrayList<>(appsMap.values());
-               appList.removeIf(app -> app.getId() == 1);
-               List<FnApp> appsFinalList = appList.stream()
-               .filter(app -> app.getEnabled() && !app.getOpen()).collect(Collectors.toList());
-               
-               List<OnboardingApp> onboardingAppsList = new ArrayList<>();
-               for (FnApp app : appsFinalList) {
-                       OnboardingApp onboardingApp = new OnboardingApp();
-                       appsService.createOnboardingFromApp(app, onboardingApp);
-                       onboardingAppsList.add(onboardingApp);
-               }
-               return onboardingAppsList;      
-       }
-
-       public FnApp getApp(Long appId) {
-               refreshAppsMap(quickRefreshCacheConf);
-               FnApp app = appsMap.get(appId);
-               return app;
-       }
-
-       public FnApp getAppFromUeb(String appKey) {
-               return  getAppFromUeb(appKey,0);        
-       }
-
-       public FnApp getAppFromUeb(String appKey, Integer quickCacheRefresh) {
-               refreshAppsMap(quickCacheRefresh == 1 ? quickRefreshCacheConf:slowRefreshCacheConf);
-               FnApp app = uebAppsMap.get(appKey);
-               return app;
-       }
-
-}
index b72a829..fea7133 100644 (file)
@@ -58,8 +58,10 @@ import lombok.NoArgsConstructor;
 import org.apache.commons.codec.DecoderException;
 import org.apache.commons.codec.binary.Hex;
 import org.onap.portal.domain.db.fn.FnRole;
+import org.onap.portal.domain.db.fn.FnRoleComposite;
 import org.onap.portal.domain.db.fn.FnUser;
 import org.onap.portal.domain.db.fn.FnUserRole;
+import org.onap.portal.domain.dto.transport.Role;
 import org.onap.portal.exception.RoleFunctionException;
 import org.onap.portal.service.fn.old.EPRoleFunctionService;
 import org.onap.portalsdk.core.domain.RoleFunction;
@@ -249,10 +251,10 @@ public class EPUserUtils {
 
               // Additionally; the account admin role is overloaded between onap
               // portal and partners; lets also include that
-              for (FnUserRole epUserApp : user.getFnUserRoles()) {
+              for (FnUserRole epUserApp : user.getUserApps()) {
                      FnRole role = epUserApp.getRoleId();
 
-                     if (role.getActiveYn() && role.getRoleId().equals(ACCOUNT_ADMIN_ROLE_ID)) {
+                     if (role.getActiveYn() && role.getId().equals(ACCOUNT_ADMIN_ROLE_ID)) {
                             roles.put(role.getId(), role);
 
                             // let's take a recursive trip down the tree to add all child
@@ -272,8 +274,11 @@ public class EPUserUtils {
         */
        @SuppressWarnings({"rawtypes", "unchecked"})
        private static void addChildRoles(FnRole role, HashMap roles) {
-              Set<FnRole> childRoles = role.getFnRoles();
-              if (childRoles != null && !childRoles.isEmpty()) {
+              List<Role> childRoles = role.getChildRoles()
+                  .stream()
+                  .map(FnRoleComposite::getChildRoles)
+                  .collect(Collectors.toList());
+              if (!childRoles.isEmpty()) {
                      for (Object o : childRoles) {
                             FnRole childRole = (FnRole) o;
                             if (childRole.getActiveYn()) {
index ed03f4a..caff67e 100644 (file)
@@ -71,7 +71,7 @@ import org.springframework.http.MediaType;
 
 public class EcompPortalUtils {
 
-       private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EcompPortalUtils.class);
+       private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EcompPortalUtils.class);
 
        private static final String FUNCTION_PIPE = "|";
 
index 4d184ce..c4e5875 100644 (file)
@@ -45,7 +45,7 @@ import org.hibernate.validator.constraints.SafeHtml;
 public class SecureString {
 
        @SafeHtml
-       private String data;
+       private final String data;
 
        public SecureString(String string) {
               this.data = string;
index 56e0f04..eff7141 100644 (file)
@@ -29,4 +29,7 @@ log4j.logger.org.hibernate=info
 
 # SQL statements and parameters
 log4j.logger.org.hibernate.SQL=debug
-log4j.logger.org.hibernate.type.descriptor.sql=trace
\ No newline at end of file
+log4j.logger.org.hibernate.type.descriptor.sql=trace
+
+#PROPERTIES
+external_access_enable = false
\ No newline at end of file
diff --git a/portal-BE/src/main/resources/data.sql b/portal-BE/src/main/resources/data.sql
deleted file mode 100644 (file)
index d883177..0000000
+++ /dev/null
@@ -1,1363 +0,0 @@
---
--- ============LICENSE_START==========================================
--- ONAP Portal
--- ===================================================================
--- Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
--- ===================================================================
--- Modifications Copyright (c) 2019 Samsung
--- ===================================================================
---
--- 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============================================
---
---
-
-
--- MySQL dump 10.17  Distrib 10.3.14-MariaDB, for debian-linux-gnu (x86_64)
---
--- Host: localhost    Database: portal
--- ------------------------------------------------------
--- Server version      10.3.14-MariaDB-1:10.3.14+maria~bionic
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8mb4 */;
-/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
-/*!40103 SET TIME_ZONE='+00:00' */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-
-INSERT INTO `cr_report` (`rep_id`, `title`, `descr`, `public_yn`, `report_xml`, `create_id`, `create_date`, `maint_id`, `maint_date`, `menu_id`, `menu_approved_yn`, `owner_id`, `folder_id`, `dashboard_type_yn`, `dashboard_yn`) VALUES (15,'Application Usage Report Wid','',1,'<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<customReport pageSize=\"200\" reportType=\"Linear\">\n    <reportName>Application Usage Report Wid</reportName>\n    <reportDescr></reportDescr>\n    <dbInfo>local</dbInfo>\n    <dbType>mysql</dbType>\n    <chartType>BarChart3D</chartType>\n    <chartWidth>700</chartWidth>\n    <chartHeight>500</chartHeight>\n    <showChartTitle>false</showChartTitle>\n    <public>false</public>\n    <hideFormFieldAfterRun>false</hideFormFieldAfterRun>\n    <createId>27</createId>\n    <createDate>2017-01-28-05:00</createDate>\n    <reportSQL>SELECT \n       l.date audit_date, \n   app_id app_id, \n       IF(CHAR_LENGTH(l.app_name) &gt;14, CONCAT(CONCAT(SUBSTR(l.app_name,1,7),\'...\'), SUBSTR(l.app_name, CHAR_LENGTH(l.app_name)-3,CHAR_LENGTH(l.app_name))) , l.app_name) app_name, \n     IFNULL(r.ct,0) ct \nfrom\n(\n   select a.Date, app_id, app_name\n       from (\n            select curdate() - INTERVAL (a.a + (10 * b.a) + (100 * c.a)) DAY as Date\n      from (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as a\n          cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as b\n            cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as c\n        ) a, \n (\n             SELECT  \n                      app_id, app_name\n              from\n          (\n                     select @rn := @rn+1 AS rowId, app_id, app_name from \n                          (\n                                     select app_id, app_name, ct from \n                                     (\n                                             select affected_record_id, count(*) ct\n                                                from fn_audit_log l\n                                           where audit_date &gt; date_add( curdate(), interval -6 day)\n                                           and affected_record_id not in ( 1, -1)\n                                                and activity_cd in (\'tab_access\', \'app_access\')\n                                           and user_id = [USER_ID]\n                                               group by affected_record_id\n                                   ) a, fn_app f\n                                 where a.affected_record_id = f.app_id\n                                 order by ct desc \n                             ) b,\n                          (SELECT @rn := 0) t2\n          ) mm where rowId &lt;= 4\n      )b\n    where a.Date between date_add( curdate(), interval -6 day) and  curdate()\n) l left outer join\n(\n     select app_name,  DATE(audit_date) audit_date_1 ,count(*) ct from fn_audit_log a, fn_app b\n    where user_id = [USER_ID]\n     and audit_date &gt; date_add( curdate(), interval -6 day)\n     and activity_cd in (\'tab_access\', \'app_access\')\n   and a.affected_record_id = b.app_id\n   and b.app_id &lt;&gt; 1\n       and b.app_id in \n      (\n             SELECT  \n                      app_id\n                from\n          (\n                     select @rn := @rn+1 AS rowId, app_id from \n                            (\n                                     select app_id, ct from \n                                       (\n                                             select affected_record_id app_id, count(*) ct\n                                         from fn_audit_log \n                                            where audit_date &gt; date_add( curdate(), interval -6 day)\n                                           and affected_record_id not in ( 1, -1)\n                                                and activity_cd in (\'tab_access\', \'app_access\')\n                                           and user_id = [USER_ID]\n                                               group by affected_record_id\n                                   ) a\n                                   order by ct desc \n                             ) b,\n                          (SELECT @rn := 0) t2\n          ) mm \n )\n     group by app_name,  DATE(audit_date)\n) r\non l.Date = r.audit_date_1\nand l.app_name = r.app_name</reportSQL>\n    <reportTitle></reportTitle>\n    <reportSubTitle></reportSubTitle>\n    <reportHeader></reportHeader>\n    <frozenColumns>0</frozenColumns>\n    <emptyMessage>Your Search didn\'t yield any results.</emptyMessage>\n    <dataGridAlign>left</dataGridAlign>\n    <reportFooter></reportFooter>\n    <numFormCols>1</numFormCols>\n    <displayOptions>NNNNNNN</displayOptions>\n    <dataContainerHeight>100</dataContainerHeight>\n    <dataContainerWidth>100</dataContainerWidth>\n    <allowSchedule>N</allowSchedule>\n    <multiGroupColumn>N</multiGroupColumn>\n    <topDown>N</topDown>\n    <sizedByContent>N</sizedByContent>\n    <comment>N|</comment>\n    <dataSourceList>\n        <dataSource tableId=\"du0\">\n            <tableName>DUAL</tableName>\n            <tablePK></tablePK>\n            <displayName>DUAL</displayName>\n            <dataColumnList>\n                <dataColumn colId=\"audit_date\">\n                    <tableId>du0</tableId>\n                    <dbColName>l.date</dbColName>\n                    <colName>l.date</colName>\n                    <displayName>audit_date_1</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayWidthInPxls>nullpxpx</displayWidthInPxls>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>1</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <colOnChart>LEGEND</colOnChart>\n                    <chartSeq>1</chartSeq>\n                    <chartColor></chartColor>\n                    <chartLineType></chartLineType>\n                    <chartSeries>false</chartSeries>\n                    <dbColType>VARCHAR2</dbColType>\n                    <chartGroup></chartGroup>\n                    <yAxis></yAxis>\n                </dataColumn>\n                <dataColumn colId=\"app_id\">\n                    <tableId>du0</tableId>\n                    <dbColName>app_id</dbColName>\n                    <colName>app_id</colName>\n                    <displayName>app_id</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>2</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <dbColType>VARCHAR2</dbColType>\n                </dataColumn>\n                <dataColumn colId=\"app_name\">\n                    <tableId>du0</tableId>\n                    <dbColName>IF(CHAR_LENGTH(l.app_name) &gt;14, CONCAT(CONCAT(SUBSTR(l.app_name,1,7),\'...\'), SUBSTR(l.app_name, CHAR_LENGTH(l.app_name)-3,CHAR_LENGTH(l.app_name))) , l.app_name)</dbColName>\n                    <colName>IF(CHAR_LENGTH(l.app_name) &gt;14, CONCAT(CONCAT(SUBSTR(l.app_name,1,7),\'...\'), SUBSTR(l.app_name, CHAR_LENGTH(l.app_name)-3,CHAR_LENGTH(l.app_name))) , l.app_name)</colName>\n                    <displayName>app_name</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayWidthInPxls>nullpxpx</displayWidthInPxls>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>3</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <chartSeq>2</chartSeq>\n                    <chartColor></chartColor>\n                    <chartLineType></chartLineType>\n                    <chartSeries>true</chartSeries>\n                    <dbColType>VARCHAR2</dbColType>\n                    <chartGroup></chartGroup>\n                    <yAxis></yAxis>\n                </dataColumn>\n                <dataColumn colId=\"ct\">\n                    <tableId>du0</tableId>\n                    <dbColName>IFNULL(r.ct,0)</dbColName>\n                    <colName>IFNULL(r.ct,0)</colName>\n                    <displayName>ct</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayWidthInPxls>nullpxpx</displayWidthInPxls>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>4</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <colOnChart>0</colOnChart>\n                    <chartSeq>1</chartSeq>\n                    <chartColor></chartColor>\n                    <chartLineType></chartLineType>\n                    <chartSeries>false</chartSeries>\n                    <dbColType>VARCHAR2</dbColType>\n                    <chartGroup></chartGroup>\n                    <yAxis></yAxis>\n                </dataColumn>\n            </dataColumnList>\n        </dataSource>\n    </dataSourceList>\n    <reportInNewWindow>false</reportInNewWindow>\n    <displayFolderTree>false</displayFolderTree>\n    <maxRowsInExcelDownload>500</maxRowsInExcelDownload>\n    <chartAdditionalOptions>\n        <chartOrientation>vertical</chartOrientation>\n        <hidechartLegend>N</hidechartLegend>\n        <legendPosition>bottom</legendPosition>\n        <labelAngle>up90</labelAngle>\n        <rangeAxisUpperLimit></rangeAxisUpperLimit>\n        <rangeAxisLowerLimit></rangeAxisLowerLimit>\n        <animate>true</animate>\n        <animateAnimatedChart>true</animateAnimatedChart>\n        <stacked>true</stacked>\n        <barControls>false</barControls>\n        <xAxisDateType>false</xAxisDateType>\n        <lessXaxisTickers>false</lessXaxisTickers>\n        <timeAxis>true</timeAxis>\n        <logScale>false</logScale>\n        <topMargin>30</topMargin>\n        <bottomMargin>50</bottomMargin>\n        <rightMargin>60</rightMargin>\n        <leftMargin>100</leftMargin>\n    </chartAdditionalOptions>\n    <folderId>NULL</folderId>\n    <isOneTimeScheduleAllowed>N</isOneTimeScheduleAllowed>\n    <isHourlyScheduleAllowed>N</isHourlyScheduleAllowed>\n    <isDailyScheduleAllowed>N</isDailyScheduleAllowed>\n    <isDailyMFScheduleAllowed>N</isDailyMFScheduleAllowed>\n    <isWeeklyScheduleAllowed>N</isWeeklyScheduleAllowed>\n    <isMonthlyScheduleAllowed>N</isMonthlyScheduleAllowed>\n</customReport>\n',1,'2019-08-08 08:43:27',1,'2019-08-08 08:43:27','',0,1,NULL,0,0),(18,'Application Usage bar Wid','',1,'<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<customReport pageSize=\"200\" reportType=\"Linear\">\n    <reportName>Application Usage Line Wid</reportName>\n    <reportDescr></reportDescr>\n    <dbInfo>local</dbInfo>\n    <dbType>mysql</dbType>\n    <chartType>TimeSeriesChart</chartType>\n    <chartMultiSeries>N</chartMultiSeries>\n    <chartWidth>700</chartWidth>\n    <chartHeight>300</chartHeight>\n    <showChartTitle>false</showChartTitle>\n    <public>false</public>\n    <hideFormFieldAfterRun>false</hideFormFieldAfterRun>\n    <createId>27</createId>\n    <createDate>2017-01-28-05:00</createDate>\n    <reportSQL>SELECT \n      l.date audit_date, \n   IF(CHAR_LENGTH(l.app_name) &gt;14, CONCAT(CONCAT(SUBSTR(l.app_name,1,7),\'...\'), SUBSTR(l.app_name, CHAR_LENGTH(l.app_name)-3,CHAR_LENGTH(l.app_name))) , l.app_name) app_name, \n     IFNULL(r.ct,0) ct \nfrom\n(\n   select a.Date, app_id, app_name\n       from (\n            select curdate() - INTERVAL (a.a + (10 * b.a) + (100 * c.a)) DAY as Date\n      from (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as a\n          cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as b\n            cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as c\n        ) a, \n (\n             SELECT  \n                      app_id, app_name\n              from\n          (\n                     select @rn := @rn+1 AS rowId, app_id, app_name from \n                          (\n                                     select app_id, app_name, ct from \n                                     (\n                                             select affected_record_id, count(*) ct\n                                                from fn_audit_log l\n                                           where audit_date &gt; date_add( curdate(), interval -30 day)\n                                          and affected_record_id not in ( 1, -1)\n                                                and activity_cd in (\'tab_access\', \'app_access\')\n                                           and user_id = [USER_ID]\n                                               group by affected_record_id\n                                   ) a, fn_app f\n                                 where a.affected_record_id = f.app_id\n                                 order by ct desc \n                             ) b,\n                          (SELECT @rn := 0) t2\n          ) mm where rowId &lt;= 4\n      )b\n    where a.Date between date_add( curdate(), interval -30 day) and  curdate()\n) l left outer join\n(\n    select app_name,  DATE(audit_date) audit_date_1 ,count(*) ct from fn_audit_log a, fn_app b\n    where user_id = [USER_ID]\n     and audit_date &gt; date_add( curdate(), interval -30 day)\n    and activity_cd in (\'tab_access\', \'app_access\')\n   and a.affected_record_id = b.app_id\n   and b.app_id &lt;&gt; 1\n       and b.app_id in \n      (\n             SELECT  \n                      app_id\n                from\n          (\n                     select @rn := @rn+1 AS rowId, app_id from \n                            (\n                                     select app_id, ct from \n                                       (\n                                             select affected_record_id app_id, count(*) ct\n                                         from fn_audit_log \n                                            where audit_date &gt; date_add( curdate(), interval -30 day)\n                                          and affected_record_id not in ( 1, -1)\n                                                and activity_cd in (\'tab_access\', \'app_access\')\n                                           and user_id = [USER_ID]\n                                               group by affected_record_id\n                                   ) a\n                                   order by ct desc \n                             ) b,\n                          (SELECT @rn := 0) t2\n          ) mm \n )\n     group by app_name,  DATE(audit_date)\n) r\non l.Date = r.audit_date_1\nand l.app_name = r.app_name</reportSQL>\n    <reportTitle></reportTitle>\n    <reportSubTitle></reportSubTitle>\n    <reportHeader></reportHeader>\n    <frozenColumns>0</frozenColumns>\n    <emptyMessage>Your Search didn\'t yield any results.</emptyMessage>\n    <dataGridAlign>left</dataGridAlign>\n    <reportFooter></reportFooter>\n    <numFormCols>1</numFormCols>\n    <displayOptions>NNNNNNN</displayOptions>\n    <dataContainerHeight>100</dataContainerHeight>\n    <dataContainerWidth>100</dataContainerWidth>\n    <allowSchedule>N</allowSchedule>\n    <multiGroupColumn>N</multiGroupColumn>\n    <topDown>N</topDown>\n    <sizedByContent>N</sizedByContent>\n    <comment>N|</comment>\n    <dataSourceList>\n        <dataSource tableId=\"du0\">\n            <tableName>DUAL</tableName>\n            <tablePK></tablePK>\n            <displayName>DUAL</displayName>\n            <dataColumnList>\n                <dataColumn colId=\"audit_date\">\n                    <tableId>du0</tableId>\n                    <dbColName>l.date</dbColName>\n                    <colName>l.date</colName>\n                    <displayName>audit_date_1</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayWidthInPxls>nullpxpx</displayWidthInPxls>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>1</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <colOnChart>LEGEND</colOnChart>\n                    <chartSeq>1</chartSeq>\n                    <chartSeries>false</chartSeries>\n                    <isRangeAxisFilled>false</isRangeAxisFilled>\n                    <drillinPoPUp>false</drillinPoPUp>\n                    <dbColType>VARCHAR2</dbColType>\n                    <enhancedPagination>false</enhancedPagination>\n                </dataColumn>\n                <dataColumn colId=\"app_name\">\n                    <tableId>du0</tableId>\n                    <dbColName>IF(CHAR_LENGTH(l.app_name) &gt;14, CONCAT(CONCAT(SUBSTR(l.app_name,1,7),\'...\'), SUBSTR(l.app_name, CHAR_LENGTH(l.app_name)-3,CHAR_LENGTH(l.app_name))) , l.app_name)</dbColName>\n                    <colName>IF(CHAR_LENGTH(l.app_name) &gt;14, CONCAT(CONCAT(SUBSTR(l.app_name,1,7),\'...\'), SUBSTR(l.app_name, CHAR_LENGTH(l.app_name)-3,CHAR_LENGTH(l.app_name))) , l.app_name)</colName>\n                    <displayName>app_name</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayWidthInPxls>nullpxpx</displayWidthInPxls>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>2</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <colOnChart>0</colOnChart>\n                    <chartSeq>2</chartSeq>\n                    <chartColor></chartColor>\n                    <chartLineType></chartLineType>\n                    <chartSeries>true</chartSeries>\n                    <isRangeAxisFilled>false</isRangeAxisFilled>\n                    <drillinPoPUp>false</drillinPoPUp>\n                    <dbColType>VARCHAR2</dbColType>\n                    <chartGroup></chartGroup>\n                    <yAxis></yAxis>\n                    <enhancedPagination>false</enhancedPagination>\n                </dataColumn>\n                <dataColumn colId=\"ct\">\n                    <tableId>du0</tableId>\n                    <dbColName>IFNULL(r.ct,0)</dbColName>\n                    <colName>IFNULL(r.ct,0)</colName>\n                    <displayName>ct</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayWidthInPxls>nullpxpx</displayWidthInPxls>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>3</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <colOnChart>0</colOnChart>\n                    <chartSeq>1</chartSeq>\n                    <chartColor></chartColor>\n                    <chartLineType></chartLineType>\n                    <chartSeries>false</chartSeries>\n                    <isRangeAxisFilled>false</isRangeAxisFilled>\n                    <drillinPoPUp>false</drillinPoPUp>\n                    <dbColType>VARCHAR2</dbColType>\n                    <chartGroup></chartGroup>\n                    <yAxis></yAxis>\n                    <enhancedPagination>false</enhancedPagination>\n                </dataColumn>\n            </dataColumnList>\n        </dataSource>\n    </dataSourceList>\n    <reportInNewWindow>false</reportInNewWindow>\n    <displayFolderTree>false</displayFolderTree>\n    <maxRowsInExcelDownload>500</maxRowsInExcelDownload>\n    <chartAdditionalOptions>\n        <chartOrientation>vertical</chartOrientation>\n        <hidechartLegend>N</hidechartLegend>\n        <legendPosition>bottom</legendPosition>\n        <labelAngle>down45</labelAngle>\n        <animate>true</animate>\n        <animateAnimatedChart>true</animateAnimatedChart>\n        <stacked>true</stacked>\n        <barControls>false</barControls>\n        <xAxisDateType>false</xAxisDateType>\n        <lessXaxisTickers>false</lessXaxisTickers>\n        <timeAxis>true</timeAxis>\n        <timeSeriesRender>line</timeSeriesRender>\n        <multiSeries>false</multiSeries>\n        <showXAxisLabel>false</showXAxisLabel>\n        <addXAxisTickers>false</addXAxisTickers>\n        <topMargin>30</topMargin>\n        <bottomMargin>50</bottomMargin>\n        <rightMargin>60</rightMargin>\n        <leftMargin>100</leftMargin>\n    </chartAdditionalOptions>\n    <folderId>NULL</folderId>\n    <drillURLInPoPUpPresent>false</drillURLInPoPUpPresent>\n    <isOneTimeScheduleAllowed>N</isOneTimeScheduleAllowed>\n    <isHourlyScheduleAllowed>N</isHourlyScheduleAllowed>\n    <isDailyScheduleAllowed>N</isDailyScheduleAllowed>\n    <isDailyMFScheduleAllowed>N</isDailyMFScheduleAllowed>\n    <isWeeklyScheduleAllowed>N</isWeeklyScheduleAllowed>\n    <isMonthlyScheduleAllowed>N</isMonthlyScheduleAllowed>\n</customReport>\n',1,'2019-08-08 08:43:27',1,'2019-08-08 08:43:27','',0,1,NULL,0,0),(20,'Average time spend on portal','',1,'<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<customReport pageSize=\"200\" reportType=\"Linear\">\n    <reportName>Average time spend on portal</reportName>\n    <reportDescr></reportDescr>\n    <dbInfo>local</dbInfo>\n    <dbType>mysql</dbType>\n    <chartType>TimeSeriesChart</chartType>\n    <chartMultiSeries>N</chartMultiSeries>\n    <chartWidth>700</chartWidth>\n    <chartHeight>300</chartHeight>\n    <showChartTitle>false</showChartTitle>\n    <public>true</public>\n    <hideFormFieldAfterRun>false</hideFormFieldAfterRun>\n    <createId>27</createId>\n    <createDate>2017-01-28-05:00</createDate>\n    <reportSQL>SELECT \n      d.dat audit_date, \n    \'# of Minutes\' app, \n        coalesce(diff, null, 0) mins \nfrom\n(\n        select * from\n (\n     select curdate() - INTERVAL (a.a + (10 * b.a) + (100 * c.a)) DAY as dat\n       from (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as a\n  cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as b\n    cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as c \n   ) d where d.dat between date_add( curdate(), interval -30 day) and  curdate()\n) d left outer join\n(\n select dat, mi, mx, TIMESTAMPDIFF(MINUTE, coalesce(mi, null, 0), coalesce(mx, null, 0)) + 30  diff\n    from\n  (\n             select DATE(audit_date) dat, coalesce(min(audit_date), null, 0) mi, coalesce(max(audit_date), null, 0) mx\n             from fn_audit_log \n            where user_id = [USER_ID] and DATE(audit_date) between CURDATE()-300 and CURDATE()\n            group by DATE(audit_date)\n     ) a\n) a\non a.dat = d.dat\norder by 1</reportSQL>\n    <reportTitle></reportTitle>\n    <reportSubTitle></reportSubTitle>\n    <reportHeader></reportHeader>\n    <frozenColumns>0</frozenColumns>\n    <emptyMessage>Your Search didn\'t yield any results.</emptyMessage>\n    <dataGridAlign>left</dataGridAlign>\n    <reportFooter></reportFooter>\n    <numFormCols>1</numFormCols>\n    <displayOptions>NNNNNNN</displayOptions>\n    <dataContainerHeight>100</dataContainerHeight>\n    <dataContainerWidth>100</dataContainerWidth>\n    <allowSchedule>N</allowSchedule>\n    <multiGroupColumn>N</multiGroupColumn>\n    <topDown>N</topDown>\n    <sizedByContent>N</sizedByContent>\n    <comment>N|</comment>\n    <dataSourceList>\n        <dataSource tableId=\"du0\">\n            <tableName>DUAL</tableName>\n            <tablePK></tablePK>\n            <displayName>DUAL</displayName>\n            <dataColumnList>\n                <dataColumn colId=\"audit_date\">\n                    <tableId>du0</tableId>\n                    <dbColName>d.dat</dbColName>\n                    <colName>d.dat</colName>\n                    <displayName>audit_date_1</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayWidthInPxls>nullpxpx</displayWidthInPxls>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>1</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <colOnChart>LEGEND</colOnChart>\n                    <chartSeq>1</chartSeq>\n                    <chartSeries>false</chartSeries>\n                    <isRangeAxisFilled>false</isRangeAxisFilled>\n                    <drillinPoPUp>false</drillinPoPUp>\n                    <dbColType>VARCHAR2</dbColType>\n                    <enhancedPagination>false</enhancedPagination>\n                </dataColumn>\n                <dataColumn colId=\"app\">\n                    <tableId>du0</tableId>\n                    <dbColName>\'# of Minutes\'</dbColName>\n                    <colName>\'# of Minutes\'</colName>\n                    <displayName>app</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayWidthInPxls>nullpxpx</displayWidthInPxls>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>2</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <chartSeries>true</chartSeries>\n                    <dbColType>VARCHAR2</dbColType>\n                </dataColumn>\n                <dataColumn colId=\"mins\">\n                    <tableId>du0</tableId>\n                    <dbColName>coalesce(diff, null, 0)</dbColName>\n                    <colName>coalesce(diff, null, 0)</colName>\n                    <displayName>mins</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayWidthInPxls>nullpxpx</displayWidthInPxls>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>3</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <colOnChart>0</colOnChart>\n                    <chartSeq>1</chartSeq>\n                    <chartColor></chartColor>\n                    <chartLineType></chartLineType>\n                    <chartSeries>false</chartSeries>\n                    <dbColType>VARCHAR2</dbColType>\n                    <chartGroup></chartGroup>\n                    <yAxis></yAxis>\n                </dataColumn>\n            </dataColumnList>\n        </dataSource>\n    </dataSourceList>\n    <reportInNewWindow>false</reportInNewWindow>\n    <displayFolderTree>false</displayFolderTree>\n    <maxRowsInExcelDownload>500</maxRowsInExcelDownload>\n    <chartAdditionalOptions>\n        <chartOrientation>vertical</chartOrientation>\n        <hidechartLegend>N</hidechartLegend>\n        <legendPosition>bottom</legendPosition>\n        <labelAngle>down45</labelAngle>\n        <animate>true</animate>\n        <animateAnimatedChart>true</animateAnimatedChart>\n        <stacked>true</stacked>\n        <barControls>false</barControls>\n        <xAxisDateType>false</xAxisDateType>\n        <lessXaxisTickers>false</lessXaxisTickers>\n        <timeAxis>true</timeAxis>\n        <timeSeriesRender>line</timeSeriesRender>\n        <multiSeries>false</multiSeries>\n        <showXAxisLabel>false</showXAxisLabel>\n        <addXAxisTickers>false</addXAxisTickers>\n        <topMargin>30</topMargin>\n        <bottomMargin>50</bottomMargin>\n        <rightMargin>60</rightMargin>\n        <leftMargin>100</leftMargin>\n    </chartAdditionalOptions>\n    <folderId>NULL</folderId>\n    <drillURLInPoPUpPresent>false</drillURLInPoPUpPresent>\n    <isOneTimeScheduleAllowed>N</isOneTimeScheduleAllowed>\n    <isHourlyScheduleAllowed>N</isHourlyScheduleAllowed>\n    <isDailyScheduleAllowed>N</isDailyScheduleAllowed>\n    <isDailyMFScheduleAllowed>N</isDailyMFScheduleAllowed>\n    <isWeeklyScheduleAllowed>N</isWeeklyScheduleAllowed>\n    <isMonthlyScheduleAllowed>N</isMonthlyScheduleAllowed>\n</customReport>\n',1,'2019-08-08 08:43:27',1,'2019-08-08 08:43:27','',0,1,NULL,0,0);
-
-LOCK TABLES `fn_app` WRITE;
-/*!40000 ALTER TABLE `fn_app` DISABLE KEYS */;
-INSERT INTO
-  `fn_app` (
-    `app_Id`,
-    `app_name`,
-    `app_image_url`,
-    `app_description`,
-    `app_notes`,
-    `app_url`,
-    `app_alternate_url`,
-    `app_rest_endpoint`,
-    `ml_app_name`,
-    `ml_app_admin_id`,
-    `mots_id`,
-    `app_password`,
-    `_open`,
-    `_enabled`,
-    `app_username`,
-    `ueb_key`,
-    `ueb_secret`,
-    `ueb_topic_name`,
-    `app_type`,
-    `auth_central`,
-    `auth_namespace`
-  )
-VALUES
-  (
-    1,
-    'Default',
-    'assets/images/tmp/portal1.png',
-    'Some Default Description',
-    'Some Default Note',
-    'http://localhost',
-    'http://localhost',
-    'http://localhost:8080/ecompportal',
-    'EcompPortal',
-    '',
-    NULL,
-    'dR2NABMkxPaFbIbym87ZwQ==',
-    0,
-    0,
-    'm00468@portal.onap.org',
-    'EkrqsjQqZt4ZrPh6',
-    NULL,
-    NULL,
-    1,
-    1,
-    'org.onap.portal'
-  ),(
-    2,
-    'xDemo App',
-    'images/cache/portal-222865671_37476.png',
-    NULL,
-    NULL,
-    'http://portal-sdk.simpledemo.onap.org:30212/ONAPPORTALSDK/welcome.htm',
-    NULL,
-    'http://portal-sdk:8080/ONAPPORTALSDK/api/v3',
-    '',
-    '',
-    NULL,
-    '2VxipM8Z3SETg32m3Gp0FvKS6zZ2uCbCw46WDyK6T5E=',
-    0,
-    1,
-    'Default',
-    'ueb_key',
-    'ueb_secret',
-    'ECOMP-PORTAL-OUTBOX',
-    1,
-    0,
-    NULL
-  ),(
-    3,
-    'DMaaP Bus Ctrl',
-    'images/cache/portal944583064_80711.png',
-    NULL,
-    NULL,
-    'http://dmaap-bc.simpledemo.onap.org:/ECOMPDBCAPP/dbc#/dmaap',
-    NULL,
-    'http://dmaap-bc:8989/ECOMPDBCAPP/api/v2',
-    '',
-    '',
-    NULL,
-    'okYTaDrhzibcbGVq5mjkVQ==',
-    0,
-    0,
-    'Default',
-    'ueb_key',
-    'ueb_secret',
-    'ECOMP-PORTAL-OUTBOX',
-    1,
-    0,
-    NULL
-  ),(
-    4,
-    'SDC',
-    'images/cache/portal956868231_53879.png',
-    NULL,
-    NULL,
-    'http://sdc.api.fe.simpledemo.onap.org:30206/sdc1/portal',
-    NULL,
-    'http://sdc-be:8080/api/v3',
-    '',
-    '',
-    NULL,
-    'j85yNhyIs7zKYbR1VlwEfNhS6b7Om4l0Gx5O8931sCI=',
-    0,
-    1,
-    'sdc',
-    'ueb_key',
-    'ueb_secret',
-    'ECOMP-PORTAL-OUTBOX',
-    1,
-    1,
-    'org.onap.sdc'
-  ),(
-    5,
-    'Policy',
-    'images/cache/portal1470452815_67021.png',
-    NULL,
-    NULL,
-    'https://policy.api.simpledemo.onap.org:30219/onap/policy',
-    NULL,
-    'https://pap:8443/onap/api/v3',
-    '',
-    '',
-    NULL,
-    '2VxipM8Z3SETg32m3Gp0FvKS6zZ2uCbCw46WDyK6T5E=',
-    0,
-    1,
-    'Default',
-    'ueb_key_5',
-    'ueb_secret',
-    'ECOMP-PORTAL-OUTBOX',
-    1,
-    1,
-    'org.onap.policy'
-  ),(
-    6,
-    'Virtual Infrastructure Deployment',
-    'images/cache/portal-345993588_92550.png',
-    NULL,
-    NULL,
-    'https://vid.api.simpledemo.onap.org:30200/vid/welcome.htm',
-    NULL,
-    'https://vid:8443/vid/api/v3',
-    '',
-    '',
-    NULL,
-    '2VxipM8Z3SETg32m3Gp0FvKS6zZ2uCbCw46WDyK6T5E=',
-    0,
-    1,
-    'Default',
-    '2Re7Pvdkgw5aeAUD',
-    'S31PrbOzGgL4hg4owgtx47Da',
-    'ECOMP-PORTAL-OUTBOX-90',
-    1,
-    1,
-    'org.onap.vid'
-  ),(
-    7,
-    'A&AI UI',
-    'images/cache/portal-345993588_92550.png',
-    NULL,
-    NULL,
-    'https://aai.ui.simpledemo.onap.org:30220/services/aai/webapp/index.html#/viewInspect',
-    NULL,
-    'https://aai-sparky-be.onap:8000/api/v2',
-    '',
-    '',
-    NULL,
-    '4LK69amiIFtuzcl6Gsv97Tt7MLhzo03aoOx7dTvdjKQ=',
-    0,
-    1,
-    'aaiui',
-    'ueb_key_7',
-    'ueb_secret',
-    'ECOMP-PORTAL-OUTBOX',
-    1,
-    1,
-    'org.onap.aai'
-  ),(
-    8,
-    'CLI',
-    'images/cache/portal-345993588_92550.png',
-    NULL,
-    NULL,
-    'http://cli.api.simpledemo.onap.org:30260/',
-    NULL,
-    NULL,
-    '',
-    '',
-    NULL,
-    '',
-    1,
-    1,
-    '',
-    '',
-    '',
-    '',
-    1,
-    0,
-    NULL
-  ),(
-    9,
-    'MSB',
-    'images/cache/portal-345993588_92550.png',
-    NULL,
-    NULL,
-    'http://msb.api.simpledemo.onap.org:30280/iui/microservices/default.html',
-    NULL,
-    NULL,
-    '',
-    '',
-    NULL,
-    '',
-    1,
-    1,
-    '',
-    '',
-    '',
-    '',
-    2,
-    0,
-    NULL
-  ),(
-    10,
-    'SO-Monitoring',
-    'images/cache/portal-345993588_92550.png',
-    NULL,
-    NULL,
-    'http://so-monitoring:30224',
-    NULL,
-    'http://so-monitoring:30224',
-    '',
-    '',
-    NULL,
-    'password',
-    1,
-    1,
-    'user',
-    '',
-    '',
-    '',
-    1,
-    0,
-    'SO-Monitoring'
-  ),(
-    11,
-    'LF Acumos Marketplace',
-    'images/cache/portal_907838932_26954.png',
-    NULL,
-    NULL,
-    'https://marketplace.acumos.org/#/home',
-    NULL,
-    NULL,
-    '',
-    '',
-    NULL,
-    '',
-    1,
-    1,
-    '',
-    '',
-    '',
-    '',
-    2,
-    0,
-    NULL
-  );
-
-/*!40000 ALTER TABLE `fn_app` ENABLE KEYS */;
-UNLOCK TABLES;
-
-
---
--- Dumping data for table `ep_app_function`
---
-
-LOCK TABLES `ep_app_function` WRITE;
-/*!40000 ALTER TABLE `ep_app_function` DISABLE KEYS */;
-INSERT INTO `ep_app_function` (`app_id`, `function_cd`, `function_name`) VALUES (1,'menu|menu_acc_admin|*','Admin Account Menu'),(1,'menu|menu_admin|*','Admin Menu'),(1,'menu|menu_home|*','Home Menu'),(1,'menu|menu_logout|*','Logout Menu'),(1,'menu|menu_web_analytics|*','Web Analytics'),(1,'url|addWebAnalyticsReport|*','Add Web Analytics Report'),(1,'url|appsFullList|*','Apps Full List'),(1,'url|centralizedApps|*','Centralized Apps'),(1,'url|edit_notification|*','User Notification'),(1,'url|functionalMenu|*','Functional Menu'),(1,'url|getAdminNotifications|*','Admin Notifications'),(1,'url|getAllWebAnalytics|*','Get All Web Analytics'),(1,'url|getFunctionalMenuRole|*','Get Functional Menu Role'),(1,'url|getNotificationAppRoles|*','Get Notification App Roles'),(1,'url|getUserAppsWebAnalytics|*','Get User Apps Web Analytics'),(1,'url|getUserJourneyAnalyticsReport|*','Get User Journey Report'),(1,'url|get_roles%2f%2a|*','getRolesOfApp'),(1,'url|get_role_functions%2f%2a|*','Get Role Functions'),(1,'url|login|*','Login'),(1,'url|notification_code|*','Notification Code'),(1,'url|role_function_list%2fsaveRoleFunction%2f%2a|*','Save Role Function'),(1,'url|saveNotification|*','publish notifications'),(1,'url|syncRoles|*','SyncRoles'),(1,'url|url_role.htm|*','role page'),(1,'url|url_welcome.htm|*','welcome page'),(1,'url|userAppRoles|*','userAppRoles'),(1,'url|userApps|*','User Apps');
-/*!40000 ALTER TABLE `ep_app_function` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_role`
---
-
-LOCK TABLES `fn_role` WRITE;
-/*!40000 ALTER TABLE `fn_role` DISABLE KEYS */;
-INSERT INTO `fn_role` (`role_id`, `role_name`, `active_yn`, `priority`, `app_id`, `app_role_id`) VALUES (1,'System_Administrator',1,1,NULL,NULL),(16,'Standard_User',1,5,NULL,NULL),(900,'Restricted_App_Role',1,1,NULL,NULL),(950,'Portal_Notification_Admin',1,1,NULL,NULL),(999,'Account_Administrator',1,1,NULL,NULL),(1000,'System_Administrator',1,1,2,1),(1001,'Standard_User',1,1,2,16),(1002,'System_Administrator',1,1,3,1),(1003,'Standard_User',1,1,3,16),(1004,'ADMIN',1,1,4,0),(1005,'TESTOR',1,1,4,1),(1006,'System_Administrator',1,1,5,1),(1007,'Standard_User',1,1,5,16),(1008,'System_Administrator',1,1,6,1),(1009,'Standard_User',1,1,6,16),(1010,'Usage_Analyst',1,1,NULL,NULL),(1011,'View',1,1,7,1),(1012,'Standard_User',1,1,7,16),(2115,'Portal_Usage_Analyst',1,6,NULL,NULL);
-/*!40000 ALTER TABLE `fn_role` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `ep_app_role_function`
---
-
-LOCK TABLES `ep_app_role_function` WRITE;
-/*!40000 ALTER TABLE `ep_app_role_function` DISABLE KEYS */;
-INSERT INTO `ep_app_role_function` (`id`, `app_id`, `role_id`, `function_cd`, `role_app_id`) VALUES (1,1,1,'url|login|*',NULL),(2,1,1,'menu|menu_admin|*',NULL),(3,1,1,'menu|menu_home|*',NULL),(4,1,1,'menu|menu_logout|*',NULL),(5,1,16,'url|login|*',NULL),(6,1,16,'menu|menu_home|*',NULL),(7,1,16,'menu|menu_logout|*',NULL),(8,1,950,'url|edit_notification|*',NULL),(9,1,950,'url|getAdminNotifications|*',NULL),(10,1,950,'url|saveNotification|*',NULL),(11,1,999,'url|userAppRoles|*',NULL),(12,1,999,'url|getAdminNotifications|*',NULL),(13,1,999,'url|userApps|*',NULL),(14,1,1010,'menu|menu_web_analytics|*',NULL),(15,1,2115,'menu|menu_web_analytics|*',NULL),(16,1,1,'menu|menu_acc_admin|*',NULL),(17,1,999,'menu|menu_acc_admin|*',NULL),(18,1,999,'url|centralizedApps|*',NULL),(19,1,999,'url|getAllWebAnalytics|*',NULL),(20,1,999,'url|getFunctionalMenuRole|*',NULL),(21,1,999,'url|getNotificationAppRoles|*',NULL),(22,1,999,'url|getUserAppsWebAnalytics|*',NULL),(23,1,999,'url|getUserJourneyAnalyticsReport|*',NULL),(24,1,999,'url|get_roles%2f%2a|*',NULL),(25,1,999,'url|get_role_functions%2f%2a|*',NULL),(26,1,999,'url|notification_code|*',NULL),(27,1,999,'url|role_function_list%2fsaveRoleFunction%2f%2a|*',NULL),(28,1,999,'url|syncRoles|*',NULL);
-/*!40000 ALTER TABLE `ep_app_role_function` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `ep_basic_auth_account`
---
-
-LOCK TABLES `ep_basic_auth_account` WRITE;
-/*!40000 ALTER TABLE `ep_basic_auth_account` DISABLE KEYS */;
-INSERT INTO `ep_basic_auth_account` (`id`, `ext_app_name`, `username`, `password`, `active_yn`) VALUES (1,'JIRA','jira','6APqvG4AU2rfLgCvMdySwQ==',1);
-/*!40000 ALTER TABLE `ep_basic_auth_account` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `ep_microservice`
---
-
-LOCK TABLES `ep_microservice` WRITE;
-/*!40000 ALTER TABLE `ep_microservice` DISABLE KEYS */;
-INSERT INTO `ep_microservice` (`id`, `name`, `description`, `app_Id`, `endpoint_url`, `security_type`, `username`, `password`, `active`) VALUES (1,'News Microservice','News',1,'http://portal-app:8989/ONAPPORTAL/commonWidgets','Basic Authentication','portal','6APqvG4AU2rfLgCvMdySwQ==',1),(2,'Events Microservice','Events',1,'http://portal-app:8989/ONAPPORTAL/commonWidgets','Basic Authentication','portal','6APqvG4AU2rfLgCvMdySwQ==',1),(3,'Resources Microservice','Resources',1,'http://portal-app:8989/ONAPPORTAL/commonWidgets','Basic Authentication','portal','6APqvG4AU2rfLgCvMdySwQ==',1),(4,'Portal-Common-Scheduler Microservice','Portal-Common-Scheduler',1,'http://portal-app:8989/ONAPPORTAL/commonWidgets','Basic Authentication','portal','6APqvG4AU2rfLgCvMdySwQ==',1);
-/*!40000 ALTER TABLE `ep_microservice` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `ep_microservice_parameter`
---
-
-LOCK TABLES `ep_microservice_parameter` WRITE;
-/*!40000 ALTER TABLE `ep_microservice_parameter` DISABLE KEYS */;
-INSERT INTO `ep_microservice_parameter` (`id`, `service_id`, `para_key`, `para_value`) VALUES (1,1,'resourceType','NEWS'),(2,2,'resourceType','EVENTS'),(3,3,'resourceType','IMPORTANTRESOURCES'),(4,4,'resourceType',NULL);
-/*!40000 ALTER TABLE `ep_microservice_parameter` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `ep_widget_catalog`
---
-
-LOCK TABLES `ep_widget_catalog` WRITE;
-/*!40000 ALTER TABLE `ep_widget_catalog` DISABLE KEYS */;
-INSERT INTO `ep_widget_catalog` (`wdg_name`, `service_id`, `wdg_desc`, `wdg_file_loc`, `all_user_flag`) VALUES ('News',1,'News','news-widget.zip',1),('Events',2,'Events','events-widget.zip',1),('Resources',3,'Resources','resources-widget.zip',1),('Portal-Common-Scheduler',4,'Portal-Common-Scheduler','portal-common-scheduler-widget.zip',1);
-/*!40000 ALTER TABLE `ep_widget_catalog` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `ep_widget_catalog_files`
---
-
-LOCK TABLES `ep_widget_catalog_files` WRITE;
-/*!40000 ALTER TABLE `ep_widget_catalog_files` DISABLE KEYS */;
-INSERT INTO `ep_widget_catalog_files` (`file_id`, `widget_id`, `widget_name`, `framework_js`, `controller_js`, `markup_html`, `widget_css`) VALUES (1,1,'News','var Portal1Widget = (function(window, undefined) {                                                                                      \n                                                                                                                                    \n       var Portal1Widget = Portal1Widget || {};                                                                                                \n      function extractHostPortApp(src) {                                                                                                  \n          \n              Portal1Widget.microserviceId = 1;                                                                                 \n            Portal1Widget.pathArray = src.split( \'/\' );                                                                                     \n                    \n              Portal1Widget.widgetName = 1;\n         Portal1Widget.serviceSeperator = Portal1Widget.pathArray[Portal1Widget.pathArray.length - 4];                                           \n              Portal1Widget.commonUrl = src.substring(0, src.lastIndexOf(\"/\" + Portal1Widget.pathArray[Portal1Widget.pathArray.length - 2]));       \n              \n              Portal1Widget.recipientDivDataAttrib = \'data-\' + Portal1Widget.widgetName;                                                          \n                Portal1Widget.controllerName = \'Portal1Ctrl\';                                                                                     \n          Portal1Widget.readyCssFlag = \'portal1-css-ready\';                                                                                       \n            Portal1Widget.readyCssFlagExpectedValue = \'#bada55\';                                                                            \n            Portal1Widget.serviceURL = src.substring(0, src.lastIndexOf(\"/\" + Portal1Widget.serviceSeperator)) + \'/portalApi/microservice/proxy/parameter/\' + 1;  \n    }                                  \n   \n      extractHostPortApp(document.getElementsByTagName(\'script\')[0].src);\n \n      function loadStylesheet(url) {                                                                                                 \n               var link = document.createElement(\'link\');                                                                                 \n         link.rel = \'stylesheet\';                                                                                                   \n         link.type = \'text/css\';                                                                                                    \n         link.href = url;                                                                                                           \n           var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(link, entry);                                                                                \n   }                                                                                                                              \n                                                                                                                                   \n  function isCssReady(callback) {                                                                                                \n               var testElem = document.createElement(\'span\');                                                                             \n         testElem.id = Portal1Widget.readyCssFlag;                                                                                          \n           testElem.style = \'color: #fff\';                                                                       \n              var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(testElem, entry);                                                                            \n                                                                                                                                  \n               (function poll() {                                                                                                         \n                   var node = document.getElementById(\'css-ready\');                                                                       \n                     var value;                                                                                                             \n                       if (window.getComputedStyle) {                                                                                         \n                               value = document.defaultView.getComputedStyle(testElem, null)                                                      \n                                           .getPropertyValue(\'color\');                                                                                \n                 }                                                                                                                      \n                       else if (node.currentStyle) {                                                                                          \n                               value = node.currentStyle.color;                                                                                   \n                   }                                                                                                                      \n                       if (value && value === \'rgb(186, 218, 85)\' || value.toLowerCase() === Portal1Widget.readyCssFlagExpectedValue) {           \n                         callback();                                                                                                        \n                   } else {                                                                                                               \n                               setTimeout(poll, 500);                                                                                             \n                   }                                                                                                                      \n               })();                                                                                                                      \n   }                                                                                                                              \n                                                                                                                                      \n       function injectCss(css) {                                                                                                      \n               var style = document.createElement(\'style\');                                                                               \n         style.type = \'text/css\';                                                                                                   \n                 css = css.replace(/\\}/g, \"}\\n\");                                                                                           \n                                                                                                                                      \n               if (style.styleSheet) {                                                                                                    \n                   style.styleSheet.cssText = css;                                                                                        \n               } else {                                                                                                                   \n                   style.appendChild(document.createTextNode(css));                                                                       \n               }                                                                                                                          \n           var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(style, entry);                                                                               \n   }                                                                                                                              \n                                                                                                                                      \n       function loadScript(url, callback) {                                                                                           \n               var script = document.createElement(\'script\');                                                                             \n         script.src = url;                                                                                                          \n           \n              var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(script, entry);                                                                              \n           \n              script.onload = script.onreadystatechange = function() {   \n                   var rdyState = script.readyState;                                                                                      \n                       if (!rdyState || /complete|loaded/.test(script.readyState)) {                                                          \n                               callback();                                                                                                        \n                           script.onload = null;                                                                                              \n                           script.onreadystatechange = null;                                                                                  \n                   }                                                                                                                      \n               };                                                                                                                         \n   }                                                                                                                              \n                                                                                                                                   \n  function loadSupportingFiles(callback) {                                                                                       \n               callback();                                                                                                                \n   }                                                                                                                              \n                                                                                                                                      \n       function getWidgetParams() {                                                                                                   \n                                                                                                                                          \n   }                                                                                                                              \n                                                                                                                                      \n       function getWidgetData(widgetUrl, callback) {                                                                                      \n   var responseData;                                                                                                                                                                                                  \n   try{                                                                                                                                                                                                               \n           jQuery.ajax({                                                                                                                                                                                              \n                   url: widgetUrl,                                                                                                                                                                                            \n                   method: \"GET\",                                                                                                                                                                                                   \n                   xhrFields: {                                                                                                                                                                                                       \n                           withCredentials: true                                                                                                                                                                              \n                   },    \n                        crossDomain: true,                      \n                      success: function (result) {                                                                                                                                                                               \n                           if (result.isOk == false){                                                                                                                                                                         \n                                                                                                                                                                                                                              \n                           }else{                                                                                                                                                                                             \n                                   callback(result);                                                                                                                                                                                          \n                           }                                                                                                                                                                                                  \n                   }                                                                                                                                                                                                  \n           });                                                                                                                                                                                                \n   }                                                                                                                                                                                                                  \n   catch(e){                                                                                                                                                                                                          \n   \n      }                                                                                                                                                                                                                  \n                                                                                                                                                                                      \n   }                                                                                                   \n  \n      function getMarkupContent(markupLocation, callback){                                                                             \n                                                                                                                                        \n           try{\n                  jQuery.ajax({                                                                                                              \n                   url: markupLocation,\n                  method: \"GET\",   \n                   xhrFields: {                                                                                                                                                                                                       \n                                   withCredentials: true                                                                                                                                                                              \n                           },   \n                         crossDomain: true,              \n                      success: function (result) {                                                                                           \n                           if (result.isOk == false){                                                                                         \n                                                                                                                                              \n                           }else{                                                                                                             \n                               callback(result);                                                                                   \n                                  }                                                                                                                  \n                   }                                                                                                        \n                     });       \n            }\n             catch(e){\n                     \n              }\n     }                                                                                                                              \n                                                                                                                                      \n       function renderWidget(data, location, $controllerProvider) {                                                                   \n               var div = document.createElement(\'div\');                                                                                   \n         getMarkupContent(Portal1Widget.commonUrl + \"/markup/\" + Portal1Widget.widgetName, function(div){\n                    location.append(div);                                                                                                      \n                   Portal1Widget.widgetData = data;\n                      app.controllerProvider.register(Portal1Widget.controllerName, Portal1Widget.controller);                                           \n                   var mController = angular.element(document.getElementById(\"widgets\"));                                                   \n                   mController.scope().activateThis(location);   \n                });\n           \n      }                                                                                                                              \n                                                                                                                                      \n       function printAllArtifacts(moduleName, controllerName) {                                                                       \n           var queue = angular.module(moduleName)._invokeQueue;                                                                       \n           for(var i=0;i<queue.length;i++) {                                                                                          \n               var call = queue[i];                                                                                                   \n               console.log(i + \'. \' + call[0] + \' - \' + call[1] + \' - \' + call[2][0]);                                                \n     }                                                                                                                          \n       }                                                                                                                              \n                                                                                                                                      \n       function get(name){                                                                                                            \n          if(name=(new RegExp(\'[?&]\'+encodeURIComponent(name)+\'=([^&]*)\')).exec(location.search))                                     \n         return decodeURIComponent(name[1]);                                                                                      \n       }                                                                                                                              \n                                                                                                                                   \n  loadSupportingFiles(function() {                                                                                               \n               loadStylesheet(Portal1Widget.commonUrl + \'/\' + Portal1Widget.widgetName + \'/style.css\');                                           \n               loadScript(Portal1Widget.commonUrl + \'/\' + Portal1Widget.widgetName + \'/controller.js\',                                            \n                       function() {                                                                                                           \n                               $(\'[\'+ Portal1Widget.recipientDivDataAttrib + \']\').each(function() {                                                   \n                                   var location = jQuery(this);                                                                                   \n                                       location.removeAttr(Portal1Widget.recipientDivDataAttrib);                                                         \n                                   var id = location.attr(Portal1Widget.recipientDivDataAttrib);                                                      \n                                   getWidgetData(Portal1Widget.serviceURL, function(data) { \n                                             isCssReady(function(){                                                                                     \n                                                   renderWidget(data, location);                                                                          \n                                               });                                                                                                                                        \n                                   });                                                                                                            \n                               });                                                                                                                \n                   }                                                                                                                      \n               );                                                                                                                         \n   });                                                                                                                            \n                                                                                                                                      \n       return Portal1Widget;                                                                                                              \n})(window);                                                                                                                        \n                              ','Portal1Widget.controller = function Portal1Ctrl($rootScope, applicationsService , $log,\n                    $window, userProfileService, $scope, $cookies, $timeout, $interval,\n                   $uibModal, dashboardService, ngDialog) {Portal1Widget=Portal1Widget||{};var res = Portal1Widget.widgetData;\n           \n              var _this = this;       \n\n            //activate spinner\n            this.isLoading = true;\n                $scope.getUserAppsIsDone = false;\n             this.userProfileService = userProfileService;\n         $scope.demoNum = 1;\n           $scope.event_content_show = false;\n            $scope.widgetData = [];\n\n             $scope.editWidgetModalPopup = function(availableData, resourceType) {\n\n                       $scope.editData = JSON.stringify(availableData);\n                      $scope.availableDataTemp = $scope.availableData;\n                      \n              };\n            \n              /*Setting News data*/\n         $scope.newsData = [];\n         $scope.updateNews = function() {\n                      $scope.newsData.length=0;\n                     //dashboardService.getCommonWidgetData(\'NEWS\').then(function(res) {\n                         // $log.info(res.message);\n                            var newsDataJsonArray = res.response.items;\n                           for (var i = 0; i < newsDataJsonArray.length; i++) {\n                                  $scope.newsData.push(newsDataJsonArray[i]);\n                           }\n                     //})[\'catch\'](function(err) {\n                       //      $log.error(\'dashboard controller: failed to get news list\', err);\n                   //      _this.isLoading = false;\n                      //});\n         }\n             $scope.updateNews();\n\n        }\n\n;Portal1Widget.controller.$inject = [\'$rootScope\',\'applicationsService\',\'$log\',\'$window\',\'userProfileService\',\'$scope\',\'$cookies\',\'$timeout\',\'$interval\',\'$uibModal\',\'dashboardService\',\'ngDialog\'];','<div  id=\"widget-news\" ng-controller=\"Portal1Ctrl\" class=\"widget-news-main\">\n                <div att-gridster-item-body class=\"information-section-gridsterContent\">\n                    <div class=\"resources\">\n                             <ul ng-show=\"newsData.length!=0\">\n                                   <li ng-repeat=\"item in newsData\"><a id=\"new-widget-{{item.id}}\"\n                                                                                           href=\"{{item.href}}\" target=\"_blank\" ng-bind=\"item.title\"></a></li>\n                             </ul>\n                                                 <div ng-hide=\"newsData.length!=0\">\n                                                          <div class=\"activity-error-container\"\n                                                                       style=\"background: rgb(255, 255, 255); overflow: hidden !important; width: 100%;\">\n                                                                  <div class=\"activity-error-block\">\n                                                                          <i class=\"icon-information full-linear-icon-information\"\n                                                                               style=\"margin-left: 125px; font-size: 90px\"></i> <br>\n                                                                            <div class=\"activity-error-msg1\">There\'s currently no\n                                                                                                              news available.</div>\n                                                                 </div>\n                                                                </div>\n                                        </div>\n                        </div>\n                </div>\n</div>\n','\n.portal-widget-panel-container {\n margin-left:150px;\n    width:1500px;\n}\n\n\n.portal-widget-panel-fixed-panel {\n  min-height: 300px;\n  max-height: 1300px;\n  overflow: auto;\n}\n\n.portal-widget-panel-double-middle {\n  min-height: 660px;\n  max-height: 660px;\n  overflow: auto;\n}\n\n.portal-widget-panel-row {\n    margin-right: 0px;\n    margin-left:  0px;\n    width: 2800px;\n}\n\n/*Increases the width of the card/panel */\n.portal-widget-panel-panel-default {\n        width:450px\n}\n\n/*Controls the spacing between the cards */\n.portal-widget-panel-col-sm-3 {\n        width:20.5%\n}\n\n.portal-widget-panel-top {\n    top: 15px;\n  left: 15px;\n}\n\n#portal1-css-ready {\ncolor: #bada55 !important;\n}'),(2,2,'Events','var Portal2Widget = (function(window, undefined) {                                                                                      \n                                                                                                                                    \n var Portal2Widget = Portal2Widget || {};                                                                                                \n      function extractHostPortApp(src) {                                                                                                  \n          \n              Portal2Widget.microserviceId = 2;                                                                                 \n            Portal2Widget.pathArray = src.split( \'/\' );                                                                                     \n                    \n              Portal2Widget.widgetName = 2;\n         Portal2Widget.serviceSeperator = Portal2Widget.pathArray[Portal2Widget.pathArray.length - 4];                                           \n              Portal2Widget.commonUrl = src.substring(0, src.lastIndexOf(\"/\" + Portal2Widget.pathArray[Portal2Widget.pathArray.length - 2]));       \n              \n              Portal2Widget.recipientDivDataAttrib = \'data-\' + Portal2Widget.widgetName;                                                          \n                Portal2Widget.controllerName = \'Portal2Ctrl\';                                                                                     \n          Portal2Widget.readyCssFlag = \'portal2-css-ready\';                                                                                       \n            Portal2Widget.readyCssFlagExpectedValue = \'#bada55\';                                                                            \n            Portal2Widget.serviceURL = src.substring(0, src.lastIndexOf(\"/\" + Portal2Widget.serviceSeperator)) + \'/portalApi/microservice/proxy/parameter/\' + 2;  \n    }                                  \n   \n      extractHostPortApp(document.getElementsByTagName(\'script\')[0].src);\n \n      function loadStylesheet(url) {                                                                                                 \n               var link = document.createElement(\'link\');                                                                                 \n         link.rel = \'stylesheet\';                                                                                                   \n         link.type = \'text/css\';                                                                                                    \n         link.href = url;                                                                                                           \n           var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(link, entry);                                                                                \n   }                                                                                                                              \n                                                                                                                                   \n  function isCssReady(callback) {                                                                                                \n               var testElem = document.createElement(\'span\');                                                                             \n         testElem.id = Portal2Widget.readyCssFlag;                                                                                          \n           testElem.style = \'color: #fff\';                                                                       \n              var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(testElem, entry);                                                                            \n                                                                                                                                  \n               (function poll() {                                                                                                         \n                   var node = document.getElementById(\'css-ready\');                                                                       \n                     var value;                                                                                                             \n                       if (window.getComputedStyle) {                                                                                         \n                               value = document.defaultView.getComputedStyle(testElem, null)                                                      \n                                           .getPropertyValue(\'color\');                                                                                \n                 }                                                                                                                      \n                       else if (node.currentStyle) {                                                                                          \n                               value = node.currentStyle.color;                                                                                   \n                   }                                                                                                                      \n                       if (value && value === \'rgb(186, 218, 85)\' || value.toLowerCase() === Portal2Widget.readyCssFlagExpectedValue) {           \n                         callback();                                                                                                        \n                   } else {                                                                                                               \n                               setTimeout(poll, 500);                                                                                             \n                   }                                                                                                                      \n               })();                                                                                                                      \n   }                                                                                                                              \n                                                                                                                                      \n       function injectCss(css) {                                                                                                      \n               var style = document.createElement(\'style\');                                                                               \n         style.type = \'text/css\';                                                                                                   \n                 css = css.replace(/\\}/g, \"}\\n\");                                                                                           \n                                                                                                                                      \n               if (style.styleSheet) {                                                                                                    \n                   style.styleSheet.cssText = css;                                                                                        \n               } else {                                                                                                                   \n                   style.appendChild(document.createTextNode(css));                                                                       \n               }                                                                                                                          \n           var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(style, entry);                                                                               \n   }                                                                                                                              \n                                                                                                                                      \n       function loadScript(url, callback) {                                                                                           \n               var script = document.createElement(\'script\');                                                                             \n         script.src = url;                                                                                                          \n           \n              var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(script, entry);                                                                              \n           \n              script.onload = script.onreadystatechange = function() {   \n                   var rdyState = script.readyState;                                                                                      \n                       if (!rdyState || /complete|loaded/.test(script.readyState)) {                                                          \n                               callback();                                                                                                        \n                           script.onload = null;                                                                                              \n                           script.onreadystatechange = null;                                                                                  \n                   }                                                                                                                      \n               };                                                                                                                         \n   }                                                                                                                              \n                                                                                                                                   \n  function loadSupportingFiles(callback) {                                                                                       \n               callback();                                                                                                                \n   }                                                                                                                              \n                                                                                                                                      \n       function getWidgetParams() {                                                                                                   \n                                                                                                                                          \n   }                                                                                                                              \n                                                                                                                                      \n       function getWidgetData(widgetUrl, callback) {                                                                                      \n   var responseData;                                                                                                                                                                                                  \n   try{                                                                                                                                                                                                               \n           jQuery.ajax({                                                                                                                                                                                              \n                   url: widgetUrl,                                                                                                                                                                                            \n                   method: \"GET\",                                                                                                                                                                                                   \n                   xhrFields: {                                                                                                                                                                                                       \n                           withCredentials: true                                                                                                                                                                              \n                   },    \n                        crossDomain: true,                      \n                      success: function (result) {                                                                                                                                                                               \n                           if (result.isOk == false){                                                                                                                                                                         \n                                                                                                                                                                                                                              \n                           }else{                                                                                                                                                                                             \n                                   callback(result);                                                                                                                                                                                          \n                           }                                                                                                                                                                                                  \n                   }                                                                                                                                                                                                  \n           });                                                                                                                                                                                                \n   }                                                                                                                                                                                                                  \n   catch(e){                                                                                                                                                                                                          \n   \n      }                                                                                                                                                                                                                  \n                                                                                                                                                                                      \n   }                                                                                                   \n  \n      function getMarkupContent(markupLocation, callback){                                                                             \n                                                                                                                                        \n           try{\n                  jQuery.ajax({                                                                                                              \n                   url: markupLocation,\n                  method: \"GET\",   \n                   xhrFields: {                                                                                                                                                                                                       \n                                   withCredentials: true                                                                                                                                                                              \n                           },   \n                         crossDomain: true,              \n                      success: function (result) {                                                                                           \n                           if (result.isOk == false){                                                                                         \n                                                                                                                                              \n                           }else{                                                                                                             \n                               callback(result);                                                                                   \n                                  }                                                                                                                  \n                   }                                                                                                        \n                     });       \n            }\n             catch(e){\n                     \n              }\n     }                                                                                                                              \n                                                                                                                                      \n       function renderWidget(data, location, $controllerProvider) {                                                                   \n               var div = document.createElement(\'div\');                                                                                   \n         getMarkupContent(Portal2Widget.commonUrl + \"/markup/\" + Portal2Widget.widgetName, function(div){\n                    location.append(div);                                                                                                      \n                   Portal2Widget.widgetData = data;\n                      app.controllerProvider.register(Portal2Widget.controllerName, Portal2Widget.controller);                                           \n                   var mController = angular.element(document.getElementById(\"widgets\"));                                                   \n                   mController.scope().activateThis(location);   \n                });\n           \n      }                                                                                                                              \n                                                                                                                                      \n       function printAllArtifacts(moduleName, controllerName) {                                                                       \n           var queue = angular.module(moduleName)._invokeQueue;                                                                       \n           for(var i=0;i<queue.length;i++) {                                                                                          \n               var call = queue[i];                                                                                                   \n               console.log(i + \'. \' + call[0] + \' - \' + call[1] + \' - \' + call[2][0]);                                                \n     }                                                                                                                          \n       }                                                                                                                              \n                                                                                                                                      \n       function get(name){                                                                                                            \n          if(name=(new RegExp(\'[?&]\'+encodeURIComponent(name)+\'=([^&]*)\')).exec(location.search))                                     \n         return decodeURIComponent(name[1]);                                                                                      \n       }                                                                                                                              \n                                                                                                                                   \n  loadSupportingFiles(function() {                                                                                               \n               loadStylesheet(Portal2Widget.commonUrl + \'/\' + Portal2Widget.widgetName + \'/style.css\');                                           \n               loadScript(Portal2Widget.commonUrl + \'/\' + Portal2Widget.widgetName + \'/controller.js\',                                            \n                       function() {                                                                                                           \n                               $(\'[\'+ Portal2Widget.recipientDivDataAttrib + \']\').each(function() {                                                   \n                                   var location = jQuery(this);                                                                                   \n                                       location.removeAttr(Portal2Widget.recipientDivDataAttrib);                                                         \n                                   var id = location.attr(Portal2Widget.recipientDivDataAttrib);                                                      \n                                   getWidgetData(Portal2Widget.serviceURL, function(data) { \n                                             isCssReady(function(){                                                                                     \n                                                   renderWidget(data, location);                                                                          \n                                               });                                                                                                                                        \n                                   });                                                                                                            \n                               });                                                                                                                \n                   }                                                                                                                      \n               );                                                                                                                         \n   });                                                                                                                            \n                                                                                                                                      \n       return Portal2Widget;                                                                                                              \n})(window);                                                                                                                        \n                              ','Portal2Widget.controller = function Portal2Ctrl($rootScope, applicationsService , $log,\n                    $window, userProfileService, $scope, $cookies, $timeout, $interval,\n                   $uibModal, dashboardService, ngDialog) {Portal2Widget=Portal2Widget||{};var res = Portal2Widget.widgetData;\n           var _this = this;\n\n           //activate spinner\n            this.isLoading = true;\n                $scope.getUserAppsIsDone = false;\n             this.userProfileService = userProfileService;\n         $scope.demoNum = 1;\n           $scope.event_content_show = false;\n            $scope.widgetData = [];\n\n             $scope.editWidgetModalPopup = function(availableData, resourceType) {\n\n                       $scope.editData = JSON.stringify(availableData);\n                      $scope.availableDataTemp = $scope.availableData;\n                      \n              };\n            /*Setting News data*/\n         $scope.eventData = [];\n                $scope.updateEvents = function() {\n\n                  $scope.eventData.length=0;\n                    //dashboardService.getCommonWidgetData(\'EVENTS\').then(function(res) {\n                               var eventDataJsonArray = res.response.items;    \n                              for (var i = 0; i < eventDataJsonArray.length; i++) {\n                                 if(eventDataJsonArray[i].eventDate !=null) {\n                                          // yyyy-mm-dd\n                                         eventDataJsonArray[i].year = eventDataJsonArray[i].eventDate.substring(2,4);\n                                          eventDataJsonArray[i].mon  = eventDataJsonArray[i].eventDate.substring(5,7);\n                                          eventDataJsonArray[i].day  = eventDataJsonArray[i].eventDate.substring(8,10);\n                                 }\n                                     $scope.eventData.push(eventDataJsonArray[i]);\n                         }\n                     //})[\'catch\'](function(err) {\n                       //      $log.error(\'dashboard controller: failed to get Events list\', err);\n                 //      _this.isLoading = false;\n                      //});\n         }\n             $scope.updateEvents();\n\n\n    }\n;Portal2Widget.controller.$inject = [\'$rootScope\',\'applicationsService\',\'$log\',\'$window\',\'userProfileService\',\'$scope\',\'$cookies\',\'$timeout\',\'$interval\',\'$uibModal\',\'dashboardService\',\'ngDialog\'];','<div  id=\"widget-events\" ng-controller=\"Portal2Ctrl\" class=\"widget-news-main\">\n                <div att-gridster-item-body\n                   class=\"information-section-gridsterContent\">\n                        <div class=\"events\">\n                                <ul ng-show=\"eventData.length!=0\">\n                                  <li ng-repeat=\"event in eventData\">\n                                         <div ng-click=\"event_content_show=!event_content_show\">\n                                                     <div class=\"events-date\">{{event.mon}}/{{event.day}}/{{event.year}}\n                                                 </div>\n                                                        <div>\n                                                         <div class=\"event-title-div\">\n                                                                       <p ng-bind=\"event.title\"></p>\n                                                               </div>\n                                                                <div>\n                                                                 <span class=\"icon-chevron-up\" ng-if=\"event_content_show\"\n                                                                          style=\"color: #888; font-size: 22px;\"></span> <span\n                                                                         class=\"icon-chevron-down\" ng-if=\"!event_content_show\"\n                                                                             style=\"color: #888; font-size: 22px;\"></span>\n\n                                                             </div>\n                                                                <div style=\"clear: both;\"></div>\n                                                    </div>\n                                                </div>\n                                                <div class=\"events-content\" ng-show=\"event_content_show\">\n                                                 <div class=\"events-content-body\">\n                                                           <a id=\"event-widget-{{event.id}}\" class=\"events-link\" ng-href=\"{{event.href}}\"\n                                                                  target=\"_blank\"> <span ng-bind=\"event.content\"></span>\n                                                            </a>\n                                                  </div>\n                                                        <div></div>\n                                           </div>\n                                        </li>\n\n\n                             </ul>\n                         <div ng-hide=\"eventData.length!=0\">\n                                 <div class=\"activity-error-container\"\n                                               style=\"background: rgb(255, 255, 255); overflow: hidden !important; width: 100%;\">\n                                          <div class=\"activity-error-block\">\n                                                  <i class=\"icon-information full-linear-icon-information\"\n                                                            style=\"margin-left: 125px; font-size: 90px\"></i> <br>\n                                                       <div class=\"activity-error-msg1\">There\'s currently no\n                                                              event available.</div>\n                                                </div>\n                                        </div>\n                                </div>\n                        </div>\n          </div>\n</div>\n','\n.portal-widget-panel-container {\n       margin-left:150px;\n    width:1500px;\n}\n\n\n.portal-widget-panel-fixed-panel {\n  min-height: 300px;\n  max-height: 1300px;\n  overflow: auto;\n}\n\n.portal-widget-panel-double-middle {\n  min-height: 660px;\n  max-height: 660px;\n  overflow: auto;\n}\n\n.portal-widget-panel-row {\n    margin-right: 0px;\n    margin-left:  0px;\n    width: 2800px;\n}\n\n/*Increases the width of the card/panel */\n.portal-widget-panel-panel-default {\n        width:450px\n}\n\n/*Controls the spacing between the cards */\n.portal-widget-panel-col-sm-3 {\n        width:20.5%\n}\n\n.portal-widget-panel-top {\n    top: 15px;\n  left: 15px;\n}\n\n#portal2-css-ready {\ncolor: #bada55 !important;\n}'),(3,3,'Resources','var Portal3Widget = (function(window, undefined) {                                                                                      \n                                                                                                                                    \n      var Portal3Widget = Portal3Widget || {};                                                                                                \n      function extractHostPortApp(src) {                                                                                                  \n          \n              Portal3Widget.microserviceId = 3;                                                                                 \n            Portal3Widget.pathArray = src.split( \'/\' );                                                                                     \n                    \n              Portal3Widget.widgetName = 3;\n         Portal3Widget.serviceSeperator = Portal3Widget.pathArray[Portal3Widget.pathArray.length - 4];                                           \n              Portal3Widget.commonUrl = src.substring(0, src.lastIndexOf(\"/\" + Portal3Widget.pathArray[Portal3Widget.pathArray.length - 2]));       \n              \n              Portal3Widget.recipientDivDataAttrib = \'data-\' + Portal3Widget.widgetName;                                                          \n                Portal3Widget.controllerName = \'Portal3Ctrl\';                                                                                     \n          Portal3Widget.readyCssFlag = \'portal3-css-ready\';                                                                                       \n            Portal3Widget.readyCssFlagExpectedValue = \'#bada55\';                                                                            \n            Portal3Widget.serviceURL = src.substring(0, src.lastIndexOf(\"/\" + Portal3Widget.serviceSeperator)) + \'/portalApi/microservice/proxy/parameter/\' + 3;  \n    }                                  \n   \n      extractHostPortApp(document.getElementsByTagName(\'script\')[0].src);\n \n      function loadStylesheet(url) {                                                                                                 \n               var link = document.createElement(\'link\');                                                                                 \n         link.rel = \'stylesheet\';                                                                                                   \n         link.type = \'text/css\';                                                                                                    \n         link.href = url;                                                                                                           \n           var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(link, entry);                                                                                \n   }                                                                                                                              \n                                                                                                                                   \n  function isCssReady(callback) {                                                                                                \n               var testElem = document.createElement(\'span\');                                                                             \n         testElem.id = Portal3Widget.readyCssFlag;                                                                                          \n           testElem.style = \'color: #fff\';                                                                       \n              var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(testElem, entry);                                                                            \n                                                                                                                                  \n               (function poll() {                                                                                                         \n                   var node = document.getElementById(\'css-ready\');                                                                       \n                     var value;                                                                                                             \n                       if (window.getComputedStyle) {                                                                                         \n                               value = document.defaultView.getComputedStyle(testElem, null)                                                      \n                                           .getPropertyValue(\'color\');                                                                                \n                 }                                                                                                                      \n                       else if (node.currentStyle) {                                                                                          \n                               value = node.currentStyle.color;                                                                                   \n                   }                                                                                                                      \n                       if (value && value === \'rgb(186, 218, 85)\' || value.toLowerCase() === Portal3Widget.readyCssFlagExpectedValue) {           \n                         callback();                                                                                                        \n                   } else {                                                                                                               \n                               setTimeout(poll, 500);                                                                                             \n                   }                                                                                                                      \n               })();                                                                                                                      \n   }                                                                                                                              \n                                                                                                                                      \n       function injectCss(css) {                                                                                                      \n               var style = document.createElement(\'style\');                                                                               \n         style.type = \'text/css\';                                                                                                   \n                 css = css.replace(/\\}/g, \"}\\n\");                                                                                           \n                                                                                                                                      \n               if (style.styleSheet) {                                                                                                    \n                   style.styleSheet.cssText = css;                                                                                        \n               } else {                                                                                                                   \n                   style.appendChild(document.createTextNode(css));                                                                       \n               }                                                                                                                          \n           var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(style, entry);                                                                               \n   }                                                                                                                              \n                                                                                                                                      \n       function loadScript(url, callback) {                                                                                           \n               var script = document.createElement(\'script\');                                                                             \n         script.src = url;                                                                                                          \n           \n              var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(script, entry);                                                                              \n           \n              script.onload = script.onreadystatechange = function() {   \n                   var rdyState = script.readyState;                                                                                      \n                       if (!rdyState || /complete|loaded/.test(script.readyState)) {                                                          \n                               callback();                                                                                                        \n                           script.onload = null;                                                                                              \n                           script.onreadystatechange = null;                                                                                  \n                   }                                                                                                                      \n               };                                                                                                                         \n   }                                                                                                                              \n                                                                                                                                   \n  function loadSupportingFiles(callback) {                                                                                       \n               callback();                                                                                                                \n   }                                                                                                                              \n                                                                                                                                      \n       function getWidgetParams() {                                                                                                   \n                                                                                                                                          \n   }                                                                                                                              \n                                                                                                                                      \n       function getWidgetData(widgetUrl, callback) {                                                                                      \n   var responseData;                                                                                                                                                                                                  \n   try{                                                                                                                                                                                                               \n           jQuery.ajax({                                                                                                                                                                                              \n                   url: widgetUrl,                                                                                                                                                                                            \n                   method: \"GET\",                                                                                                                                                                                                   \n                   xhrFields: {                                                                                                                                                                                                       \n                           withCredentials: true                                                                                                                                                                              \n                   },    \n                        crossDomain: true,                      \n                      success: function (result) {                                                                                                                                                                               \n                           if (result.isOk == false){                                                                                                                                                                         \n                                                                                                                                                                                                                              \n                           }else{                                                                                                                                                                                             \n                                   callback(result);                                                                                                                                                                                          \n                           }                                                                                                                                                                                                  \n                   }                                                                                                                                                                                                  \n           });                                                                                                                                                                                                \n   }                                                                                                                                                                                                                  \n   catch(e){                                                                                                                                                                                                          \n   \n      }                                                                                                                                                                                                                  \n                                                                                                                                                                                      \n   }                                                                                                   \n  \n      function getMarkupContent(markupLocation, callback){                                                                             \n                                                                                                                                        \n           try{\n                  jQuery.ajax({                                                                                                              \n                   url: markupLocation,\n                  method: \"GET\",   \n                   xhrFields: {                                                                                                                                                                                                       \n                                   withCredentials: true                                                                                                                                                                              \n                           },   \n                         crossDomain: true,              \n                      success: function (result) {                                                                                           \n                           if (result.isOk == false){                                                                                         \n                                                                                                                                              \n                           }else{                                                                                                             \n                               callback(result);                                                                                   \n                                  }                                                                                                                  \n                   }                                                                                                        \n                     });       \n            }\n             catch(e){\n                     \n              }\n     }                                                                                                                              \n                                                                                                                                      \n       function renderWidget(data, location, $controllerProvider) {                                                                   \n               var div = document.createElement(\'div\');                                                                                   \n         getMarkupContent(Portal3Widget.commonUrl + \"/markup/\" + Portal3Widget.widgetName, function(div){\n                    location.append(div);                                                                                                      \n                   Portal3Widget.widgetData = data;\n                      app.controllerProvider.register(Portal3Widget.controllerName, Portal3Widget.controller);                                           \n                   var mController = angular.element(document.getElementById(\"widgets\"));                                                   \n                   mController.scope().activateThis(location);   \n                });\n           \n      }                                                                                                                              \n                                                                                                                                      \n       function printAllArtifacts(moduleName, controllerName) {                                                                       \n           var queue = angular.module(moduleName)._invokeQueue;                                                                       \n           for(var i=0;i<queue.length;i++) {                                                                                          \n               var call = queue[i];                                                                                                   \n               console.log(i + \'. \' + call[0] + \' - \' + call[1] + \' - \' + call[2][0]);                                                \n     }                                                                                                                          \n       }                                                                                                                              \n                                                                                                                                      \n       function get(name){                                                                                                            \n          if(name=(new RegExp(\'[?&]\'+encodeURIComponent(name)+\'=([^&]*)\')).exec(location.search))                                     \n         return decodeURIComponent(name[1]);                                                                                      \n       }                                                                                                                              \n                                                                                                                                   \n  loadSupportingFiles(function() {                                                                                               \n               loadStylesheet(Portal3Widget.commonUrl + \'/\' + Portal3Widget.widgetName + \'/style.css\');                                           \n               loadScript(Portal3Widget.commonUrl + \'/\' + Portal3Widget.widgetName + \'/controller.js\',                                            \n                       function() {                                                                                                           \n                               $(\'[\'+ Portal3Widget.recipientDivDataAttrib + \']\').each(function() {                                                   \n                                   var location = jQuery(this);                                                                                   \n                                       location.removeAttr(Portal3Widget.recipientDivDataAttrib);                                                         \n                                   var id = location.attr(Portal3Widget.recipientDivDataAttrib);                                                      \n                                   getWidgetData(Portal3Widget.serviceURL, function(data) { \n                                             isCssReady(function(){                                                                                     \n                                                   renderWidget(data, location);                                                                          \n                                               });                                                                                                                                        \n                                   });                                                                                                            \n                               });                                                                                                                \n                   }                                                                                                                      \n               );                                                                                                                         \n   });                                                                                                                            \n                                                                                                                                      \n       return Portal3Widget;                                                                                                              \n})(window);                                                                                                                        \n                              ','Portal3Widget.controller = function Portal3Ctrl($rootScope, applicationsService , $log,\n                    $window, userProfileService, $scope, $cookies, $timeout, $interval,\n                   $uibModal, dashboardService, ngDialog) {Portal3Widget=Portal3Widget||{};var res = Portal3Widget.widgetData;\n           \n              var _this = this;       \n\n            //activate spinner\n            this.isLoading = true;\n                $scope.getUserAppsIsDone = false;\n             this.userProfileService = userProfileService;\n         $scope.demoNum = 1;\n           $scope.event_content_show = false;\n            $scope.widgetData = [];\n\n             $scope.editWidgetModalPopup = function(availableData, resourceType) {\n\n                       $scope.editData = JSON.stringify(availableData);\n                      $scope.availableDataTemp = $scope.availableData;\n                      \n              };\n            \n              /*Setting News data*/\n         $scope.newsData = [];\n         $scope.updateNews = function() {\n                      $scope.newsData.length=0;\n                     //dashboardService.getCommonWidgetData(\'NEWS\').then(function(res) {\n                         // $log.info(res.message);\n                            var newsDataJsonArray = res.response.items;\n                           for (var i = 0; i < newsDataJsonArray.length; i++) {\n                                  $scope.newsData.push(newsDataJsonArray[i]);\n                           }\n                     //})[\'catch\'](function(err) {\n                       //      $log.error(\'dashboard controller: failed to get news list\', err);\n                   //      _this.isLoading = false;\n                      //});\n         }\n             $scope.updateNews();\n\n        }\n\n;Portal3Widget.controller.$inject = [\'$rootScope\',\'applicationsService\',\'$log\',\'$window\',\'userProfileService\',\'$scope\',\'$cookies\',\'$timeout\',\'$interval\',\'$uibModal\',\'dashboardService\',\'ngDialog\'];','<div  id=\"widget-news\" ng-controller=\"Portal3Ctrl\" class=\"widget-news-main\">\n                <div att-gridster-item-body class=\"information-section-gridsterContent\">\n                    <div class=\"resources\">\n                             <ul ng-show=\"newsData.length!=0\">\n                                   <li ng-repeat=\"item in newsData\"><a id=\"resource-widget-{{item.id}}\"\n                                                                                              href=\"{{item.href}}\" target=\"_blank\" ng-bind=\"item.title\"></a></li>\n                             </ul>\n                                                 <div ng-hide=\"newsData.length!=0\">\n                                                          <div class=\"activity-error-container\"\n                                                                       style=\"background: rgb(255, 255, 255); overflow: hidden !important; width: 100%;\">\n                                                                  <div class=\"activity-error-block\">\n                                                                          <i class=\"icon-information full-linear-icon-information\"\n                                                                               style=\"margin-left: 125px; font-size: 90px\"></i> <br>\n                                                                            <div class=\"activity-error-msg1\">There\'s currently no\n                                                                                                              news available.</div>\n                                                                 </div>\n                                                                </div>\n                                        </div>\n                        </div>\n                </div>\n</div>\n','\n.portal-widget-panel-container {\n margin-left:150px;\n    width:1500px;\n}\n\n\n.portal-widget-panel-fixed-panel {\n  min-height: 300px;\n  max-height: 1300px;\n  overflow: auto;\n}\n\n.portal-widget-panel-double-middle {\n  min-height: 660px;\n  max-height: 660px;\n  overflow: auto;\n}\n\n.portal-widget-panel-row {\n    margin-right: 0px;\n    margin-left:  0px;\n    width: 2800px;\n}\n\n/*Increases the width of the card/panel */\n.portal-widget-panel-panel-default {\n        width:450px\n}\n\n/*Controls the spacing between the cards */\n.portal-widget-panel-col-sm-3 {\n        width:20.5%\n}\n\n.portal-widget-panel-top {\n    top: 15px;\n  left: 15px;\n}\n\n#portal3-css-ready {\ncolor: #bada55 !important;\n}');
-/*!40000 ALTER TABLE `ep_widget_catalog_files` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_app_contact_us`
---
-
-LOCK TABLES `fn_app_contact_us` WRITE;
-/*!40000 ALTER TABLE `fn_app_contact_us` DISABLE KEYS */;
-INSERT INTO `fn_app_contact_us` (`app_id`, `contact_name`, `contact_email`, `url`, `active_yn`, `description`) VALUES (2,'Portal SDK Team','portal@lists.onap.org','https://wiki.onap.org/display/DW/Approved+Projects',NULL,'xDemo Application'),(3,'DBC Team','portal@lists.onap.org','https://wiki.onap.org/display/DW/Approved+Projects',NULL,'DBC.'),(4,'SDC Team','sdc@lists.onap.org','https://wiki.onap.org/display/DW/Approved+Projects',NULL,'Service Design and Creation (SDC).'),(5,'Policy Team','policy@lists.onap.org','https://wiki.onap.org/display/DW/Approved+Projects',NULL,'Policy.'),(6,'VID Team','vid@lists.onap.org','https://wiki.onap.org/display/DW/Approved+Projects',NULL,'Virtual Infrastructure Design.'),(7,'AAI UI Team','aaiui@lists.onap.org','https://wiki.onap.org/display/DW/Approved+Projects',NULL,'AAI UI Application'),(8,'CLI Team','onap-discuss@lists.onap.org','https://wiki.onap.org/display/DW/Approved+Projects',NULL,'CLI Application'),(10,'SO Team','so@lists.onap.org','https://wiki.onap.org/display/DW/Approved+Projects',NULL,'Service Orchestration (SO).');
-/*!40000 ALTER TABLE `fn_app_contact_us` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_common_widget_data`
---
-
-LOCK TABLES `fn_common_widget_data` WRITE;
-/*!40000 ALTER TABLE `fn_common_widget_data` DISABLE KEYS */;
-INSERT INTO `fn_common_widget_data` (`id`, `category`, `href`, `title`, `content`, `event_date`, `sort_order`) VALUES (6,'NEWS','https://www.onap.org/announcement/2017/09/27/open-network-automation-platform-onap-project-continues-rapid-membership-growth','Open Network Automation Platform (ONAP) Project Continues Rapid Membership Growth',NULL,NULL,10),(7,'NEWS','https://www.onap.org/announcement/2017/02/23/the-linux-foundation-announces-the-formation-of-a-new-project-to-help-accelerate-innovation-in-open-networking-automation','The Linux Foundation Announces Merger of Open Source ECOMP and OPEN-O to Form New Open Network Automation Platform (ONAP) Project',NULL,NULL,20),(8,'NEWS','http://about.att.com/story/orange_testing_att_open_source_ecomp_platform.html','Orange Testing AT&Ts Open Source ECOMP Platform for Building Software-Defined Network Capabilities',NULL,NULL,30),(9,'NEWS','http://about.att.com/innovationblog/linux_foundation','Opening up ECOMP: Our Network Operating System for SDN',NULL,NULL,40),(10,'EVENTS','https://onapbeijing2017.sched.com/list/descriptions/','ONAP Beijing Release Developer Forum',NULL,'2017-12-11',1),(11,'EVENTS','https://events.linuxfoundation.org/events/open-networking-summit-north-america-2018','Open Networking Summit',NULL,'2018-03-26',2),(12,'IMPORTANTRESOURCES','http://onap.readthedocs.io/en/latest/guides/onap-developer/developing/index.html','Development Guides',NULL,NULL,1),(13,'IMPORTANTRESOURCES','https://wiki.onap.org/','ONAP Wiki',NULL,NULL,2),(14,'IMPORTANTRESOURCES','http://onap.readthedocs.io/en/latest/guides/onap-developer/developing/index.html#portal-platform','ONAP Portal Documentation',NULL,NULL,3),(15,'IMPORTANTRESOURCES','http://onap.readthedocs.io/en/latest/guides/onap-developer/architecture/index.html#architecture','ONAP Architecture',NULL,NULL,4);
-/*!40000 ALTER TABLE `fn_common_widget_data` ENABLE KEYS */;
-UNLOCK TABLES;
-
-
---
--- Dumping data for table `fn_display_text`
---
-
-LOCK TABLES `fn_display_text` WRITE;
-/*!40000 ALTER TABLE `fn_display_text` DISABLE KEYS */;
-INSERT INTO `fn_display_text` (`id`, `language_id`, `text_id`, `text_label`) VALUES (1,1,2,'Home'),(2,1,3,'Application Catalog'),(3,1,4,'Widget Catalog'),(4,1,5,'Admins'),(5,1,6,'Roles'),(6,1,7,'Users'),(7,1,8,'Portal Admins'),(8,1,9,'Application Onboarding'),(9,1,10,'Widget Onboarding'),(10,1,11,'Edit Functional Menu'),(11,1,12,'User Notifications'),(12,1,13,'Microservice Onboarding'),(13,1,15,'App Account Management'),(14,2,2,'主页'),(15,2,3,'应用目录'),(16,2,4,'部件目录'),(17,2,5,'管ç\90†å‘˜'),(18,2,6,'角色'),(19,2,7,'用户'),(20,2,8,'门户管ç\90†å‘˜'),(21,2,9,'应用管ç\90†'),(22,2,10,'部件管ç\90†'),(23,2,11,'编辑功能è\8fœå\8d•'),(24,2,12,'用户通知'),(25,2,13,'å¾®æœ\8d务管ç\90†'),(26,2,15,'应用账户管ç\90†');
-/*!40000 ALTER TABLE `fn_display_text` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_function`
---
-
-LOCK TABLES `fn_function` WRITE;
-/*!40000 ALTER TABLE `fn_function` DISABLE KEYS */;
-INSERT INTO `fn_function` (`function_cd`, `function_name`) VALUES ('edit_notification','User Notification'),('getAdminNotifications','Admin Notifications'),('login','Login'),('menu_admin','Admin Menu'),('menu_ajax','Ajax Menu'),('menu_customer','Customer Menu'),('menu_customer_create','Customer Create'),('menu_feedback','Feedback Menu'),('menu_help','Help Menu'),('menu_home','Home Menu'),('menu_job','Job Menu'),('menu_job_create','Job Create'),('menu_job_designer','Process in Designer view'),('menu_logout','Logout Menu'),('menu_map','Map Menu'),('menu_notes','Notes Menu'),('menu_process','Process List'),('menu_profile','Profile Menu'),('menu_profile_create','Profile Create'),('menu_profile_import','Profile Import'),('menu_reports','Reports Menu'),('menu_sample','Sample Pages Menu'),('menu_tab','Sample Tab Menu'),('menu_task','Task Menu'),('menu_task_search','Task Search'),('menu_web_analytics','Web Analytics'),('saveNotification','publish notifications'),('view_reports','View Raptor reports');
-/*!40000 ALTER TABLE `fn_function` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_language`
---
-
-LOCK TABLES `fn_language` WRITE;
-/*!40000 ALTER TABLE `fn_language` DISABLE KEYS */;
-INSERT INTO `fn_language` (`language_name`, `language_alias`) VALUES ('English','EN'),('简体中文','CN');
-/*!40000 ALTER TABLE `fn_language` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_lu_activity`
---
-
-LOCK TABLES `fn_lu_activity` WRITE;
-/*!40000 ALTER TABLE `fn_lu_activity` DISABLE KEYS */;
-INSERT INTO `fn_lu_activity` (`activity_cd`, `activity`) VALUES ('add_child_role','add_child_role'),('add_role','add_role'),('add_role_function','add_role_function'),('add_user_role','add_user_role'),('apa','Add Portal Admin'),('app_access','App Access'),('dpa','Delete Portal Admin'),('eaaf','External auth add function'),('eaar','External auth add role'),('eadf','External auth delete function'),('eadr','External auth delete role'),('eauf','External auth update function'),('eaurf','External auth update role and function'),('functional_access','Functional Access'),('guest_login','Guest Login'),('left_menu_access','Left Menu Access'),('login','Login'),('logout','Logout'),('mobile_login','Mobile Login'),('mobile_logout','Mobile Logout'),('remove_child_role','remove_child_role'),('remove_role','remove_role'),('remove_role_function','remove_role_function'),('remove_user_role','remove_user_role'),('search','Search'),('tab_access','Tab Access'),('uaa','Update Account Admin'),('uu','Update User');
-/*!40000 ALTER TABLE `fn_lu_activity` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_lu_alert_method`
---
-
-LOCK TABLES `fn_lu_alert_method` WRITE;
-/*!40000 ALTER TABLE `fn_lu_alert_method` DISABLE KEYS */;
-INSERT INTO `fn_lu_alert_method` (`alert_method_cd`, `alert_method`) VALUES ('EMAIL','Email'),('FAX','Fax'),('PAGER','Pager'),('PHONE','Phone'),('SMS','SMS');
-/*!40000 ALTER TABLE `fn_lu_alert_method` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_lu_menu_set`
---
-
-LOCK TABLES `fn_lu_menu_set` WRITE;
-/*!40000 ALTER TABLE `fn_lu_menu_set` DISABLE KEYS */;
-INSERT INTO `fn_lu_menu_set` (`menu_set_cd`, `menu_set_name`) VALUES ('APP','Application Menu');
-/*!40000 ALTER TABLE `fn_lu_menu_set` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_lu_priority`
---
-
-LOCK TABLES `fn_lu_priority` WRITE;
-/*!40000 ALTER TABLE `fn_lu_priority` DISABLE KEYS */;
-INSERT INTO `fn_lu_priority` (`priority_id`, `priority`, `active_yn`, `sort_order`) VALUES (10,'Low',1,10),(20,'Normal',1,20),(30,'High',1,30),(40,'Urgent',1,40),(50,'Fatal',1,50);
-/*!40000 ALTER TABLE `fn_lu_priority` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_lu_tab_set`
---
-
-LOCK TABLES `fn_lu_tab_set` WRITE;
-/*!40000 ALTER TABLE `fn_lu_tab_set` DISABLE KEYS */;
-INSERT INTO `fn_lu_tab_set` (`tab_set_cd`, `tab_set_name`) VALUES ('APP','Application Tabs');
-/*!40000 ALTER TABLE `fn_lu_tab_set` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_lu_timezone`
---
-
-LOCK TABLES `fn_lu_timezone` WRITE;
-/*!40000 ALTER TABLE `fn_lu_timezone` DISABLE KEYS */;
-INSERT INTO `fn_lu_timezone` (`timezone_id`, `timezone_name`, `timezone_value`) VALUES (10,'US/Eastern','US/Eastern'),(20,'US/Central','US/Central'),(30,'US/Mountain','US/Mountain'),(40,'US/Arizona','America/Phoenix'),(50,'US/Pacific','US/Pacific'),(60,'US/Alaska','US/Alaska'),(70,'US/Hawaii','US/Hawaii');
-/*!40000 ALTER TABLE `fn_lu_timezone` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_menu`
---
-
-LOCK TABLES `fn_menu` WRITE;
-/*!40000 ALTER TABLE `fn_menu` DISABLE KEYS */;
-INSERT INTO `fn_menu` (`menu_id`, `label`, `parent_id`, `sort_order`, `action`, `function_cd`, `active_yn`, `servlet`, `query_string`, `external_url`, `target`, `menu_set_cd`, `separator_yn`, `image_src`) VALUES (1,'root',NULL,10,NULL,'menu_home',0,NULL,NULL,NULL,NULL,'APP',0,NULL),(2,'Home',1,10,'root.applicationsHome','menu_home',1,NULL,NULL,NULL,NULL,'APP',0,'icon-building-home'),(3,'Application Catalog',1,15,'root.appCatalog','menu_home',1,NULL,NULL,NULL,NULL,'APP',0,'icon-retail-gallery'),(4,'Widget Catalog',1,20,'root.widgetCatalog','menu_home',1,NULL,NULL,NULL,NULL,'APP',0,'icon-retail-gallery'),(5,'Admins',1,40,'root.admins','menu_admin',1,NULL,NULL,NULL,NULL,'APP',0,'icon-content-star'),(6,'Roles',1,45,'root.roles','menu_acc_admin',1,NULL,NULL,NULL,NULL,'APP',0,'icon-people-groupcollaboration'),(7,'Users',1,50,'root.users','menu_acc_admin',1,NULL,NULL,NULL,NULL,'APP',0,'icon-people-groupcollaboration'),(8,'Portal Admins',1,60,'root.portalAdmins','menu_admin',1,NULL,NULL,NULL,NULL,'APP',0,'icon-controls-settingsconnectedactivity'),(9,'Application Onboarding',1,70,'root.applications','menu_admin',1,NULL,NULL,NULL,NULL,'APP',0,'icon-content-grid2'),(10,'Widget Onboarding',1,80,'root.widgetOnboarding','menu_admin',1,NULL,NULL,NULL,NULL,'APP',0,'icon-content-grid2'),(11,'Edit Functional Menu',1,90,'root.functionalMenu','menu_admin',1,NULL,NULL,NULL,NULL,'APP',0,'icon-misc-pen'),(12,'User Notifications',1,100,'root.userNotifications','edit_notification',1,NULL,NULL,NULL,NULL,'APP',0,'icon-controls-settingsconnectedactivity'),(13,'Microservice Onboarding',1,110,'root.microserviceOnboarding','menu_admin',1,NULL,NULL,NULL,NULL,'APP',0,'icon-content-grid2'),(15,'App Account Management',1,130,'root.accountOnboarding','menu_admin',1,NULL,NULL,NULL,NULL,'App',0,'icon-content-grid2');
-/*!40000 ALTER TABLE `fn_menu` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_menu_functional`
---
-
-LOCK TABLES `fn_menu_functional` WRITE;
-/*!40000 ALTER TABLE `fn_menu_functional` DISABLE KEYS */;
-INSERT INTO
-  `fn_menu_functional` (
-    `menu_id`,
-    `column_num`,
-    `text`,
-    `parent_menu_id`,
-    `url`,
-    `active_yn`,
-    `image_src`
-  )
-VALUES
-  (175, 1, 'Manage', NULL, '', 1, NULL),
-  (178, 2, 'Support', NULL, '', 1, NULL),
-  (1, 2, 'Design', 175, '', 1, NULL),
-  (2, 8, 'ECOMP Platform Management', 175, '', 0, NULL),
-  (3, 5, 'Technology Insertion', 175, '', 1, NULL),
-  (5, 7, 'Performance Management', 175, '', 0, NULL),
-  (6, 6, 'Technology Management', 175, '', 1, NULL),
-  (7, 4, 'Capacity Planning', 175, '', 0, NULL),
-  (8, 3, 'Operations Planning', 175, '', 1, NULL),
-  (11, 1, 'Product Design', 1, '', 1, NULL),
-  (12, 2, 'Resource/Service Design & Onboarding', 1, '', 1, NULL),
-  (13, 3, 'Orchestration (recipe/Process) Design', 1, '', 0, NULL),
-  (14, 4, 'Service Graph visualizer', 1, '', 0, NULL),
-  (15, 5, 'Distribution', 1, '', 1, NULL),
-  (16, 6, 'Testing', 1, '', 1, NULL),
-  (17, 7, 'Simulation', 1, '', 0, NULL),
-  (18, 8, 'Certification', 1, '', 0, NULL),
-  (19, 9, 'Policy Creation/Management', 1, 'http://policy.api.simpledemo.onap.org:8443/onap/policy', 1, NULL),
-  (20, 10, 'Catalog Browser', 1, '', 1, NULL),
-  (24, 5, 'Create/Manage Policy', 12, 'http://policy.api.simpledemo.onap.org:8443/onap/policy', 1, NULL),
-  (56, 1, 'Policy Engineering', 8, 'http://policy.api.simpledemo.onap.org:8443/onap/policy', 1, NULL),
-  (115, 1, 'Test/Approve a Resource or Service', 16, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/dashboard', 1, NULL),
-  (130, 1, 'Favorites', 175, '', 1, NULL),
-  (139, 2, 'Approve a Service for distribution', 12, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/dashboard', 1,NULL),
-  (142, 3, 'Create a License model', 12, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/onboardVendor', 1, NULL),
-  (145, 1, 'Distribute a Service', 15, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/dashboard', 1, NULL),
-  (181, 1, 'Contact Us', 178, '', 1, NULL),
-  (184, 2, 'Get Access', 178, '', 1, NULL),
-  (301, 1, 'Create a Product', 11, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/dashboard', 1, NULL),
-  (304, 2, 'Create a Vendor Software Product', 11, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/onboardVendor', 1, NULL),
-  (307, 1, 'Manage a Resource/Service', 20, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/catalog', 1, NULL),
-  (310, 2, 'Manage a Product', 20, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/catalog', 1, NULL),
-       (313, 3, 'View a Resource/Service/Product', 20, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/catalog', 1, NULL),
-       (316, 11, 'Administration', 1, '', 1, NULL),
-       (148, 1, 'User Management / Category Management', 316, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/adminDashboard', 1, NULL),
-       (317, 1, 'Message Bus Management', 6, 'http://portal.api.simpledemo.onap.org:8989/ECOMPDBCAPP/dbc#/dmaap', 1, NULL),
-       (318, 1, 'Infrastructure Provisioning', 3, '', 1, NULL),
-       (319, 1, 'Infrastructure VNF Provisioning', 318, 'https://vid.api.simpledemo.onap.org:8443/vid/welcome.htm', 1, NULL);
-
-/*!40000 ALTER TABLE `fn_menu_functional` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_menu_functional_ancestors`
---
-
-LOCK TABLES `fn_menu_functional_ancestors` WRITE;
-/*!40000 ALTER TABLE `fn_menu_functional_ancestors` DISABLE KEYS */;
-INSERT INTO `fn_menu_functional_ancestors` (`id`, `menu_id`, `ancestor_menu_id`, `depth`) VALUES (1,175,175,0),(2,178,178,0),(3,11,11,0),(4,12,12,0),(5,13,13,0),(6,14,14,0),(7,15,15,0),(8,16,16,0),(9,17,17,0),(10,18,18,0),(11,19,19,0),(12,20,20,0),(13,316,316,0),(14,318,318,0),(15,317,317,0),(16,56,56,0),(17,301,301,0),(18,304,304,0),(19,24,24,0),(20,139,139,0),(21,142,142,0),(22,145,145,0),(23,115,115,0),(24,307,307,0),(25,310,310,0),(26,313,313,0),(27,1,1,0),(28,2,2,0),(29,3,3,0),(30,5,5,0),(31,6,6,0),(32,7,7,0),(33,8,8,0),(34,130,130,0),(35,181,181,0),(36,184,184,0),(37,148,148,0),(38,319,319,0),(64,11,1,1),(65,12,1,1),(66,13,1,1),(67,14,1,1),(68,15,1,1),(69,16,1,1),(70,17,1,1),(71,18,1,1),(72,19,1,1),(73,20,1,1),(74,316,1,1),(75,318,3,1),(76,317,6,1),(77,56,8,1),(78,301,11,1),(79,304,11,1),(80,24,12,1),(81,139,12,1),(82,142,12,1),(83,145,15,1),(84,115,16,1),(85,307,20,1),(86,310,20,1),(87,313,20,1),(88,1,175,1),(89,2,175,1),(90,3,175,1),(91,5,175,1),(92,6,175,1),(93,7,175,1),(94,8,175,1),(95,130,175,1),(96,181,178,1),(97,184,178,1),(98,148,316,1),(99,319,318,1),(127,301,1,2),(128,304,1,2),(129,24,1,2),(130,139,1,2),(131,142,1,2),(132,145,1,2),(133,115,1,2),(134,307,1,2),(135,310,1,2),(136,313,1,2),(137,148,1,2),(138,319,3,2),(139,11,175,2),(140,12,175,2),(141,13,175,2),(142,14,175,2),(143,15,175,2),(144,16,175,2),(145,17,175,2),(146,18,175,2),(147,19,175,2),(148,20,175,2),(149,316,175,2),(150,318,175,2),(151,317,175,2),(152,56,175,2),(158,301,175,3),(159,304,175,3),(160,24,175,3),(161,139,175,3),(162,142,175,3),(163,145,175,3),(164,115,175,3),(165,307,175,3),(166,310,175,3),(167,313,175,3),(168,148,175,3),(169,319,175,3);
-/*!40000 ALTER TABLE `fn_menu_functional_ancestors` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_menu_functional_roles`
---
-
-LOCK TABLES `fn_menu_functional_roles` WRITE;
-/*!40000 ALTER TABLE `fn_menu_functional_roles` DISABLE KEYS */;
-INSERT INTO `fn_menu_functional_roles` (`id`, `menu_id`, `app_id`, `role_id`) VALUES (1,19,5,1007),(2,19,5,1006),(3,24,5,1007),(4,24,5,1006),(5,56,5,1007),(6,56,5,1006),(8,115,4,1004),(9,115,4,1005),(10,139,4,1004),(11,139,4,1005),(12,142,4,1004),(13,142,4,1005),(14,145,4,1004),(15,145,4,1005),(16,148,4,1004),(17,148,4,1005),(18,301,4,1004),(19,301,4,1005),(20,304,4,1004),(21,304,4,1005),(22,307,4,1004),(23,307,4,1005),(24,310,4,1004),(25,310,4,1005),(26,313,4,1004),(27,313,4,1005),(39,319,6,1009),(40,319,6,1008),(42,317,3,1003),(43,317,3,1002);
-/*!40000 ALTER TABLE `fn_menu_functional_roles` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_qz_job_details`
---
-
-LOCK TABLES `fn_qz_job_details` WRITE;
-/*!40000 ALTER TABLE `fn_qz_job_details` DISABLE KEYS */;
-INSERT INTO `fn_qz_job_details` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `JOB_CLASS_NAME`, `IS_DURABLE`, `IS_NONCONCURRENT`, `IS_UPDATE_DATA`, `REQUESTS_RECOVERY`, `JOB_DATA`) VALUES ('Scheduler_20190808_one','LogJob','AppGroup',NULL,'org.onap.portalapp.scheduler.LogJob','0','1','1','0','��\0\ 5sr\0\15org.quartz.JobDataMap���迩��\ 2\0\0xr\0&org.quartz.utils.StringKeyDirtyFlagMap�\b����](\ 2\0\ 1Z\0\13allowsTransientDataxr\0\1dorg.quartz.utils.DirtyFlagMap\13�.�(v\n�\ 2\0\ 2Z\0\ 5dirtyL\0\ 3mapt\0\ fLjava/util/Map;xp\ 1sr\0\11java.util.HashMap\ 5\a���\16`�\ 3\0\ 2F\0\nloadFactorI\0       thresholdxp?@\0\0\0\0\0\fw\b\0\0\0\10\0\0\0\ 1t\0\ 5unitst\0\ 5bytesx\0'),('Scheduler_20190808_one','PortalSessionTimeoutFeedJob','AppGroup',NULL,'org.onap.portalapp.service.sessionmgt.TimeoutHandler','0','1','1','0','��\0\ 5sr\0\15org.quartz.JobDataMap���迩��\ 2\0\0xr\0&org.quartz.utils.StringKeyDirtyFlagMap�\b����](\ 2\0\ 1Z\0\13allowsTransientDataxr\0\1dorg.quartz.utils.DirtyFlagMap\13�.�(v\n�\ 2\0\ 2Z\0\ 5dirtyL\0\ 3mapt\0\ fLjava/util/Map;xp\0sr\0\11java.util.HashMap\ 5\a���\16`�\ 3\0\ 2F\0\nloadFactorI\0      thresholdxp?@\0\0\0\0\0\10w\b\0\0\0\10\0\0\0\0x\0');
-/*!40000 ALTER TABLE `fn_qz_job_details` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_qz_locks`
---
-
-LOCK TABLES `fn_qz_locks` WRITE;
-/*!40000 ALTER TABLE `fn_qz_locks` DISABLE KEYS */;
-INSERT INTO `fn_qz_locks` (`SCHED_NAME`, `LOCK_NAME`) VALUES ('Scheduler_20190808_one','STATE_ACCESS'),('Scheduler_20190808_one','TRIGGER_ACCESS');
-/*!40000 ALTER TABLE `fn_qz_locks` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_qz_scheduler_state`
---
-
-LOCK TABLES `fn_qz_scheduler_state` WRITE;
-/*!40000 ALTER TABLE `fn_qz_scheduler_state` DISABLE KEYS */;
-INSERT INTO `fn_qz_scheduler_state` (`SCHED_NAME`, `INSTANCE_NAME`, `LAST_CHECKIN_TIME`, `CHECKIN_INTERVAL`) VALUES ('Scheduler_20190808_one','portal-portal-app-76c9f7bfb5-s8rhd1565254283688',1565691615399,20000);
-/*!40000 ALTER TABLE `fn_qz_scheduler_state` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_qz_triggers`
---
-
-LOCK TABLES `fn_qz_triggers` WRITE;
-/*!40000 ALTER TABLE `fn_qz_triggers` DISABLE KEYS */;
-INSERT INTO `fn_qz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `NEXT_FIRE_TIME`, `PREV_FIRE_TIME`, `PRIORITY`, `TRIGGER_STATE`, `TRIGGER_TYPE`, `START_TIME`, `END_TIME`, `CALENDAR_NAME`, `MISFIRE_INSTR`, `JOB_DATA`) VALUES ('Scheduler_20190808_one','LogTrigger','AppGroup','LogJob','AppGroup',NULL,1565691660000,1565691600000,0,'WAITING','CRON',1565254275000,0,NULL,0,''),('Scheduler_20190808_one','PortalSessionTimeoutFeedTrigger','AppGroup','PortalSessionTimeoutFeedJob','AppGroup',NULL,1565691900000,1565691600000,0,'WAITING','CRON',1565254275000,0,NULL,0,'');
-/*!40000 ALTER TABLE `fn_qz_triggers` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_qz_cron_triggers`
---
-
-LOCK TABLES `fn_qz_cron_triggers` WRITE;
-/*!40000 ALTER TABLE `fn_qz_cron_triggers` DISABLE KEYS */;
-INSERT INTO `fn_qz_cron_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `CRON_EXPRESSION`, `TIME_ZONE_ID`) VALUES ('Scheduler_20190808_one','LogTrigger','AppGroup','0 * * * * ? *','GMT'),('Scheduler_20190808_one','PortalSessionTimeoutFeedTrigger','AppGroup','0 0/5 * * * ? *','GMT');
-/*!40000 ALTER TABLE `fn_qz_cron_triggers` ENABLE KEYS */;
-UNLOCK TABLES;
-
-
---
--- Dumping data for table `fn_restricted_url`
---
-
-LOCK TABLES `fn_restricted_url` WRITE;
-/*!40000 ALTER TABLE `fn_restricted_url` DISABLE KEYS */;
-INSERT INTO `fn_restricted_url` (`restricted_url`, `function_cd`) VALUES ('async_test.htm','menu_home'),('attachment.htm','menu_admin'),('broadcast.htm','menu_admin'),('chatWindow.htm','menu_home'),('contact_list.htm','menu_home'),('customer_dynamic_list.htm','menu_home'),('event.htm','menu_home'),('event_list.htm','menu_home'),('file_upload.htm','menu_admin'),('gauge.htm','menu_tab'),('gmap_controller.htm','menu_tab'),('gmap_frame.htm','menu_tab'),('jbpm_designer.htm','menu_job_create'),('jbpm_drools.htm','menu_job_create'),('job.htm','menu_admin'),('map.htm','menu_tab'),('map_download.htm','menu_tab'),('map_grid_search.htm','menu_tab'),('mobile_welcome.htm','menu_home'),('process_job.htm','menu_job_create'),('profile.htm','menu_profile_create'),('raptor.htm','menu_reports'),('raptor.htm','view_reports'),('raptor2.htm','menu_reports'),('raptor_blob_extract.htm','menu_reports'),('raptor_blob_extract.htm','view_reports'),('raptor_email_attachment.htm','menu_reports'),('raptor_search.htm','menu_reports'),('report_list.htm','menu_reports'),('role.htm','menu_admin'),('role_function.htm','menu_admin'),('sample_animated_map.htm','menu_tab'),('sample_map.htm','menu_home'),('sample_map_2.htm','menu_tab'),('sample_map_3.htm','menu_tab'),('tab2_sub1.htm','menu_tab'),('tab2_sub2_link1.htm','menu_tab'),('tab2_sub2_link2.htm','menu_tab'),('tab2_sub3.htm','menu_tab'),('tab3.htm','menu_tab'),('tab4.htm','menu_tab'),('template.jsp','menu_home'),('test.htm','menu_admin');
-/*!40000 ALTER TABLE `fn_restricted_url` ENABLE KEYS */;
-UNLOCK TABLES;
-
-
-
---
--- Dumping data for table `fn_role_composite`
---
-
-LOCK TABLES `fn_role_composite` WRITE;
-/*!40000 ALTER TABLE `fn_role_composite` DISABLE KEYS */;
-INSERT INTO `fn_role_composite` (`parent_role_id`, `child_role_id`) VALUES (1,16);
-/*!40000 ALTER TABLE `fn_role_composite` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_role_function`
---
-
-LOCK TABLES `fn_role_function` WRITE;
-/*!40000 ALTER TABLE `fn_role_function` DISABLE KEYS */;
-INSERT INTO `fn_role_function` (`role_id`, `function_cd`) VALUES (1,'login'),(1,'menu_admin'),(1,'menu_ajax'),(1,'menu_customer'),(1,'menu_customer_create'),(1,'menu_feedback'),(1,'menu_help'),(1,'menu_home'),(1,'menu_job'),(1,'menu_job_create'),(1,'menu_logout'),(1,'menu_notes'),(1,'menu_process'),(1,'menu_profile'),(1,'menu_profile_create'),(1,'menu_profile_import'),(1,'menu_reports'),(1,'menu_sample'),(1,'menu_tab'),(16,'login'),(16,'menu_ajax'),(16,'menu_customer'),(16,'menu_customer_create'),(16,'menu_home'),(16,'menu_logout'),(16,'menu_map'),(16,'menu_profile'),(16,'menu_reports'),(16,'menu_tab'),(950,'edit_notification'),(950,'getAdminNotifications'),(950,'saveNotification'),(1010,'menu_web_analytics'),(2115,'menu_web_analytics');
-/*!40000 ALTER TABLE `fn_role_function` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_shared_context`
---
-
-LOCK TABLES `fn_shared_context` WRITE;
-/*!40000 ALTER TABLE `fn_shared_context` DISABLE KEYS */;
-INSERT INTO `fn_shared_context` (`id`, `create_time`, `context_id`, `ckey`, `cvalue`) VALUES (1,'2019-08-08 10:11:18','b999771d~2d60~4638~a670~d47d17219157','USER_FIRST_NAME','Jimmy'),(2,'2019-08-08 10:11:18','b999771d~2d60~4638~a670~d47d17219157','USER_LAST_NAME','Hendrix'),(3,'2019-08-08 10:11:18','b999771d~2d60~4638~a670~d47d17219157','USER_EMAIL','admin@onap.org'),(4,'2019-08-08 10:11:18','b999771d~2d60~4638~a670~d47d17219157','USER_ORG_USERID','jh0003'),(5,'2019-08-08 10:17:47','29cc8f94~5a7d~41f8~b359~432bb903a718','USER_FIRST_NAME','Demo'),(6,'2019-08-08 10:17:47','29cc8f94~5a7d~41f8~b359~432bb903a718','USER_LAST_NAME','User'),(7,'2019-08-08 10:17:47','29cc8f94~5a7d~41f8~b359~432bb903a718','USER_EMAIL','demo@openecomp.org'),(8,'2019-08-08 10:17:47','29cc8f94~5a7d~41f8~b359~432bb903a718','USER_ORG_USERID','demo'),(9,'2019-08-08 11:01:02','7e3ced0a~52a3~492a~be53~2885d2df5a43','USER_FIRST_NAME','Demo'),(10,'2019-08-08 11:01:02','7e3ced0a~52a3~492a~be53~2885d2df5a43','USER_LAST_NAME','User'),(11,'2019-08-08 11:01:02','7e3ced0a~52a3~492a~be53~2885d2df5a43','USER_EMAIL','demo@openecomp.org'),(12,'2019-08-08 11:01:02','7e3ced0a~52a3~492a~be53~2885d2df5a43','USER_ORG_USERID','demo');
-/*!40000 ALTER TABLE `fn_shared_context` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_tab`
---
-
-LOCK TABLES `fn_tab` WRITE;
-/*!40000 ALTER TABLE `fn_tab` DISABLE KEYS */;
-INSERT INTO `fn_tab` (`tab_cd`, `tab_name`, `tab_descr`, `action`, `function_cd`, `active_yn`, `sort_order`, `parent_tab_cd`, `tab_set_cd`) VALUES ('TAB1','Tab 1','Tab 1 Information','tab1.htm','menu_tab',1,10,NULL,'APP'),('TAB2','Tab 2','Tab 2 Information','tab2_sub1.htm','menu_tab',1,20,NULL,'APP'),('TAB2_SUB1','Sub Tab 1','Sub Tab 1 Information','tab2_sub1.htm','menu_tab',1,10,'TAB2','APP'),('TAB2_SUB1_S1','Left Tab 1','Sub - Sub Tab 1 Information','tab2_sub1.htm','menu_tab',1,10,'TAB2_SUB1','APP'),('TAB2_SUB2','Sub Tab 2','Sub Tab 2 Information','tab2_sub2.htm','menu_tab',1,20,'TAB2','APP'),('TAB2_SUB3','Sub Tab 3','Sub Tab 3 Information','tab2_sub3.htm','menu_tab',1,30,'TAB2','APP'),('TAB3','Tab 3','Tab 3 Information','tab3.htm','menu_tab',1,30,NULL,'APP'),('TAB4','Tab 4','Tab 4 Information','tab4.htm','menu_tab',1,40,NULL,'APP');
-/*!40000 ALTER TABLE `fn_tab` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_tab_selected`
---
-
-LOCK TABLES `fn_tab_selected` WRITE;
-/*!40000 ALTER TABLE `fn_tab_selected` DISABLE KEYS */;
-INSERT INTO `fn_tab_selected` (`selected_tab_cd`, `tab_uri`) VALUES ('TAB1','tab1'),('TAB2','tab2_sub1'),('TAB2','tab2_sub2'),('TAB2','tab2_sub3'),('TAB2_SUB1','tab2_sub1'),('TAB2_SUB1_S1','tab2_sub1'),('TAB2_SUB2','tab2_sub2'),('TAB2_SUB3','tab2_sub3'),('TAB3','tab3'),('TAB4','tab4');
-/*!40000 ALTER TABLE `fn_tab_selected` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_user`
---
-
-LOCK TABLES `fn_user` WRITE;
-/*!40000 ALTER TABLE `fn_user` DISABLE KEYS */;
-INSERT INTO
-  `fn_user` (
-    `org_id`,
-    `manager_id`,
-    `first_name`,
-    `middle_name`,
-    `last_name`,
-    `phone`,
-    `fax`,
-    `cellular`,
-    `email`,
-    `address_id`,
-    `alert_method_cd`,
-    `hrid`,
-    `org_user_id`,
-    `org_code`,
-    `login_id`,
-    `login_pwd`,
-    `last_login_date`,
-    `active_yn`,
-    `created_id`,
-    `created_date`,
-    `modified_id`,
-    `modified_date`,
-    `is_internal_yn`,
-    `address_line_1`,
-    `address_line_2`,
-    `city`,
-    `state_cd`,
-    `zip_code`,
-    `country_cd`,
-    `location_clli`,
-    `org_manager_userid`,
-    `company`,
-    `department_name`,
-    `job_title`,
-    `timezone`,
-    `department`,
-    `business_unit`,
-    `business_unit_name`,
-    `cost_center`,
-    `fin_loc_code`,
-    `silo_status`,
-    `language_id`
-  )
-VALUES
-  (
-    NULL,
-    NULL,
-    'Demo',
-    NULL,
-    'User',
-    NULL,
-    NULL,
-    NULL,
-    'demo@openecomp.org',
-    NULL,
-    NULL,
-    NULL,
-    'demo',
-    NULL,
-    'demo',
-    'demo123',
-    '2019-08-08 12:18:17',
-    1,
-    NULL,
-    '2016-10-14 21:00:00',
-    1,
-    '2019-08-08 12:18:17',
-    0,
-    NULL,
-    NULL,
-    NULL,
-    'NJ',
-    NULL,
-    'US',
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    10,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    1
-  ),(
-    NULL,
-    NULL,
-    'Jimmy',
-    NULL,
-    'Hendrix',
-    NULL,
-    NULL,
-    NULL,
-    'admin@onap.org',
-    NULL,
-    NULL,
-    NULL,
-    'jh0003',
-    NULL,
-    'jh0003',
-    'demo123',
-    '2019-08-08 10:16:11',
-    1,
-    NULL,
-    '2016-10-14 21:00:00',
-    1,
-    '2019-08-08 10:16:11',
-    0,
-    NULL,
-    NULL,
-    NULL,
-    'NJ',
-    NULL,
-    'US',
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    10,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    1
-  ),(
-    NULL,
-    NULL,
-    'Carlos',
-    NULL,
-    'Santana',
-    NULL,
-    NULL,
-    NULL,
-    'designer@onap.org',
-    NULL,
-    NULL,
-    NULL,
-    'cs0008',
-    NULL,
-    'cs0008',
-    'demo123',
-    '2016-10-20 15:11:16',
-    1,
-    NULL,
-    '2016-10-14 21:00:00',
-    1,
-    '2016-10-20 15:11:16',
-    0,
-    NULL,
-    NULL,
-    NULL,
-    'NJ',
-    NULL,
-    'US',
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    10,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    1
-  ),(
-    NULL,
-    NULL,
-    'Joni',
-    NULL,
-    'Mitchell',
-    NULL,
-    NULL,
-    NULL,
-    'tester@onap.org',
-    NULL,
-    NULL,
-    NULL,
-    'jm0007',
-    NULL,
-    'jm0007',
-    'demo123',
-    '2016-10-20 15:11:16',
-    1,
-    NULL,
-    '2016-10-14 21:00:00',
-    1,
-    '2016-10-20 15:11:16',
-    0,
-    NULL,
-    NULL,
-    NULL,
-    'NJ',
-    NULL,
-    'US',
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    10,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    1
-  ),(
-    NULL,
-    NULL,
-    'Steve',
-    NULL,
-    'Regev',
-    NULL,
-    NULL,
-    NULL,
-    'ops@onap.org',
-    NULL,
-    NULL,
-    NULL,
-    'op0001',
-    NULL,
-    'op0001',
-    'demo123',
-    '2016-10-20 15:11:16',
-    1,
-    NULL,
-    '2016-10-14 21:00:00',
-    1,
-    '2016-10-20 15:11:16',
-    0,
-    NULL,
-    NULL,
-    NULL,
-    'NJ',
-    NULL,
-    'US',
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    10,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    1
-  ),(
-    NULL,
-    NULL,
-    'David',
-    NULL,
-    'Shadmi',
-    NULL,
-    NULL,
-    NULL,
-    'governor@onap.org',
-    NULL,
-    NULL,
-    NULL,
-    'gv0001',
-    NULL,
-    'gv0001',
-    'demo123',
-    '2016-10-20 15:11:16',
-    1,
-    NULL,
-    '2016-10-14 21:00:00',
-    1,
-    '2016-10-20 15:11:16',
-    0,
-    NULL,
-    NULL,
-    NULL,
-    'NJ',
-    NULL,
-    'US',
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    10,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    1
-  ),(
-    NULL,
-    NULL,
-    'Teddy',
-    NULL,
-    'Isashar',
-    NULL,
-    NULL,
-    NULL,
-    'pm1@onap.org',
-    NULL,
-    NULL,
-    NULL,
-    'pm0001',
-    NULL,
-    'pm0001',
-    'demo123',
-    '2016-10-20 15:11:16',
-    1,
-    NULL,
-    '2016-10-14 21:00:00',
-    1,
-    '2016-10-20 15:11:16',
-    0,
-    NULL,
-    NULL,
-    NULL,
-    'NJ',
-    NULL,
-    'US',
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    10,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    1
-  ),(
-    NULL,
-    NULL,
-    'Eden',
-    NULL,
-    'Rozin',
-    NULL,
-    NULL,
-    NULL,
-    'ps1@onap.org',
-    NULL,
-    NULL,
-    NULL,
-    'ps0001',
-    NULL,
-    'ps0001',
-    'demo123',
-    '2016-10-20 15:11:16',
-    1,
-    NULL,
-    '2016-10-14 21:00:00',
-    1,
-    '2016-10-20 15:11:16',
-    0,
-    NULL,
-    NULL,
-    NULL,
-    'NJ',
-    NULL,
-    'US',
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    10,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    1
-  ),(
-    NULL,
-    NULL,
-    'vid1',
-    NULL,
-    'user',
-    NULL,
-    NULL,
-    NULL,
-    'vid1@onap.org',
-    NULL,
-    NULL,
-    NULL,
-    'vid1',
-    NULL,
-    'vid1',
-    'demo123',
-    '2016-10-20 15:11:16',
-    1,
-    NULL,
-    '2016-10-14 21:00:00',
-    1,
-    '2016-10-20 15:11:16',
-    0,
-    NULL,
-    NULL,
-    NULL,
-    'NJ',
-    NULL,
-    'US',
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    10,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    1
-  ),(
-    NULL,
-    NULL,
-    'vid2',
-    NULL,
-    'user',
-    NULL,
-    NULL,
-    NULL,
-    'vid2@onap.org',
-    NULL,
-    NULL,
-    NULL,
-    'vid2',
-    NULL,
-    'vid2',
-    'demo123',
-    '2016-10-20 15:11:16',
-    1,
-    NULL,
-    '2016-10-14 21:00:00',
-    1,
-    '2016-10-20 15:11:16',
-    0,
-    NULL,
-    NULL,
-    NULL,
-    'NJ',
-    NULL,
-    'US',
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    10,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    1
-  ),(
-    NULL,
-    NULL,
-    'vid3',
-    NULL,
-    'user',
-    NULL,
-    NULL,
-    NULL,
-    'vid3@onap.org',
-    NULL,
-    NULL,
-    NULL,
-    'vid3',
-    NULL,
-    'vid3',
-    'demo123',
-    '2016-10-20 15:11:16',
-    1,
-    NULL,
-    '2016-10-14 21:00:00',
-    1,
-    '2016-10-20 15:11:16',
-    0,
-    NULL,
-    NULL,
-    NULL,
-    'NJ',
-    NULL,
-    'US',
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    10,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    1
-  ),(
-    NULL,
-    NULL,
-    'steve',
-    NULL,
-    'user',
-    NULL,
-    NULL,
-    NULL,
-    'steve@onap.org',
-    NULL,
-    NULL,
-    NULL,
-    'steve',
-    NULL,
-    'steve',
-    'demo123',
-    '2017-05-19 15:11:16',
-    1,
-    NULL,
-    '2017-05-19 21:00:00',
-    1,
-    '2017-05-19 15:11:16',
-    0,
-    NULL,
-    NULL,
-    NULL,
-    'NJ',
-    NULL,
-    'US',
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    10,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    1
-  );
-
-/*!40000 ALTER TABLE `fn_user` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `ep_pers_user_app_sort`
---
-
-LOCK TABLES `ep_pers_user_app_sort` WRITE;
-/*!40000 ALTER TABLE `ep_pers_user_app_sort` DISABLE KEYS */;
-INSERT INTO `ep_pers_user_app_sort` (`id`, `user_id`, `sort_pref`) VALUES (1,1,0);
-/*!40000 ALTER TABLE `ep_pers_user_app_sort` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_pers_user_app_sel`
---
-
-LOCK TABLES `fn_pers_user_app_sel` WRITE;
-/*!40000 ALTER TABLE `fn_pers_user_app_sel` DISABLE KEYS */;
-INSERT INTO `fn_pers_user_app_sel` (`id`, `user_id`, `app_id`, `status_cd`) VALUES (1,1,7,'S'),(2,1,8,'S'),(10,1,10,'S'),(11,1,5,'S');
-/*!40000 ALTER TABLE `fn_pers_user_app_sel` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `fn_audit_log`
---
-
-LOCK TABLES `fn_audit_log` WRITE;
-/*!40000 ALTER TABLE `fn_audit_log` DISABLE KEYS */;
-INSERT INTO `fn_audit_log` (`log_id`, `user_id`, `activity_cd`, `audit_date`, `comments`, `affected_record_id_bk`, `affected_record_id`) VALUES (1,1,'app_access','2019-08-08 10:18:52','https://aai.ui.simpledemo.onap.org:30220/services/aai/webapp/index.html',NULL,'7'),(2,1,'tab_access','2019-08-08 10:18:52','https://aai.ui.simpledemo.onap.org:30220/services/aai/webapp/index.html?cc=1565259532115',NULL,'7'),(3,1,'tab_access','2019-08-08 10:18:56','Home',NULL,'1'),(4,1,'tab_access','2019-08-08 10:18:59','https://aai.ui.simpledemo.onap.org:30220/services/aai/webapp/index.html?cc=1565259538769',NULL,'7'),(5,1,'app_access','2019-08-08 10:18:59','https://aai.ui.simpledemo.onap.org:30220/services/aai/webapp/index.html',NULL,'7'),(6,1,'tab_access','2019-08-08 10:18:59','https://aai.ui.simpledemo.onap.org:30220/services/aai/webapp/index.html?cc=1565259538769',NULL,'7'),(7,1,'tab_access','2019-08-08 10:19:06','Home',NULL,'1');
-/*!40000 ALTER TABLE `fn_audit_log` ENABLE KEYS */;
-UNLOCK TABLES;
-
-
---
--- Dumping data for table `fn_user_role`
---
-
-LOCK TABLES `fn_user_role` WRITE;
-/*!40000 ALTER TABLE `fn_user_role` DISABLE KEYS */;
-INSERT INTO `fn_user_role` (`user_id`, `role_id`, `priority`, `app_id`)
- VALUES
- (1,1,1,1),
- (1,950,1,1),
- (1,999,1,1),
- (1,999,1,2),(1,999,1,3),(1,999,1,4),(1,999,1,5),(1,999,1,6),(1,999,1,7),(1,1000,1,2),(1,1001,1,2),(1,1002,1,3),(1,1004,1,4),(1,1006,1,5),(1,1008,1,6),(2,999,1,4),(2,1004,1,4),(3,16,NULL,4),(3,1005,NULL,4),(4,16,NULL,4),(4,1005,NULL,4),(5,16,NULL,4),(5,1005,NULL,4),(6,16,NULL,4),(6,1005,NULL,4),(7,16,NULL,4),(7,1005,NULL,4),(8,16,NULL,4),(8,1005,NULL,4),(9,16,NULL,6),(9,999,NULL,1),(9,1008,NULL,6),(10,16,NULL,6),(10,1008,NULL,6),(10,1009,NULL,6),(11,16,NULL,6),(12,16,NULL,7),(12,1011,NULL,7),(12,1012,NULL,7);
-/*!40000 ALTER TABLE `fn_user_role` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Dumping data for table `schema_info`
---
-
-LOCK TABLES `schema_info` WRITE;
-/*!40000 ALTER TABLE `schema_info` DISABLE KEYS */;
-/*!40000 ALTER TABLE `schema_info` ENABLE KEYS */;
-UNLOCK TABLES;
-/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
-
-/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
-/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
-/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
-/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
-/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-
--- Dump completed on 2019-08-13 10:20:25
diff --git a/portal-BE/src/main/resources/data2.sql b/portal-BE/src/main/resources/data2.sql
new file mode 100644 (file)
index 0000000..bb7a9f5
--- /dev/null
@@ -0,0 +1,1639 @@
+--
+-- ============LICENSE_START==========================================
+-- ONAP Portal
+-- ===================================================================
+-- Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+-- ===================================================================
+-- Modifications Copyright (c) 2019 Samsung
+-- ===================================================================
+--
+-- 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============================================
+--
+--
+
+
+-- MySQL dump 10.17  Distrib 10.3.14-MariaDB, for debian-linux-gnu (x86_64)
+--
+-- Host: localhost    Database: portal
+-- ------------------------------------------------------
+-- Server version      10.3.14-MariaDB-1:10.3.14+maria~bionic
+
+INSERT INTO `cr_report` (`rep_id`, `title`, `descr`, `public_yn`, `report_xml`, `create_id`, `create_date`, `maint_id`, `maint_date`, `menu_id`, `menu_approved_yn`, `owner_id`, `folder_id`, `dashboard_type_yn`, `dashboard_yn`) VALUES (15,'Application Usage Report Wid','',1,'<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<customReport pageSize=\"200\" reportType=\"Linear\">\n    <reportName>Application Usage Report Wid</reportName>\n    <reportDescr></reportDescr>\n    <dbInfo>local</dbInfo>\n    <dbType>mysql</dbType>\n    <chartType>BarChart3D</chartType>\n    <chartWidth>700</chartWidth>\n    <chartHeight>500</chartHeight>\n    <showChartTitle>false</showChartTitle>\n    <public>false</public>\n    <hideFormFieldAfterRun>false</hideFormFieldAfterRun>\n    <createId>27</createId>\n    <createDate>2017-01-28-05:00</createDate>\n    <reportSQL>SELECT \n       l.date audit_date, \n   app_id app_id, \n       IF(CHAR_LENGTH(l.app_name) >14, CONCAT(CONCAT(SUBSTR(l.app_name,1,7),\'...\'), SUBSTR(l.app_name, CHAR_LENGTH(l.app_name)-3,CHAR_LENGTH(l.app_name))) , l.app_name) app_name, \n        IFNULL(r.ct,0) ct \nfrom\n(\n   select a.Date, app_id, app_name\n       from (\n            select curdate() - INTERVAL (a.a + (10 * b.a) + (100 * c.a)) DAY as Date\n      from (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as a\n          cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as b\n            cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as c\n        ) a, \n (\n             SELECT  \n                      app_id, app_name\n              from\n          (\n                     select @rn := @rn+1 AS rowId, app_id, app_name from \n                          (\n                                     select app_id, app_name, ct from \n                                     (\n                                             select affected_record_id, count(*) ct\n                                                from fn_audit_log l\n                                           where audit_date > date_add( curdate(), interval -6 day)\n                                              and affected_record_id not in ( 1, -1)\n                                                and activity_cd in (\'tab_access\', \'app_access\')\n                                           and user_id = [USER_ID]\n                                               group by affected_record_id\n                                   ) a, fn_app f\n                                 where a.affected_record_id = f.app_id\n                                 order by ct desc \n                             ) b,\n                          (SELECT @rn := 0) t2\n          ) mm where rowId <= 4\n )b\n    where a.Date between date_add( curdate(), interval -6 day) and  curdate()\n) l left outer join\n(\n     select app_name,  DATE(audit_date) audit_date_1 ,count(*) ct from fn_audit_log a, fn_app b\n    where user_id = [USER_ID]\n     and audit_date > date_add( curdate(), interval -6 day)\n        and activity_cd in (\'tab_access\', \'app_access\')\n   and a.affected_record_id = b.app_id\n   and b.app_id <> 1\n     and b.app_id in \n      (\n             SELECT  \n                      app_id\n                from\n          (\n                     select @rn := @rn+1 AS rowId, app_id from \n                            (\n                                     select app_id, ct from \n                                       (\n                                             select affected_record_id app_id, count(*) ct\n                                         from fn_audit_log \n                                            where audit_date > date_add( curdate(), interval -6 day)\n                                              and affected_record_id not in ( 1, -1)\n                                                and activity_cd in (\'tab_access\', \'app_access\')\n                                           and user_id = [USER_ID]\n                                               group by affected_record_id\n                                   ) a\n                                   order by ct desc \n                             ) b,\n                          (SELECT @rn := 0) t2\n          ) mm \n )\n     group by app_name,  DATE(audit_date)\n) r\non l.Date = r.audit_date_1\nand l.app_name = r.app_name</reportSQL>\n    <reportTitle></reportTitle>\n    <reportSubTitle></reportSubTitle>\n    <reportHeader></reportHeader>\n    <frozenColumns>0</frozenColumns>\n    <emptyMessage>Your Search didn\'t yield any results.</emptyMessage>\n    <dataGridAlign>left</dataGridAlign>\n    <reportFooter></reportFooter>\n    <numFormCols>1</numFormCols>\n    <displayOptions>NNNNNNN</displayOptions>\n    <dataContainerHeight>100</dataContainerHeight>\n    <dataContainerWidth>100</dataContainerWidth>\n    <allowSchedule>N</allowSchedule>\n    <multiGroupColumn>N</multiGroupColumn>\n    <topDown>N</topDown>\n    <sizedByContent>N</sizedByContent>\n    <comment>N|</comment>\n    <dataSourceList>\n        <dataSource tableId=\"du0\">\n            <tableName>DUAL</tableName>\n            <tablePK></tablePK>\n            <displayName>DUAL</displayName>\n            <dataColumnList>\n                <dataColumn colId=\"audit_date\">\n                    <tableId>du0</tableId>\n                    <dbColName>l.date</dbColName>\n                    <colName>l.date</colName>\n                    <displayName>audit_date_1</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayWidthInPxls>nullpxpx</displayWidthInPxls>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>1</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <colOnChart>LEGEND</colOnChart>\n                    <chartSeq>1</chartSeq>\n                    <chartColor></chartColor>\n                    <chartLineType></chartLineType>\n                    <chartSeries>false</chartSeries>\n                    <dbColType>VARCHAR2</dbColType>\n                    <chartGroup></chartGroup>\n                    <yAxis></yAxis>\n                </dataColumn>\n                <dataColumn colId=\"app_id\">\n                    <tableId>du0</tableId>\n                    <dbColName>app_id</dbColName>\n                    <colName>app_id</colName>\n                    <displayName>app_id</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>2</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <dbColType>VARCHAR2</dbColType>\n                </dataColumn>\n                <dataColumn colId=\"app_name\">\n                    <tableId>du0</tableId>\n                    <dbColName>IF(CHAR_LENGTH(l.app_name) >14, CONCAT(CONCAT(SUBSTR(l.app_name,1,7),\'...\'), SUBSTR(l.app_name, CHAR_LENGTH(l.app_name)-3,CHAR_LENGTH(l.app_name))) , l.app_name)</dbColName>\n                    <colName>IF(CHAR_LENGTH(l.app_name) >14, CONCAT(CONCAT(SUBSTR(l.app_name,1,7),\'...\'), SUBSTR(l.app_name, CHAR_LENGTH(l.app_name)-3,CHAR_LENGTH(l.app_name))) , l.app_name)</colName>\n                    <displayName>app_name</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayWidthInPxls>nullpxpx</displayWidthInPxls>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>3</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <chartSeq>2</chartSeq>\n                    <chartColor></chartColor>\n                    <chartLineType></chartLineType>\n                    <chartSeries>true</chartSeries>\n                    <dbColType>VARCHAR2</dbColType>\n                    <chartGroup></chartGroup>\n                    <yAxis></yAxis>\n                </dataColumn>\n                <dataColumn colId=\"ct\">\n                    <tableId>du0</tableId>\n                    <dbColName>IFNULL(r.ct,0)</dbColName>\n                    <colName>IFNULL(r.ct,0)</colName>\n                    <displayName>ct</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayWidthInPxls>nullpxpx</displayWidthInPxls>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>4</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <colOnChart>0</colOnChart>\n                    <chartSeq>1</chartSeq>\n                    <chartColor></chartColor>\n                    <chartLineType></chartLineType>\n                    <chartSeries>false</chartSeries>\n                    <dbColType>VARCHAR2</dbColType>\n                    <chartGroup></chartGroup>\n                    <yAxis></yAxis>\n                </dataColumn>\n            </dataColumnList>\n        </dataSource>\n    </dataSourceList>\n    <reportInNewWindow>false</reportInNewWindow>\n    <displayFolderTree>false</displayFolderTree>\n    <maxRowsInExcelDownload>500</maxRowsInExcelDownload>\n    <chartAdditionalOptions>\n        <chartOrientation>vertical</chartOrientation>\n        <hidechartLegend>N</hidechartLegend>\n        <legendPosition>bottom</legendPosition>\n        <labelAngle>up90</labelAngle>\n        <rangeAxisUpperLimit></rangeAxisUpperLimit>\n        <rangeAxisLowerLimit></rangeAxisLowerLimit>\n        <animate>true</animate>\n        <animateAnimatedChart>true</animateAnimatedChart>\n        <stacked>true</stacked>\n        <barControls>false</barControls>\n        <xAxisDateType>false</xAxisDateType>\n        <lessXaxisTickers>false</lessXaxisTickers>\n        <timeAxis>true</timeAxis>\n        <logScale>false</logScale>\n        <topMargin>30</topMargin>\n        <bottomMargin>50</bottomMargin>\n        <rightMargin>60</rightMargin>\n        <leftMargin>100</leftMargin>\n    </chartAdditionalOptions>\n    <folderId>NULL</folderId>\n    <isOneTimeScheduleAllowed>N</isOneTimeScheduleAllowed>\n    <isHourlyScheduleAllowed>N</isHourlyScheduleAllowed>\n    <isDailyScheduleAllowed>N</isDailyScheduleAllowed>\n    <isDailyMFScheduleAllowed>N</isDailyMFScheduleAllowed>\n    <isWeeklyScheduleAllowed>N</isWeeklyScheduleAllowed>\n    <isMonthlyScheduleAllowed>N</isMonthlyScheduleAllowed>\n</customReport>\n',1,'2019-08-08 08:43:27',1,'2019-08-08 08:43:27','',0,1,NULL,0,0),(18,'Application Usage bar Wid','',1,'<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<customReport pageSize=\"200\" reportType=\"Linear\">\n    <reportName>Application Usage Line Wid</reportName>\n    <reportDescr></reportDescr>\n    <dbInfo>local</dbInfo>\n    <dbType>mysql</dbType>\n    <chartType>TimeSeriesChart</chartType>\n    <chartMultiSeries>N</chartMultiSeries>\n    <chartWidth>700</chartWidth>\n    <chartHeight>300</chartHeight>\n    <showChartTitle>false</showChartTitle>\n    <public>false</public>\n    <hideFormFieldAfterRun>false</hideFormFieldAfterRun>\n    <createId>27</createId>\n    <createDate>2017-01-28-05:00</createDate>\n    <reportSQL>SELECT \n    l.date audit_date, \n   IF(CHAR_LENGTH(l.app_name) >14, CONCAT(CONCAT(SUBSTR(l.app_name,1,7),\'...\'), SUBSTR(l.app_name, CHAR_LENGTH(l.app_name)-3,CHAR_LENGTH(l.app_name))) , l.app_name) app_name, \n        IFNULL(r.ct,0) ct \nfrom\n(\n   select a.Date, app_id, app_name\n       from (\n            select curdate() - INTERVAL (a.a + (10 * b.a) + (100 * c.a)) DAY as Date\n      from (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as a\n          cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as b\n            cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as c\n        ) a, \n (\n             SELECT  \n                      app_id, app_name\n              from\n          (\n                     select @rn := @rn+1 AS rowId, app_id, app_name from \n                          (\n                                     select app_id, app_name, ct from \n                                     (\n                                             select affected_record_id, count(*) ct\n                                                from fn_audit_log l\n                                           where audit_date > date_add( curdate(), interval -30 day)\n                                             and affected_record_id not in ( 1, -1)\n                                                and activity_cd in (\'tab_access\', \'app_access\')\n                                           and user_id = [USER_ID]\n                                               group by affected_record_id\n                                   ) a, fn_app f\n                                 where a.affected_record_id = f.app_id\n                                 order by ct desc \n                             ) b,\n                          (SELECT @rn := 0) t2\n          ) mm where rowId <= 4\n )b\n    where a.Date between date_add( curdate(), interval -30 day) and  curdate()\n) l left outer join\n(\n    select app_name,  DATE(audit_date) audit_date_1 ,count(*) ct from fn_audit_log a, fn_app b\n    where user_id = [USER_ID]\n     and audit_date > date_add( curdate(), interval -30 day)\n       and activity_cd in (\'tab_access\', \'app_access\')\n   and a.affected_record_id = b.app_id\n   and b.app_id <> 1\n     and b.app_id in \n      (\n             SELECT  \n                      app_id\n                from\n          (\n                     select @rn := @rn+1 AS rowId, app_id from \n                            (\n                                     select app_id, ct from \n                                       (\n                                             select affected_record_id app_id, count(*) ct\n                                         from fn_audit_log \n                                            where audit_date > date_add( curdate(), interval -30 day)\n                                             and affected_record_id not in ( 1, -1)\n                                                and activity_cd in (\'tab_access\', \'app_access\')\n                                           and user_id = [USER_ID]\n                                               group by affected_record_id\n                                   ) a\n                                   order by ct desc \n                             ) b,\n                          (SELECT @rn := 0) t2\n          ) mm \n )\n     group by app_name,  DATE(audit_date)\n) r\non l.Date = r.audit_date_1\nand l.app_name = r.app_name</reportSQL>\n    <reportTitle></reportTitle>\n    <reportSubTitle></reportSubTitle>\n    <reportHeader></reportHeader>\n    <frozenColumns>0</frozenColumns>\n    <emptyMessage>Your Search didn\'t yield any results.</emptyMessage>\n    <dataGridAlign>left</dataGridAlign>\n    <reportFooter></reportFooter>\n    <numFormCols>1</numFormCols>\n    <displayOptions>NNNNNNN</displayOptions>\n    <dataContainerHeight>100</dataContainerHeight>\n    <dataContainerWidth>100</dataContainerWidth>\n    <allowSchedule>N</allowSchedule>\n    <multiGroupColumn>N</multiGroupColumn>\n    <topDown>N</topDown>\n    <sizedByContent>N</sizedByContent>\n    <comment>N|</comment>\n    <dataSourceList>\n        <dataSource tableId=\"du0\">\n            <tableName>DUAL</tableName>\n            <tablePK></tablePK>\n            <displayName>DUAL</displayName>\n            <dataColumnList>\n                <dataColumn colId=\"audit_date\">\n                    <tableId>du0</tableId>\n                    <dbColName>l.date</dbColName>\n                    <colName>l.date</colName>\n                    <displayName>audit_date_1</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayWidthInPxls>nullpxpx</displayWidthInPxls>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>1</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <colOnChart>LEGEND</colOnChart>\n                    <chartSeq>1</chartSeq>\n                    <chartSeries>false</chartSeries>\n                    <isRangeAxisFilled>false</isRangeAxisFilled>\n                    <drillinPoPUp>false</drillinPoPUp>\n                    <dbColType>VARCHAR2</dbColType>\n                    <enhancedPagination>false</enhancedPagination>\n                </dataColumn>\n                <dataColumn colId=\"app_name\">\n                    <tableId>du0</tableId>\n                    <dbColName>IF(CHAR_LENGTH(l.app_name) >14, CONCAT(CONCAT(SUBSTR(l.app_name,1,7),\'...\'), SUBSTR(l.app_name, CHAR_LENGTH(l.app_name)-3,CHAR_LENGTH(l.app_name))) , l.app_name)</dbColName>\n                    <colName>IF(CHAR_LENGTH(l.app_name) >14, CONCAT(CONCAT(SUBSTR(l.app_name,1,7),\'...\'), SUBSTR(l.app_name, CHAR_LENGTH(l.app_name)-3,CHAR_LENGTH(l.app_name))) , l.app_name)</colName>\n                    <displayName>app_name</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayWidthInPxls>nullpxpx</displayWidthInPxls>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>2</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <colOnChart>0</colOnChart>\n                    <chartSeq>2</chartSeq>\n                    <chartColor></chartColor>\n                    <chartLineType></chartLineType>\n                    <chartSeries>true</chartSeries>\n                    <isRangeAxisFilled>false</isRangeAxisFilled>\n                    <drillinPoPUp>false</drillinPoPUp>\n                    <dbColType>VARCHAR2</dbColType>\n                    <chartGroup></chartGroup>\n                    <yAxis></yAxis>\n                    <enhancedPagination>false</enhancedPagination>\n                </dataColumn>\n                <dataColumn colId=\"ct\">\n                    <tableId>du0</tableId>\n                    <dbColName>IFNULL(r.ct,0)</dbColName>\n                    <colName>IFNULL(r.ct,0)</colName>\n                    <displayName>ct</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayWidthInPxls>nullpxpx</displayWidthInPxls>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>3</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <colOnChart>0</colOnChart>\n                    <chartSeq>1</chartSeq>\n                    <chartColor></chartColor>\n                    <chartLineType></chartLineType>\n                    <chartSeries>false</chartSeries>\n                    <isRangeAxisFilled>false</isRangeAxisFilled>\n                    <drillinPoPUp>false</drillinPoPUp>\n                    <dbColType>VARCHAR2</dbColType>\n                    <chartGroup></chartGroup>\n                    <yAxis></yAxis>\n                    <enhancedPagination>false</enhancedPagination>\n                </dataColumn>\n            </dataColumnList>\n        </dataSource>\n    </dataSourceList>\n    <reportInNewWindow>false</reportInNewWindow>\n    <displayFolderTree>false</displayFolderTree>\n    <maxRowsInExcelDownload>500</maxRowsInExcelDownload>\n    <chartAdditionalOptions>\n        <chartOrientation>vertical</chartOrientation>\n        <hidechartLegend>N</hidechartLegend>\n        <legendPosition>bottom</legendPosition>\n        <labelAngle>down45</labelAngle>\n        <animate>true</animate>\n        <animateAnimatedChart>true</animateAnimatedChart>\n        <stacked>true</stacked>\n        <barControls>false</barControls>\n        <xAxisDateType>false</xAxisDateType>\n        <lessXaxisTickers>false</lessXaxisTickers>\n        <timeAxis>true</timeAxis>\n        <timeSeriesRender>line</timeSeriesRender>\n        <multiSeries>false</multiSeries>\n        <showXAxisLabel>false</showXAxisLabel>\n        <addXAxisTickers>false</addXAxisTickers>\n        <topMargin>30</topMargin>\n        <bottomMargin>50</bottomMargin>\n        <rightMargin>60</rightMargin>\n        <leftMargin>100</leftMargin>\n    </chartAdditionalOptions>\n    <folderId>NULL</folderId>\n    <drillURLInPoPUpPresent>false</drillURLInPoPUpPresent>\n    <isOneTimeScheduleAllowed>N</isOneTimeScheduleAllowed>\n    <isHourlyScheduleAllowed>N</isHourlyScheduleAllowed>\n    <isDailyScheduleAllowed>N</isDailyScheduleAllowed>\n    <isDailyMFScheduleAllowed>N</isDailyMFScheduleAllowed>\n    <isWeeklyScheduleAllowed>N</isWeeklyScheduleAllowed>\n    <isMonthlyScheduleAllowed>N</isMonthlyScheduleAllowed>\n</customReport>\n',1,'2019-08-08 08:43:27',1,'2019-08-08 08:43:27','',0,1,NULL,0,0),(20,'Average time spend on portal','',1,'<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<customReport pageSize=\"200\" reportType=\"Linear\">\n    <reportName>Average time spend on portal</reportName>\n    <reportDescr></reportDescr>\n    <dbInfo>local</dbInfo>\n    <dbType>mysql</dbType>\n    <chartType>TimeSeriesChart</chartType>\n    <chartMultiSeries>N</chartMultiSeries>\n    <chartWidth>700</chartWidth>\n    <chartHeight>300</chartHeight>\n    <showChartTitle>false</showChartTitle>\n    <public>true</public>\n    <hideFormFieldAfterRun>false</hideFormFieldAfterRun>\n    <createId>27</createId>\n    <createDate>2017-01-28-05:00</createDate>\n    <reportSQL>SELECT \n    d.dat audit_date, \n    \'# of Minutes\' app, \n        coalesce(diff, null, 0) mins \nfrom\n(\n        select * from\n (\n     select curdate() - INTERVAL (a.a + (10 * b.a) + (100 * c.a)) DAY as dat\n       from (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as a\n  cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as b\n    cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as c \n   ) d where d.dat between date_add( curdate(), interval -30 day) and  curdate()\n) d left outer join\n(\n select dat, mi, mx, TIMESTAMPDIFF(MINUTE, coalesce(mi, null, 0), coalesce(mx, null, 0)) + 30  diff\n    from\n  (\n             select DATE(audit_date) dat, coalesce(min(audit_date), null, 0) mi, coalesce(max(audit_date), null, 0) mx\n             from fn_audit_log \n            where user_id = [USER_ID] and DATE(audit_date) between CURDATE()-300 and CURDATE()\n            group by DATE(audit_date)\n     ) a\n) a\non a.dat = d.dat\norder by 1</reportSQL>\n    <reportTitle></reportTitle>\n    <reportSubTitle></reportSubTitle>\n    <reportHeader></reportHeader>\n    <frozenColumns>0</frozenColumns>\n    <emptyMessage>Your Search didn\'t yield any results.</emptyMessage>\n    <dataGridAlign>left</dataGridAlign>\n    <reportFooter></reportFooter>\n    <numFormCols>1</numFormCols>\n    <displayOptions>NNNNNNN</displayOptions>\n    <dataContainerHeight>100</dataContainerHeight>\n    <dataContainerWidth>100</dataContainerWidth>\n    <allowSchedule>N</allowSchedule>\n    <multiGroupColumn>N</multiGroupColumn>\n    <topDown>N</topDown>\n    <sizedByContent>N</sizedByContent>\n    <comment>N|</comment>\n    <dataSourceList>\n        <dataSource tableId=\"du0\">\n            <tableName>DUAL</tableName>\n            <tablePK></tablePK>\n            <displayName>DUAL</displayName>\n            <dataColumnList>\n                <dataColumn colId=\"audit_date\">\n                    <tableId>du0</tableId>\n                    <dbColName>d.dat</dbColName>\n                    <colName>d.dat</colName>\n                    <displayName>audit_date_1</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayWidthInPxls>nullpxpx</displayWidthInPxls>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>1</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <colOnChart>LEGEND</colOnChart>\n                    <chartSeq>1</chartSeq>\n                    <chartSeries>false</chartSeries>\n                    <isRangeAxisFilled>false</isRangeAxisFilled>\n                    <drillinPoPUp>false</drillinPoPUp>\n                    <dbColType>VARCHAR2</dbColType>\n                    <enhancedPagination>false</enhancedPagination>\n                </dataColumn>\n                <dataColumn colId=\"app\">\n                    <tableId>du0</tableId>\n                    <dbColName>\'# of Minutes\'</dbColName>\n                    <colName>\'# of Minutes\'</colName>\n                    <displayName>app</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayWidthInPxls>nullpxpx</displayWidthInPxls>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>2</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <chartSeries>true</chartSeries>\n                    <dbColType>VARCHAR2</dbColType>\n                </dataColumn>\n                <dataColumn colId=\"mins\">\n                    <tableId>du0</tableId>\n                    <dbColName>coalesce(diff, null, 0)</dbColName>\n                    <colName>coalesce(diff, null, 0)</colName>\n                    <displayName>mins</displayName>\n                    <displayWidth>10</displayWidth>\n                    <displayWidthInPxls>nullpxpx</displayWidthInPxls>\n                    <displayAlignment>Left</displayAlignment>\n                    <orderSeq>3</orderSeq>\n                    <visible>true</visible>\n                    <calculated>true</calculated>\n                    <colType>VARCHAR2</colType>\n                    <groupBreak>false</groupBreak>\n                    <colOnChart>0</colOnChart>\n                    <chartSeq>1</chartSeq>\n                    <chartColor></chartColor>\n                    <chartLineType></chartLineType>\n                    <chartSeries>false</chartSeries>\n                    <dbColType>VARCHAR2</dbColType>\n                    <chartGroup></chartGroup>\n                    <yAxis></yAxis>\n                </dataColumn>\n            </dataColumnList>\n        </dataSource>\n    </dataSourceList>\n    <reportInNewWindow>false</reportInNewWindow>\n    <displayFolderTree>false</displayFolderTree>\n    <maxRowsInExcelDownload>500</maxRowsInExcelDownload>\n    <chartAdditionalOptions>\n        <chartOrientation>vertical</chartOrientation>\n        <hidechartLegend>N</hidechartLegend>\n        <legendPosition>bottom</legendPosition>\n        <labelAngle>down45</labelAngle>\n        <animate>true</animate>\n        <animateAnimatedChart>true</animateAnimatedChart>\n        <stacked>true</stacked>\n        <barControls>false</barControls>\n        <xAxisDateType>false</xAxisDateType>\n        <lessXaxisTickers>false</lessXaxisTickers>\n        <timeAxis>true</timeAxis>\n        <timeSeriesRender>line</timeSeriesRender>\n        <multiSeries>false</multiSeries>\n        <showXAxisLabel>false</showXAxisLabel>\n        <addXAxisTickers>false</addXAxisTickers>\n        <topMargin>30</topMargin>\n        <bottomMargin>50</bottomMargin>\n        <rightMargin>60</rightMargin>\n        <leftMargin>100</leftMargin>\n    </chartAdditionalOptions>\n    <folderId>NULL</folderId>\n    <drillURLInPoPUpPresent>false</drillURLInPoPUpPresent>\n    <isOneTimeScheduleAllowed>N</isOneTimeScheduleAllowed>\n    <isHourlyScheduleAllowed>N</isHourlyScheduleAllowed>\n    <isDailyScheduleAllowed>N</isDailyScheduleAllowed>\n    <isDailyMFScheduleAllowed>N</isDailyMFScheduleAllowed>\n    <isWeeklyScheduleAllowed>N</isWeeklyScheduleAllowed>\n    <isMonthlyScheduleAllowed>N</isMonthlyScheduleAllowed>\n</customReport>\n',1,'2019-08-08 08:43:27',1,'2019-08-08 08:43:27','',0,1,NULL,0,0);
+
+INSERT INTO
+  `fn_app` (
+    `id`,
+    `app_name`,
+    `app_image_url`,
+    `app_description`,
+    `app_notes`,
+    `app_url`,
+    `app_alternate_url`,
+    `app_rest_endpoint`,
+    `ml_app_name`,
+    `ml_app_admin_id`,
+    `mots_id`,
+    `app_password`,
+    `_open`,
+    `_enabled`,
+    `app_username`,
+    `ueb_key`,
+    `ueb_secret`,
+    `ueb_topic_name`,
+    `app_type`,
+    `auth_central`,
+    `auth_namespace`
+  )
+VALUES
+  (
+    1,
+    'Default',
+    'assets/images/tmp/portal1.png',
+    'Some Default Description',
+    'Some Default Note',
+    'http://localhost',
+    'http://localhost',
+    'http://localhost:8080/ecompportal',
+    'EcompPortal',
+    '',
+    NULL,
+    'dR2NABMkxPaFbIbym87ZwQ==',
+    0,
+    0,
+    'm00468@portal.onap.org',
+    'EkrqsjQqZt4ZrPh6',
+    NULL,
+    NULL,
+    1,
+    1,
+    'org.onap.portal'
+  ),(
+    2,
+    'xDemo App',
+    'images/cache/portal-222865671_37476.png',
+    NULL,
+    NULL,
+    'http://portal-sdk.simpledemo.onap.org:30212/ONAPPORTALSDK/welcome.htm',
+    NULL,
+    'http://portal-sdk:8080/ONAPPORTALSDK/api/v3',
+    '',
+    '',
+    NULL,
+    '2VxipM8Z3SETg32m3Gp0FvKS6zZ2uCbCw46WDyK6T5E=',
+    0,
+    1,
+    'Default',
+    'ueb_key',
+    'ueb_secret',
+    'ECOMP-PORTAL-OUTBOX',
+    1,
+    0,
+    NULL
+  ),(
+    3,
+    'DMaaP Bus Ctrl',
+    'images/cache/portal944583064_80711.png',
+    NULL,
+    NULL,
+    'http://dmaap-bc.simpledemo.onap.org:/ECOMPDBCAPP/dbc#/dmaap',
+    NULL,
+    'http://dmaap-bc:8989/ECOMPDBCAPP/api/v2',
+    '',
+    '',
+    NULL,
+    'okYTaDrhzibcbGVq5mjkVQ==',
+    0,
+    0,
+    'Default',
+    'ueb_key',
+    'ueb_secret',
+    'ECOMP-PORTAL-OUTBOX',
+    1,
+    0,
+    NULL
+  ),(
+    4,
+    'SDC',
+    'images/cache/portal956868231_53879.png',
+    NULL,
+    NULL,
+    'http://sdc.api.fe.simpledemo.onap.org:30206/sdc1/portal',
+    NULL,
+    'http://sdc-be:8080/api/v3',
+    '',
+    '',
+    NULL,
+    'j85yNhyIs7zKYbR1VlwEfNhS6b7Om4l0Gx5O8931sCI=',
+    0,
+    1,
+    'sdc',
+    'ueb_key',
+    'ueb_secret',
+    'ECOMP-PORTAL-OUTBOX',
+    1,
+    1,
+    'org.onap.sdc'
+  ),(
+    5,
+    'Policy',
+    'images/cache/portal1470452815_67021.png',
+    NULL,
+    NULL,
+    'https://policy.api.simpledemo.onap.org:30219/onap/policy',
+    NULL,
+    'https://pap:8443/onap/api/v3',
+    '',
+    '',
+    NULL,
+    '2VxipM8Z3SETg32m3Gp0FvKS6zZ2uCbCw46WDyK6T5E=',
+    0,
+    1,
+    'Default',
+    'ueb_key_5',
+    'ueb_secret',
+    'ECOMP-PORTAL-OUTBOX',
+    1,
+    1,
+    'org.onap.policy'
+  ),(
+    6,
+    'Virtual Infrastructure Deployment',
+    'images/cache/portal-345993588_92550.png',
+    NULL,
+    NULL,
+    'https://vid.api.simpledemo.onap.org:30200/vid/welcome.htm',
+    NULL,
+    'https://vid:8443/vid/api/v3',
+    '',
+    '',
+    NULL,
+    '2VxipM8Z3SETg32m3Gp0FvKS6zZ2uCbCw46WDyK6T5E=',
+    0,
+    1,
+    'Default',
+    '2Re7Pvdkgw5aeAUD',
+    'S31PrbOzGgL4hg4owgtx47Da',
+    'ECOMP-PORTAL-OUTBOX-90',
+    1,
+    1,
+    'org.onap.vid'
+  ),(
+    7,
+    'A&AI UI',
+    'images/cache/portal-345993588_92550.png',
+    NULL,
+    NULL,
+    'https://aai.ui.simpledemo.onap.org:30220/services/aai/webapp/index.html#/viewInspect',
+    NULL,
+    'https://aai-sparky-be.onap:8000/api/v2',
+    '',
+    '',
+    NULL,
+    '4LK69amiIFtuzcl6Gsv97Tt7MLhzo03aoOx7dTvdjKQ=',
+    0,
+    1,
+    'aaiui',
+    'ueb_key_7',
+    'ueb_secret',
+    'ECOMP-PORTAL-OUTBOX',
+    1,
+    1,
+    'org.onap.aai'
+  ),(
+    8,
+    'CLI',
+    'images/cache/portal-345993588_92550.png',
+    NULL,
+    NULL,
+    'http://cli.api.simpledemo.onap.org:30260/',
+    NULL,
+    NULL,
+    '',
+    '',
+    NULL,
+    '',
+    1,
+    1,
+    '',
+    '',
+    '',
+    '',
+    1,
+    0,
+    NULL
+  ),(
+    9,
+    'MSB',
+    'images/cache/portal-345993588_92550.png',
+    NULL,
+    NULL,
+    'http://msb.api.simpledemo.onap.org:30280/iui/microservices/default.html',
+    NULL,
+    NULL,
+    '',
+    '',
+    NULL,
+    '',
+    1,
+    1,
+    '',
+    '',
+    '',
+    '',
+    2,
+    0,
+    NULL
+  ),(
+    10,
+    'SO-Monitoring',
+    'images/cache/portal-345993588_92550.png',
+    NULL,
+    NULL,
+    'http://so-monitoring:30224',
+    NULL,
+    'http://so-monitoring:30224',
+    '',
+    '',
+    NULL,
+    'password',
+    1,
+    1,
+    'user',
+    '',
+    '',
+    '',
+    1,
+    0,
+    'SO-Monitoring'
+  ),
+  (11,'LF Acumos Marketplace','images/cache/portal_907838932_26954.png',NULL,NULL,'https://marketplace.acumos.org/#/home',
+    NULL,NULL,'','',NULL,'',1,1,'','','','',2,0,NULL);
+
+
+--
+-- Dumping data for table `ep_app_function`
+--
+
+INSERT INTO `ep_app_function` (`id`,`app_id`, `function_cd`, `function_name`) VALUES
+(12, 1,'menu|menu_acc_admin|*','Admin Account Menu'),
+(13, 1,'menu|menu_admin|*','Admin Menu'),
+(14, 1,'menu|menu_home|*','Home Menu'),
+(15, 1,'menu|menu_logout|*','Logout Menu'),
+(16, 1,'menu|menu_web_analytics|*','Web Analytics'),
+(17, 1,'url|addWebAnalyticsReport|*','Add Web Analytics Report'),
+(18, 1,'url|appsFullList|*','Apps Full List'),
+(19, 1,'url|centralizedApps|*','Centralized Apps'),
+(20, 1,'url|edit_notification|*','User Notification'),
+(21, 1,'url|functionalMenu|*','Functional Menu'),
+(22, 1,'url|getAdminNotifications|*','Admin Notifications'),
+(23, 1,'url|getAllWebAnalytics|*','Get All Web Analytics'),
+(24, 1,'url|getFunctionalMenuRole|*','Get Functional Menu Role'),
+(25, 1,'url|getNotificationAppRoles|*','Get Notification App Roles'),
+(26, 1,'url|getUserAppsWebAnalytics|*','Get User Apps Web Analytics'),
+(27, 1,'url|getUserJourneyAnalyticsReport|*','Get User Journey Report'),
+(28, 1,'url|get_roles%2f%2a|*','getRolesOfApp'),
+(29, 1,'url|get_role_functions%2f%2a|*','Get Role Functions'),
+(30, 1,'url|login|*','Login'),
+(31, 1,'url|notification_code|*','Notification Code'),
+(32, 1,'url|role_function_list%2fsaveRoleFunction%2f%2a|*','Save Role Function'),
+(33, 1,'url|saveNotification|*','publish notifications'),
+(34, 1,'url|syncRoles|*','SyncRoles'),
+(35, 1,'url|url_role.htm|*','role page'),
+(36, 1,'url|url_welcome.htm|*','welcome page'),
+(37, 1,'url|userAppRoles|*','userAppRoles'),
+(38, 1,'url|userApps|*','User Apps');
+
+--
+-- Dumping data for table `fn_role`
+--
+
+INSERT INTO `fn_role` (`id`, `role_name`, `active_yn`, `priority`, `app_id`, `app_role_id`) VALUES
+(1,'System_Administrator',1,1,NULL,NULL),
+(16,'Standard_User',1,5,NULL,NULL),
+(900,'Restricted_App_Role',1,1,NULL,NULL),
+(950,'Portal_Notification_Admin',1,1,NULL,NULL),
+(999,'Account_Administrator',1,1,NULL,NULL),
+(1000,'System_Administrator',1,1,2,1),
+(1001,'Standard_User',1,1,2,16),
+(1002,'System_Administrator',1,1,3,1),
+(1003,'Standard_User',1,1,3,16),
+(1004,'ADMIN',1,1,4,0),
+(1005,'TESTOR',1,1,4,1),
+(1006,'System_Administrator',1,1,5,1),
+(1007,'Standard_User',1,1,5,16),
+(1008,'System_Administrator',1,1,6,1),
+(1009,'Standard_User',1,1,6,16),
+(1010,'Usage_Analyst',1,1,NULL,NULL),
+(1011,'View',1,1,7,1),
+(1012,'Standard_User',1,1,7,16),
+(2115,'Portal_Usage_Analyst',1,6,NULL,NULL);
+
+--
+-- Dumping data for table `ep_app_role_function`
+--
+
+INSERT INTO `ep_app_role_function` (`id`, `app_id`, `role_id`, `function_cd`, `role_app_id`) VALUES
+(1,1,1,'url|login|*',NULL),
+(2,1,1,'menu|menu_admin|*',NULL),
+(3,1,1,'menu|menu_home|*',NULL),
+(4,1,1,'menu|menu_logout|*',NULL),
+(5,1,16,'url|login|*',NULL),
+(6,1,16,'menu|menu_home|*',NULL),
+(7,1,16,'menu|menu_logout|*',NULL),
+(8,1,950,'url|edit_notification|*',NULL),
+(9,1,950,'url|getAdminNotifications|*',NULL),
+(10,1,950,'url|saveNotification|*',NULL),
+(11,1,999,'url|userAppRoles|*',NULL),
+(12,1,999,'url|getAdminNotifications|*',NULL),
+(13,1,999,'url|userApps|*',NULL),
+(14,1,1010,'menu|menu_web_analytics|*',NULL),
+(15,1,2115,'menu|menu_web_analytics|*',NULL),
+(16,1,1,'menu|menu_acc_admin|*',NULL),
+(17,1,999,'menu|menu_acc_admin|*',NULL),
+(18,1,999,'url|centralizedApps|*',NULL),
+(19,1,999,'url|getAllWebAnalytics|*',NULL),
+(20,1,999,'url|getFunctionalMenuRole|*',NULL),
+(21,1,999,'url|getNotificationAppRoles|*',NULL),
+(22,1,999,'url|getUserAppsWebAnalytics|*',NULL),
+(23,1,999,'url|getUserJourneyAnalyticsReport|*',NULL),
+(24,1,999,'url|get_roles%2f%2a|*',NULL),
+(25,1,999,'url|get_role_functions%2f%2a|*',NULL),
+(26,1,999,'url|notification_code|*',NULL),
+(27,1,999,'url|role_function_list%2fsaveRoleFunction%2f%2a|*',NULL),
+(28,1,999,'url|syncRoles|*',NULL);
+
+--
+-- Dumping data for table `ep_basic_auth_account`
+--
+
+INSERT INTO `ep_basic_auth_account` (`id`, `ext_app_name`, `username`, `password`, `active_yn`) VALUES
+(1,'JIRA','jira','6APqvG4AU2rfLgCvMdySwQ==',1);
+
+--
+-- Dumping data for table `ep_microservice`
+--
+
+INSERT INTO `ep_microservice` (`id`, `name`, `description`, `app_Id`, `endpoint_url`, `security_type`, `username`, `password`, `active`) VALUES
+(1,'News Microservice','News',1,'http://portal-app:8989/ONAPPORTAL/commonWidgets','Basic Authentication','portal','6APqvG4AU2rfLgCvMdySwQ==',1),
+(2,'Events Microservice','Events',1,'http://portal-app:8989/ONAPPORTAL/commonWidgets','Basic Authentication','portal','6APqvG4AU2rfLgCvMdySwQ==',1),
+(3,'Resources Microservice','Resources',1,'http://portal-app:8989/ONAPPORTAL/commonWidgets','Basic Authentication','portal','6APqvG4AU2rfLgCvMdySwQ==',1),
+(4,'Portal-Common-Scheduler Microservice','Portal-Common-Scheduler',1,'http://portal-app:8989/ONAPPORTAL/commonWidgets','Basic Authentication','portal','6APqvG4AU2rfLgCvMdySwQ==',1);
+
+--
+-- Dumping data for table `ep_microservice_parameter`
+--
+
+INSERT INTO `ep_microservice_parameter` (`id`, `service_id`, `para_key`, `para_value`) VALUES
+(1,1,'resourceType','NEWS'),
+(2,2,'resourceType','EVENTS'),
+(3,3,'resourceType','IMPORTANTRESOURCES'),
+(4,4,'resourceType',NULL);
+
+--
+-- Dumping data for table `ep_widget_catalog`
+--
+
+INSERT INTO `ep_widget_catalog` (`wdg_name`, `service_id`, `wdg_desc`, `wdg_file_loc`, `all_user_flag`) VALUES
+('News',1,'News','news-widget.zip',1),
+('Events',2,'Events','events-widget.zip',1),
+('Resources',3,'Resources','resources-widget.zip',1),
+('Portal-Common-Scheduler',4,'Portal-Common-Scheduler','portal-common-scheduler-widget.zip',1);
+
+--
+-- Dumping data for table `ep_widget_catalog_files`
+--
+
+INSERT INTO `ep_widget_catalog_files` (`file_id`, `widget_id`, `widget_name`, `framework_js`, `controller_js`, `markup_html`, `widget_css`) VALUES
+(1,1,'News','var Portal1Widget = (function(window, undefined) {\n\n    var Portal1Widget = Portal1Widget || {};\nfunction extractHostPortApp(src) {\n\nPortal1Widget.microserviceId = 1;\nPortal1Widget.pathArray = src.split( \'/\' );\n\n            Portal1Widget.widgetName = 1;\n         Portal1Widget.serviceSeperator = Portal1Widget.pathArray[Portal1Widget.pathArray.length - 4];                                           \n              Portal1Widget.commonUrl = src.substring(0, src.lastIndexOf(\"/\" + Portal1Widget.pathArray[Portal1Widget.pathArray.length - 2]));       \n              \n              Portal1Widget.recipientDivDataAttrib = \'data-\' + Portal1Widget.widgetName;                                                          \n                Portal1Widget.controllerName = \'Portal1Ctrl\';                                                                                     \n          Portal1Widget.readyCssFlag = \'portal1-css-ready\';                                                                                       \n            Portal1Widget.readyCssFlagExpectedValue = \'#bada55\';                                                                            \n            Portal1Widget.serviceURL = src.substring(0, src.lastIndexOf(\"/\" + Portal1Widget.serviceSeperator)) + \'/portalApi/microservice/proxy/parameter/\' + 1;  \n    }                                  \n   \n      extractHostPortApp(document.getElementsByTagName(\'script\')[0].src);\n \n      function loadStylesheet(url) {                                                                                                 \n               var link = document.createElement(\'link\');                                                                                 \n         link.rel = \'stylesheet\';                                                                                                   \n         link.type = \'text/css\';                                                                                                    \n         link.href = url;                                                                                                           \n           var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(link, entry);                                                                                \n   }                                                                                                                              \n                                                                                                                                   \n  function isCssReady(callback) {                                                                                                \n               var testElem = document.createElement(\'span\');                                                                             \n         testElem.id = Portal1Widget.readyCssFlag;                                                                                          \n           testElem.style = \'color: #fff\';                                                                       \n              var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(testElem, entry);                                                                            \n                                                                                                                                  \n               (function poll() {                                                                                                         \n                   var node = document.getElementById(\'css-ready\');                                                                       \n                     var value;                                                                                                             \n                       if (window.getComputedStyle) {                                                                                         \n                               value = document.defaultView.getComputedStyle(testElem, null)                                                      \n                                           .getPropertyValue(\'color\');                                                                                \n                 }                                                                                                                      \n                       else if (node.currentStyle) {                                                                                          \n                               value = node.currentStyle.color;                                                                                   \n                   }                                                                                                                      \n                       if (value && value === \'rgb(186, 218, 85)\' || value.toLowerCase() === Portal1Widget.readyCssFlagExpectedValue) {           \n                         callback();                                                                                                        \n                   } else {                                                                                                               \n                               setTimeout(poll, 500);                                                                                             \n                   }                                                                                                                      \n               })();                                                                                                                      \n   }                                                                                                                              \n                                                                                                                                      \n       function injectCss(css) {                                                                                                      \n               var style = document.createElement(\'style\');                                                                               \n         style.type = \'text/css\';                                                                                                   \n                 css = css.replace(/\\}/g, \"}\\n\");                                                                                           \n                                                                                                                                      \n               if (style.styleSheet) {                                                                                                    \n                   style.styleSheet.cssText = css;                                                                                        \n               } else {                                                                                                                   \n                   style.appendChild(document.createTextNode(css));                                                                       \n               }                                                                                                                          \n           var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(style, entry);                                                                               \n   }                                                                                                                              \n                                                                                                                                      \n       function loadScript(url, callback) {                                                                                           \n               var script = document.createElement(\'script\');                                                                             \n         script.src = url;                                                                                                          \n           \n              var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(script, entry);                                                                              \n           \n              script.onload = script.onreadystatechange = function() {   \n                   var rdyState = script.readyState;                                                                                      \n                       if (!rdyState || /complete|loaded/.test(script.readyState)) {                                                          \n                               callback();                                                                                                        \n                           script.onload = null;                                                                                              \n                           script.onreadystatechange = null;                                                                                  \n                   }                                                                                                                      \n               };                                                                                                                         \n   }                                                                                                                              \n                                                                                                                                   \n  function loadSupportingFiles(callback) {                                                                                       \n               callback();                                                                                                                \n   }                                                                                                                              \n                                                                                                                                      \n       function getWidgetParams() {                                                                                                   \n                                                                                                                                          \n   }                                                                                                                              \n                                                                                                                                      \n       function getWidgetData(widgetUrl, callback) {                                                                                      \n   var responseData;                                                                                                                                                                                                  \n   try{                                                                                                                                                                                                               \n           jQuery.ajax({                                                                                                                                                                                              \n                   url: widgetUrl,                                                                                                                                                                                            \n                   method: \"GET\",                                                                                                                                                                                                   \n                   xhrFields: {                                                                                                                                                                                                       \n                           withCredentials: true                                                                                                                                                                              \n                   },    \n                        crossDomain: true,                      \n                      success: function (result) {                                                                                                                                                                               \n                           if (result.isOk == false){                                                                                                                                                                         \n                                                                                                                                                                                                                              \n                           }else{                                                                                                                                                                                             \n                                   callback(result);                                                                                                                                                                                          \n                           }                                                                                                                                                                                                  \n                   }                                                                                                                                                                                                  \n           });                                                                                                                                                                                                \n   }                                                                                                                                                                                                                  \n   catch(e){                                                                                                                                                                                                          \n   \n      }                                                                                                                                                                                                                  \n                                                                                                                                                                                      \n   }                                                                                                   \n  \n      function getMarkupContent(markupLocation, callback){                                                                             \n                                                                                                                                        \n           try{\n                  jQuery.ajax({                                                                                                              \n                   url: markupLocation,\n                  method: \"GET\",   \n                   xhrFields: {                                                                                                                                                                                                       \n                                   withCredentials: true                                                                                                                                                                              \n                           },   \n                         crossDomain: true,              \n                      success: function (result) {                                                                                           \n                           if (result.isOk == false){                                                                                         \n                                                                                                                                              \n                           }else{                                                                                                             \n                               callback(result);                                                                                   \n                                  }                                                                                                                  \n                   }                                                                                                        \n                     });       \n            }\n             catch(e){\n                     \n              }\n     }                                                                                                                              \n                                                                                                                                      \n       function renderWidget(data, location, $controllerProvider) {                                                                   \n               var div = document.createElement(\'div\');                                                                                   \n         getMarkupContent(Portal1Widget.commonUrl + \"/markup/\" + Portal1Widget.widgetName, function(div){\n                    location.append(div);                                                                                                      \n                   Portal1Widget.widgetData = data;\n                      app.controllerProvider.register(Portal1Widget.controllerName, Portal1Widget.controller);                                           \n                   var mController = angular.element(document.getElementById(\"widgets\"));                                                   \n                   mController.scope().activateThis(location);   \n                });\n           \n      }                                                                                                                              \n                                                                                                                                      \n       function printAllArtifacts(moduleName, controllerName) {                                                                       \n           var queue = angular.module(moduleName)._invokeQueue;                                                                       \n           for(var i=0;i<queue.length;i++) {                                                                                          \n               var call = queue[i];                                                                                                   \n               console.log(i + \'. \' + call[0] + \' - \' + call[1] + \' - \' + call[2][0]);                                                \n     }                                                                                                                          \n       }                                                                                                                              \n                                                                                                                                      \n       function get(name){                                                                                                            \n          if(name=(new RegExp(\'[?&]\'+encodeURIComponent(name)+\'=([^&]*)\')).exec(location.search))                                     \n         return decodeURIComponent(name[1]);                                                                                      \n       }                                                                                                                              \n                                                                                                                                   \n  loadSupportingFiles(function() {                                                                                               \n               loadStylesheet(Portal1Widget.commonUrl + \'/\' + Portal1Widget.widgetName + \'/style.css\');                                           \n               loadScript(Portal1Widget.commonUrl + \'/\' + Portal1Widget.widgetName + \'/controller.js\',                                            \n                       function() {                                                                                                           \n                               $(\'[\'+ Portal1Widget.recipientDivDataAttrib + \']\').each(function() {                                                   \n                                   var location = jQuery(this);                                                                                   \n                                       location.removeAttr(Portal1Widget.recipientDivDataAttrib);                                                         \n                                   var id = location.attr(Portal1Widget.recipientDivDataAttrib);                                                      \n                                   getWidgetData(Portal1Widget.serviceURL, function(data) { \n                                             isCssReady(function(){                                                                                     \n                                                   renderWidget(data, location);                                                                          \n                                               });                                                                                                                                        \n                                   });                                                                                                            \n                               });                                                                                                                \n                   }                                                                                                                      \n               );                                                                                                                         \n   });                                                                                                                            \n                                                                                                                                      \n       return Portal1Widget;                                                                                                              \n})(window);                                                                                                                        \n                              ','Portal1Widget.controller = function Portal1Ctrl($rootScope, applicationsService , $log,\n                    $window, userProfileService, $scope, $cookies, $timeout, $interval,\n                   $uibModal, dashboardService, ngDialog) {Portal1Widget=Portal1Widget||{};var res = Portal1Widget.widgetData;\n           \n              var _this = this;       \n\n            //activate spinner\n            this.isLoading = true;\n                $scope.getUserAppsIsDone = false;\n             this.userProfileService = userProfileService;\n         $scope.demoNum = 1;\n           $scope.event_content_show = false;\n            $scope.widgetData = [];\n\n             $scope.editWidgetModalPopup = function(availableData, resourceType) {\n\n                       $scope.editData = JSON.stringify(availableData);\n                      $scope.availableDataTemp = $scope.availableData;\n                      \n              };\n            \n              /*Setting News data*/\n         $scope.newsData = [];\n         $scope.updateNews = function() {\n                      $scope.newsData.length=0;\n                     //dashboardService.getCommonWidgetData(\'NEWS\').then(function(res) {\n                         // $log.info(res.message);\n                            var newsDataJsonArray = res.response.items;\n                           for (var i = 0; i < newsDataJsonArray.length; i++) {\n                                  $scope.newsData.push(newsDataJsonArray[i]);\n                           }\n                     //})[\'catch\'](function(err) {\n                       //      $log.error(\'dashboard controller: failed to get news list\', err);\n                   //      _this.isLoading = false;\n                      //});\n         }\n             $scope.updateNews();\n\n        }\n\n;Portal1Widget.controller.$inject = [\'$rootScope\',\'applicationsService\',\'$log\',\'$window\',\'userProfileService\',\'$scope\',\'$cookies\',\'$timeout\',\'$interval\',\'$uibModal\',\'dashboardService\',\'ngDialog\'];','<div  id=\"widget-news\" ng-controller=\"Portal1Ctrl\" class=\"widget-news-main\">\n                <div att-gridster-item-body class=\"information-section-gridsterContent\">\n                    <div class=\"resources\">\n                             <ul ng-show=\"newsData.length!=0\">\n                                   <li ng-repeat=\"item in newsData\"><a id=\"new-widget-{{item.id}}\"\n                                                                                           href=\"{{item.href}}\" target=\"_blank\" ng-bind=\"item.title\"></a></li>\n                             </ul>\n                                                 <div ng-hide=\"newsData.length!=0\">\n                                                          <div class=\"activity-error-container\"\n                                                                       style=\"background: rgb(255, 255, 255); overflow: hidden !important; width: 100%;\">\n                                                                  <div class=\"activity-error-block\">\n                                                                          <i class=\"icon-information full-linear-icon-information\"\n                                                                               style=\"margin-left: 125px; font-size: 90px\"></i> <br>\n                                                                            <div class=\"activity-error-msg1\">There\'s currently no\n                                                                                                              news available.</div>\n                                                                 </div>\n                                                                </div>\n                                        </div>\n                        </div>\n                </div>\n</div>\n','\n.portal-widget-panel-container {\n margin-left:150px;\n    width:1500px;\n}\n\n\n.portal-widget-panel-fixed-panel {\n  min-height: 300px;\n  max-height: 1300px;\n  overflow: auto;\n}\n\n.portal-widget-panel-double-middle {\n  min-height: 660px;\n  max-height: 660px;\n  overflow: auto;\n}\n\n.portal-widget-panel-row {\n    margin-right: 0px;\n    margin-left:  0px;\n    width: 2800px;\n}\n\n/*Increases the width of the card/panel */\n.portal-widget-panel-panel-default {\n        width:450px\n}\n\n/*Controls the spacing between the cards */\n.portal-widget-panel-col-sm-3 {\n        width:20.5%\n}\n\n.portal-widget-panel-top {\n    top: 15px;\n  left: 15px;\n}\n\n#portal1-css-ready {\ncolor: #bada55 !important;\n}'),(2,2,'Events','var Portal2Widget = (function(window, undefined) {                                                                                      \n                                                                                                                                    \n var Portal2Widget = Portal2Widget || {};                                                                                                \n      function extractHostPortApp(src) {                                                                                                  \n          \n              Portal2Widget.microserviceId = 2;                                                                                 \n            Portal2Widget.pathArray = src.split( \'/\' );                                                                                     \n                    \n              Portal2Widget.widgetName = 2;\n         Portal2Widget.serviceSeperator = Portal2Widget.pathArray[Portal2Widget.pathArray.length - 4];                                           \n              Portal2Widget.commonUrl = src.substring(0, src.lastIndexOf(\"/\" + Portal2Widget.pathArray[Portal2Widget.pathArray.length - 2]));       \n              \n              Portal2Widget.recipientDivDataAttrib = \'data-\' + Portal2Widget.widgetName;                                                          \n                Portal2Widget.controllerName = \'Portal2Ctrl\';                                                                                     \n          Portal2Widget.readyCssFlag = \'portal2-css-ready\';                                                                                       \n            Portal2Widget.readyCssFlagExpectedValue = \'#bada55\';                                                                            \n            Portal2Widget.serviceURL = src.substring(0, src.lastIndexOf(\"/\" + Portal2Widget.serviceSeperator)) + \'/portalApi/microservice/proxy/parameter/\' + 2;  \n    }                                  \n   \n      extractHostPortApp(document.getElementsByTagName(\'script\')[0].src);\n \n      function loadStylesheet(url) {                                                                                                 \n               var link = document.createElement(\'link\');                                                                                 \n         link.rel = \'stylesheet\';                                                                                                   \n         link.type = \'text/css\';                                                                                                    \n         link.href = url;                                                                                                           \n           var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(link, entry);                                                                                \n   }                                                                                                                              \n                                                                                                                                   \n  function isCssReady(callback) {                                                                                                \n               var testElem = document.createElement(\'span\');                                                                             \n         testElem.id = Portal2Widget.readyCssFlag;                                                                                          \n           testElem.style = \'color: #fff\';                                                                       \n              var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(testElem, entry);                                                                            \n                                                                                                                                  \n               (function poll() {                                                                                                         \n                   var node = document.getElementById(\'css-ready\');                                                                       \n                     var value;                                                                                                             \n                       if (window.getComputedStyle) {                                                                                         \n                               value = document.defaultView.getComputedStyle(testElem, null)                                                      \n                                           .getPropertyValue(\'color\');                                                                                \n                 }                                                                                                                      \n                       else if (node.currentStyle) {                                                                                          \n                               value = node.currentStyle.color;                                                                                   \n                   }                                                                                                                      \n                       if (value && value === \'rgb(186, 218, 85)\' || value.toLowerCase() === Portal2Widget.readyCssFlagExpectedValue) {           \n                         callback();                                                                                                        \n                   } else {                                                                                                               \n                               setTimeout(poll, 500);                                                                                             \n                   }                                                                                                                      \n               })();                                                                                                                      \n   }                                                                                                                              \n                                                                                                                                      \n       function injectCss(css) {                                                                                                      \n               var style = document.createElement(\'style\');                                                                               \n         style.type = \'text/css\';                                                                                                   \n                 css = css.replace(/\\}/g, \"}\\n\");                                                                                           \n                                                                                                                                      \n               if (style.styleSheet) {                                                                                                    \n                   style.styleSheet.cssText = css;                                                                                        \n               } else {                                                                                                                   \n                   style.appendChild(document.createTextNode(css));                                                                       \n               }                                                                                                                          \n           var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(style, entry);                                                                               \n   }                                                                                                                              \n                                                                                                                                      \n       function loadScript(url, callback) {                                                                                           \n               var script = document.createElement(\'script\');                                                                             \n         script.src = url;                                                                                                          \n           \n              var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(script, entry);                                                                              \n           \n              script.onload = script.onreadystatechange = function() {   \n                   var rdyState = script.readyState;                                                                                      \n                       if (!rdyState || /complete|loaded/.test(script.readyState)) {                                                          \n                               callback();                                                                                                        \n                           script.onload = null;                                                                                              \n                           script.onreadystatechange = null;                                                                                  \n                   }                                                                                                                      \n               };                                                                                                                         \n   }                                                                                                                              \n                                                                                                                                   \n  function loadSupportingFiles(callback) {                                                                                       \n               callback();                                                                                                                \n   }                                                                                                                              \n                                                                                                                                      \n       function getWidgetParams() {                                                                                                   \n                                                                                                                                          \n   }                                                                                                                              \n                                                                                                                                      \n       function getWidgetData(widgetUrl, callback) {                                                                                      \n   var responseData;                                                                                                                                                                                                  \n   try{                                                                                                                                                                                                               \n           jQuery.ajax({                                                                                                                                                                                              \n                   url: widgetUrl,                                                                                                                                                                                            \n                   method: \"GET\",                                                                                                                                                                                                   \n                   xhrFields: {                                                                                                                                                                                                       \n                           withCredentials: true                                                                                                                                                                              \n                   },    \n                        crossDomain: true,                      \n                      success: function (result) {                                                                                                                                                                               \n                           if (result.isOk == false){                                                                                                                                                                         \n                                                                                                                                                                                                                              \n                           }else{                                                                                                                                                                                             \n                                   callback(result);                                                                                                                                                                                          \n                           }                                                                                                                                                                                                  \n                   }                                                                                                                                                                                                  \n           });                                                                                                                                                                                                \n   }                                                                                                                                                                                                                  \n   catch(e){                                                                                                                                                                                                          \n   \n      }                                                                                                                                                                                                                  \n                                                                                                                                                                                      \n   }                                                                                                   \n  \n      function getMarkupContent(markupLocation, callback){                                                                             \n                                                                                                                                        \n           try{\n                  jQuery.ajax({                                                                                                              \n                   url: markupLocation,\n                  method: \"GET\",   \n                   xhrFields: {                                                                                                                                                                                                       \n                                   withCredentials: true                                                                                                                                                                              \n                           },   \n                         crossDomain: true,              \n                      success: function (result) {                                                                                           \n                           if (result.isOk == false){                                                                                         \n                                                                                                                                              \n                           }else{                                                                                                             \n                               callback(result);                                                                                   \n                                  }                                                                                                                  \n                   }                                                                                                        \n                     });       \n            }\n             catch(e){\n                     \n              }\n     }                                                                                                                              \n                                                                                                                                      \n       function renderWidget(data, location, $controllerProvider) {                                                                   \n               var div = document.createElement(\'div\');                                                                                   \n         getMarkupContent(Portal2Widget.commonUrl + \"/markup/\" + Portal2Widget.widgetName, function(div){\n                    location.append(div);                                                                                                      \n                   Portal2Widget.widgetData = data;\n                      app.controllerProvider.register(Portal2Widget.controllerName, Portal2Widget.controller);                                           \n                   var mController = angular.element(document.getElementById(\"widgets\"));                                                   \n                   mController.scope().activateThis(location);   \n                });\n           \n      }                                                                                                                              \n                                                                                                                                      \n       function printAllArtifacts(moduleName, controllerName) {                                                                       \n           var queue = angular.module(moduleName)._invokeQueue;                                                                       \n           for(var i=0;i<queue.length;i++) {                                                                                          \n               var call = queue[i];                                                                                                   \n               console.log(i + \'. \' + call[0] + \' - \' + call[1] + \' - \' + call[2][0]);                                                \n     }                                                                                                                          \n       }                                                                                                                              \n                                                                                                                                      \n       function get(name){                                                                                                            \n          if(name=(new RegExp(\'[?&]\'+encodeURIComponent(name)+\'=([^&]*)\')).exec(location.search))                                     \n         return decodeURIComponent(name[1]);                                                                                      \n       }                                                                                                                              \n                                                                                                                                   \n  loadSupportingFiles(function() {                                                                                               \n               loadStylesheet(Portal2Widget.commonUrl + \'/\' + Portal2Widget.widgetName + \'/style.css\');                                           \n               loadScript(Portal2Widget.commonUrl + \'/\' + Portal2Widget.widgetName + \'/controller.js\',                                            \n                       function() {                                                                                                           \n                               $(\'[\'+ Portal2Widget.recipientDivDataAttrib + \']\').each(function() {                                                   \n                                   var location = jQuery(this);                                                                                   \n                                       location.removeAttr(Portal2Widget.recipientDivDataAttrib);                                                         \n                                   var id = location.attr(Portal2Widget.recipientDivDataAttrib);                                                      \n                                   getWidgetData(Portal2Widget.serviceURL, function(data) { \n                                             isCssReady(function(){                                                                                     \n                                                   renderWidget(data, location);                                                                          \n                                               });                                                                                                                                        \n                                   });                                                                                                            \n                               });                                                                                                                \n                   }                                                                                                                      \n               );                                                                                                                         \n   });                                                                                                                            \n                                                                                                                                      \n       return Portal2Widget;                                                                                                              \n})(window);                                                                                                                        \n                              ','Portal2Widget.controller = function Portal2Ctrl($rootScope, applicationsService , $log,\n                    $window, userProfileService, $scope, $cookies, $timeout, $interval,\n                   $uibModal, dashboardService, ngDialog) {Portal2Widget=Portal2Widget||{};var res = Portal2Widget.widgetData;\n           var _this = this;\n\n           //activate spinner\n            this.isLoading = true;\n                $scope.getUserAppsIsDone = false;\n             this.userProfileService = userProfileService;\n         $scope.demoNum = 1;\n           $scope.event_content_show = false;\n            $scope.widgetData = [];\n\n             $scope.editWidgetModalPopup = function(availableData, resourceType) {\n\n                       $scope.editData = JSON.stringify(availableData);\n                      $scope.availableDataTemp = $scope.availableData;\n                      \n              };\n            /*Setting News data*/\n         $scope.eventData = [];\n                $scope.updateEvents = function() {\n\n                  $scope.eventData.length=0;\n                    //dashboardService.getCommonWidgetData(\'EVENTS\').then(function(res) {\n                               var eventDataJsonArray = res.response.items;    \n                              for (var i = 0; i < eventDataJsonArray.length; i++) {\n                                 if(eventDataJsonArray[i].eventDate !=null) {\n                                          // yyyy-mm-dd\n                                         eventDataJsonArray[i].year = eventDataJsonArray[i].eventDate.substring(2,4);\n                                          eventDataJsonArray[i].mon  = eventDataJsonArray[i].eventDate.substring(5,7);\n                                          eventDataJsonArray[i].day  = eventDataJsonArray[i].eventDate.substring(8,10);\n                                 }\n                                     $scope.eventData.push(eventDataJsonArray[i]);\n                         }\n                     //})[\'catch\'](function(err) {\n                       //      $log.error(\'dashboard controller: failed to get Events list\', err);\n                 //      _this.isLoading = false;\n                      //});\n         }\n             $scope.updateEvents();\n\n\n    }\n;Portal2Widget.controller.$inject = [\'$rootScope\',\'applicationsService\',\'$log\',\'$window\',\'userProfileService\',\'$scope\',\'$cookies\',\'$timeout\',\'$interval\',\'$uibModal\',\'dashboardService\',\'ngDialog\'];','<div  id=\"widget-events\" ng-controller=\"Portal2Ctrl\" class=\"widget-news-main\">\n                <div att-gridster-item-body\n                   class=\"information-section-gridsterContent\">\n                        <div class=\"events\">\n                                <ul ng-show=\"eventData.length!=0\">\n                                  <li ng-repeat=\"event in eventData\">\n                                         <div ng-click=\"event_content_show=!event_content_show\">\n                                                     <div class=\"events-date\">{{event.mon}}/{{event.day}}/{{event.year}}\n                                                 </div>\n                                                        <div>\n                                                         <div class=\"event-title-div\">\n                                                                       <p ng-bind=\"event.title\"></p>\n                                                               </div>\n                                                                <div>\n                                                                 <span class=\"icon-chevron-up\" ng-if=\"event_content_show\"\n                                                                          style=\"color: #888; font-size: 22px;\"></span> <span\n                                                                         class=\"icon-chevron-down\" ng-if=\"!event_content_show\"\n                                                                             style=\"color: #888; font-size: 22px;\"></span>\n\n                                                             </div>\n                                                                <div style=\"clear: both;\"></div>\n                                                    </div>\n                                                </div>\n                                                <div class=\"events-content\" ng-show=\"event_content_show\">\n                                                 <div class=\"events-content-body\">\n                                                           <a id=\"event-widget-{{event.id}}\" class=\"events-link\" ng-href=\"{{event.href}}\"\n                                                                  target=\"_blank\"> <span ng-bind=\"event.content\"></span>\n                                                            </a>\n                                                  </div>\n                                                        <div></div>\n                                           </div>\n                                        </li>\n\n\n                             </ul>\n                         <div ng-hide=\"eventData.length!=0\">\n                                 <div class=\"activity-error-container\"\n                                               style=\"background: rgb(255, 255, 255); overflow: hidden !important; width: 100%;\">\n                                          <div class=\"activity-error-block\">\n                                                  <i class=\"icon-information full-linear-icon-information\"\n                                                            style=\"margin-left: 125px; font-size: 90px\"></i> <br>\n                                                       <div class=\"activity-error-msg1\">There\'s currently no\n                                                              event available.</div>\n                                                </div>\n                                        </div>\n                                </div>\n                        </div>\n          </div>\n</div>\n','\n.portal-widget-panel-container {\n       margin-left:150px;\n    width:1500px;\n}\n\n\n.portal-widget-panel-fixed-panel {\n  min-height: 300px;\n  max-height: 1300px;\n  overflow: auto;\n}\n\n.portal-widget-panel-double-middle {\n  min-height: 660px;\n  max-height: 660px;\n  overflow: auto;\n}\n\n.portal-widget-panel-row {\n    margin-right: 0px;\n    margin-left:  0px;\n    width: 2800px;\n}\n\n/*Increases the width of the card/panel */\n.portal-widget-panel-panel-default {\n        width:450px\n}\n\n/*Controls the spacing between the cards */\n.portal-widget-panel-col-sm-3 {\n        width:20.5%\n}\n\n.portal-widget-panel-top {\n    top: 15px;\n  left: 15px;\n}\n\n#portal2-css-ready {\ncolor: #bada55 !important;\n}'),(3,3,'Resources','var Portal3Widget = (function(window, undefined) {                                                                                      \n                                                                                                                                    \n      var Portal3Widget = Portal3Widget || {};                                                                                                \n      function extractHostPortApp(src) {                                                                                                  \n          \n              Portal3Widget.microserviceId = 3;                                                                                 \n            Portal3Widget.pathArray = src.split( \'/\' );                                                                                     \n                    \n              Portal3Widget.widgetName = 3;\n         Portal3Widget.serviceSeperator = Portal3Widget.pathArray[Portal3Widget.pathArray.length - 4];                                           \n              Portal3Widget.commonUrl = src.substring(0, src.lastIndexOf(\"/\" + Portal3Widget.pathArray[Portal3Widget.pathArray.length - 2]));       \n              \n              Portal3Widget.recipientDivDataAttrib = \'data-\' + Portal3Widget.widgetName;                                                          \n                Portal3Widget.controllerName = \'Portal3Ctrl\';                                                                                     \n          Portal3Widget.readyCssFlag = \'portal3-css-ready\';                                                                                       \n            Portal3Widget.readyCssFlagExpectedValue = \'#bada55\';                                                                            \n            Portal3Widget.serviceURL = src.substring(0, src.lastIndexOf(\"/\" + Portal3Widget.serviceSeperator)) + \'/portalApi/microservice/proxy/parameter/\' + 3;  \n    }                                  \n   \n      extractHostPortApp(document.getElementsByTagName(\'script\')[0].src);\n \n      function loadStylesheet(url) {                                                                                                 \n               var link = document.createElement(\'link\');                                                                                 \n         link.rel = \'stylesheet\';                                                                                                   \n         link.type = \'text/css\';                                                                                                    \n         link.href = url;                                                                                                           \n           var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(link, entry);                                                                                \n   }                                                                                                                              \n                                                                                                                                   \n  function isCssReady(callback) {                                                                                                \n               var testElem = document.createElement(\'span\');                                                                             \n         testElem.id = Portal3Widget.readyCssFlag;                                                                                          \n           testElem.style = \'color: #fff\';                                                                       \n              var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(testElem, entry);                                                                            \n                                                                                                                                  \n               (function poll() {                                                                                                         \n                   var node = document.getElementById(\'css-ready\');                                                                       \n                     var value;                                                                                                             \n                       if (window.getComputedStyle) {                                                                                         \n                               value = document.defaultView.getComputedStyle(testElem, null)                                                      \n                                           .getPropertyValue(\'color\');                                                                                \n                 }                                                                                                                      \n                       else if (node.currentStyle) {                                                                                          \n                               value = node.currentStyle.color;                                                                                   \n                   }                                                                                                                      \n                       if (value && value === \'rgb(186, 218, 85)\' || value.toLowerCase() === Portal3Widget.readyCssFlagExpectedValue) {           \n                         callback();                                                                                                        \n                   } else {                                                                                                               \n                               setTimeout(poll, 500);                                                                                             \n                   }                                                                                                                      \n               })();                                                                                                                      \n   }                                                                                                                              \n                                                                                                                                      \n       function injectCss(css) {                                                                                                      \n               var style = document.createElement(\'style\');                                                                               \n         style.type = \'text/css\';                                                                                                   \n                 css = css.replace(/\\}/g, \"}\\n\");                                                                                           \n                                                                                                                                      \n               if (style.styleSheet) {                                                                                                    \n                   style.styleSheet.cssText = css;                                                                                        \n               } else {                                                                                                                   \n                   style.appendChild(document.createTextNode(css));                                                                       \n               }                                                                                                                          \n           var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(style, entry);                                                                               \n   }                                                                                                                              \n                                                                                                                                      \n       function loadScript(url, callback) {                                                                                           \n               var script = document.createElement(\'script\');                                                                             \n         script.src = url;                                                                                                          \n           \n              var entry = document.getElementsByTagName(\'script\')[0];                                                                    \n         entry.parentNode.insertBefore(script, entry);                                                                              \n           \n              script.onload = script.onreadystatechange = function() {   \n                   var rdyState = script.readyState;                                                                                      \n                       if (!rdyState || /complete|loaded/.test(script.readyState)) {                                                          \n                               callback();                                                                                                        \n                           script.onload = null;                                                                                              \n                           script.onreadystatechange = null;                                                                                  \n                   }                                                                                                                      \n               };                                                                                                                         \n   }                                                                                                                              \n                                                                                                                                   \n  function loadSupportingFiles(callback) {                                                                                       \n               callback();                                                                                                                \n   }                                                                                                                              \n                                                                                                                                      \n       function getWidgetParams() {                                                                                                   \n                                                                                                                                          \n   }                                                                                                                              \n                                                                                                                                      \n       function getWidgetData(widgetUrl, callback) {                                                                                      \n   var responseData;                                                                                                                                                                                                  \n   try{                                                                                                                                                                                                               \n           jQuery.ajax({                                                                                                                                                                                              \n                   url: widgetUrl,                                                                                                                                                                                            \n                   method: \"GET\",                                                                                                                                                                                                   \n                   xhrFields: {                                                                                                                                                                                                       \n                           withCredentials: true                                                                                                                                                                              \n                   },    \n                        crossDomain: true,                      \n                      success: function (result) {                                                                                                                                                                               \n                           if (result.isOk == false){                                                                                                                                                                         \n                                                                                                                                                                                                                              \n                           }else{                                                                                                                                                                                             \n                                   callback(result);                                                                                                                                                                                          \n                           }                                                                                                                                                                                                  \n                   }                                                                                                                                                                                                  \n           });                                                                                                                                                                                                \n   }                                                                                                                                                                                                                  \n   catch(e){                                                                                                                                                                                                          \n   \n      }                                                                                                                                                                                                                  \n                                                                                                                                                                                      \n   }                                                                                                   \n  \n      function getMarkupContent(markupLocation, callback){                                                                             \n                                                                                                                                        \n           try{\n                  jQuery.ajax({                                                                                                              \n                   url: markupLocation,\n                  method: \"GET\",   \n                   xhrFields: {                                                                                                                                                                                                       \n                                   withCredentials: true                                                                                                                                                                              \n                           },   \n                         crossDomain: true,              \n                      success: function (result) {                                                                                           \n                           if (result.isOk == false){                                                                                         \n                                                                                                                                              \n                           }else{                                                                                                             \n                               callback(result);                                                                                   \n                                  }                                                                                                                  \n                   }                                                                                                        \n                     });       \n            }\n             catch(e){\n                     \n              }\n     }                                                                                                                              \n                                                                                                                                      \n       function renderWidget(data, location, $controllerProvider) {                                                                   \n               var div = document.createElement(\'div\');                                                                                   \n         getMarkupContent(Portal3Widget.commonUrl + \"/markup/\" + Portal3Widget.widgetName, function(div){\n                    location.append(div);                                                                                                      \n                   Portal3Widget.widgetData = data;\n                      app.controllerProvider.register(Portal3Widget.controllerName, Portal3Widget.controller);                                           \n                   var mController = angular.element(document.getElementById(\"widgets\"));                                                   \n                   mController.scope().activateThis(location);   \n                });\n           \n      }                                                                                                                              \n                                                                                                                                      \n       function printAllArtifacts(moduleName, controllerName) {                                                                       \n           var queue = angular.module(moduleName)._invokeQueue;                                                                       \n           for(var i=0;i<queue.length;i++) {                                                                                          \n               var call = queue[i];                                                                                                   \n               console.log(i + \'. \' + call[0] + \' - \' + call[1] + \' - \' + call[2][0]);                                                \n     }                                                                                                                          \n       }                                                                                                                              \n                                                                                                                                      \n       function get(name){                                                                                                            \n          if(name=(new RegExp(\'[?&]\'+encodeURIComponent(name)+\'=([^&]*)\')).exec(location.search))                                     \n         return decodeURIComponent(name[1]);                                                                                      \n       }                                                                                                                              \n                                                                                                                                   \n  loadSupportingFiles(function() {                                                                                               \n               loadStylesheet(Portal3Widget.commonUrl + \'/\' + Portal3Widget.widgetName + \'/style.css\');                                           \n               loadScript(Portal3Widget.commonUrl + \'/\' + Portal3Widget.widgetName + \'/controller.js\',                                            \n                       function() {                                                                                                           \n                               $(\'[\'+ Portal3Widget.recipientDivDataAttrib + \']\').each(function() {                                                   \n                                   var location = jQuery(this);                                                                                   \n                                       location.removeAttr(Portal3Widget.recipientDivDataAttrib);                                                         \n                                   var id = location.attr(Portal3Widget.recipientDivDataAttrib);                                                      \n                                   getWidgetData(Portal3Widget.serviceURL, function(data) { \n                                             isCssReady(function(){                                                                                     \n                                                   renderWidget(data, location);                                                                          \n                                               });                                                                                                                                        \n                                   });                                                                                                            \n                               });                                                                                                                \n                   }                                                                                                                      \n               );                                                                                                                         \n   });                                                                                                                            \n                                                                                                                                      \n       return Portal3Widget;                                                                                                              \n})(window);                                                                                                                        \n                              ','Portal3Widget.controller = function Portal3Ctrl($rootScope, applicationsService , $log,\n                    $window, userProfileService, $scope, $cookies, $timeout, $interval,\n                   $uibModal, dashboardService, ngDialog) {Portal3Widget=Portal3Widget||{};var res = Portal3Widget.widgetData;\n           \n              var _this = this;       \n\n            //activate spinner\n            this.isLoading = true;\n                $scope.getUserAppsIsDone = false;\n             this.userProfileService = userProfileService;\n         $scope.demoNum = 1;\n           $scope.event_content_show = false;\n            $scope.widgetData = [];\n\n             $scope.editWidgetModalPopup = function(availableData, resourceType) {\n\n                       $scope.editData = JSON.stringify(availableData);\n                      $scope.availableDataTemp = $scope.availableData;\n                      \n              };\n            \n              /*Setting News data*/\n         $scope.newsData = [];\n         $scope.updateNews = function() {\n                      $scope.newsData.length=0;\n                     //dashboardService.getCommonWidgetData(\'NEWS\').then(function(res) {\n                         // $log.info(res.message);\n                            var newsDataJsonArray = res.response.items;\n                           for (var i = 0; i < newsDataJsonArray.length; i++) {\n                                  $scope.newsData.push(newsDataJsonArray[i]);\n                           }\n                     //})[\'catch\'](function(err) {\n                       //      $log.error(\'dashboard controller: failed to get news list\', err);\n                   //      _this.isLoading = false;\n                      //});\n         }\n             $scope.updateNews();\n\n        }\n\n;Portal3Widget.controller.$inject = [\'$rootScope\',\'applicationsService\',\'$log\',\'$window\',\'userProfileService\',\'$scope\',\'$cookies\',\'$timeout\',\'$interval\',\'$uibModal\',\'dashboardService\',\'ngDialog\'];','<div  id=\"widget-news\" ng-controller=\"Portal3Ctrl\" class=\"widget-news-main\">\n                <div att-gridster-item-body class=\"information-section-gridsterContent\">\n                    <div class=\"resources\">\n                             <ul ng-show=\"newsData.length!=0\">\n                                   <li ng-repeat=\"item in newsData\"><a id=\"resource-widget-{{item.id}}\"\n                                                                                              href=\"{{item.href}}\" target=\"_blank\" ng-bind=\"item.title\"></a></li>\n                             </ul>\n                                                 <div ng-hide=\"newsData.length!=0\">\n                                                          <div class=\"activity-error-container\"\n                                                                       style=\"background: rgb(255, 255, 255); overflow: hidden !important; width: 100%;\">\n                                                                  <div class=\"activity-error-block\">\n                                                                          <i class=\"icon-information full-linear-icon-information\"\n                                                                               style=\"margin-left: 125px; font-size: 90px\"></i> <br>\n                                                                            <div class=\"activity-error-msg1\">There\'s currently no\n                                                                                                              news available.</div>\n                                                                 </div>\n                                                                </div>\n                                        </div>\n                        </div>\n                </div>\n</div>\n','\n.portal-widget-panel-container {\n margin-left:150px;\n    width:1500px;\n}\n\n\n.portal-widget-panel-fixed-panel {\n  min-height: 300px;\n  max-height: 1300px;\n  overflow: auto;\n}\n\n.portal-widget-panel-double-middle {\n  min-height: 660px;\n  max-height: 660px;\n  overflow: auto;\n}\n\n.portal-widget-panel-row {\n    margin-right: 0px;\n    margin-left:  0px;\n    width: 2800px;\n}\n\n/*Increases the width of the card/panel */\n.portal-widget-panel-panel-default {\n        width:450px\n}\n\n/*Controls the spacing between the cards */\n.portal-widget-panel-col-sm-3 {\n        width:20.5%\n}\n\n.portal-widget-panel-top {\n    top: 15px;\n  left: 15px;\n}\n\n#portal3-css-ready {\ncolor: #bada55 !important;\n}');
+
+--
+-- Dumping data for table `fn_app_contact_us`
+--
+
+INSERT INTO `fn_app_contact_us` (`app_id`, `contact_name`, `contact_email`, `url`, `active_yn`, `description`) VALUES
+(2,'Portal SDK Team','portal@lists.onap.org','https://wiki.onap.org/display/DW/Approved+Projects',NULL,'xDemo Application'),
+(3,'DBC Team','portal@lists.onap.org','https://wiki.onap.org/display/DW/Approved+Projects',NULL,'DBC.'),
+(4,'SDC Team','sdc@lists.onap.org','https://wiki.onap.org/display/DW/Approved+Projects',NULL,'Service Design and Creation (SDC).'),
+(5,'Policy Team','policy@lists.onap.org','https://wiki.onap.org/display/DW/Approved+Projects',NULL,'Policy.'),
+(6,'VID Team','vid@lists.onap.org','https://wiki.onap.org/display/DW/Approved+Projects',NULL,'Virtual Infrastructure Design.'),
+(7,'AAI UI Team','aaiui@lists.onap.org','https://wiki.onap.org/display/DW/Approved+Projects',NULL,'AAI UI Application'),
+(8,'CLI Team','onap-discuss@lists.onap.org','https://wiki.onap.org/display/DW/Approved+Projects',NULL,'CLI Application'),
+(10,'SO Team','so@lists.onap.org','https://wiki.onap.org/display/DW/Approved+Projects',NULL,'Service Orchestration (SO).');
+
+--
+-- Dumping data for table `fn_common_widget_data`
+--
+
+INSERT INTO `fn_common_widget_data` (`id`, `category`, `href`, `title`, `content`, `event_date`, `sort_order`) VALUES
+(6,'NEWS','https://www.onap.org/announcement/2017/09/27/open-network-automation-platform-onap-project-continues-rapid-membership-growth','Open Network Automation Platform (ONAP) Project Continues Rapid Membership Growth',NULL,NULL,10),
+(7,'NEWS','https://www.onap.org/announcement/2017/02/23/the-linux-foundation-announces-the-formation-of-a-new-project-to-help-accelerate-innovation-in-open-networking-automation','The Linux Foundation Announces Merger of Open Source ECOMP and OPEN-O to Form New Open Network Automation Platform (ONAP) Project',NULL,NULL,20),
+(8,'NEWS','http://about.att.com/story/orange_testing_att_open_source_ecomp_platform.html','Orange Testing AT&Ts Open Source ECOMP Platform for Building Software-Defined Network Capabilities',NULL,NULL,30),
+(9,'NEWS','http://about.att.com/innovationblog/linux_foundation','Opening up ECOMP: Our Network Operating System for SDN',NULL,NULL,40),
+(10,'EVENTS','https://onapbeijing2017.sched.com/list/descriptions/','ONAP Beijing Release Developer Forum',NULL,'2017-12-11',1),
+(11,'EVENTS','https://events.linuxfoundation.org/events/open-networking-summit-north-america-2018','Open Networking Summit',NULL,'2018-03-26',2),
+(12,'IMPORTANTRESOURCES','http://onap.readthedocs.io/en/latest/guides/onap-developer/developing/index.html','Development Guides',NULL,NULL,1),
+(13,'IMPORTANTRESOURCES','https://wiki.onap.org/','ONAP Wiki',NULL,NULL,2),
+(14,'IMPORTANTRESOURCES','http://onap.readthedocs.io/en/latest/guides/onap-developer/developing/index.html#portal-platform','ONAP Portal Documentation',NULL,NULL,3),
+(15,'IMPORTANTRESOURCES','http://onap.readthedocs.io/en/latest/guides/onap-developer/architecture/index.html#architecture','ONAP Architecture',NULL,NULL,4);
+
+--
+-- Dumping data for table `fn_display_text`
+--
+
+INSERT INTO `fn_display_text` (`id`, `language_id`, `text_id`, `text_label`) VALUES
+(1,1,2,'Home'),
+(2,1,3,'Application Catalog'),
+(3,1,4,'Widget Catalog'),
+(4,1,5,'Admins'),
+(5,1,6,'Roles'),
+(6,1,7,'Users'),
+(7,1,8,'Portal Admins'),
+(8,1,9,'Application Onboarding'),
+(9,1,10,'Widget Onboarding'),
+(10,1,11,'Edit Functional Menu'),
+(11,1,12,'User Notifications'),
+(12,1,13,'Microservice Onboarding'),
+(13,1,15,'App Account Management'),
+(14,2,2,'主页'),
+(15,2,3,'应用目录'),
+(16,2,4,'部件目录'),
+(17,2,5,'管ç\90†å‘˜'),
+(18,2,6,'角色'),
+(19,2,7,'用户'),
+(20,2,8,'门户管ç\90†å‘˜'),
+(21,2,9,'应用管ç\90†'),
+(22,2,10,'部件管ç\90†'),
+(23,2,11,'编辑功能è\8fœå\8d•'),
+(24,2,12,'用户通知'),
+(25,2,13,'å¾®æœ\8d务管ç\90†'),
+(26,2,15,'应用账户管ç\90†');
+
+--
+-- Dumping data for table `fn_function`
+--
+
+INSERT INTO `fn_function` (`function_cd`, `function_name`) VALUES
+('edit_notification','User Notification'),
+('getAdminNotifications','Admin Notifications'),
+('login','Login'),
+('menu_admin','Admin Menu'),
+('menu_ajax','Ajax Menu'),
+('menu_customer','Customer Menu'),
+('menu_customer_create','Customer Create'),
+('menu_feedback','Feedback Menu'),
+('menu_help','Help Menu'),
+('menu_home','Home Menu'),
+('menu_job','Job Menu'),
+('menu_job_create','Job Create'),
+('menu_job_designer','Process in Designer view'),
+('menu_logout','Logout Menu'),
+('menu_map','Map Menu'),
+('menu_notes','Notes Menu'),
+('menu_process','Process List'),
+('menu_profile','Profile Menu'),
+('menu_profile_create','Profile Create'),
+('menu_profile_import','Profile Import'),
+('menu_reports','Reports Menu'),
+('menu_sample','Sample Pages Menu'),
+('menu_tab','Sample Tab Menu'),
+('menu_task','Task Menu'),
+('menu_task_search','Task Search'),
+('menu_web_analytics','Web Analytics'),
+('saveNotification','publish notifications'),
+('view_reports','View Raptor reports');
+
+--
+-- Dumping data for table `fn_language`
+--
+
+INSERT INTO `fn_language` (`language_name`, `language_alias`) VALUES
+('English','EN'),
+('简体中文','CN');
+
+--
+-- Dumping data for table `fn_lu_activity`
+--
+
+INSERT INTO `fn_lu_activity` (`activity_cd`, `activity`) VALUES
+('add_child_role','add_child_role'),
+('add_role','add_role'),
+('add_role_function','add_role_function'),
+('add_user_role','add_user_role'),
+('apa','Add Portal Admin'),
+('app_access','App Access'),
+('dpa','Delete Portal Admin'),
+('eaaf','External auth add function'),
+('eaar','External auth add role'),
+('eadf','External auth delete function'),
+('eadr','External auth delete role'),
+('eauf','External auth update function'),
+('eaurf','External auth update role and function'),
+('functional_access','Functional Access'),
+('guest_login','Guest Login'),
+('left_menu_access','Left Menu Access'),
+('login','Login'),
+('logout','Logout'),
+('mobile_login','Mobile Login'),
+('mobile_logout','Mobile Logout'),
+('remove_child_role','remove_child_role'),
+('remove_role','remove_role'),
+('remove_role_function','remove_role_function'),
+('remove_user_role','remove_user_role'),
+('search','Search'),
+('tab_access','Tab Access'),
+('uaa','Update Account Admin'),
+('uu','Update User');
+
+--
+-- Dumping data for table `fn_lu_alert_method`
+--
+
+INSERT INTO `fn_lu_alert_method` (`alert_method_cd`, `alert_method`) VALUES
+('EMAIL','Email'),
+('FAX','Fax'),
+('PAGER','Pager'),
+('PHONE','Phone'),
+('SMS','SMS');
+
+--
+-- Dumping data for table `fn_lu_menu_set`
+--
+
+INSERT INTO `fn_lu_menu_set` (`menu_set_cd`, `menu_set_name`) VALUES
+('APP','Application Menu');
+
+--
+-- Dumping data for table `fn_lu_priority`
+--
+
+INSERT INTO `fn_lu_priority` (`priority_id`, `priority`, `active_yn`, `sort_order`) VALUES
+(10,'Low',1,10),
+(20,'Normal',1,20),
+(30,'High',1,30),
+(40,'Urgent',1,40),
+(50,'Fatal',1,50);
+
+--
+-- Dumping data for table `fn_lu_tab_set`
+--
+
+INSERT INTO `fn_lu_tab_set` (`tab_set_cd`, `tab_set_name`) VALUES
+('APP','Application Tabs');
+
+--
+-- Dumping data for table `fn_lu_timezone`
+--
+
+INSERT INTO `fn_lu_timezone` (`timezone_id`, `timezone_name`, `timezone_value`) VALUES
+(10,'US/Eastern','US/Eastern'),
+(20,'US/Central','US/Central'),
+(30,'US/Mountain','US/Mountain'),
+(40,'US/Arizona','America/Phoenix'),
+(50,'US/Pacific','US/Pacific'),
+(60,'US/Alaska','US/Alaska'),
+(70,'US/Hawaii','US/Hawaii');
+
+--
+-- Dumping data for table `fn_menu`
+--
+
+INSERT INTO `fn_menu` (`menu_id`, `label`, `parent_id`, `sort_order`, `action`, `function_cd`, `active_yn`, `servlet`, `query_string`, `external_url`, `target`, `menu_set_cd`, `separator_yn`, `image_src`) VALUES
+(1,'root',NULL,10,NULL,'menu_home',0,NULL,NULL,NULL,NULL,'APP',0,NULL),
+(2,'Home',1,10,'root.applicationsHome','menu_home',1,NULL,NULL,NULL,NULL,'APP',0,'icon-building-home'),
+(3,'Application Catalog',1,15,'root.appCatalog','menu_home',1,NULL,NULL,NULL,NULL,'APP',0,'icon-retail-gallery'),
+(4,'Widget Catalog',1,20,'root.widgetCatalog','menu_home',1,NULL,NULL,NULL,NULL,'APP',0,'icon-retail-gallery'),
+(5,'Admins',1,40,'root.admins','menu_admin',1,NULL,NULL,NULL,NULL,'APP',0,'icon-content-star'),
+(6,'Roles',1,45,'root.roles','menu_acc_admin',1,NULL,NULL,NULL,NULL,'APP',0,'icon-people-groupcollaboration'),
+(7,'Users',1,50,'root.users','menu_acc_admin',1,NULL,NULL,NULL,NULL,'APP',0,'icon-people-groupcollaboration'),
+(8,'Portal Admins',1,60,'root.portalAdmins','menu_admin',1,NULL,NULL,NULL,NULL,'APP',0,'icon-controls-settingsconnectedactivity'),
+(9,'Application Onboarding',1,70,'root.applications','menu_admin',1,NULL,NULL,NULL,NULL,'APP',0,'icon-content-grid2'),
+(10,'Widget Onboarding',1,80,'root.widgetOnboarding','menu_admin',1,NULL,NULL,NULL,NULL,'APP',0,'icon-content-grid2'),
+(11,'Edit Functional Menu',1,90,'root.functionalMenu','menu_admin',1,NULL,NULL,NULL,NULL,'APP',0,'icon-misc-pen'),
+(12,'User Notifications',1,100,'root.userNotifications','edit_notification',1,NULL,NULL,NULL,NULL,'APP',0,'icon-controls-settingsconnectedactivity'),
+(13,'Microservice Onboarding',1,110,'root.microserviceOnboarding','menu_admin',1,NULL,NULL,NULL,NULL,'APP',0,'icon-content-grid2'),
+(15,'App Account Management',1,130,'root.accountOnboarding','menu_admin',1,NULL,NULL,NULL,NULL,'App',0,'icon-content-grid2');
+
+--
+-- Dumping data for table `fn_menu_functional`
+--
+
+INSERT INTO
+  `fn_menu_functional` (
+    `menu_id`,
+    `column_num`,
+    `text`,
+    `parent_menu_id`,
+    `url`,
+    `active_yn`,
+    `image_src`
+  )
+VALUES
+  (175, 1, 'Manage', NULL, '', 1, NULL),
+  (178, 2, 'Support', NULL, '', 1, NULL),
+  (1, 2, 'Design', 175, '', 1, NULL),
+  (2, 8, 'ECOMP Platform Management', 175, '', 0, NULL),
+  (3, 5, 'Technology Insertion', 175, '', 1, NULL),
+  (5, 7, 'Performance Management', 175, '', 0, NULL),
+  (6, 6, 'Technology Management', 175, '', 1, NULL),
+  (7, 4, 'Capacity Planning', 175, '', 0, NULL),
+  (8, 3, 'Operations Planning', 175, '', 1, NULL),
+  (11, 1, 'Product Design', 1, '', 1, NULL),
+  (12, 2, 'Resource/Service Design & Onboarding', 1, '', 1, NULL),
+  (13, 3, 'Orchestration (recipe/Process) Design', 1, '', 0, NULL),
+  (14, 4, 'Service Graph visualizer', 1, '', 0, NULL),
+  (15, 5, 'Distribution', 1, '', 1, NULL),
+  (16, 6, 'Testing', 1, '', 1, NULL),
+  (17, 7, 'Simulation', 1, '', 0, NULL),
+  (18, 8, 'Certification', 1, '', 0, NULL),
+  (19, 9, 'Policy Creation/Management', 1, 'http://policy.api.simpledemo.onap.org:8443/onap/policy', 1, NULL),
+  (20, 10, 'Catalog Browser', 1, '', 1, NULL),
+  (24, 5, 'Create/Manage Policy', 12, 'http://policy.api.simpledemo.onap.org:8443/onap/policy', 1, NULL),
+  (56, 1, 'Policy Engineering', 8, 'http://policy.api.simpledemo.onap.org:8443/onap/policy', 1, NULL),
+  (115, 1, 'Test/Approve a Resource or Service', 16, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/dashboard', 1, NULL),
+  (130, 1, 'Favorites', 175, '', 1, NULL),
+  (139, 2, 'Approve a Service for distribution', 12, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/dashboard', 1,NULL),
+  (142, 3, 'Create a License model', 12, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/onboardVendor', 1, NULL),
+  (145, 1, 'Distribute a Service', 15, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/dashboard', 1, NULL),
+  (181, 1, 'Contact Us', 178, '', 1, NULL),
+  (184, 2, 'Get Access', 178, '', 1, NULL),
+  (301, 1, 'Create a Product', 11, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/dashboard', 1, NULL),
+  (304, 2, 'Create a Vendor Software Product', 11, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/onboardVendor', 1, NULL),
+  (307, 1, 'Manage a Resource/Service', 20, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/catalog', 1, NULL),
+  (310, 2, 'Manage a Product', 20, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/catalog', 1, NULL),
+       (313, 3, 'View a Resource/Service/Product', 20, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/catalog', 1, NULL),
+       (316, 11, 'Administration', 1, '', 1, NULL),
+       (148, 1, 'User Management / Category Management', 316, 'http://sdc.api.simpledemo.onap.org:8181/sdc1/portal#/adminDashboard', 1, NULL),
+       (317, 1, 'Message Bus Management', 6, 'http://portal.api.simpledemo.onap.org:8989/ECOMPDBCAPP/dbc#/dmaap', 1, NULL),
+       (318, 1, 'Infrastructure Provisioning', 3, '', 1, NULL),
+       (319, 1, 'Infrastructure VNF Provisioning', 318, 'https://vid.api.simpledemo.onap.org:8443/vid/welcome.htm', 1, NULL);
+
+--
+-- Dumping data for table `fn_menu_functional_ancestors`
+--
+
+INSERT INTO `fn_menu_functional_ancestors` (`id`, `menu_id`, `ancestor_menu_id`, `depth`) VALUES
+(1,175,175,0),
+(2,178,178,0),
+(3,11,11,0),
+(4,12,12,0),
+(5,13,13,0),
+(6,14,14,0),
+(7,15,15,0),
+(8,16,16,0),
+(9,17,17,0),
+(10,18,18,0),
+(11,19,19,0),
+(12,20,20,0),
+(13,316,316,0),
+(14,318,318,0),
+(15,317,317,0),
+(16,56,56,0),
+(17,301,301,0),
+(18,304,304,0),
+(19,24,24,0),
+(20,139,139,0),
+(21,142,142,0),
+(22,145,145,0),
+(23,115,115,0),
+(24,307,307,0),
+(25,310,310,0),
+(26,313,313,0),
+(27,1,1,0),
+(28,2,2,0),
+(29,3,3,0),
+(30,5,5,0),
+(31,6,6,0),
+(32,7,7,0),
+(33,8,8,0),
+(34,130,130,0),
+(35,181,181,0),
+(36,184,184,0),
+(37,148,148,0),
+(38,319,319,0),
+(64,11,1,1),
+(65,12,1,1),
+(66,13,1,1),
+(67,14,1,1),
+(68,15,1,1),
+(69,16,1,1),
+(70,17,1,1),
+(71,18,1,1),
+(72,19,1,1),
+(73,20,1,1),
+(74,316,1,1),
+(75,318,3,1),
+(76,317,6,1),
+(77,56,8,1),
+(78,301,11,1),
+(79,304,11,1),
+(80,24,12,1),
+(81,139,12,1),
+(82,142,12,1),
+(83,145,15,1),
+(84,115,16,1),
+(85,307,20,1),
+(86,310,20,1),
+(87,313,20,1),
+(88,1,175,1),
+(89,2,175,1),
+(90,3,175,1),
+(91,5,175,1),
+(92,6,175,1),
+(93,7,175,1),
+(94,8,175,1),
+(95,130,175,1),
+(96,181,178,1),
+(97,184,178,1),
+(98,148,316,1),
+(99,319,318,1),
+(127,301,1,2),
+(128,304,1,2),
+(129,24,1,2),
+(130,139,1,2),
+(131,142,1,2),
+(132,145,1,2),
+(133,115,1,2),
+(134,307,1,2),
+(135,310,1,2),
+(136,313,1,2),
+(137,148,1,2),
+(138,319,3,2),
+(139,11,175,2),
+(140,12,175,2),
+(141,13,175,2),
+(142,14,175,2),
+(143,15,175,2),
+(144,16,175,2),
+(145,17,175,2),
+(146,18,175,2),
+(147,19,175,2),
+(148,20,175,2),
+(149,316,175,2),
+(150,318,175,2),
+(151,317,175,2),
+(152,56,175,2),
+(158,301,175,3),
+(159,304,175,3),
+(160,24,175,3),
+(161,139,175,3),
+(162,142,175,3),
+(163,145,175,3),
+(164,115,175,3),
+(165,307,175,3),
+(166,310,175,3),
+(167,313,175,3),
+(168,148,175,3),
+(169,319,175,3);
+
+--
+-- Dumping data for table `fn_menu_functional_roles`
+--
+
+INSERT INTO `fn_menu_functional_roles` (`id`, `menu_id`, `app_id`, `role_id`) VALUES
+(1,19,5,1007),
+(2,19,5,1006),
+(3,24,5,1007),
+(4,24,5,1006),
+(5,56,5,1007),
+(6,56,5,1006),
+(8,115,4,1004),
+(9,115,4,1005),
+(10,139,4,1004),
+(11,139,4,1005),
+(12,142,4,1004),
+(13,142,4,1005),
+(14,145,4,1004),
+(15,145,4,1005),
+(16,148,4,1004),
+(17,148,4,1005),
+(18,301,4,1004),
+(19,301,4,1005),
+(20,304,4,1004),
+(21,304,4,1005),
+(22,307,4,1004),
+(23,307,4,1005),
+(24,310,4,1004),
+(25,310,4,1005),
+(26,313,4,1004),
+(27,313,4,1005),
+(39,319,6,1009),
+(40,319,6,1008),
+(42,317,3,1003),
+(43,317,3,1002);
+
+--
+-- Dumping data for table `fn_qz_job_details`
+--
+
+INSERT INTO `fn_qz_job_details` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `JOB_CLASS_NAME`, `IS_DURABLE`, `IS_NONCONCURRENT`, `IS_UPDATE_DATA`, `REQUESTS_RECOVERY`, `JOB_DATA`) VALUES
+('Scheduler_20190808_one','LogJob','AppGroup',NULL,'org.onap.portalapp.scheduler.LogJob','0','1','1','0','��\0\ 5sr\0\15org.quartz.JobDataMap���迩��\ 2\0\0xr\0&org.quartz.utils.StringKeyDirtyFlagMap�\b����](\ 2\0\ 1Z\0\13allowsTransientDataxr\0\1dorg.quartz.utils.DirtyFlagMap\13�.�(v\n�\ 2\0\ 2Z\0\ 5dirtyL\0\ 3mapt\0\ fLjava/util/Map;xp\ 1sr\0\11java.util.HashMap\ 5\a���\16`�\ 3\0\ 2F\0\nloadFactorI\0    thresholdxp?@\0\0\0\0\0\fw\b\0\0\0\10\0\0\0\ 1t\0\ 5unitst\0\ 5bytesx\0'),
+('Scheduler_20190808_one','PortalSessionTimeoutFeedJob','AppGroup',NULL,'org.onap.portalapp.service.sessionmgt.TimeoutHandler','0','1','1','0','��\0\ 5sr\0\15org.quartz.JobDataMap���迩��\ 2\0\0xr\0&org.quartz.utils.StringKeyDirtyFlagMap�\b����](\ 2\0\ 1Z\0\13allowsTransientDataxr\0\1dorg.quartz.utils.DirtyFlagMap\13�.�(v\n�\ 2\0\ 2Z\0\ 5dirtyL\0\ 3mapt\0\ fLjava/util/Map;xp\0sr\0\11java.util.HashMap\ 5\a���\16`�\ 3\0\ 2F\0\nloadFactorI\0     thresholdxp?@\0\0\0\0\0\10w\b\0\0\0\10\0\0\0\0x\0');
+
+INSERT INTO `fn_qz_locks` (`SCHED_NAME`, `LOCK_NAME`) VALUES
+('Scheduler_20190808_one','STATE_ACCESS'),
+('Scheduler_20190808_one','TRIGGER_ACCESS');
+
+--
+-- Dumping data for table `fn_qz_scheduler_state`
+--
+
+INSERT INTO `fn_qz_scheduler_state` (`SCHED_NAME`, `INSTANCE_NAME`, `LAST_CHECKIN_TIME`, `CHECKIN_INTERVAL`) VALUES
+('Scheduler_20190808_one','portal-portal-app-76c9f7bfb5-s8rhd1565254283688',1565691615399,20000);
+
+--
+-- Dumping data for table `fn_qz_triggers`
+--
+
+INSERT INTO `fn_qz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `NEXT_FIRE_TIME`, `PREV_FIRE_TIME`, `PRIORITY`, `TRIGGER_STATE`, `TRIGGER_TYPE`, `START_TIME`, `END_TIME`, `CALENDAR_NAME`, `MISFIRE_INSTR`, `JOB_DATA`) VALUES
+('Scheduler_20190808_one','LogTrigger','AppGroup','LogJob','AppGroup',NULL,1565691660000,1565691600000,0,'WAITING','CRON',1565254275000,0,NULL,0,''),
+('Scheduler_20190808_one','PortalSessionTimeoutFeedTrigger','AppGroup','PortalSessionTimeoutFeedJob','AppGroup',NULL,1565691900000,1565691600000,0,'WAITING','CRON',1565254275000,0,NULL,0,'');
+
+--
+-- Dumping data for table `fn_qz_cron_triggers`
+--
+
+INSERT INTO `fn_qz_cron_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `CRON_EXPRESSION`, `TIME_ZONE_ID`) VALUES
+('Scheduler_20190808_one','LogTrigger','AppGroup','0 * * * * ? *','GMT'),
+('Scheduler_20190808_one','PortalSessionTimeoutFeedTrigger','AppGroup','0 0/5 * * * ? *','GMT');
+
+--
+-- Dumping data for table `fn_restricted_url`
+--
+
+INSERT INTO `fn_restricted_url` (`restricted_url`, `function_cd`) VALUES
+('async_test.htm','menu_home'),
+('attachment.htm','menu_admin'),
+('broadcast.htm','menu_admin'),
+('chatWindow.htm','menu_home'),
+('contact_list.htm','menu_home'),
+('customer_dynamic_list.htm','menu_home'),
+('event.htm','menu_home'),
+('event_list.htm','menu_home'),
+('file_upload.htm','menu_admin'),
+('gauge.htm','menu_tab'),
+('gmap_controller.htm','menu_tab'),
+('gmap_frame.htm','menu_tab'),
+('jbpm_designer.htm','menu_job_create'),
+('jbpm_drools.htm','menu_job_create'),
+('job.htm','menu_admin'),
+('map.htm','menu_tab'),
+('map_download.htm','menu_tab'),
+('map_grid_search.htm','menu_tab'),
+('mobile_welcome.htm','menu_home'),
+('process_job.htm','menu_job_create'),
+('profile.htm','menu_profile_create'),
+('raptor.htm','menu_reports'),
+('raptor.htm','view_reports'),
+('raptor2.htm','menu_reports'),
+('raptor_blob_extract.htm','menu_reports'),
+('raptor_blob_extract.htm','view_reports'),
+('raptor_email_attachment.htm','menu_reports'),
+('raptor_search.htm','menu_reports'),('report_list.htm','menu_reports'),
+('role.htm','menu_admin'),
+('role_function.htm','menu_admin'),
+('sample_animated_map.htm','menu_tab'),
+('sample_map.htm','menu_home'),
+('sample_map_2.htm','menu_tab'),
+('sample_map_3.htm','menu_tab'),
+('tab2_sub1.htm','menu_tab'),
+('tab2_sub2_link1.htm','menu_tab'),
+('tab2_sub2_link2.htm','menu_tab'),
+('tab2_sub3.htm','menu_tab'),
+('tab3.htm','menu_tab'),
+('tab4.htm','menu_tab'),
+('template.jsp','menu_home'),
+('test.htm','menu_admin');
+
+--
+-- Dumping data for table `fn_role_composite`
+--
+
+INSERT INTO `fn_role_composite` (`parent_role_id`, `child_role_id`) VALUES
+(1,16);
+
+--
+-- Dumping data for table `fn_role_function`
+--
+
+INSERT INTO `fn_role_function` (`id`, `function_cd`) VALUES
+(1,'login'),
+(1,'menu_admin'),
+(1,'menu_ajax'),
+(1,'menu_customer'),
+(1,'menu_customer_create'),
+(1,'menu_feedback'),
+(1,'menu_help'),
+(1,'menu_home'),
+(1,'menu_job'),
+(1,'menu_job_create'),
+(1,'menu_logout'),
+(1,'menu_notes'),
+(1,'menu_process'),
+(1,'menu_profile'),
+(1,'menu_profile_create'),
+(1,'menu_profile_import'),
+(1,'menu_reports'),
+(1,'menu_sample'),
+(1,'menu_tab'),
+(16,'login'),
+(16,'menu_ajax'),
+(16,'menu_customer'),
+(16,'menu_customer_create'),
+(16,'menu_home'),
+(16,'menu_logout'),
+(16,'menu_map'),
+(16,'menu_profile'),
+(16,'menu_reports'),
+(16,'menu_tab'),
+(950,'edit_notification'),
+(950,'getAdminNotifications'),
+(950,'saveNotification'),
+(1010,'menu_web_analytics'),
+(2115,'menu_web_analytics');
+
+--
+-- Dumping data for table `fn_shared_context`
+--
+
+INSERT INTO `fn_shared_context` (`id`, `create_time`, `context_id`, `ckey`, `cvalue`) VALUES
+(1,'2019-08-08 10:11:18','b999771d~2d60~4638~a670~d47d17219157','USER_FIRST_NAME','Jimmy'),
+(2,'2019-08-08 10:11:18','b999771d~2d60~4638~a670~d47d17219157','USER_LAST_NAME','Hendrix'),
+(3,'2019-08-08 10:11:18','b999771d~2d60~4638~a670~d47d17219157','USER_EMAIL','admin@onap.org'),
+(4,'2019-08-08 10:11:18','b999771d~2d60~4638~a670~d47d17219157','USER_ORG_USERID','jh0003'),
+(5,'2019-08-08 10:17:47','29cc8f94~5a7d~41f8~b359~432bb903a718','USER_FIRST_NAME','Demo'),
+(6,'2019-08-08 10:17:47','29cc8f94~5a7d~41f8~b359~432bb903a718','USER_LAST_NAME','User'),
+(7,'2019-08-08 10:17:47','29cc8f94~5a7d~41f8~b359~432bb903a718','USER_EMAIL','demo@openecomp.org'),
+(8,'2019-08-08 10:17:47','29cc8f94~5a7d~41f8~b359~432bb903a718','USER_ORG_USERID','demo'),
+(9,'2019-08-08 11:01:02','7e3ced0a~52a3~492a~be53~2885d2df5a43','USER_FIRST_NAME','Demo'),
+(10,'2019-08-08 11:01:02','7e3ced0a~52a3~492a~be53~2885d2df5a43','USER_LAST_NAME','User'),
+(11,'2019-08-08 11:01:02','7e3ced0a~52a3~492a~be53~2885d2df5a43','USER_EMAIL','demo@openecomp.org'),
+(12,'2019-08-08 11:01:02','7e3ced0a~52a3~492a~be53~2885d2df5a43','USER_ORG_USERID','demo');
+
+--
+-- Dumping data for table `fn_tab`
+--
+
+INSERT INTO `fn_tab` (`tab_cd`, `tab_name`, `tab_descr`, `action`, `function_cd`, `active_yn`, `sort_order`, `parent_tab_cd`, `tab_set_cd`) VALUES
+('TAB1','Tab 1','Tab 1 Information','tab1.htm','menu_tab',1,10,NULL,'APP'),
+('TAB2','Tab 2','Tab 2 Information','tab2_sub1.htm','menu_tab',1,20,NULL,'APP'),
+('TAB2_SUB1','Sub Tab 1','Sub Tab 1 Information','tab2_sub1.htm','menu_tab',1,10,'TAB2','APP'),
+('TAB2_SUB1_S1','Left Tab 1','Sub - Sub Tab 1 Information','tab2_sub1.htm','menu_tab',1,10,'TAB2_SUB1','APP'),
+('TAB2_SUB2','Sub Tab 2','Sub Tab 2 Information','tab2_sub2.htm','menu_tab',1,20,'TAB2','APP'),
+('TAB2_SUB3','Sub Tab 3','Sub Tab 3 Information','tab2_sub3.htm','menu_tab',1,30,'TAB2','APP'),
+('TAB3','Tab 3','Tab 3 Information','tab3.htm','menu_tab',1,30,NULL,'APP'),
+('TAB4','Tab 4','Tab 4 Information','tab4.htm','menu_tab',1,40,NULL,'APP');
+
+--
+-- Dumping data for table `fn_tab_selected`
+--
+
+INSERT INTO `fn_tab_selected` (`selected_tab_cd`, `tab_uri`) VALUES
+('TAB1','tab1'),('TAB2','tab2_sub1'),
+('TAB2','tab2_sub2'),
+('TAB2','tab2_sub3'),
+('TAB2_SUB1','tab2_sub1'),
+('TAB2_SUB1_S1','tab2_sub1'),
+('TAB2_SUB2','tab2_sub2'),
+('TAB2_SUB3','tab2_sub3'),
+('TAB3','tab3'),
+('TAB4','tab4');
+
+--
+-- Dumping data for table `fn_user`
+--
+
+INSERT INTO
+  `fn_user` (
+    `org_id`,
+    `first_name`,
+    `middle_name`,
+    `last_name`,
+    `phone`,
+    `fax`,
+    `cellular`,
+    `email`,
+    `address_id`,
+    `alert_method_cd`,
+    `hrid`,
+    `org_user_id`,
+    `org_code`,
+    `login_id`,
+    `login_pwd`,
+    `last_login_date`,
+    `active_yn`,
+    `created_date`,
+    `modified_date`,
+    `is_internal_yn`,
+    `address_line_1`,
+    `address_line_2`,
+    `city`,
+    `state_cd`,
+    `zip_code`,
+    `country_cd`,
+    `location_clli`,
+    `org_manager_userid`,
+    `company`,
+    `department_name`,
+    `job_title`,
+    `timezone`,
+    `department`,
+    `business_unit`,
+    `business_unit_name`,
+    `cost_center`,
+    `fin_loc_code`,
+    `silo_status`,
+    `language_id`
+  )
+VALUES
+  (
+    NULL,
+    'Demo',
+    NULL,
+    'User',
+    NULL,
+    NULL,
+    NULL,
+    'demo@openecomp.org',
+    NULL,
+    NULL,
+    NULL,
+    'demo',
+    NULL,
+    'demo',
+    'demo123',
+    '2019-08-08 12:18:17',
+    1,
+    '2016-10-14 21:00:00',
+    '2019-08-08 12:18:17',
+    0,
+    NULL,
+    NULL,
+    NULL,
+    'NJ',
+    NULL,
+    'US',
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    10,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    1
+  ),(
+    NULL,
+    'Jimmy',
+    NULL,
+    'Hendrix',
+    NULL,
+    NULL,
+    NULL,
+    'admin@onap.org',
+    NULL,
+    NULL,
+    NULL,
+    'jh0003',
+    NULL,
+    'jh0003',
+    'demo123',
+    '2019-08-08 10:16:11',
+    1,
+    '2016-10-14 21:00:00',
+    '2019-08-08 10:16:11',
+    0,
+    NULL,
+    NULL,
+    NULL,
+    'NJ',
+    NULL,
+    'US',
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    10,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    1
+  ),(
+    NULL,
+    'Carlos',
+    NULL,
+    'Santana',
+    NULL,
+    NULL,
+    NULL,
+    'designer@onap.org',
+    NULL,
+    NULL,
+    NULL,
+    'cs0008',
+    NULL,
+    'cs0008',
+    'demo123',
+    '2016-10-20 15:11:16',
+    1,
+    '2016-10-14 21:00:00',
+    '2016-10-20 15:11:16',
+    0,
+    NULL,
+    NULL,
+    NULL,
+    'NJ',
+    NULL,
+    'US',
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    10,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    1
+  ),(
+    NULL,
+    'Joni',
+    NULL,
+    'Mitchell',
+    NULL,
+    NULL,
+    NULL,
+    'tester@onap.org',
+    NULL,
+    NULL,
+    NULL,
+    'jm0007',
+    NULL,
+    'jm0007',
+    'demo123',
+    '2016-10-20 15:11:16',
+    1,
+    '2016-10-14 21:00:00',
+    '2016-10-20 15:11:16',
+    0,
+    NULL,
+    NULL,
+    NULL,
+    'NJ',
+    NULL,
+    'US',
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    10,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    1
+  ),(
+    NULL,
+    'Steve',
+    NULL,
+    'Regev',
+    NULL,
+    NULL,
+    NULL,
+    'ops@onap.org',
+    NULL,
+    NULL,
+    NULL,
+    'op0001',
+    NULL,
+    'op0001',
+    'demo123',
+    '2016-10-20 15:11:16',
+    1,
+    '2016-10-14 21:00:00',
+    '2016-10-20 15:11:16',
+    0,
+    NULL,
+    NULL,
+    NULL,
+    'NJ',
+    NULL,
+    'US',
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    10,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    1
+  ),(
+    NULL,
+    'David',
+    NULL,
+    'Shadmi',
+    NULL,
+    NULL,
+    NULL,
+    'governor@onap.org',
+    NULL,
+    NULL,
+    NULL,
+    'gv0001',
+    NULL,
+    'gv0001',
+    'demo123',
+    '2016-10-20 15:11:16',
+    1,
+    '2016-10-14 21:00:00',
+    '2016-10-20 15:11:16',
+    0,
+    NULL,
+    NULL,
+    NULL,
+    'NJ',
+    NULL,
+    'US',
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    10,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    1
+  ),(
+    NULL,
+    'Teddy',
+    NULL,
+    'Isashar',
+    NULL,
+    NULL,
+    NULL,
+    'pm1@onap.org',
+    NULL,
+    NULL,
+    NULL,
+    'pm0001',
+    NULL,
+    'pm0001',
+    'demo123',
+    '2016-10-20 15:11:16',
+    1,
+    '2016-10-14 21:00:00',
+    '2016-10-20 15:11:16',
+    0,
+    NULL,
+    NULL,
+    NULL,
+    'NJ',
+    NULL,
+    'US',
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    10,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    1
+  ),(
+    NULL,
+    'Eden',
+    NULL,
+    'Rozin',
+    NULL,
+    NULL,
+    NULL,
+    'ps1@onap.org',
+    NULL,
+    NULL,
+    NULL,
+    'ps0001',
+    NULL,
+    'ps0001',
+    'demo123',
+    '2016-10-20 15:11:16',
+    1,
+    '2016-10-14 21:00:00',
+    '2016-10-20 15:11:16',
+    0,
+    NULL,
+    NULL,
+    NULL,
+    'NJ',
+    NULL,
+    'US',
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    10,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    1
+  ),(
+    NULL,
+    'vid1',
+    NULL,
+    'user',
+    NULL,
+    NULL,
+    NULL,
+    'vid1@onap.org',
+    NULL,
+    NULL,
+    NULL,
+    'vid1',
+    NULL,
+    'vid1',
+    'demo123',
+    '2016-10-20 15:11:16',
+    1,
+    '2016-10-14 21:00:00',
+    '2016-10-20 15:11:16',
+    0,
+    NULL,
+    NULL,
+    NULL,
+    'NJ',
+    NULL,
+    'US',
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    10,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    1
+  ),(
+    NULL,
+    'vid2',
+    NULL,
+    'user',
+    NULL,
+    NULL,
+    NULL,
+    'vid2@onap.org',
+    NULL,
+    NULL,
+    NULL,
+    'vid2',
+    NULL,
+    'vid2',
+    'demo123',
+    '2016-10-20 15:11:16',
+    1,
+    '2016-10-14 21:00:00',
+    '2016-10-20 15:11:16',
+    0,
+    NULL,
+    NULL,
+    NULL,
+    'NJ',
+    NULL,
+    'US',
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    10,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    1
+  ),(
+    NULL,
+    'vid3',
+    NULL,
+    'user',
+    NULL,
+    NULL,
+    NULL,
+    'vid3@onap.org',
+    NULL,
+    NULL,
+    NULL,
+    'vid3',
+    NULL,
+    'vid3',
+    'demo123',
+    '2016-10-20 15:11:16',
+    1,
+    '2016-10-14 21:00:00',
+    '2016-10-20 15:11:16',
+    0,
+    NULL,
+    NULL,
+    NULL,
+    'NJ',
+    NULL,
+    'US',
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    10,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    1
+  ),(
+    NULL,
+    'steve',
+    NULL,
+    'user',
+    NULL,
+    NULL,
+    NULL,
+    'steve@onap.org',
+    NULL,
+    NULL,
+    NULL,
+    'steve',
+    NULL,
+    'steve',
+    'demo123',
+    '2017-05-19 15:11:16',
+    1,
+    '2017-05-19 21:00:00',
+    '2017-05-19 15:11:16',
+    0,
+    NULL,
+    NULL,
+    NULL,
+    'NJ',
+    NULL,
+    'US',
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    10,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    1
+  );
+
+--
+-- Dumping data for table `ep_pers_user_app_sort`
+--
+
+INSERT INTO `ep_pers_user_app_sort` (`id`, `user_id`, `sort_pref`) VALUES
+(1,1,0);
+
+--
+-- Dumping data for table `fn_pers_user_app_sel`
+--
+
+INSERT INTO `fn_pers_user_app_sel` (`id`, `user_id`, `app_id`, `status_cd`) VALUES
+(1,1,7,'S'),
+(2,1,8,'S'),
+(10,1,10,'S'),
+(11,1,5,'S');
+
+--
+-- Dumping data for table `fn_audit_log`
+--
+
+INSERT INTO `fn_audit_log` (`log_id`, `user_id`, `activity_cd`, `audit_date`, `comments`, `affected_record_id_bk`, `affected_record_id`) VALUES
+(1,1,'app_access','2019-08-08 10:18:52','https://aai.ui.simpledemo.onap.org:30220/services/aai/webapp/index.html',NULL,'7'),
+(2,1,'tab_access','2019-08-08 10:18:52','https://aai.ui.simpledemo.onap.org:30220/services/aai/webapp/index.html?cc=1565259532115',NULL,'7'),
+(3,1,'tab_access','2019-08-08 10:18:56','Home',NULL,'1'),
+(4,1,'tab_access','2019-08-08 10:18:59','https://aai.ui.simpledemo.onap.org:30220/services/aai/webapp/index.html?cc=1565259538769',NULL,'7'),
+(5,1,'app_access','2019-08-08 10:18:59','https://aai.ui.simpledemo.onap.org:30220/services/aai/webapp/index.html',NULL,'7'),
+(6,1,'tab_access','2019-08-08 10:18:59','https://aai.ui.simpledemo.onap.org:30220/services/aai/webapp/index.html?cc=1565259538769',NULL,'7'),
+(7,1,'tab_access','2019-08-08 10:19:06','Home',NULL,'1');
+
+--
+-- Dumping data for table `fn_user_role`
+--
+
+INSERT INTO `fn_user_role` (`user_id`, `role_id`, `priority`, `app_id`)
+ VALUES
+(1,1,1,1),
+(1,950,1,1),
+(1,999,1,1),
+(1,999,1,2),
+(1,999,1,3),
+(1,999,1,4),
+(1,999,1,5),
+(1,999,1,6),
+(1,999,1,7),
+(1,1000,1,2),
+(1,1001,1,2),
+(1,1002,1,3),
+(1,1004,1,4),
+(1,1006,1,5),
+(1,1008,1,6),
+(2,999,1,4),
+(2,1004,1,4),
+(3,16,NULL,4),
+(3,1005,NULL,4),
+(4,16,NULL,4),
+(4,1005,NULL,4),
+(5,16,NULL,4),
+(5,1005,NULL,4),
+(6,16,NULL,4),
+(6,1005,NULL,4),
+(7,16,NULL,4),
+(7,1005,NULL,4),
+(8,16,NULL,4),
+(8,1005,NULL,4),
+(9,16,NULL,6),
+(9,999,NULL,1),
+(9,1008,NULL,6),
+(10,16,NULL,6),
+(10,1008,NULL,6),
+(10,1009,NULL,6),
+(11,16,NULL,6),
+(12,16,NULL,7),
+(12,1011,NULL,7),
+(12,1012,NULL,7);
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2019-08-13 10:20:25
index bdc23f7..64639b4 100644 (file)
@@ -10,3 +10,6 @@ spring.datasource.username=sa
 spring.datasource.password=password
 spring.datasource.initialization-mode=always
 spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
+
+#PROPERTIES
+external_access_enable = false
\ No newline at end of file
index 622acb9..e00dc5c 100644 (file)
@@ -64,7 +64,7 @@ import org.springframework.transaction.annotation.Transactional;
 @TestPropertySource(locations="classpath:test.properties")
 @Transactional
 class LanguageControllerTest {
-       private UsernamePasswordAuthenticationToken principal = new UsernamePasswordAuthenticationToken("demo", "demo123");
+       private final UsernamePasswordAuthenticationToken principal = new UsernamePasswordAuthenticationToken("demo", "demo123");
 
        @Autowired
        private LanguageController languageController;
index c950fb4..0316683 100644 (file)
@@ -60,7 +60,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 @TestPropertySource(locations = "classpath:test.properties")
 class UserControllerTest {
 
-       private UsernamePasswordAuthenticationToken principal = new UsernamePasswordAuthenticationToken("demo",
+       private final UsernamePasswordAuthenticationToken principal = new UsernamePasswordAuthenticationToken("demo",
                "demo123");
 
        private final FnUserService userService;
index b2048e8..e83c247 100644 (file)
@@ -42,49 +42,20 @@ package org.onap.portal.controller;
 
 import static org.junit.jupiter.api.Assertions.*;
 
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.time.LocalDateTime;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-import javax.sql.DataSource;
-import org.h2.tools.RunScript;
-import org.hibernate.Session;
-import org.hibernate.jdbc.Work;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.jupiter.api.Test;
 import org.junit.runner.RunWith;
-import org.onap.portal.domain.db.fn.FnApp;
-import org.onap.portal.domain.db.fn.FnLanguage;
-import org.onap.portal.domain.db.fn.FnRole;
-import org.onap.portal.domain.db.fn.FnUser;
-import org.onap.portal.domain.db.fn.FnUserRole;
+import org.onap.portal.domain.dto.ecomp.ExternalSystemAccess;
 import org.onap.portal.service.fn.FnAppService;
 import org.onap.portal.service.fn.FnLanguageService;
-import org.onap.portal.service.fn.FnLuTimezoneService;
 import org.onap.portal.service.fn.FnRoleService;
 import org.onap.portal.service.fn.FnUserRoleService;
 import org.onap.portal.service.fn.FnUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.jdbc.datasource.init.DatabasePopulatorUtils;
-import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.test.context.TestPropertySource;
 import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.test.web.servlet.MockMvc;
-import org.springframework.test.web.servlet.setup.MockMvcBuilders;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.context.WebApplicationContext;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest
@@ -117,14 +88,11 @@ class UserRolesControllerTest {
        }
 
        @Test
-       void checkIfUserIsSuperAdminTrue() {
-              UsernamePasswordAuthenticationToken principal = new UsernamePasswordAuthenticationToken("demo",
-                      "demo123");
-              //Given
-              boolean expected = true;
-              //When
-              boolean actual = userRolesController.checkIfUserIsSuperAdmin(principal);
-              //Then
-              assertEquals(expected, actual);
+       void readExternalRequestAccess() {
+              ExternalSystemAccess expected = new ExternalSystemAccess("external_access_enable", false);
+              ExternalSystemAccess actual = userRolesController.readExternalRequestAccess();
+
+              assertEquals(expected.getAccessValue(), actual.getAccessValue());
+              assertEquals(expected.getKey(), actual.getKey());
        }
 }
\ No newline at end of file
index 3dd1fc2..9a1a96a 100644 (file)
@@ -62,10 +62,10 @@ class WidgetMSControllerTest {
        @Autowired
        WidgetMSController widgetMSController;
 
-       MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+       final MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
 
-       HttpServletRequest request = mockitoTestSuite.getMockedRequest();
-       HttpServletResponse response = mockitoTestSuite.getMockedResponse();
+       final HttpServletRequest request = mockitoTestSuite.getMockedRequest();
+       final HttpServletResponse response = mockitoTestSuite.getMockedResponse();
 
        @Test
        void getServiceLocation() {
index b82ac2f..27ce348 100644 (file)
@@ -41,7 +41,6 @@
 package org.onap.portal.controller;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
@@ -49,21 +48,21 @@ import java.time.LocalDateTime;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
-import javax.servlet.http.HttpServletRequest;
 import javax.transaction.Transactional;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.onap.portal.dao.fn.FnLanguageDao;
 import org.onap.portal.domain.db.ep.EpMicroserviceParameter;
 import org.onap.portal.domain.db.ep.EpWidgetCatalog;
 import org.onap.portal.domain.db.ep.EpWidgetCatalogParameter;
 import org.onap.portal.domain.db.fn.FnLanguage;
 import org.onap.portal.domain.db.fn.FnUser;
 import org.onap.portal.domain.dto.ecomp.WidgetCatalog;
-import org.onap.portal.framework.MockitoTestSuite;
 import org.onap.portal.service.ep.EpMicroserviceParameterService;
 import org.onap.portal.service.ep.EpWidgetCatalogParameterService;
 import org.onap.portal.service.ep.EpWidgetCatalogService;
 import org.onap.portal.service.fn.FnLanguageService;
+import org.onap.portal.service.fn.FnUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -75,11 +74,13 @@ import org.springframework.test.context.junit4.SpringRunner;
 @Transactional
 @TestPropertySource(locations = "classpath:test.properties")
 public class WidgetsCatalogControllerTest {
-       private UsernamePasswordAuthenticationToken principal = new UsernamePasswordAuthenticationToken("demo",
+       private final UsernamePasswordAuthenticationToken principal = new UsernamePasswordAuthenticationToken("demo",
                "demo123");
        @Autowired
        private WidgetsCatalogController widgetsCatalogController;
        @Autowired
+       private FnUserService fnUserService;
+       @Autowired
        private FnLanguageService fnLanguageService;
        @Autowired
        private EpWidgetCatalogParameterService epWidgetCatalogParameterService;
@@ -87,6 +88,8 @@ public class WidgetsCatalogControllerTest {
        private EpMicroserviceParameterService epMicroserviceParameterService;
        @Autowired
        private EpWidgetCatalogService epWidgetCatalogService;
+       @Autowired
+       private FnLanguageDao fnLanguageDao;
 
        @Test
        public void getUserWidgetCatalog() {
@@ -142,10 +145,11 @@ public class WidgetsCatalogControllerTest {
               EpMicroserviceParameter parameter = new EpMicroserviceParameter();
               epMicroserviceParameterService.save(parameter);
               FnLanguage language = FnLanguage.builder().languageAlias("TS").languageName("TEST").build();
-              fnLanguageService.save(principal, language);
+              fnLanguageService.save(language);
               FnUser user = buildFnUser();
               language.setFnUsers(new HashSet<>(Collections.singleton(user)));
               user.setLanguageId(language);
+              fnUserService.saveFnUser(user);
               EpWidgetCatalogParameter data =  EpWidgetCatalogParameter.builder()
                       .widgetId(widget).userId(user).paramId(parameter).userValue("TestData").build();
               //When
@@ -167,11 +171,10 @@ public class WidgetsCatalogControllerTest {
               epWidgetCatalogService.save(widget);
               EpMicroserviceParameter parameter = new EpMicroserviceParameter();
               epMicroserviceParameterService.save(parameter);
-              FnLanguage language = FnLanguage.builder().languageAlias("TS").languageName("TEST").build();
-              fnLanguageService.save(principal, language);
               FnUser user = buildFnUser();
-              language.setFnUsers(new HashSet<>(Collections.singleton(user)));
+              FnLanguage language = fnLanguageDao.getByLanguageAlias("EN");
               user.setLanguageId(language);
+              fnUserService.saveFnUser(user);
               EpWidgetCatalogParameter data =  EpWidgetCatalogParameter.builder()
                       .widgetId(widget).userId(user).paramId(parameter).userValue("TestData").build();
               //When
@@ -200,7 +203,7 @@ public class WidgetsCatalogControllerTest {
               EpMicroserviceParameter parameter = new EpMicroserviceParameter();
               epMicroserviceParameterService.save(parameter);
               FnLanguage language = FnLanguage.builder().languageAlias("TS").languageName("TEST").build();
-              fnLanguageService.save(principal, language);
+              fnLanguageService.save(language);
               FnUser user = buildFnUser();
               language.setFnUsers(new HashSet<>(Collections.singleton(user)));
               user.setLanguageId(language);
@@ -228,10 +231,12 @@ public class WidgetsCatalogControllerTest {
               EpMicroserviceParameter parameter = new EpMicroserviceParameter();
               epMicroserviceParameterService.save(parameter);
               FnLanguage language = FnLanguage.builder().languageAlias("TS").languageName("TEST").build();
-              fnLanguageService.save(principal, language);
+              fnLanguageService.save(language);
               FnUser user = buildFnUser();
               language.setFnUsers(new HashSet<>(Collections.singleton(user)));
               user.setLanguageId(language);
+              fnUserService.saveFnUser(user);
+
               EpWidgetCatalogParameter old =  EpWidgetCatalogParameter.builder()
                       .widgetId(widget).userId(user).paramId(parameter).userValue("TestData").build();
 
@@ -265,6 +270,7 @@ public class WidgetsCatalogControllerTest {
                       .modifiedDate(LocalDateTime.now())
                       .createdDate(LocalDateTime.now())
                       .isInternalYn(true)
+                      .isSystemUser(true)
                       .guest(false)
                       .build();
        }
index ebc0d9f..168fcc7 100644 (file)
@@ -50,6 +50,7 @@ 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.junit.runner.RunWith;
 import org.onap.portal.dao.fn.FnLanguageDao;
@@ -62,6 +63,7 @@ import org.onap.portal.domain.dto.transport.OnboardingWidget;
 import org.onap.portal.domain.dto.transport.WidgetCatalogPersonalization;
 import org.onap.portal.framework.MockitoTestSuite;
 import org.onap.portal.service.WidgetService;
+import org.onap.portal.service.fn.FnLanguageService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -76,13 +78,13 @@ import org.springframework.transaction.annotation.Transactional;
 @Transactional
 public class WidgetsControllerTest {
 
-       private UsernamePasswordAuthenticationToken principal = new UsernamePasswordAuthenticationToken("demo",
+       private final UsernamePasswordAuthenticationToken principal = new UsernamePasswordAuthenticationToken("demo",
                "demo123");
 
-       MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+       final MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
 
-       HttpServletRequest request = mockitoTestSuite.getMockedRequest();
-       HttpServletResponse response = mockitoTestSuite.getMockedResponse();
+       final HttpServletRequest request = mockitoTestSuite.getMockedRequest();
+       final HttpServletResponse response = mockitoTestSuite.getMockedResponse();
 
        @Autowired
        private WidgetsController widgetsController;
@@ -92,10 +94,20 @@ public class WidgetsControllerTest {
        private FnLanguageDao fnLanguageDao;
        @Autowired
        private WidgetService widgetService;
+       @Autowired
+       private  FnLanguageService fnLanguageService;
+
+       private FnLanguage language;
+       private FnUser questUser;
+       private FnUser notQuestUser;
+
+       @Before
+       public void init(){
+              this.language = getFnLanguage();
+              this.questUser = getQuestUser();
+              this.notQuestUser = getNotQuestUser();
+       }
 
-       private FnLanguage language = getFnLanguage();
-       private FnUser questUser = getQuestUser();
-       private FnUser notQuestUser = getNotQuestUser();
 
        @Test(expected = UsernameNotFoundException.class)
        public void getOnboardingWidgetsNullUserTest() {
@@ -364,6 +376,7 @@ public class WidgetsControllerTest {
                       .modifiedDate(LocalDateTime.now())
                       .isInternalYn(true)
                       .languageId(language)
+                      .isSystemUser(true)
                       .guest(true)
                       .build();
        }
@@ -377,12 +390,16 @@ public class WidgetsControllerTest {
                       .createdDate(LocalDateTime.now())
                       .modifiedDate(LocalDateTime.now())
                       .isInternalYn(true)
+                      .isSystemUser(true)
                       .languageId(language)
                       .guest(false)
                       .build();
        }
 
+
        private FnLanguage getFnLanguage() {
-              return FnLanguage.builder().languageName("Polish").languageAlias("Pl").build();
+              FnLanguage tmp = FnLanguage.builder().languageName("Polish").languageAlias("Pl").build();
+              fnLanguageService.save(tmp);
+              return tmp;
        }
 }
\ No newline at end of file
index 492c179..1825e40 100644 (file)
@@ -50,9 +50,9 @@ import org.mockito.runners.MockitoJUnitRunner;
 public class MockitoTestSuite {
 
 
-       public MockHttpServletRequestWrapper mockedRequest = new MockHttpServletRequestWrapper(
+       public final MockHttpServletRequestWrapper mockedRequest = new MockHttpServletRequestWrapper(
                Mockito.mock(HttpServletRequest.class));
-       public HttpServletResponse mockedResponse = Mockito.mock(HttpServletResponse.class);
+       public final HttpServletResponse mockedResponse = Mockito.mock(HttpServletResponse.class);
 
        public HttpServletResponse getMockedResponse() {
               return mockedResponse;
@@ -64,7 +64,7 @@ public class MockitoTestSuite {
 
        public class MockHttpServletRequestWrapper extends HttpServletRequestWrapper {
 
-              HttpSession session = Mockito.mock(HttpSession.class);
+              final HttpSession session = Mockito.mock(HttpSession.class);
 
               public MockHttpServletRequestWrapper(HttpServletRequest request) {
                      super(request);
index 6a6c06b..ad1ee60 100644 (file)
@@ -48,12 +48,14 @@ import java.util.HashSet;
 import org.junit.jupiter.api.Test;
 import org.junit.runner.RunWith;
 import org.onap.portal.controller.WidgetsCatalogController;
+import org.onap.portal.dao.fn.FnLanguageDao;
 import org.onap.portal.domain.db.ep.EpMicroserviceParameter;
 import org.onap.portal.domain.db.ep.EpWidgetCatalog;
 import org.onap.portal.domain.db.ep.EpWidgetCatalogParameter;
 import org.onap.portal.domain.db.fn.FnLanguage;
 import org.onap.portal.domain.db.fn.FnUser;
 import org.onap.portal.service.fn.FnLanguageService;
+import org.onap.portal.service.fn.FnUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -67,27 +69,29 @@ import org.springframework.transaction.annotation.Transactional;
 @TestPropertySource(locations = "classpath:test.properties")
 class EpWidgetCatalogParameterServiceTest {
 
-       private UsernamePasswordAuthenticationToken principal = new UsernamePasswordAuthenticationToken("demo",
+       private final UsernamePasswordAuthenticationToken principal = new UsernamePasswordAuthenticationToken("demo",
                "demo123");
 
-       private EpWidgetCatalogParameterService epWidgetCatalogParameterService;
-       private WidgetsCatalogController widgetsCatalogController;
-       private FnLanguageService fnLanguageService;
-       private EpMicroserviceParameterService epMicroserviceParameterService;
-       private EpWidgetCatalogService epWidgetCatalogService;
+       private final EpWidgetCatalogParameterService epWidgetCatalogParameterService;
+       private final WidgetsCatalogController widgetsCatalogController;
+       private final FnUserService fnUserService;
+       private final EpMicroserviceParameterService epMicroserviceParameterService;
+       private final EpWidgetCatalogService epWidgetCatalogService;
+       private final FnLanguageDao fnLanguageDao;
 
        @Autowired
        public EpWidgetCatalogParameterServiceTest(
-               EpWidgetCatalogParameterService epWidgetCatalogParameterService,
-               WidgetsCatalogController widgetsCatalogController,
-               FnLanguageService fnLanguageService,
-               EpMicroserviceParameterService epMicroserviceParameterService,
-               EpWidgetCatalogService epWidgetCatalogService) {
+           EpWidgetCatalogParameterService epWidgetCatalogParameterService,
+           WidgetsCatalogController widgetsCatalogController,
+           FnUserService fnUserService,
+           EpMicroserviceParameterService epMicroserviceParameterService,
+           EpWidgetCatalogService epWidgetCatalogService, FnLanguageDao fnLanguageDao) {
               this.epWidgetCatalogParameterService = epWidgetCatalogParameterService;
               this.widgetsCatalogController = widgetsCatalogController;
-              this.fnLanguageService = fnLanguageService;
+              this.fnUserService = fnUserService;
               this.epMicroserviceParameterService = epMicroserviceParameterService;
               this.epWidgetCatalogService = epWidgetCatalogService;
+              this.fnLanguageDao = fnLanguageDao;
        }
 
        @Test
@@ -105,11 +109,8 @@ class EpWidgetCatalogParameterServiceTest {
               epWidgetCatalogService.save(widget);
               EpMicroserviceParameter parameter = new EpMicroserviceParameter();
               epMicroserviceParameterService.save(parameter);
-              FnLanguage language = FnLanguage.builder().languageAlias("TS").languageName("TEST").build();
-              fnLanguageService.save(principal, language);
               FnUser user = buildFnUser();
-              language.setFnUsers(new HashSet<>(Collections.singleton(user)));
-              user.setLanguageId(language);
+              fnUserService.saveFnUser(user);
               EpWidgetCatalogParameter data = EpWidgetCatalogParameter.builder()
                       .widgetId(widget).userId(user).paramId(parameter).userValue("TestData").build();
               //When
@@ -134,11 +135,8 @@ class EpWidgetCatalogParameterServiceTest {
               epWidgetCatalogService.save(widget);
               EpMicroserviceParameter parameter = new EpMicroserviceParameter();
               epMicroserviceParameterService.save(parameter);
-              FnLanguage language = FnLanguage.builder().languageAlias("TS").languageName("TEST").build();
-              fnLanguageService.save(principal, language);
               FnUser user = buildFnUser();
-              language.setFnUsers(new HashSet<>(Collections.singleton(user)));
-              user.setLanguageId(language);
+              fnUserService.saveFnUser(user);
               EpWidgetCatalogParameter data = EpWidgetCatalogParameter.builder()
                       .widgetId(widget).userId(user).paramId(parameter).userValue("TestData").build();
               //When
@@ -146,7 +144,7 @@ class EpWidgetCatalogParameterServiceTest {
               epWidgetCatalogParameterService.saveUserParameter(data);
               Long id = data.getId();
               assertEquals(1, epWidgetCatalogParameterService.getUserParameterById(parameter.getId()).size());
-              EpWidgetCatalogParameter actual = epWidgetCatalogParameterService.getUserParamById(widget.getWidgetId(), user.getUserId(), parameter.getId());
+              EpWidgetCatalogParameter actual = epWidgetCatalogParameterService.getUserParamById(widget.getWidgetId(), user.getId(), parameter.getId());
               //Then
               assertEquals(id, actual.getId());
               assertEquals(data.getUserValue(), actual.getUserValue());
@@ -156,13 +154,16 @@ class EpWidgetCatalogParameterServiceTest {
        }
 
        private FnUser buildFnUser() {
+              FnLanguage language = fnLanguageDao.getByLanguageAlias("EN");
               return FnUser.builder()
                       .lastLoginDate(LocalDateTime.now())
                       .activeYn(true)
                       .modifiedDate(LocalDateTime.now())
                       .createdDate(LocalDateTime.now())
                       .isInternalYn(true)
+                      .isSystemUser(true)
                       .guest(false)
+                      .languageId(language)
                       .build();
        }
 }
\ No newline at end of file
diff --git a/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserRoleServiceTest.java b/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserRoleServiceTest.java
new file mode 100644 (file)
index 0000000..fbb09e1
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.service.fn;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.transaction.Transactional;
+import org.junit.jupiter.api.Test;
+import org.junit.runner.RunWith;
+import org.onap.portal.domain.db.fn.FnUser;
+import org.onap.portal.domain.dto.ecomp.EPUserAppCatalogRoles;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+@Transactional
+@TestPropertySource(locations = "classpath:test.properties")
+class FnUserRoleServiceTest {
+       @Autowired
+       private FnUserRoleService fnUserRoleService;
+       @Autowired
+       private FnUserService fnUserService;
+
+       @Test
+       void getUserAppCatalogRoles() {
+              FnUser user = fnUserService.loadUserByUsername("demo");
+
+              List<EPUserAppCatalogRoles> actual = fnUserRoleService.getUserAppCatalogRoles(user, "appName");
+
+              List<EPUserAppCatalogRoles> expected = new ArrayList<>();
+
+              assertEquals(expected, actual);
+       }
+
+
+}
\ No newline at end of file
index e408388..56cbe81 100644 (file)
@@ -48,6 +48,7 @@ import java.util.Arrays;
 import java.util.List;
 import org.junit.jupiter.api.Test;
 import org.junit.runner.RunWith;
+import org.onap.portal.dao.fn.FnLanguageDao;
 import org.onap.portal.domain.db.fn.FnLanguage;
 import org.onap.portal.domain.db.fn.FnLuTimezone;
 import org.onap.portal.domain.db.fn.FnUser;
@@ -70,12 +71,12 @@ class FnUserServiceTest {
        private FnLuTimezoneService fnLuTimezoneService;
        @Autowired
        private FnLanguageService fnLanguageService;
+       @Autowired
+       private FnLanguageDao fnLanguageDao;
 
        @Test
        void saveUser(){
               //Given
-              //FnLuTimezone fnLuTimezone = fnLuTimezoneService.getById(10L).get();
-              FnLanguage language = fnLanguageService.findById(1L).get();
 
               FnUser expected = FnUser.builder().build();
               expected.setFirstName("Demo");
@@ -91,18 +92,18 @@ class FnUserServiceTest {
               expected.setModifiedDate(LocalDateTime.parse("2019-08-08T12:18:17"));
               expected.setIsInternalYn(false);
               expected.setStateCd("NJ");
+              expected.setIsSystemUser(true);
               expected.setCountryCd("US");
-              expected.setLanguageId(language);
+              expected.setLanguageId(fnLanguageService.findById(1L).orElse(new FnLanguage()));
               expected.setGuest(false);
-
-              //fnLuTimezone.getFnUsers().add(expected);
-              language.getFnUsers().add(expected);
+              FnLanguage language = fnLanguageDao.getByLanguageAlias("EN");
+              expected.setLanguageId(language);
 
               //When
-              fnUserService.saveFnUser(principal, expected);
-              FnUser actual = fnUserService.getUser(expected.getUserId()).get();
+              fnUserService.saveFnUser(expected);
+              FnUser actual = fnUserService.getUser(expected.getId()).get();
               //Then
-              assertEquals(expected.getUserId(), actual.getUserId());
+              assertEquals(expected.getId(), actual.getId());
               assertEquals(expected.getLoginPwd(), actual.getLoginPwd());
               //Clean up
               fnUserService.deleteUser(expected);
@@ -110,22 +111,16 @@ class FnUserServiceTest {
 
        @Test
        void getUser() {
-              FnUser actual = fnUserService.getUser(1L).get();
-
+              FnUser actual = fnUserService.loadUserByUsername("demo");
 
               FnUser expected = FnUser.builder().build();
-              expected.setUserId(1L);
               expected.setFirstName("Demo");
               expected.setLastName("User");
               expected.setEmail("demo@openecomp.org");
               expected.setOrgUserId("demo");
               expected.setLoginId("demo");
               expected.setLoginPwd("demo123");
-              expected.setLastLoginDate(LocalDateTime.parse("2019-08-08T12:18:17"));
               expected.setActiveYn(true);
-              expected.setCreatedDate(LocalDateTime.parse("2016-10-14T21:00"));
-              expected.setModifiedId(actual);
-              expected.setModifiedDate(LocalDateTime.parse("2019-08-08T12:18:17"));
               expected.setIsInternalYn(false);
               expected.setStateCd("NJ");
               expected.setCountryCd("US");
@@ -133,9 +128,6 @@ class FnUserServiceTest {
               expected.setLanguageId(fnLanguageService.findById(1L).orElse(new FnLanguage()));
 
 
-              assertEquals(expected.getUserId(), actual.getUserId());
-              assertEquals(expected.getOrgId(), actual.getOrgId());
-              assertEquals(expected.getManagerId(), actual.getManagerId());
               assertEquals(expected.getFirstName(), actual.getFirstName());
               assertEquals(expected.getMiddleName(), actual.getMiddleName());
               assertEquals(expected.getLastName(), actual.getLastName());
@@ -150,11 +142,7 @@ class FnUserServiceTest {
               assertEquals(expected.getOrg_code(), actual.getOrg_code());
               assertEquals(expected.getLoginId(), actual.getLoginId());
               assertEquals(expected.getLoginPwd(), actual.getLoginPwd());
-              assertEquals(expected.getLastLoginDate(), actual.getLastLoginDate());
               assertEquals(expected.getActiveYn(), actual.getActiveYn());
-              assertEquals(expected.getCreatedId(), actual.getCreatedId());
-              assertEquals(expected.getCreatedDate(), actual.getCreatedDate());
-              assertEquals(expected.getModifiedDate(), actual.getModifiedDate());
               assertEquals(expected.getIsInternalYn(), actual.getIsInternalYn());
               assertEquals(expected.getAddressLine1(), actual.getAddressLine1());
               assertEquals(expected.getAddressLine2(), actual.getAddressLine2());
@@ -167,14 +155,11 @@ class FnUserServiceTest {
               assertEquals(expected.getCompany(), actual.getCompany());
               assertEquals(expected.getDepartmentName(), actual.getDepartmentName());
               assertEquals(expected.getJobTitle(), actual.getJobTitle());
-              assertEquals(expected.getTimezone().getTimezoneId(), actual.getTimezone().getTimezoneId());
               assertEquals(expected.getDepartment(), actual.getDepartment());
               assertEquals(expected.getBusinessUnit(), actual.getBusinessUnit());
-              assertEquals(expected.getBusinessUnitName(), actual.getBusinessUnitName());
               assertEquals(expected.getCost_center(), actual.getCost_center());
               assertEquals(expected.getFinLocCode(), actual.getFinLocCode());
               assertEquals(expected.getSiloStatus(), actual.getSiloStatus());
-              assertEquals(expected.getLanguageId(), actual.getLanguageId());
        }
 
        @Test