diff options
author | 2019-12-04 15:49:03 +0100 | |
---|---|---|
committer | 2019-12-04 15:49:43 +0100 | |
commit | ffd9af970318c1f5a0bad46d7aad5d4611414aae (patch) | |
tree | 935f5e0a13a21df52ca1d796ac3b684910d4ba4c /portal-BE/src/main/java/org/onap | |
parent | 39fb119cdaea6bd8d801b22d195db39f6d8faaca (diff) |
Domain model change
ORM inheritance implementation in all classes that extend from DomainVo
class.
This patch also change data source from data.sql to DBInitializingBean that
pushing data by hibernate to database.
Issue-ID: PORTAL-710
Change-Id: I0f95f7a50facae9f3004ff9f16cdee4e76a39e35
Signed-off-by: Dominik Mizyn <d.mizyn@samsung.com>
Diffstat (limited to 'portal-BE/src/main/java/org/onap')
186 files changed, 4610 insertions, 1154 deletions
diff --git a/portal-BE/src/main/java/org/onap/portal/aop/service/FnLanguageServiceAOP.java b/portal-BE/src/main/java/org/onap/portal/aop/service/FnLanguageServiceAOP.java index db8e0699..4b48ae41 100644 --- a/portal-BE/src/main/java/org/onap/portal/aop/service/FnLanguageServiceAOP.java +++ b/portal-BE/src/main/java/org/onap/portal/aop/service/FnLanguageServiceAOP.java @@ -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); } } diff --git a/portal-BE/src/main/java/org/onap/portal/aop/service/FnUserServiceAOP.java b/portal-BE/src/main/java/org/onap/portal/aop/service/FnUserServiceAOP.java index 65fc88d9..f891392e 100644 --- a/portal-BE/src/main/java/org/onap/portal/aop/service/FnUserServiceAOP.java +++ b/portal-BE/src/main/java/org/onap/portal/aop/service/FnUserServiceAOP.java @@ -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 index 00000000..ebd23cd9 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/configuration/DBInitializingBean.java @@ -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("管ç†å‘˜").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("门户管ç†å‘˜").build(); + FnDisplayText fnDisplayText21 = FnDisplayText.builder().languageId(2L).textId(9L).textLabel("应用管ç†").build(); + FnDisplayText fnDisplayText22 = FnDisplayText.builder().languageId(2L).textId(10L).textLabel("部件管ç†").build(); + FnDisplayText fnDisplayText23 = FnDisplayText.builder().languageId(2L).textId(11L).textLabel("编辑功能èœå•").build(); + FnDisplayText fnDisplayText24 = FnDisplayText.builder().languageId(2L).textId(12L).textLabel("用户通知").build(); + FnDisplayText fnDisplayText25 = FnDisplayText.builder().languageId(2L).textId(13L).textLabel("å¾®æœåŠ¡ç®¡ç†").build(); + FnDisplayText fnDisplayText26 = FnDisplayText.builder().languageId(2L).textId(15L).textLabel("应用账户管ç†").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); + + + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/configuration/SecurityConfig.java b/portal-BE/src/main/java/org/onap/portal/configuration/SecurityConfig.java index 3fae09cf..a0542ec4 100644 --- a/portal-BE/src/main/java/org/onap/portal/configuration/SecurityConfig.java +++ b/portal-BE/src/main/java/org/onap/portal/configuration/SecurityConfig.java @@ -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(); + + } } diff --git a/portal-BE/src/main/java/org/onap/portal/configuration/WebMvcConfiguration.java b/portal-BE/src/main/java/org/onap/portal/configuration/WebMvcConfiguration.java index 90b02563..f3b38187 100644 --- a/portal-BE/src/main/java/org/onap/portal/configuration/WebMvcConfiguration.java +++ b/portal-BE/src/main/java/org/onap/portal/configuration/WebMvcConfiguration.java @@ -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); } + } diff --git a/portal-BE/src/main/java/org/onap/portal/controller/LanguageController.java b/portal-BE/src/main/java/org/onap/portal/controller/LanguageController.java index c470aead..4a25e614 100644 --- a/portal-BE/src/main/java/org/onap/portal/controller/LanguageController.java +++ b/portal-BE/src/main/java/org/onap/portal/controller/LanguageController.java @@ -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); diff --git a/portal-BE/src/main/java/org/onap/portal/controller/UserController.java b/portal-BE/src/main/java/org/onap/portal/controller/UserController.java index 8057a9a6..571ab20a 100644 --- a/portal-BE/src/main/java/org/onap/portal/controller/UserController.java +++ b/portal-BE/src/main/java/org/onap/portal/controller/UserController.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/controller/UserRolesController.java b/portal-BE/src/main/java/org/onap/portal/controller/UserRolesController.java index 87c8dff5..dbba777e 100644 --- a/portal-BE/src/main/java/org/onap/portal/controller/UserRolesController.java +++ b/portal-BE/src/main/java/org/onap/portal/controller/UserRolesController.java @@ -55,7 +55,9 @@ 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; @@ -88,7 +90,7 @@ import org.springframework.web.bind.annotation.RestController; @Configuration public class UserRolesController { - private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UserRolesController.class); + private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UserRolesController.class); private final FnUserService fnUserService; private final FnUserRoleService fnUserRoleService; @@ -96,11 +98,6 @@ public class UserRolesController { private final ApplicationsRestClientService applicationsRestClientService; private final AuditServiceImpl auditService = new AuditServiceImpl(); -/* - private final UserRolesService userRolesService; - private final SearchService searchService;*/ - - private static final String FAILURE = "failure"; @Autowired @@ -115,152 +112,149 @@ public class UserRolesController { } - /* - @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/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.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") @@ -272,15 +266,15 @@ public class UserRolesController { FnUser user = fnUserService.loadUserByUsername(principal.getName()); List<RoleInAppForUser> result = null; String feErrorString = ""; - if (!adminRolesService.isAccountAdmin(user) && !adminRolesService.isRoleAdmin(user.getUserId())) { + if (!adminRolesService.isAccountAdmin(user) && !adminRolesService.isRoleAdmin(user.getId())) { logger.debug(EELFLoggerDelegate.debugLogger, "getAppRolesForUser: Accountadminpermissioncheck {}, RoleAdmincheck {}", - adminRolesService.isAccountAdmin(user), adminRolesService.isRoleAdmin(user.getUserId())); + 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.getUserId()); + result = adminRolesService.getAppRolesForUser(appid, orgUserId, extRequestValue, user.getId()); logger.debug(EELFLoggerDelegate.debugLogger, "getAppRolesForUser: result {}, appId {}", result, appid); int responseCode = EcompPortalUtils.getExternalAppResponseCode(); @@ -361,7 +355,7 @@ public class UserRolesController { // boolean changesApplied = false; ExternalRequestFieldsValidator changesApplied = null; - if (!adminRolesService.isAccountAdmin(user) && !adminRolesService.isRoleAdmin(user.getUserId())) { + if (!adminRolesService.isAccountAdmin(user) && !adminRolesService.isRoleAdmin(user.getId())) { EcompPortalUtils.setBadPermissions(user, response, "putAppWithUserRoleStateForUser"); } else if (newAppRolesForUser == null) { logger.error(EELFLoggerDelegate.errorLogger, @@ -540,7 +534,7 @@ public class UserRolesController { } - private Comparator<EPUserAppCatalogRoles> getUserAppCatalogRolesComparator = + private final Comparator<EPUserAppCatalogRoles> getUserAppCatalogRolesComparator = Comparator.comparing(EPUserAppCatalogRoles::getRoleName); @RequestMapping(value = "/portalApi/externalRequestAccessSystem", method = RequestMethod.GET, @@ -567,7 +561,7 @@ public class UserRolesController { boolean isSuperAdmin = false; try { - isSuperAdmin = adminRolesService.isSuperAdmin(user.getOrgUserId()); + isSuperAdmin = adminRolesService.isSuperAdmin(user.getLoginId()); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "checkIfUserIsSuperAdmin failed: " + e.getMessage()); } diff --git a/portal-BE/src/main/java/org/onap/portal/controller/WebAnalyticsExtAppController.java b/portal-BE/src/main/java/org/onap/portal/controller/WebAnalyticsExtAppController.java index 603e45d2..20c64546 100644 --- a/portal-BE/src/main/java/org/onap/portal/controller/WebAnalyticsExtAppController.java +++ b/portal-BE/src/main/java/org/onap/portal/controller/WebAnalyticsExtAppController.java @@ -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")); } } diff --git a/portal-BE/src/main/java/org/onap/portal/controller/WidgetMSController.java b/portal-BE/src/main/java/org/onap/portal/controller/WidgetMSController.java index ab1b2806..92b4b512 100644 --- a/portal-BE/src/main/java/org/onap/portal/controller/WidgetMSController.java +++ b/portal-BE/src/main/java/org/onap/portal/controller/WidgetMSController.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/controller/WidgetsCatalogController.java b/portal-BE/src/main/java/org/onap/portal/controller/WidgetsCatalogController.java index 07695aeb..59779448 100644 --- a/portal-BE/src/main/java/org/onap/portal/controller/WidgetsCatalogController.java +++ b/portal-BE/src/main/java/org/onap/portal/controller/WidgetsCatalogController.java @@ -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()); diff --git a/portal-BE/src/main/java/org/onap/portal/controller/WidgetsCatalogMarkupController.java b/portal-BE/src/main/java/org/onap/portal/controller/WidgetsCatalogMarkupController.java index e63de2e8..4a4287c5 100644 --- a/portal-BE/src/main/java/org/onap/portal/controller/WidgetsCatalogMarkupController.java +++ b/portal-BE/src/main/java/org/onap/portal/controller/WidgetsCatalogMarkupController.java @@ -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}") diff --git a/portal-BE/src/main/java/org/onap/portal/controller/WidgetsController.java b/portal-BE/src/main/java/org/onap/portal/controller/WidgetsController.java index 556c7ef3..6a92fbc3 100644 --- a/portal-BE/src/main/java/org/onap/portal/controller/WidgetsController.java +++ b/portal-BE/src/main/java/org/onap/portal/controller/WidgetsController.java @@ -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 index 935e5646..c7782b56 100644 --- 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 @@ -42,7 +42,6 @@ package org.onap.portal.dao.ep; import java.util.List; import org.onap.portal.domain.db.ep.EpAppFunction; -import org.onap.portal.domain.db.ep.EpAppFunction.EpAppFunctionId; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; @@ -51,7 +50,7 @@ import org.springframework.transaction.annotation.Transactional; @Repository @Transactional -public interface EpAppFunctionDao extends JpaRepository<EpAppFunction, EpAppFunctionId> { +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 index 00000000..3296eb7e --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/ep/EpAppRoleFunctionDao.java @@ -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 index 00000000..cc3219c0 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/ep/EpBasicAuthAccountDao.java @@ -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 index 00000000..d68e1f84 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/ep/EpMicroserviceDao.java @@ -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 index 00000000..bc9da593 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/ep/EpPersUserAppSortDao.java @@ -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/fn/FnAppContactUsDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnAppContactUsDao.java new file mode 100644 index 00000000..39603eb7 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnAppContactUsDao.java @@ -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> { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnAppDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnAppDao.java index a1be3bd1..f86456f2 100644 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnAppDao.java +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnAppDao.java @@ -15,4 +15,7 @@ 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 index 00000000..4e747b4f --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnAuditLogDao.java @@ -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 index 00000000..deb062f0 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnCommonWidgetDataDao.java @@ -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 index 00000000..fae8d684 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnDisplayTextDao.java @@ -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 index 00000000..6892de21 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnFunctionDao.java @@ -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> { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLanguageDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLanguageDao.java index 6e3d829e..c79fb0ed 100644 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLanguageDao.java +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLanguageDao.java @@ -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 index 00000000..abc8cff1 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuActivityDao.java @@ -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 index 00000000..cfd22ce5 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuAlertMethodDao.java @@ -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 index 00000000..adcb792a --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuMenuSetDao.java @@ -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 index 00000000..98253ceb --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuPriorityDao.java @@ -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 index 00000000..bcc3a1b8 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuTabSetDao.java @@ -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 index 00000000..bbd1b6ad --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuDao.java @@ -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 index 00000000..3ffc7bb9 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalAncestorsDao.java @@ -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/FnPersUserAppSelDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnPersUserAppSelDao.java new file mode 100644 index 00000000..ff7e6e72 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnPersUserAppSelDao.java @@ -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 index 00000000..ec09ae54 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzCronTriggersDao.java @@ -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 index 00000000..3a3a4183 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzJobDetailsDao.java @@ -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 index 00000000..7063cf7e --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzLocksDao.java @@ -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 index 00000000..17bbd7fa --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzSchedulerStateDao.java @@ -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 index 00000000..55a86de2 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzTriggersDao.java @@ -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 index 00000000..1bf54d6d --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnRestrictedUrlDao.java @@ -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 index 00000000..89df2c41 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnRoleCompositeDao.java @@ -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> { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnRoleDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnRoleDao.java index b428ea11..f979be6e 100644 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnRoleDao.java +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnRoleDao.java @@ -76,4 +76,7 @@ public interface FnRoleDao extends JpaRepository<FnRole, Long> { @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 index 00000000..eaafb78d --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnRoleFunctionDao.java @@ -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 index 00000000..765bc1dd --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnSharedContextDao.java @@ -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 index 00000000..c6518a99 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnTabDao.java @@ -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 index 00000000..42da97e0 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnTabSelectedDao.java @@ -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> { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnUserDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnUserDao.java index 8dbfb70f..f52075c1 100644 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnUserDao.java +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnUserDao.java @@ -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); diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnUserRoleDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnUserRoleDao.java index 952d5163..402304b8 100644 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnUserRoleDao.java +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnUserRoleDao.java @@ -61,11 +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); - - @Query 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 index 00000000..477d915b --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/DomainVo.java @@ -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; + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/VUrlAccess.java b/portal-BE/src/main/java/org/onap/portal/domain/db/VUrlAccess.java index 9f50f3bd..34e22c45 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/VUrlAccess.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/VUrlAccess.java @@ -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) diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFavoriteReports.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFavoriteReports.java index 6c8296a7..ce47c2e6 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFavoriteReports.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFavoriteReports.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFilehistLog.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFilehistLog.java index 3dec4ee1..f6b8a650 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFilehistLog.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFilehistLog.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFolder.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFolder.java index 44e3902f..741258be 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFolder.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFolder.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFolderAccess.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFolderAccess.java index 05ec2465..7a99359a 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFolderAccess.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFolderAccess.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrLuFileType.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrLuFileType.java index 94201c58..e4393d93 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrLuFileType.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrLuFileType.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReport.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReport.java index 791518d2..a7e6fdc4 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReport.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReport.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportAccess.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportAccess.java index 2eb50c74..15aaf027 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportAccess.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportAccess.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportEmailSentLog.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportEmailSentLog.java index e43c5c76..7a63890d 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportEmailSentLog.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportEmailSentLog.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportFileHistory.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportFileHistory.java index 05696ab6..63aafa77 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportFileHistory.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportFileHistory.java @@ -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; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportLog.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportLog.java index 30a0b27f..2c05fa50 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportLog.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportLog.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportSchedule.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportSchedule.java index 611dd194..0920f186 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportSchedule.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportSchedule.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportScheduleUsers.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportScheduleUsers.java index 237956c1..8c6d761e 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportScheduleUsers.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportScheduleUsers.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportTemplateMap.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportTemplateMap.java index a886bfd4..466902aa 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportTemplateMap.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportTemplateMap.java @@ -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]") diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableJoin.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableJoin.java index eb1117cb..c894bf00 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableJoin.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableJoin.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableRole.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableRole.java index 7b6a3013..8042c414 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableRole.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableRole.java @@ -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) diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableSource.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableSource.java index 791e5617..078b5385 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableSource.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableSource.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpAppFunction.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpAppFunction.java index 5cccdcbd..2c23c3d7 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpAppFunction.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpAppFunction.java @@ -41,13 +41,12 @@ 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; @@ -56,17 +55,17 @@ 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; -import org.onap.portal.domain.dto.DomainVo; /* CREATE TABLE `ep_app_function` ( @@ -86,29 +85,28 @@ CREATE TABLE `ep_app_function` ( + " EpAppRoleFunction rf,\n" + " EpAppFunction f\n" + " where\n" - + " rf.fnRole.roleId = :roleId\n" - + " and rf.appId.appId = :appId\n" - + " and rf.appId.appId = f.appId.appId\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")}) +@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 extends DomainVo implements Serializable { - @Id - @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) - @JoinColumn(name = "app_id") + @ManyToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY) + @JoinColumn(name = "app_id", columnDefinition = "bigint") @Valid private FnApp appId; - @Id @Column(name = "function_cd", length = 250, nullable = false) @Size(max = 250) @NotNull @@ -130,14 +128,14 @@ public class EpAppFunction extends DomainVo implements Serializable { @OneToMany( targetEntity = EpAppRoleFunction.class, mappedBy = "epAppFunction", - cascade = CascadeType.ALL, + 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(); - this.id = id; + super.setId(id); this.functionCd = code; this.functionName = name; this.appId = appId; @@ -146,19 +144,24 @@ public class EpAppFunction extends DomainVo implements Serializable { 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; } } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpAppRoleFunction.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpAppRoleFunction.java index 8a60688b..3cb219a3 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpAppRoleFunction.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpAppRoleFunction.java @@ -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; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpBasicAuthAccount.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpBasicAuthAccount.java index c65c0d34..7f42a0f1 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpBasicAuthAccount.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpBasicAuthAccount.java @@ -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; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpEndpoints.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpEndpoints.java index ccb1bb29..a1766115 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpEndpoints.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpEndpoints.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpEndpointsBasicAuthAccount.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpEndpointsBasicAuthAccount.java index 9cf7d36b..2f36b1a2 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpEndpointsBasicAuthAccount.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpEndpointsBasicAuthAccount.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroservice.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroservice.java index 6c6b39cc..69e28dc3 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroservice.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroservice.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroserviceParameter.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroserviceParameter.java index 36c073ac..74b051fe 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroserviceParameter.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroserviceParameter.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpNotification.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpNotification.java index 424f61b8..a10cc3e3 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpNotification.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpNotification.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpPersUserAppSort.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpPersUserAppSort.java index 1976533e..a6bf71a2 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpPersUserAppSort.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpPersUserAppSort.java @@ -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; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpPersUserWidgetPlacement.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpPersUserWidgetPlacement.java index b1e472f8..7dbb4831 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpPersUserWidgetPlacement.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpPersUserWidgetPlacement.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpPersUserWidgetSel.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpPersUserWidgetSel.java index 4b2785f1..2d4c76f3 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpPersUserWidgetSel.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpPersUserWidgetSel.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpRoleNotification.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpRoleNotification.java index 94df52d5..53e48073 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpRoleNotification.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpRoleNotification.java @@ -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") diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpUserNotification.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpUserNotification.java index 15bb2b9a..441eb524 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpUserNotification.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpUserNotification.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpUserRolesRequest.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpUserRolesRequest.java index 752e47aa..113863c3 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpUserRolesRequest.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpUserRolesRequest.java @@ -55,6 +55,7 @@ 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; @@ -68,7 +69,6 @@ import lombok.Setter; import org.hibernate.validator.constraints.SafeHtml; import org.onap.portal.domain.db.fn.FnApp; import org.onap.portal.domain.db.fn.FnUser; -import org.onap.portal.domain.dto.ecomp.EPUserAppRolesRequestDetail; /* CREATE TABLE `ep_user_roles_request` ( @@ -89,7 +89,7 @@ CREATE TABLE `ep_user_roles_request` ( @NamedQueries({ @NamedQuery( name = "EpUserRolesRequest.userAppRolesRequestList", - query = "FROM EpUserRolesRequest where userId.userId =:userId and appId.appId =:appId and requestStatus = 'P'" + query = "FROM EpUserRolesRequest where userId.id =:userId and appId.id =:appId and requestStatus = 'P'" ) }) @@ -101,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; @@ -129,7 +130,7 @@ public class EpUserRolesRequest implements Serializable { @OneToMany( targetEntity = EpUserRolesRequestDet.class, mappedBy = "reqId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<EpUserRolesRequestDet> epUserRolesRequestDets; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpUserRolesRequestDet.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpUserRolesRequestDet.java index 5338754b..4d2fcaea 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpUserRolesRequestDet.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpUserRolesRequestDet.java @@ -54,6 +54,7 @@ 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; @@ -99,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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWebAnalyticsSource.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWebAnalyticsSource.java index 429bac1b..4b27a21b 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWebAnalyticsSource.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWebAnalyticsSource.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalog.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalog.java index 061aafc4..0aee6155 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalog.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalog.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalogFiles.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalogFiles.java index fe91d235..82ee9f1a 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalogFiles.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalogFiles.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalogParameter.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalogParameter.java index ec6bb563..ababeab6 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalogParameter.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalogParameter.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalogRole.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalogRole.java index b226b92d..f5124297 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalogRole.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalogRole.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetPreviewFiles.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetPreviewFiles.java index d96524e1..ece3896b 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetPreviewFiles.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetPreviewFiles.java @@ -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) diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnApp.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnApp.java index 9beee463..307abebd 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnApp.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnApp.java @@ -41,15 +41,12 @@ 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` ( @@ -107,7 +105,10 @@ CREATE TABLE `fn_app` ( query = "from FnApp where authCentral = 'Y' and open = 'N' and authNamespace is not null"), @NamedQuery( name = "FnApp.getByUebKey", - query = "from FnApp where uebKey = :uebKey" + query = "from FnApp where uebKey = :uebKey"), + @NamedQuery( + name = "FnApp.getCentralizedApps", + query = "from FnApp where authCentral = 'Y' and open = 'N' and authNamespace is not null" ) }) @@ -115,22 +116,16 @@ CREATE TABLE `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; + private String appName = "?"; @Column(name = "app_image_url", length = 256) @Size(max = 256) @SafeHtml @@ -161,12 +156,11 @@ public class FnApp extends DomainVo implements Serializable { @Size(max = 50) @SafeHtml @NotNull - private String ml_app_name; + private String mlAppName = "?"; @Column(name = "ml_app_admin_id", length = 7, nullable = false, columnDefinition = "varchar(7) not null default '?'") @Size(max = 7) @SafeHtml - @NotNull - private String mlAppAdminId; + private String mlAppAdminId = "?"; @Column(name = "mots_id", length = 11) @Digits(integer = 11, fraction = 0) private Long motsId; @@ -174,17 +168,14 @@ public class FnApp extends DomainVo implements Serializable { @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) + private String appPassword = "?"; + @Column(name = "open") + private Boolean open = false; + @Column(name = "enabled") + private Boolean enabled = false; + @Column(name = "active_yn") @NotNull - @SafeHtml - private String activeYn; + private Boolean activeYn = true; @Column(name = "_thumbnail", columnDefinition = "mediumblob null default null") private byte[] thumbnail; @Column(name = "app_username", length = 50) @@ -205,8 +196,8 @@ public class FnApp extends DomainVo implements Serializable { 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 Long appType = 1L; + @Column(name = "auth_central", length = 1, nullable = false) private Boolean authCentral; @Column(name = "auth_namespace", length = 100) @Size(max = 100) @@ -215,63 +206,63 @@ public class FnApp extends DomainVo implements Serializable { @OneToMany( targetEntity = FnMenuFunctionalRoles.class, mappedBy = "appId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<FnMenuFunctionalRoles> fnMenuFunctionalRoles; @OneToMany( targetEntity = EpUserRolesRequest.class, mappedBy = "appId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<EpUserRolesRequest> epUserRolesRequests; @OneToMany( targetEntity = EpAppFunction.class, mappedBy = "appId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<EpAppFunction> epAppFunctions; @OneToMany( targetEntity = EpAppRoleFunction.class, mappedBy = "appId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<EpAppRoleFunction> epAppRoleFunctions; @OneToMany( targetEntity = FnUserRole.class, - mappedBy = "appId", - cascade = CascadeType.ALL, + mappedBy = "fnAppId", + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<FnUserRole> fnUserRoles; @OneToMany( targetEntity = EpWebAnalyticsSource.class, mappedBy = "appId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<EpWebAnalyticsSource> epWebAnalyticsSources; @OneToMany( targetEntity = EpWidgetCatalogRole.class, mappedBy = "appId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<EpWidgetCatalogRole> epWidgetCatalogRoles; @OneToMany( targetEntity = EpMicroservice.class, mappedBy = "appId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<EpMicroservice> epMicroservices; @OneToMany( targetEntity = FnPersUserAppSel.class, mappedBy = "appId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<FnPersUserAppSel> fnPersUserAppSels; @@ -279,4 +270,66 @@ public class FnApp extends DomainVo implements Serializable { 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; + } } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAppContactUs.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAppContactUs.java index 26fd4668..ef51b7e7 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAppContactUs.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAppContactUs.java @@ -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") diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAuditAction.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAuditAction.java index da60049b..1ae1898a 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAuditAction.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAuditAction.java @@ -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) diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAuditActionLog.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAuditActionLog.java index df73f42c..f7f07ea2 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAuditActionLog.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAuditActionLog.java @@ -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) diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAuditLog.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAuditLog.java index 911f32a2..1094462f 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAuditLog.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAuditLog.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnBroadcastMessage.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnBroadcastMessage.java index e9cfc20d..9d5d6d70 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnBroadcastMessage.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnBroadcastMessage.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnChatRoom.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnChatRoom.java index abf96539..a663c1cd 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnChatRoom.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnChatRoom.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnCommonWidgetData.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnCommonWidgetData.java index 1255aa1d..5215acf3 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnCommonWidgetData.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnCommonWidgetData.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnDatasource.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnDatasource.java index 87ee3592..ec045cfb 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnDatasource.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnDatasource.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnDisplayText.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnDisplayText.java index 348cf9ec..8946e83d 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnDisplayText.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnDisplayText.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnFunction.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnFunction.java index 7bd9c386..8ceb12fd 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnFunction.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnFunction.java @@ -75,9 +75,7 @@ CREATE TABLE `fn_function` ( @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) @@ -91,21 +89,21 @@ public class FnFunction implements Serializable { @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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLanguage.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLanguage.java index ad976fc6..531157fe 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLanguage.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLanguage.java @@ -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; + } } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuActivity.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuActivity.java index f4d0d709..ad8e627e 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuActivity.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuActivity.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuAlertMethod.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuAlertMethod.java index 740f052b..b9b40b36 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuAlertMethod.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuAlertMethod.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuMenuSet.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuMenuSet.java index ff5e4736..5e71405b 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuMenuSet.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuMenuSet.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuPriority.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuPriority.java index 4e5e2335..e1e46bd9 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuPriority.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuPriority.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuTabSet.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuTabSet.java index 06e982ca..fe59c749 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuTabSet.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuTabSet.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuTimezone.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuTimezone.java index 54b4bc5c..c3b8843c 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuTimezone.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuTimezone.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenu.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenu.java index 7407213c..8e146259 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenu.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenu.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenuFunctional.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenuFunctional.java index e1e2787c..0e376f7a 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenuFunctional.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenuFunctional.java @@ -57,6 +57,7 @@ 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; @@ -64,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; @@ -97,6 +99,7 @@ CREATE TABLE `fn_menu_functional` ( }) @NoArgsConstructor @AllArgsConstructor +@Builder @Getter @Setter @Entity @@ -114,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; @@ -125,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") } @@ -148,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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenuFunctionalAncestors.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenuFunctionalAncestors.java index 309f11ea..00eddf0a 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenuFunctionalAncestors.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenuFunctionalAncestors.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenuFunctionalRoles.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenuFunctionalRoles.java index ff7cadc5..373f1ac6 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenuFunctionalRoles.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenuFunctionalRoles.java @@ -53,11 +53,13 @@ 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; @@ -81,7 +83,7 @@ CREATE TABLE `fn_menu_functional_roles` ( @NamedQueries({ @NamedQuery( name = "FnMenuFunctionalRoles.retrieveByRoleId", - query = "from FnMenuFunctionalRoles where roleId.roleId =:roleId"), + query = "from FnMenuFunctionalRoles where roleId.id =:roleId"), @NamedQuery( name = "FnMenuFunctionalRoles.retrieveByMenuId", query = "from FnMenuFunctionalRoles where menuId.menuId =:menuId" @@ -96,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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnOrg.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnOrg.java index 9dea65ed..0fd61b72 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnOrg.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnOrg.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnPersUserAppSel.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnPersUserAppSel.java index 1da9c219..2a3fd9bd 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnPersUserAppSel.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnPersUserAppSel.java @@ -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; } } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzCronTriggers.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzCronTriggers.java index 84c11629..6db1fb0b 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzCronTriggers.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzCronTriggers.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzJobDetails.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzJobDetails.java index 5da7b4fa..0ea12455 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzJobDetails.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzJobDetails.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzSchedulerState.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzSchedulerState.java index 3c00f959..1ce373ba 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzSchedulerState.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzSchedulerState.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzTriggers.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzTriggers.java index 35fb1307..d7f3dec9 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzTriggers.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzTriggers.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRestrictedUrl.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRestrictedUrl.java index 74e81ebe..43238181 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRestrictedUrl.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRestrictedUrl.java @@ -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; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRole.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRole.java index 3de581b1..2c16d00a 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRole.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRole.java @@ -41,16 +41,16 @@ 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.DiscriminatorValue; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.IdClass; import javax.persistence.Index; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; @@ -68,11 +68,12 @@ 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` ( @@ -99,13 +100,13 @@ CREATE TABLE `fn_role` ( query = "FROM FnRole where appId is null"), @NamedQuery( name = "FnRole.retrieveAppRoleByRoleIdWhereAppIdIsNull", - query = "FROM FnRole where roleId =:roleId and appId is null"), + 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 roleId =:roleId and appId =:appId"), + query = "FROM FnRole where id =:roleId and appId =:appId"), @NamedQuery( name = "FnRole.retrieveAppRolesByRoleNameAndWhereAppIdIsNull", query = "FROM FnRole where roleName =:roleName and appId is null"), @@ -118,9 +119,9 @@ CREATE TABLE `fn_role` ( + " FnRole fr,\n" + " FnUserRole fur\n" + " WHERE\n" - + " fr.roleId = fur.roleId\n" + + " fr.id = fur.roleId\n" + " AND fur.userId = :userId" - + " AND fur.appId = :appId\n" + + " AND fur.fnAppId.id = :appId\n" + " AND fr.activeYn = 'y'"), @NamedQuery( name = "FnRole.getGlobalRolesOfPortal", @@ -129,129 +130,108 @@ CREATE TABLE `fn_role` ( + " where" + " roleName like 'global_%'" + " and appId is null" - + " and activeYn = 'Y'" + + " 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 -@Builder @Getter @Setter @Entity -public class FnRole extends DomainVo implements Serializable { +public class FnRole extends Role { - @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 Integer 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) + @ManyToMany(cascade = CascadeType.MERGE, 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")}, + 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; - @OneToMany( - targetEntity = FnRoleComposite.class, - mappedBy = "childRoles", - cascade = CascadeType.ALL, - fetch = FetchType.LAZY - ) - private Set<FnRoleComposite> childRoles; - @OneToMany( - targetEntity = FnRoleComposite.class, - mappedBy = "parentRoles", - cascade = CascadeType.ALL, - fetch = FetchType.LAZY - ) - private Set<FnRoleComposite> parentRoles; - @ManyToMany(cascade = CascadeType.ALL, - fetch = FetchType.LAZY) + @ManyToMany(cascade = CascadeType.MERGE, + fetch = FetchType.LAZY, mappedBy = "role") private Set<FnRoleFunction> roleFunctions; @OneToMany( targetEntity = EpRoleNotification.class, mappedBy = "notificationID", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<EpRoleNotification> epRoleNotifications; @OneToMany( targetEntity = FnMenuFunctionalRoles.class, mappedBy = "roleId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<FnMenuFunctionalRoles> fnMenuFunctionalRoles; @OneToMany( targetEntity = EpWidgetCatalogRole.class, mappedBy = "roleId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<EpWidgetCatalogRole> epWidgetCatalogRoles; @OneToMany( targetEntity = EpAppRoleFunction.class, mappedBy = "fnRole", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<EpAppRoleFunction> epAppRoleFunctions; @OneToMany( targetEntity = EpUserRolesRequestDet.class, mappedBy = "requestedRoleId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<EpUserRolesRequestDet> epUserRolesRequestDets; @OneToMany( targetEntity = FnUserRole.class, mappedBy = "roleId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<FnUserRole> fnUserRoles; - public FnRole(Long roleId, String roleName, Boolean activeYn, Integer priority, + @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) { - this.roleId = roleId; - this.roleName = roleName; - this.activeYn = activeYn; - this.priority = priority; - this.fnRoleFunctions = fnRoleFunctions; - this.childRoles = childRoles; - this.parentRoles = parentRoles; + 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 index 42a24b22..a729e76c 100644 --- 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 @@ -52,11 +52,12 @@ import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.validation.Valid; 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.FnRoleComposite.FnRoleCompositeId; +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") @@ -64,6 +65,7 @@ import org.onap.portal.domain.db.fn.FnRoleComposite.FnRoleCompositeId; @Getter @Setter @Entity +@Builder @NoArgsConstructor @AllArgsConstructor @IdClass(FnRoleCompositeId.class) @@ -71,25 +73,13 @@ public class FnRoleComposite implements Serializable{ @Id @Valid - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) - @JoinColumn(name = "parent_role_id") - private FnRole parentRoles; + @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.ALL) - @JoinColumn(name = "child_role_id") - private FnRole childRoles; + @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE) + @JoinColumn(name = "child_role_id", nullable = false, columnDefinition = "bigint") + private Role childRoles; - @Getter - @Setter - @NoArgsConstructor - @EqualsAndHashCode - @AllArgsConstructor - public class FnRoleCompositeId implements Serializable { - - @Valid - private FnRole parentRoles; - @Valid - private FnRole childRoles; - } } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRoleFunction.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRoleFunction.java index 90df5905..d98687a5 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRoleFunction.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRoleFunction.java @@ -41,25 +41,25 @@ 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.Builder; -import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import org.onap.portal.domain.db.fn.FnRoleFunction.FnRoleFunctionId; -import org.onap.portal.domain.dto.DomainVo; +import org.onap.portal.domain.db.DomainVo; +import org.onap.portal.domain.dto.transport.Role; /* CREATE TABLE `fn_role_function` ( @@ -74,41 +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 -@Builder @Getter @Setter @Entity -@IdClass(FnRoleFunctionId.class) -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; +public class FnRoleFunction extends DomainVo implements Serializable { + @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; + } } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnScheduleWorkflows.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnScheduleWorkflows.java index 620532ee..d4e2dd31 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnScheduleWorkflows.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnScheduleWorkflows.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnSharedContext.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnSharedContext.java index 7c021837..ca16d343 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnSharedContext.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnSharedContext.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnTab.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnTab.java index 634fb649..fa4be7f5 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnTab.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnTab.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnTabSelected.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnTabSelected.java index 14b243dd..1369fbd5 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnTabSelected.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnTabSelected.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUser.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUser.java index dc01f388..277b04d8 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUser.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUser.java @@ -53,9 +53,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.ManyToMany; @@ -77,16 +74,13 @@ 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.domain.App; -import org.onap.portalsdk.core.domain.Role; -import org.onap.portalsdk.core.domain.UserApp; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; @@ -161,6 +155,9 @@ CREATE TABLE `fn_user` ( 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( @@ -168,11 +165,12 @@ CREATE TABLE `fn_user` ( 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_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") @@ -186,7 +184,6 @@ CREATE TABLE `fn_user` ( @Getter @Setter @Entity -@Builder @NoArgsConstructor @AllArgsConstructor @DynamicUpdate @@ -194,16 +191,12 @@ public class FnUser extends DomainVo implements UserDetails, Serializable { private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnUser.class); - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "user_id", nullable = false) - private Long userId; - @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) +/* @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; - @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) - @JoinColumn(name = "manager_id") - private FnUser managerId; @Column(name = "first_name", length = 50) @Size(max = 50) @SafeHtml @@ -236,7 +229,7 @@ public class FnUser extends DomainVo implements UserDetails, Serializable { @Column(name = "address_id") @Digits(integer = 11, fraction = 0) private Long addressId; - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) + @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE) @JoinColumn(name = "alert_method_cd") private FnLuAlertMethod alertMethodCd; @Column(name = "hrid", length = 20) @@ -264,22 +257,16 @@ public class FnUser extends DomainVo implements UserDetails, Serializable { 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 = "is_system_user", nullable = false, columnDefinition = "bit DEFAULT 0") - private Boolean isSystemUser; + @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 @@ -324,7 +311,7 @@ public class FnUser extends DomainVo implements UserDetails, Serializable { @Size(max = 100) @SafeHtml private String jobTitle; - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) + @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE) @JoinColumn(name = "timezone") private FnLuTimezone timezone; @Column(name = "department", length = 25) @@ -351,96 +338,82 @@ public class FnUser extends DomainVo implements UserDetails, Serializable { @Size(max = 10) @SafeHtml private String siloStatus; - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) - @JoinColumn(name = "language_id", nullable = false, columnDefinition = "bigint DEFAULT 1") + @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 = "bit DEFAULT 0") + @Column(name = "is_guest", nullable = false, columnDefinition = "boolean DEFAULT false") @NotNull(message = "guest must not be null") - private Boolean guest; - @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "fnUserList") + private Boolean guest = false; + @ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY, mappedBy = "fnUserList") private Set<CrReportFileHistory> crReportFileHistorie; - @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.EAGER, mappedBy = "fnUsers") private Set<FnRole> fnRoles; - @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY) private Set<FnMenuFunctional> fnRoleList; @OneToMany( targetEntity = FnAuditLog.class, mappedBy = "userId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, 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, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<EpUserRolesRequest> epUserRolesRequests; @OneToMany( targetEntity = FnPersUserAppSel.class, mappedBy = "userId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<FnPersUserAppSel> persUserAppSels; @OneToMany( targetEntity = EpWidgetCatalogParameter.class, mappedBy = "userId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<EpWidgetCatalogParameter> epWidgetCatalogParameters; @OneToMany( targetEntity = EpPersUserWidgetPlacement.class, mappedBy = "userId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<EpPersUserWidgetPlacement> epPersUserWidgetPlacements; @OneToMany( targetEntity = EpPersUserWidgetSel.class, mappedBy = "userId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<EpPersUserWidgetSel> epPersUserWidgetSels; @OneToMany( targetEntity = FnUserRole.class, mappedBy = "userId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) private Set<FnUserRole> userApps; @OneToMany( targetEntity = EpUserNotification.class, mappedBy = "userId", - cascade = CascadeType.ALL, + 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() { @@ -499,7 +472,7 @@ public class FnUser extends DomainVo implements UserDetails, Serializable { // getting default app while (userAppRolesIterator.hasNext()) { FnUserRole tempUserApp = userAppRolesIterator.next(); - if (tempUserApp.getAppId().getId().equals(app.getId())) { + if (tempUserApp.getFnAppId().getId().equals(app.getId())) { logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - for user {}, found application {}", this.getFullName(), @@ -538,7 +511,7 @@ public class FnUser extends DomainVo implements UserDetails, Serializable { for (FnRole role : roles) { FnUserRole userApp = new FnUserRole(); userApp.setUserId(this); - userApp.setAppId(app); + userApp.setFnAppId(app); userApp.setRoleId(role); newUserApps.add(userApp); } @@ -547,6 +520,108 @@ public class FnUser extends DomainVo implements UserDetails, Serializable { } 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; } } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUserRole.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUserRole.java index 10020f09..e2913e05 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUserRole.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUserRole.java @@ -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; @@ -89,19 +90,19 @@ CREATE TABLE `fn_user_role` ( @NamedNativeQueries({ @NamedNativeQuery( name = "FnUserRole.retrieveUserRoleOnUserIdAndRoleIdAndAppId", - query = "FROM FnUserRole where user_id= :userId" + query = "FROM FnUserRole where userId= :userId" + " and role_id= :roleId" + " and app_id= :appId"), @NamedNativeQuery( name = "FnUserRole.retrieveCachedAppRolesForUser", - query = "FROM FnUserRole where user_id= :userId" - + " and user_id= :userId" + query = "FROM FnUserRole where userId= :userId" + + " and userId= :userId" + " and app_id= :appId"), @NamedNativeQuery( name = "FnUserRole.isSuperAdmin", query = "SELECT" - + " user.USER_ID as userId," - + " user.org_user_id as orgUserId," + + " userId.id as userId," + + " userId.org_user_id as orgUserId," + " userrole.ROLE_ID as roleId," + " userrole.APP_ID as appId" + " FROM" @@ -134,24 +135,21 @@ CREATE TABLE `fn_user_role` ( @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" - + " FnUserRole userrole" - + " WHERE" - + " userrole.roleId.roleId = :roleId" - + " AND userrole.appId.appId = :appId"), + query = "FROM FnUserRole " + + " WHERE userId.id = :userId " + + " AND roleId.id = :roleId " + + " AND fnAppId.id = :appId"), @NamedQuery( name = "FnUserRole.retrieveByAppIdAndUserId", - query = "from FnUserRole where appId.appId =:appId and userId.userId =:userId" + query = "from FnUserRole where fnAppId.id =:appId and userId.id =:userId" ), @NamedQuery( name = "FnUserRole.retrieveByAppIdAndRoleId", - query = "from FnUserRole where appId.appId =:appId and roleId.roleId =:roleId" + 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" ) }) @@ -160,9 +158,9 @@ CREATE TABLE `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")}, + @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", "app_id"}) + @UniqueConstraint(name = "fn_user_role_id", columnNames = {"role_id", "user_id", "fn_App_Id"}) }) @NoArgsConstructor @AllArgsConstructor @@ -171,24 +169,24 @@ CREATE TABLE `fn_user_role` ( @Setter @Entity public class FnUserRole implements Serializable { - @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.ALL) - @JoinColumn(name = "user_id") + @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE) + @JoinColumn(name = "user_id", columnDefinition = "bigint") @Valid private FnUser userId; - @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) - @JoinColumn(name = "role_id") + @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.ALL, fetch = FetchType.LAZY) - @JoinColumn(name = "app_Id") + @ManyToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY) + @JoinColumn(name = "fn_App_Id", columnDefinition = "bigint") @Valid - private FnApp appId; + private FnApp fnAppId; }
\ No newline at end of file diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnWidget.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnWidget.java index f595536f..b42100d3 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnWidget.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnWidget.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnWorkflow.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnWorkflow.java index b5a4ecb6..0baaa74c 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnWorkflow.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnWorkflow.java @@ -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 index 00000000..a03c9cfc --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/compositePK/FnRoleCompositeId.java @@ -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 index 91ea87f2..00000000 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/DomainVo.java +++ /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 EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(DomainVo.class); - 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; - - 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(); - } - } - -} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/PortalRestStatusEnum.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/PortalRestStatusEnum.java index f75cb54b..182c0800 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/PortalRestStatusEnum.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/PortalRestStatusEnum.java @@ -45,7 +45,7 @@ public enum PortalRestStatusEnum{ WARN("WARNING"), ERROR("error"); - private String value; + private final String value; PortalRestStatusEnum(String value){ this.value = value; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppCatalogItem.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppCatalogItem.java index a7be2173..7e2f8859 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppCatalogItem.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppCatalogItem.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppCategoryFunctionsItem.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppCategoryFunctionsItem.java index 706c3a31..5f604b8e 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppCategoryFunctionsItem.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppCategoryFunctionsItem.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppContactUs.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppContactUs.java index 9f215a05..d0c8cee3 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppContactUs.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppContactUs.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppContactUsItem.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppContactUsItem.java index 491a82de..ac490e54 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppContactUsItem.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppContactUsItem.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/BasicAuthCredentials.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/BasicAuthCredentials.java index 23d11a34..e218fd87 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/BasicAuthCredentials.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/BasicAuthCredentials.java @@ -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 + "]"; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/CentralV2RoleFunction.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/CentralV2RoleFunction.java index de19cbd2..68f0ff0b 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/CentralV2RoleFunction.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/CentralV2RoleFunction.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/CommonWidgetsEnum.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/CommonWidgetsEnum.java index cda66229..8b0884b2 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/CommonWidgetsEnum.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/CommonWidgetsEnum.java @@ -45,7 +45,7 @@ public enum CommonWidgetsEnum{ EVENTS("events"), RESOURCES("resources"); - private String value; + private final String value; CommonWidgetsEnum(String value){ this.value = value; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPApp.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPApp.java index def3e688..5f244366 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPApp.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPApp.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPAppRoleFunction.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPAppRoleFunction.java index 254a0e67..0b4f795f 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPAppRoleFunction.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPAppRoleFunction.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPEndpoint.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPEndpoint.java index 8c6052c2..42aa1d14 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPEndpoint.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPEndpoint.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPEndpointAccount.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPEndpointAccount.java index 535470c3..ce4a57d5 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPEndpointAccount.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPEndpointAccount.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPRole.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPRole.java index dff4876c..9ef4ce24 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPRole.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPRole.java @@ -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 + "]"; } } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserApp.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserApp.java index 52d42fb9..8bf9b722 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserApp.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserApp.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppCatalogRoles.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppCatalogRoles.java index aa57cb83..81964296 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppCatalogRoles.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppCatalogRoles.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRoles.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRoles.java index 12cad851..05bfcd46 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRoles.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRoles.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRolesRequest.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRolesRequest.java index 61585355..e02420b5 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRolesRequest.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRolesRequest.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRolesRequestDetail.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRolesRequestDetail.java index 4d7ead6e..b58d9193 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRolesRequestDetail.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRolesRequestDetail.java @@ -45,7 +45,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import org.onap.portal.domain.db.ep.EpUserRolesRequest; -import org.onap.portal.domain.dto.DomainVo; +import org.onap.portal.domain.db.DomainVo; @Getter @Setter diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppsManualSortPreference.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppsManualSortPreference.java index 67779ce1..17a3e379 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppsManualSortPreference.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppsManualSortPreference.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppsSortPreference.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppsSortPreference.java index ad821a2f..d3a47de7 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppsSortPreference.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppsSortPreference.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPWidgetsManualSortPreference.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPWidgetsManualSortPreference.java index 85146c12..64953dc1 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPWidgetsManualSortPreference.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPWidgetsManualSortPreference.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/MicroserviceData.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/MicroserviceData.java index 232c8d1b..b61e0ec7 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/MicroserviceData.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/MicroserviceData.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/MicroserviceParameter.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/MicroserviceParameter.java index 99782958..67bb932a 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/MicroserviceParameter.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/MicroserviceParameter.java @@ -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; + } } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PersUserAppSelection.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PersUserAppSelection.java index b2d322b5..def7c991 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PersUserAppSelection.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PersUserAppSelection.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PersUserWidgetSelection.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PersUserWidgetSelection.java index 54eba6ad..83b86481 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PersUserWidgetSelection.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PersUserWidgetSelection.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PortalRestStatusEnum.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PortalRestStatusEnum.java index d8b69fce..d89b84f0 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PortalRestStatusEnum.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PortalRestStatusEnum.java @@ -45,7 +45,7 @@ public enum PortalRestStatusEnum{ WARN("WARNING"), ERROR("error"); - private String value; + private final String value; PortalRestStatusEnum(String value){ this.value = value; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/SearchResultItem.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/SearchResultItem.java index 4d4b6d57..bedb0f7b 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/SearchResultItem.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/SearchResultItem.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/SharedContext.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/SharedContext.java index 2a31d1cd..6127c5fb 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/SharedContext.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/SharedContext.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/Widget.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/Widget.java index 206484fa..d3e0f40a 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/Widget.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/Widget.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/WidgetCatalogParameter.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/WidgetCatalogParameter.java index e5e7255b..3a12e8e8 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/WidgetCatalogParameter.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/WidgetCatalogParameter.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/CentralV2Role.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/CentralV2Role.java index 267d23dc..742fe93a 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/CentralV2Role.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/CentralV2Role.java @@ -50,7 +50,6 @@ import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import org.onap.portal.domain.db.ep.EpAppFunction; import org.onap.portal.domain.db.fn.FnRoleFunction; @Getter diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/CentralV2RoleFunction.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/CentralV2RoleFunction.java index 4aa79cc3..db122016 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/CentralV2RoleFunction.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/CentralV2RoleFunction.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/CommonWidget.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/CommonWidget.java index c9fce6d2..c837ae49 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/CommonWidget.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/CommonWidget.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/EpNotificationItemVO.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/EpNotificationItemVO.java index 3c80e167..e4054871 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/EpNotificationItemVO.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/EpNotificationItemVO.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/EpRoleNotificationItem.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/EpRoleNotificationItem.java index 1f6f1619..947d6abd 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/EpRoleNotificationItem.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/EpRoleNotificationItem.java @@ -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 @@ -56,8 +56,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) private Integer roleId; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/OnboardingWidget.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/OnboardingWidget.java index ccc9a785..85a155b1 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/OnboardingWidget.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/transport/OnboardingWidget.java @@ -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 index 92eabbb0..e7ba856e 100644 --- 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 @@ -41,33 +41,79 @@ package org.onap.portal.domain.dto.transport; import com.fasterxml.jackson.annotation.JsonIgnore; -import java.util.Iterator; +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.dto.DomainVo; +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 -@Builder -@AllArgsConstructor +@Entity @NoArgsConstructor +@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public class Role extends DomainVo { private static final long serialVersionUID = 1L; - private String name; - private boolean active; + @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; - private Set<FnRoleFunction> roleFunctions; + @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() { @@ -75,18 +121,17 @@ public class Role extends DomainVo { } public String getToggleActiveImage() { - return "/static/fusion/images/" + (this.isActive() ? "active.png" : "inactive.png"); + return "/static/fusion/images/" + (this.activeYn ? "active.png" : "inactive.png"); } public String getToggleActiveAltText() { - return this.isActive() ? "Click to Deactivate Role" : "Click to Activate Role"; + return this.activeYn ? "Click to Deactivate Role" : "Click to Activate Role"; } public void removeChildRole(Long roleId) { - Iterator i = this.childRoles.iterator(); - while (i.hasNext()) { - org.onap.portalsdk.core.domain.Role childRole = (org.onap.portalsdk.core.domain.Role) i.next(); + for (FnRoleComposite role : this.childRoles) { + Role childRole = role.getChildRoles(); if (childRole.getId().equals(roleId)) { this.childRoles.remove(childRole); break; @@ -109,10 +154,10 @@ public class Role extends DomainVo { public void removeRoleFunction(String roleFunctionCd) { - for (Object function : this.roleFunctions) { + for (Object function : this.fnRoleFunctions) { RoleFunction roleFunction = (RoleFunction) function; if (roleFunction.getCode().equals(roleFunctionCd)) { - this.roleFunctions.remove(roleFunction); + this.fnRoleFunctions.remove(roleFunction); break; } } @@ -120,8 +165,24 @@ public class Role extends DomainVo { } public int compareTo(Object obj) { - String c1 = this.getName(); + 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; + } } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/mapper/FnUserMapper.java b/portal-BE/src/main/java/org/onap/portal/domain/mapper/FnUserMapper.java index 869ba81d..0a718502 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/mapper/FnUserMapper.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/mapper/FnUserMapper.java @@ -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/logging/aop/EPEELFLoggerAdvice.java b/portal-BE/src/main/java/org/onap/portal/logging/aop/EPEELFLoggerAdvice.java index b555e6ae..2c7151a2 100644 --- a/portal-BE/src/main/java/org/onap/portal/logging/aop/EPEELFLoggerAdvice.java +++ b/portal-BE/src/main/java/org/onap/portal/logging/aop/EPEELFLoggerAdvice.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/logging/format/EPAppMessagesEnum.java b/portal-BE/src/main/java/org/onap/portal/logging/format/EPAppMessagesEnum.java index d4bd55f1..8fb70c5c 100644 --- a/portal-BE/src/main/java/org/onap/portal/logging/format/EPAppMessagesEnum.java +++ b/portal-BE/src/main/java/org/onap/portal/logging/format/EPAppMessagesEnum.java @@ -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, diff --git a/portal-BE/src/main/java/org/onap/portal/logging/logic/EPLogUtil.java b/portal-BE/src/main/java/org/onap/portal/logging/logic/EPLogUtil.java index 00de83de..9c4799e0 100644 --- a/portal-BE/src/main/java/org/onap/portal/logging/logic/EPLogUtil.java +++ b/portal-BE/src/main/java/org/onap/portal/logging/logic/EPLogUtil.java @@ -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 diff --git a/portal-BE/src/main/java/org/onap/portal/service/AdminRolesService.java b/portal-BE/src/main/java/org/onap/portal/service/AdminRolesService.java index 9081feab..8049cd65 100644 --- a/portal-BE/src/main/java/org/onap/portal/service/AdminRolesService.java +++ b/portal-BE/src/main/java/org/onap/portal/service/AdminRolesService.java @@ -57,6 +57,7 @@ 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; @@ -77,7 +78,9 @@ 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; @@ -125,11 +128,11 @@ import org.springframework.web.client.RestTemplate; @Transactional public class AdminRolesService { - private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AdminRolesService.class); + private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AdminRolesService.class); private static final Object syncRests = new Object(); - private RestTemplate template = new RestTemplate(); + private final RestTemplate template = new RestTemplate(); - private final Long SYS_ADMIN_ROLE_ID = 1L; + 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 {}"; @@ -179,11 +182,11 @@ public class AdminRolesService { this.epUserRolesRequestService = epUserRolesRequestService; } - public boolean isSuperAdmin(final String orgUserId) { + public boolean isSuperAdmin(final String loginId) { boolean isSuperAdmin; try { isSuperAdmin = fnUserRoleService - .isSuperAdmin(orgUserId, SYS_ADMIN_ROLE_ID, ECOMP_APP_ID); + .isSuperAdmin(loginId, SYS_ADMIN_ROLE_ID, ECOMP_APP_ID); } catch (Exception e) { logger.error("isSuperAdmin exception: " + e.toString()); throw e; @@ -225,7 +228,7 @@ public class AdminRolesService { FnUser currentUser = fnUserService.getUser(user.getId()).orElseThrow(Exception::new); if (currentUser != null && currentUser.getId() != null) { for (FnUserRole userApp : currentUser.getUserApps()) { - if (!userApp.getAppId().getId().equals(ECOMP_APP_ID)) { + 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)) { @@ -325,12 +328,12 @@ public class AdminRolesService { try { FnApp app = fnAppService.getById(appId); - boolean checkIfUserisApplicationAccAdmin = isAccountAdminOfApplication(user.getUserId(), + boolean checkIfUserisApplicationAccAdmin = isAccountAdminOfApplication(user.getId(), app); Set<EcompRole> rolesGotDeletedFromApprover = new TreeSet<>(); boolean checkIfUserIsOnlyRoleAdmin = - isRoleAdmin(user.getUserId()) && !checkIfUserisApplicationAccAdmin; + isRoleAdmin(user.getId()) && !checkIfUserisApplicationAccAdmin; if (checkIfUserIsOnlyRoleAdmin) { for (RoleInAppForUser roleInAppForUser : roleInAppForUserList) { if (!roleInAppForUser.getIsApplied()) { @@ -542,8 +545,8 @@ public class AdminRolesService { .filter(applicationRole -> epRole.getId().equals(applicationRole.getId())).findAny().orElse(null); if (appRole != null) { role.setId(appRole.getAppRoleId()); - role.setName(epRole.getName()); - role.setRoleFunctions(epRole.getRoleFunctions()); + role.setRoleName(epRole.getName()); + role.setFnRoleFunctions(epRole.getRoleFunctions()); } roles.add(role); } @@ -556,8 +559,15 @@ public class AdminRolesService { } private FnRole roleToFnRole(Role role) { - return new FnRole(role.getId(), role.getName(), role.isActive(), role.getPriority(), role.getRoleFunctions(), - role.getChildRoles(), role.getParentRoles()); + 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, @@ -769,7 +779,7 @@ public class AdminRolesService { // 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.getAppId(), user.getUserId()); + userAppList = ecompUserAppRolesService.getUserAppExistingRoles(app.getId(), user.getId()); if (!roleInAppUser.isEmpty()) { for (EcompUserAppRoles userApp : userAppList) { if (userApp.getRoleId().equals(PortalConstants.SYS_ADMIN_ROLE_ID) @@ -1090,9 +1100,9 @@ public class AdminRolesService { } for (FnUserRole userRole : userRoles) { - if (!PortalConstants.ACCOUNT_ADMIN_ROLE_ID.equals(userRole.getRoleId().getRoleId()) + if (!PortalConstants.ACCOUNT_ADMIN_ROLE_ID.equals(userRole.getRoleId().getId()) && !PortalConstants.SYS_ADMIN_ROLE_ID - .equals(userRole.getRoleId().getRoleId()) + .equals(userRole.getRoleId().getId()) && !extRequestValue) { syncUserRolesExtension(userRole, appId, newUserAppRolesMap); @@ -1101,7 +1111,7 @@ public class AdminRolesService { syncUserRolesExtension(userRole, appId, newUserAppRolesMap); } else if (extRequestValue && !PortalConstants.ACCOUNT_ADMIN_ROLE_ID - .equals(userRole.getRoleId().getRoleId())) { + .equals(userRole.getRoleId().getId())) { syncUserRolesExtension(userRole, appId, newUserAppRolesMap); } @@ -1159,7 +1169,7 @@ public class AdminRolesService { } userApp.setUserId(client); - userApp.setAppId(app); + userApp.setFnAppId(app); fnUserRoleService.saveOne(userApp); } @@ -1207,7 +1217,7 @@ public class AdminRolesService { Long userAppRoleId; if (PortalConstants.PORTAL_APP_ID.equals(appId)) { // local app - userAppRoleId = userRole.getRoleId().getRoleId(); + userAppRoleId = userRole.getRoleId().getId(); } else { // remote app userAppRoleId = userRole.getId(); } @@ -1220,9 +1230,8 @@ public class AdminRolesService { } private Role fnRoleToRole(final FnRole role) { - return Role.builder().name(role.getRoleName()).active(role.getActiveYn()).priority(role.getPriority()) - .roleFunctions(role.getFnRoleFunctions()).childRoles(role.getChildRoles()).parentRoles(role.getParentRoles()) - .build(); + 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") @@ -1238,21 +1247,21 @@ public class AdminRolesService { List<CentralV2Role> cenRoleList = externalAccessRolesService.getRolesForApp(app.getUebKey()); for (CentralV2Role cenRole : cenRoleList) { Role role = new Role(); - role.setActive(cenRole.isActive()); + role.setActiveYn(cenRole.isActive()); role.setId(cenRole.getId()); - role.setName(cenRole.getName()); + role.setRoleName(cenRole.getName()); role.setPriority(cenRole.getPriority()); roleList.add(role); } } else { Optional<FnUser> user = fnUserService.getUser(userId); - if (user.isPresent()){ + 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.isActive()) { + if (role.getActiveYn()) { if (role.getId() != 1) { // prevent portal admin from being added activeRoleList.add(role); } else if (extRequestValue) { @@ -1541,7 +1550,7 @@ public class AdminRolesService { for (FnRole role : obsoleteRoles) { logger.debug(EELFLoggerDelegate.debugLogger, "syncAppRoles: obsolete role: " + role.toString()); Long roleId = role.getId(); - List<FnUserRole> userRoles = fnUserRoleService.retrieveByAppIdAndRoleId(appId, roleId); + List<FnUserRole> userRoles = fnUserRoleService.getUserRolesForRoleIdAndAppId(roleId, appId); logger.debug(EELFLoggerDelegate.debugLogger, "syncAppRoles: number of userRoles to delete: " + userRoles.size()); @@ -1670,4 +1679,201 @@ public class AdminRolesService { 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); + } + + } + } + } + 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 index 78434cc8..1c66c6d8 100644 --- a/portal-BE/src/main/java/org/onap/portal/service/ApplicationsRestClientService.java +++ b/portal-BE/src/main/java/org/onap/portal/service/ApplicationsRestClientService.java @@ -75,9 +75,9 @@ public class ApplicationsRestClientService { private static final String APP_USERNAME_HEADER = "username"; private static final String BASIC_AUTHENTICATION_HEADER = "Authorization"; - private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ApplicationsRestClientService.class); + private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ApplicationsRestClientService.class); - private Gson gson = null; + private final Gson gson = null; private final ObjectMapper mapper = new ObjectMapper(); 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 index 6274f9a6..83b5df99 100644 --- a/portal-BE/src/main/java/org/onap/portal/service/AppsCacheService.java +++ b/portal-BE/src/main/java/org/onap/portal/service/AppsCacheService.java @@ -59,7 +59,7 @@ public class AppsCacheService { private final FnAppService appsService; - private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AppsCacheService.class); + private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AppsCacheService.class); @Autowired public AppsCacheService(FnAppService appsService) { @@ -148,7 +148,7 @@ public class AppsCacheService { List<FnApp> appsFinalList = appList.stream() .filter(app -> app.getEnabled() && !app.getOpen()).collect(Collectors.toList()); - List<OnboardingApp> onboardingAppsList = new ArrayList<OnboardingApp>(); + List<OnboardingApp> onboardingAppsList = new ArrayList<>(); for (FnApp app : appsFinalList) { OnboardingApp onboardingApp = new OnboardingApp(); appsService.createOnboardingFromApp(app, onboardingApp); 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 index 76e29d69..b6739234 100644 --- a/portal-BE/src/main/java/org/onap/portal/service/ExternalAccessRolesService.java +++ b/portal-BE/src/main/java/org/onap/portal/service/ExternalAccessRolesService.java @@ -44,7 +44,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Optional; +import java.util.Objects; import java.util.SortedSet; import java.util.TreeSet; import java.util.stream.Collectors; @@ -57,7 +57,6 @@ 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.domain.dto.transport.Role; import org.onap.portal.exception.RoleFunctionException; import org.onap.portal.logging.logic.EPLogUtil; import org.onap.portal.service.ep.EpAppFunctionService; @@ -122,8 +121,8 @@ public class ExternalAccessRolesService { + " and c.appId.appId = :appId" + " and e.appId.appId = c.appId.appId"; - private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ExternalAccessRolesService.class); - private RestTemplate template = new RestTemplate(); + private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ExternalAccessRolesService.class); + private final RestTemplate template = new RestTemplate(); private final FnRoleService fnRoleService; private final FnAppService fnAppService; @@ -224,14 +223,14 @@ public class ExternalAccessRolesService { CentralV2Role cenRole; if (role.getAppRoleId() == null) { cenRole = CentralV2Role.builder().id(role.getId()).created(role.getCreated()) - .modified(role.getModified()).createdId(role.getCreatedId().getUserId()) - .modifiedId(role.getModifiedId().getUserId()).rowNum(role.getRowNum()).name(role.getRoleName()) + .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()).createdId(role.getCreatedId().getUserId()) - .modifiedId(role.getModifiedId().getUserId()).rowNum(role.getRowNum()).name(role.getRoleName()) + .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(); } @@ -251,7 +250,7 @@ public class ExternalAccessRolesService { List<FnApp> app = fnAppService.getByUebKey(uebkey); List<FnRole> appRolesList = fnRoleService.getAppRoles(app.get(0).getId()); roleList = createCentralRoleObject(app, appRolesList, roleList); - if (app.get(0).getId() != PortalConstants.PORTAL_APP_ID) { + 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<>(); @@ -285,8 +284,7 @@ public class ExternalAccessRolesService { private CentralV2Role convertRoleToCentralV2Role(FnRole role) { return CentralV2Role.builder().id(role.getId()).created(role.getCreated()) - .modified(role.getModified()).createdId(role.getCreatedId().getUserId()) - .modifiedId(role.getModifiedId().getUserId()) + .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(); @@ -357,15 +355,15 @@ public class ExternalAccessRolesService { type = EcompPortalUtils.getFunctionType(role.getFunctionCd()); action = EcompPortalUtils.getFunctionAction(role.getFunctionCd()); cenRoleFun = FnRoleFunction.builder().build(); - FnRole fnRole = FnRole.builder().build(); + FnRole fnRole = new FnRole(); FnFunction fnFunction = FnFunction.builder().functionCd(instance).name(role.getFunctionName()).type(type).action(action).build(); - cenRoleFun.setRoleId(fnRole); + 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.setRoleId(new FnRole()); + cenRoleFun.setRole(new FnRole()); cenRoleFun.setFunctionCd(fnFunction); } return cenRoleFun; diff --git a/portal-BE/src/main/java/org/onap/portal/service/PersUserWidgetService.java b/portal-BE/src/main/java/org/onap/portal/service/PersUserWidgetService.java index 38a0a408..28d63eb2 100644 --- a/portal-BE/src/main/java/org/onap/portal/service/PersUserWidgetService.java +++ b/portal-BE/src/main/java/org/onap/portal/service/PersUserWidgetService.java @@ -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) { diff --git a/portal-BE/src/main/java/org/onap/portal/service/WidgetMService.java b/portal-BE/src/main/java/org/onap/portal/service/WidgetMService.java index 624beed8..d25727bf 100644 --- a/portal-BE/src/main/java/org/onap/portal/service/WidgetMService.java +++ b/portal-BE/src/main/java/org/onap/portal/service/WidgetMService.java @@ -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); diff --git a/portal-BE/src/main/java/org/onap/portal/service/WidgetService.java b/portal-BE/src/main/java/org/onap/portal/service/WidgetService.java index 4b037919..6f8440e6 100644 --- a/portal-BE/src/main/java/org/onap/portal/service/WidgetService.java +++ b/portal-BE/src/main/java/org/onap/portal/service/WidgetService.java @@ -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/EpMicroserviceParameterService.java b/portal-BE/src/main/java/org/onap/portal/service/ep/EpMicroserviceParameterService.java index 6fa8b7d7..ea0e69b6 100644 --- a/portal-BE/src/main/java/org/onap/portal/service/ep/EpMicroserviceParameterService.java +++ b/portal-BE/src/main/java/org/onap/portal/service/ep/EpMicroserviceParameterService.java @@ -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/EpWidgetCatalogParameterService.java b/portal-BE/src/main/java/org/onap/portal/service/ep/EpWidgetCatalogParameterService.java index d43acc04..029c316e 100644 --- a/portal-BE/src/main/java/org/onap/portal/service/ep/EpWidgetCatalogParameterService.java +++ b/portal-BE/src/main/java/org/onap/portal/service/ep/EpWidgetCatalogParameterService.java @@ -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; diff --git a/portal-BE/src/main/java/org/onap/portal/service/fn/FnAppService.java b/portal-BE/src/main/java/org/onap/portal/service/fn/FnAppService.java index 4e79ba57..6e3c2879 100644 --- a/portal-BE/src/main/java/org/onap/portal/service/fn/FnAppService.java +++ b/portal-BE/src/main/java/org/onap/portal/service/fn/FnAppService.java @@ -43,10 +43,8 @@ package org.onap.portal.service.fn; import java.util.ArrayList; import java.util.List; import java.util.Optional; -import java.util.TreeSet; import javax.persistence.EntityExistsException; import javax.persistence.EntityManager; -import javax.persistence.Query; import org.onap.portal.dao.fn.FnAppDao; import org.onap.portal.domain.db.fn.FnApp; import org.onap.portal.domain.dto.transport.OnboardingApp; @@ -62,7 +60,7 @@ public class FnAppService { private static final String SUPER_ADMIN_ROLE_ID = "1"; - private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnAppService.class); + private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnAppService.class); private final FnAppDao fnAppDao; private final EntityManager entityManager; @@ -85,6 +83,10 @@ public class FnAppService { 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()); diff --git a/portal-BE/src/main/java/org/onap/portal/service/fn/FnLanguageService.java b/portal-BE/src/main/java/org/onap/portal/service/fn/FnLanguageService.java index c58bf098..c39a12b6 100644 --- a/portal-BE/src/main/java/org/onap/portal/service/fn/FnLanguageService.java +++ b/portal-BE/src/main/java/org/onap/portal/service/fn/FnLanguageService.java @@ -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/FnRoleService.java b/portal-BE/src/main/java/org/onap/portal/service/fn/FnRoleService.java index b0c4e60e..39a886c2 100644 --- a/portal-BE/src/main/java/org/onap/portal/service/fn/FnRoleService.java +++ b/portal-BE/src/main/java/org/onap/portal/service/fn/FnRoleService.java @@ -43,12 +43,9 @@ package org.onap.portal.service.fn; import java.util.ArrayList; import java.util.List; import java.util.Optional; -import java.util.Set; import javax.persistence.EntityExistsException; -import javax.print.attribute.standard.Fidelity; import org.onap.portal.dao.fn.FnRoleDao; import org.onap.portal.domain.db.fn.FnRole; -import org.onap.portal.service.ExternalAccessRolesService; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -58,7 +55,7 @@ import org.springframework.transaction.annotation.Transactional; @Transactional public class FnRoleService { - private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnRoleService.class); + private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnRoleService.class); private final FnRoleDao fnRoleDao; @@ -140,6 +137,11 @@ public class FnRoleService { return globalRoles; } + public Long getSysAdminRoleId(){ + FnRole role = fnRoleDao.getSysAdminRoleId(); + return role.getId(); + } + public void delete(FnRole role) { fnRoleDao.delete(role); } diff --git a/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserRoleService.java b/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserRoleService.java index cadc3439..fac4b14a 100644 --- a/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserRoleService.java +++ b/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserRoleService.java @@ -120,25 +120,25 @@ public class FnUserRoleService { private static final String USER_APP_CATALOG_ROLES = "select\n" + " A.reqId as reqId,\n" - + " B.requestedRoleId.roleId as requestedRoleId,\n" + + " B.requestedRoleId.id as requestedRoleId,\n" + " A.requestStatus as requestStatus,\n" - + " A.appId.appId as appId,\n" + + " A.appId.id as appId,\n" + " (\n" + " select\n" + " roleName\n" + " from\n" + " FnRole\n" + " where\n" - + " roleId = B.requestedRoleId.roleId\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.userId = :userid\n" + + " A.userId.id = :userid\n" + " and A.appId IN (\n" + " select\n" - + " appId\n" + + " id\n" + " from\n" + " FnApp\n" + " where\n" @@ -146,13 +146,12 @@ public class FnUserRoleService { + " )\n" + " and A.requestStatus = 'P'\n"; - private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnUserRoleService.class); + 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 EpAppFunctionService epAppFunctionService; private final EpUserRolesRequestService epUserRolesRequestService; private final EpUserRolesRequestDetService epUserRolesRequestDetService; private final EntityManager entityManager; @@ -164,7 +163,6 @@ public class FnUserRoleService { FnAppService fnAppService, FnRoleService fnRoleService, FnUserService fnUserService, - EpAppFunctionService epAppFunctionService, EpUserRolesRequestService epUserRolesRequestService, EpUserRolesRequestDetService epUserRolesRequestDetService, EntityManager entityManager, @@ -173,29 +171,28 @@ public class FnUserRoleService { this.fnAppService = fnAppService; this.fnRoleService = fnRoleService; this.fnUserService = fnUserService; - this.epAppFunctionService = epAppFunctionService; this.epUserRolesRequestService = epUserRolesRequestService; this.epUserRolesRequestDetService = epUserRolesRequestDetService; this.entityManager = entityManager; this.applicationsRestClientService = applicationsRestClientService; } - public List<FnUserRole> retrieveByAppIdAndRoleId(final Long appId, final Long roleId) { - return Optional.of(fnUserRoleDao.retrieveByAppIdAndRoleId(appId, roleId)).orElse(new ArrayList<>()); - } - 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) { + 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(orgUserId)).collect(Collectors.toList()); + .filter(role -> role.getUserId().getOrgUserId().equals(loginId)).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 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) { @@ -216,7 +213,7 @@ public class FnUserRoleService { public List<EPUserAppCatalogRoles> getUserAppCatalogRoles(FnUser userid, String appName) { List<Tuple> tuples = entityManager.createQuery(USER_APP_CATALOG_ROLES, Tuple.class) - .setParameter("userid", userid.getUserId()) + .setParameter("userid", userid.getId()) .setParameter("appName", appName) .getResultList(); return Optional.of(tuples.stream().map(this::tupleToEPUserAppCatalogRoles).collect(Collectors.toList())) @@ -501,7 +498,7 @@ public class FnUserRoleService { if (ecompRole.getId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID) && !extRequestValue) { continue; } - RoleInAppForUser roleForUser = new RoleInAppForUser(ecompRole.getId(), ecompRole.getName()); + RoleInAppForUser roleForUser = new RoleInAppForUser(ecompRole.getId(), ecompRole.getRoleName()); roleForUser.setIsApplied(userAppRolesMap.contains(ecompRole.getId())); rolesInAppForUser.add(roleForUser); logger.debug(EELFLoggerDelegate.debugLogger, "In constructRolesInAppForUserGet() - rolesInAppForUser = {}", diff --git a/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java b/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java index 01da50de..16d32a67 100644 --- a/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java +++ b/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java @@ -60,7 +60,7 @@ public class FnUserService implements UserDetailsService { private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnUserService.class); - private FnUserDao fnUserDao; + private final FnUserDao fnUserDao; @Autowired public FnUserService(FnUserDao fnUserDao) { diff --git a/portal-BE/src/main/java/org/onap/portal/utils/EPUserUtils.java b/portal-BE/src/main/java/org/onap/portal/utils/EPUserUtils.java index 968e64f4..fea71337 100644 --- a/portal-BE/src/main/java/org/onap/portal/utils/EPUserUtils.java +++ b/portal-BE/src/main/java/org/onap/portal/utils/EPUserUtils.java @@ -61,6 +61,7 @@ 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; @@ -253,7 +254,7 @@ public class EPUserUtils { 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 @@ -273,7 +274,10 @@ public class EPUserUtils { */ @SuppressWarnings({"rawtypes", "unchecked"}) private static void addChildRoles(FnRole role, HashMap roles) { - Set<FnRole> childRoles = role.getChildRoles().stream().map(FnRoleComposite::getChildRoles).collect(Collectors.toSet()); + List<Role> childRoles = role.getChildRoles() + .stream() + .map(FnRoleComposite::getChildRoles) + .collect(Collectors.toList()); if (!childRoles.isEmpty()) { for (Object o : childRoles) { FnRole childRole = (FnRole) o; diff --git a/portal-BE/src/main/java/org/onap/portal/utils/EcompPortalUtils.java b/portal-BE/src/main/java/org/onap/portal/utils/EcompPortalUtils.java index ed03f4a2..caff67e3 100644 --- a/portal-BE/src/main/java/org/onap/portal/utils/EcompPortalUtils.java +++ b/portal-BE/src/main/java/org/onap/portal/utils/EcompPortalUtils.java @@ -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 = "|"; diff --git a/portal-BE/src/main/java/org/onap/portal/validation/SecureString.java b/portal-BE/src/main/java/org/onap/portal/validation/SecureString.java index 4d184ce5..c4e5875d 100644 --- a/portal-BE/src/main/java/org/onap/portal/validation/SecureString.java +++ b/portal-BE/src/main/java/org/onap/portal/validation/SecureString.java @@ -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; |