From 9a391d0c4cca00a1cd448a6ce3fa755d42c8fd5d Mon Sep 17 00:00:00 2001 From: Dominik Mizyn Date: Tue, 17 Dec 2019 16:14:10 +0100 Subject: Dao object moved from dao packege to package by component in service folder This patch move all services from single folder to separete folders. All DAO classes are noc package-private and moved too to this folders, providing encapsulation mechanism. DAO object schould not be directly call from any where else that package type class. Issue-ID: PORTAL-710 Change-Id: I3c0edd9eaa8260849ca716dd6244cf4c83ec783c Signed-off-by: Dominik Mizyn --- .../java/org/onap/portal/PortalApplication.java | 2 +- .../portal/aop/service/FnLanguageServiceAOP.java | 4 +- .../onap/portal/aop/service/FnUserServiceAOP.java | 2 +- .../onap/portal/aop/service/WidgetServiceAOP.java | 2 +- .../portal/configuration/DBInitializingBean.java | 384 +++++++-------- .../onap/portal/configuration/SecurityConfig.java | 2 +- .../portal/configuration/WebMvcConfiguration.java | 9 +- .../onap/portal/controller/LanguageController.java | 4 +- .../org/onap/portal/controller/UserController.java | 2 +- .../portal/controller/UserRolesController.java | 4 +- .../controller/WidgetsCatalogController.java | 6 +- .../onap/portal/controller/WidgetsController.java | 6 +- .../org/onap/portal/dao/ep/EpAppFunctionDao.java | 58 --- .../onap/portal/dao/ep/EpAppRoleFunctionDao.java | 52 -- .../onap/portal/dao/ep/EpBasicAuthAccountDao.java | 52 -- .../org/onap/portal/dao/ep/EpMicroserviceDao.java | 52 -- .../portal/dao/ep/EpMicroserviceParameterDao.java | 59 --- .../onap/portal/dao/ep/EpPersUserAppSortDao.java | 52 -- .../onap/portal/dao/ep/EpPersUserWidgetSelDao.java | 58 --- .../onap/portal/dao/ep/EpUserRolesRequestDao.java | 56 --- .../portal/dao/ep/EpUserRolesRequestDetDao.java | 58 --- .../portal/dao/ep/EpWidgetCatalogParameterDao.java | 27 - .../org/onap/portal/dao/fn/EpWidgetCatalogDao.java | 48 -- .../org/onap/portal/dao/fn/FnAppContactUsDao.java | 52 -- .../main/java/org/onap/portal/dao/fn/FnAppDao.java | 21 - .../java/org/onap/portal/dao/fn/FnAuditLogDao.java | 52 -- .../onap/portal/dao/fn/FnCommonWidgetDataDao.java | 52 -- .../org/onap/portal/dao/fn/FnDisplayTextDao.java | 52 -- .../java/org/onap/portal/dao/fn/FnFunctionDao.java | 52 -- .../java/org/onap/portal/dao/fn/FnLanguageDao.java | 56 --- .../org/onap/portal/dao/fn/FnLuActivityDao.java | 52 -- .../org/onap/portal/dao/fn/FnLuAlertMethodDao.java | 52 -- .../org/onap/portal/dao/fn/FnLuMenuSetDao.java | 52 -- .../org/onap/portal/dao/fn/FnLuPriorityDao.java | 52 -- .../java/org/onap/portal/dao/fn/FnLuTabSetDao.java | 52 -- .../org/onap/portal/dao/fn/FnLuTimezoneDao.java | 52 -- .../java/org/onap/portal/dao/fn/FnMenuDao.java | 52 -- .../dao/fn/FnMenuFunctionalAncestorsDao.java | 52 -- .../onap/portal/dao/fn/FnMenuFunctionalDao.java | 56 --- .../portal/dao/fn/FnMenuFunctionalRolesDao.java | 62 --- .../onap/portal/dao/fn/FnPersUserAppSelDao.java | 52 -- .../onap/portal/dao/fn/FnQzCronTriggersDao.java | 53 -- .../org/onap/portal/dao/fn/FnQzJobDetailsDao.java | 53 -- .../java/org/onap/portal/dao/fn/FnQzLocksDao.java | 53 -- .../onap/portal/dao/fn/FnQzSchedulerStateDao.java | 53 -- .../org/onap/portal/dao/fn/FnQzTriggersDao.java | 53 -- .../org/onap/portal/dao/fn/FnRestrictedUrlDao.java | 53 -- .../org/onap/portal/dao/fn/FnRoleCompositeDao.java | 53 -- .../java/org/onap/portal/dao/fn/FnRoleDao.java | 82 ---- .../org/onap/portal/dao/fn/FnRoleFunctionDao.java | 52 -- .../org/onap/portal/dao/fn/FnSharedContextDao.java | 52 -- .../main/java/org/onap/portal/dao/fn/FnTabDao.java | 52 -- .../org/onap/portal/dao/fn/FnTabSelectedDao.java | 53 -- .../java/org/onap/portal/dao/fn/FnUserDao.java | 71 --- .../java/org/onap/portal/dao/fn/FnUserRoleDao.java | 71 --- .../java/org/onap/portal/dao/fn/FnWidgetDao.java | 58 --- .../portal/logging/aop/EPEELFLoggerAdvice.java | 2 +- .../org/onap/portal/service/AdminRolesService.java | 21 +- .../org/onap/portal/service/AppsCacheService.java | 2 +- .../onap/portal/service/EPRoleFunctionService.java | 103 ++++ .../portal/service/ExternalAccessRolesService.java | 6 +- .../onap/portal/service/PersUserWidgetService.java | 24 +- .../org/onap/portal/service/WidgetService.java | 250 ---------- .../java/org/onap/portal/service/app/FnAppDao.java | 21 + .../org/onap/portal/service/app/FnAppService.java | 141 ++++++ .../service/appContactUs/FnAppContactUsDao.java | 52 ++ .../appContactUs/FnAppContactUsService.java | 22 + .../service/appFunction/EpAppFunctionDao.java | 58 +++ .../service/appFunction/EpAppFunctionService.java | 83 ++++ .../appRoleFunction/EpAppRoleFunctionDao.java | 52 ++ .../appRoleFunction/EpAppRoleFunctionService.java | 62 +++ .../portal/service/auditLog/FnAuditLogDao.java | 52 ++ .../portal/service/auditLog/FnAuditLogService.java | 22 + .../basicAuthAccount/EpBasicAuthAccountDao.java | 52 ++ .../EpBasicAuthAccountService.java | 20 + .../commonWidgetData/FnCommonWidgetDataDao.java | 52 ++ .../FnCommonWidgetDataService.java | 22 + .../service/displayText/FnDisplayTextDao.java | 52 ++ .../service/displayText/FnDisplayTextService.java | 22 + .../portal/service/ep/EpAppFunctionService.java | 79 --- .../service/ep/EpMicroserviceParameterService.java | 104 ---- .../service/ep/EpUserRolesRequestDetService.java | 69 --- .../service/ep/EpUserRolesRequestService.java | 69 --- .../ep/EpWidgetCatalogParameterService.java | 109 ----- .../portal/service/ep/EpWidgetCatalogService.java | 21 - .../org/onap/portal/service/fn/FnAppService.java | 137 ------ .../onap/portal/service/fn/FnLanguageService.java | 73 --- .../portal/service/fn/FnLuTimezoneService.java | 63 --- .../service/fn/FnMenuFunctionalRolesService.java | 76 --- .../portal/service/fn/FnMenuFunctionalService.java | 65 --- .../org/onap/portal/service/fn/FnRoleService.java | 152 ------ .../onap/portal/service/fn/FnUserRoleService.java | 539 -------------------- .../org/onap/portal/service/fn/FnUserService.java | 112 ----- .../service/fn/old/EPRoleFunctionService.java | 105 ---- .../portal/service/function/FnFunctionDao.java | 52 ++ .../portal/service/function/FnFunctionService.java | 22 + .../portal/service/language/FnLanguageDao.java | 56 +++ .../portal/service/language/FnLanguageService.java | 81 +++ .../portal/service/luActivity/FnLuActivityDao.java | 52 ++ .../service/luActivity/FnLuActivityService.java | 22 + .../service/luAlertMethod/FnLuAlertMethodDao.java | 52 ++ .../luAlertMethod/FnLuAlertMethodService.java | 22 + .../portal/service/luMenuSet/FnLuMenuSetDao.java | 52 ++ .../service/luMenuSet/FnLuMenuSetService.java | 20 + .../portal/service/luPriority/FnLuPriorityDao.java | 52 ++ .../service/luPriority/FnLuPriorityService.java | 22 + .../portal/service/luTabSet/FnLuTabSetDao.java | 52 ++ .../portal/service/luTabSet/FnLuTabSetService.java | 20 + .../portal/service/luTimezone/FnLuTimezoneDao.java | 52 ++ .../service/luTimezone/FnLuTimezoneService.java | 68 +++ .../org/onap/portal/service/menu/FnMenuDao.java | 52 ++ .../onap/portal/service/menu/FnMenuService.java | 22 + .../menuFunctional/FnMenuFunctionalDao.java | 56 +++ .../menuFunctional/FnMenuFunctionalService.java | 68 +++ .../FnMenuFunctionalAncestorsDao.java | 52 ++ .../FnMenuFunctionalAncestorsService.java | 22 + .../FnMenuFunctionalRolesDao.java | 62 +++ .../FnMenuFunctionalRolesService.java | 79 +++ .../service/microservice/EpMicroserviceDao.java | 52 ++ .../microservice/EpMicroserviceService.java | 22 + .../EpMicroserviceParameterDao.java | 59 +++ .../EpMicroserviceParameterService.java | 108 ++++ .../persUserAppSel/FnPersUserAppSelDao.java | 52 ++ .../persUserAppSel/FnPersUserAppSelService.java | 22 + .../persUserAppSort/EpPersUserAppSortDao.java | 52 ++ .../persUserAppSort/EpPersUserAppSortService.java | 20 + .../persUserWidgetSel/EpPersUserWidgetSelDao.java | 58 +++ .../EpPersUserWidgetSelService.java | 32 ++ .../qzCronTriggers/FnQzCronTriggersDao.java | 53 ++ .../qzCronTriggers/FnQzCronTriggersService.java | 15 + .../service/qzJobDetails/FnQzJobDetailsDao.java | 53 ++ .../qzJobDetails/FnQzJobDetailsService.java | 22 + .../onap/portal/service/qzLocks/FnQzLocksDao.java | 53 ++ .../portal/service/qzLocks/FnQzLocksService.java | 22 + .../qzSchedulerState/FnQzSchedulerStateDao.java | 53 ++ .../FnQzSchedulerStateService.java | 20 + .../portal/service/qzTriggers/FnQzTriggersDao.java | 53 ++ .../service/qzTriggers/FnQzTriggersService.java | 15 + .../service/restrictedUrl/FnRestrictedUrlDao.java | 52 ++ .../restrictedUrl/FnRestrictedUrlService.java | 15 + .../org/onap/portal/service/role/FnRoleDao.java | 82 ++++ .../onap/portal/service/role/FnRoleService.java | 155 ++++++ .../service/roleComposite/FnRoleCompositeDao.java | 53 ++ .../roleComposite/FnRoleCompositeService.java | 15 + .../service/roleFunction/FnRoleFunctionDao.java | 52 ++ .../roleFunction/FnRoleFunctionService.java | 22 + .../service/sharedContext/FnSharedContextDao.java | 52 ++ .../sharedContext/FnSharedContextService.java | 22 + .../java/org/onap/portal/service/tab/FnTabDao.java | 52 ++ .../org/onap/portal/service/tab/FnTabService.java | 22 + .../service/tabSelected/FnTabSelectedDao.java | 53 ++ .../service/tabSelected/FnTabSelectedService.java | 15 + .../org/onap/portal/service/user/FnUserDao.java | 71 +++ .../onap/portal/service/user/FnUserService.java | 124 +++++ .../portal/service/userRole/FnUserRoleDao.java | 71 +++ .../portal/service/userRole/FnUserRoleService.java | 544 +++++++++++++++++++++ .../userRolesRequest/EpUserRolesRequestDao.java | 56 +++ .../EpUserRolesRequestService.java | 69 +++ .../EpUserRolesRequestDetDao.java | 58 +++ .../EpUserRolesRequestDetService.java | 68 +++ .../onap/portal/service/widget/FnWidgetDao.java | 58 +++ .../onap/portal/service/widget/WidgetService.java | 251 ++++++++++ .../service/widgetCatalog/EpWidgetCatalogDao.java | 48 ++ .../widgetCatalog/EpWidgetCatalogService.java | 31 ++ .../EpWidgetCatalogParameterDao.java | 27 + .../EpWidgetCatalogParameterService.java | 109 +++++ .../java/org/onap/portal/utils/EPUserUtils.java | 2 +- .../portal/controller/LanguageControllerTest.java | 14 +- .../onap/portal/controller/UserControllerTest.java | 2 +- .../portal/controller/UserRolesControllerTest.java | 10 +- .../controller/WidgetsCatalogControllerTest.java | 15 +- .../portal/controller/WidgetsControllerTest.java | 40 +- .../ep/EpMicroserviceParameterServiceTest.java | 1 + .../ep/EpWidgetCatalogParameterServiceTest.java | 19 +- .../portal/service/fn/FnUserRoleServiceTest.java | 2 + .../onap/portal/service/fn/FnUserServiceTest.java | 8 +- 176 files changed, 5349 insertions(+), 4707 deletions(-) delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/ep/EpAppFunctionDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/ep/EpAppRoleFunctionDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/ep/EpBasicAuthAccountDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/ep/EpMicroserviceDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/ep/EpMicroserviceParameterDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/ep/EpPersUserAppSortDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/ep/EpPersUserWidgetSelDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/ep/EpUserRolesRequestDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/ep/EpUserRolesRequestDetDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/ep/EpWidgetCatalogParameterDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/EpWidgetCatalogDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnAppContactUsDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnAppDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnAuditLogDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnCommonWidgetDataDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnDisplayTextDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnFunctionDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnLanguageDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuActivityDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuAlertMethodDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuMenuSetDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuPriorityDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuTabSetDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuTimezoneDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalAncestorsDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalRolesDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnPersUserAppSelDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzCronTriggersDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzJobDetailsDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzLocksDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzSchedulerStateDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzTriggersDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnRestrictedUrlDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnRoleCompositeDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnRoleDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnRoleFunctionDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnSharedContextDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnTabDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnTabSelectedDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnUserDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnUserRoleDao.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/dao/fn/FnWidgetDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/EPRoleFunctionService.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/service/WidgetService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/app/FnAppDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/app/FnAppService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/appContactUs/FnAppContactUsDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/appContactUs/FnAppContactUsService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/appFunction/EpAppFunctionDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/appFunction/EpAppFunctionService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/appRoleFunction/EpAppRoleFunctionDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/appRoleFunction/EpAppRoleFunctionService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/auditLog/FnAuditLogDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/auditLog/FnAuditLogService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/basicAuthAccount/EpBasicAuthAccountDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/basicAuthAccount/EpBasicAuthAccountService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/commonWidgetData/FnCommonWidgetDataDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/commonWidgetData/FnCommonWidgetDataService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/displayText/FnDisplayTextDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/displayText/FnDisplayTextService.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/service/ep/EpAppFunctionService.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/service/ep/EpMicroserviceParameterService.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/service/ep/EpUserRolesRequestDetService.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/service/ep/EpUserRolesRequestService.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/service/ep/EpWidgetCatalogParameterService.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/service/ep/EpWidgetCatalogService.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/service/fn/FnAppService.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/service/fn/FnLanguageService.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/service/fn/FnLuTimezoneService.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/service/fn/FnMenuFunctionalRolesService.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/service/fn/FnMenuFunctionalService.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/service/fn/FnRoleService.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/service/fn/FnUserRoleService.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java delete mode 100644 portal-BE/src/main/java/org/onap/portal/service/fn/old/EPRoleFunctionService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/function/FnFunctionDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/function/FnFunctionService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/language/FnLanguageDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/language/FnLanguageService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/luActivity/FnLuActivityDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/luActivity/FnLuActivityService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/luAlertMethod/FnLuAlertMethodDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/luAlertMethod/FnLuAlertMethodService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/luMenuSet/FnLuMenuSetDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/luMenuSet/FnLuMenuSetService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/luPriority/FnLuPriorityDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/luPriority/FnLuPriorityService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/luTabSet/FnLuTabSetDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/luTabSet/FnLuTabSetService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/luTimezone/FnLuTimezoneDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/luTimezone/FnLuTimezoneService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/menu/FnMenuDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/menu/FnMenuService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/menuFunctional/FnMenuFunctionalDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/menuFunctional/FnMenuFunctionalService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/menuFunctionalAncestors/FnMenuFunctionalAncestorsDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/menuFunctionalAncestors/FnMenuFunctionalAncestorsService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/menuFunctionalRoles/FnMenuFunctionalRolesDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/menuFunctionalRoles/FnMenuFunctionalRolesService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/microservice/EpMicroserviceDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/microservice/EpMicroserviceService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/microserviceParameter/EpMicroserviceParameterDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/microserviceParameter/EpMicroserviceParameterService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/persUserAppSel/FnPersUserAppSelDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/persUserAppSel/FnPersUserAppSelService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/persUserAppSort/EpPersUserAppSortDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/persUserAppSort/EpPersUserAppSortService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/persUserWidgetSel/EpPersUserWidgetSelDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/persUserWidgetSel/EpPersUserWidgetSelService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/qzCronTriggers/FnQzCronTriggersDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/qzCronTriggers/FnQzCronTriggersService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/qzJobDetails/FnQzJobDetailsDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/qzJobDetails/FnQzJobDetailsService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/qzLocks/FnQzLocksDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/qzLocks/FnQzLocksService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/qzSchedulerState/FnQzSchedulerStateDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/qzSchedulerState/FnQzSchedulerStateService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/qzTriggers/FnQzTriggersDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/qzTriggers/FnQzTriggersService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/restrictedUrl/FnRestrictedUrlDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/restrictedUrl/FnRestrictedUrlService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/role/FnRoleDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/role/FnRoleService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/roleComposite/FnRoleCompositeDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/roleComposite/FnRoleCompositeService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/roleFunction/FnRoleFunctionDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/roleFunction/FnRoleFunctionService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/sharedContext/FnSharedContextDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/sharedContext/FnSharedContextService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/tab/FnTabDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/tab/FnTabService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/tabSelected/FnTabSelectedDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/tabSelected/FnTabSelectedService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/user/FnUserDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/user/FnUserService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/userRole/FnUserRoleDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/userRole/FnUserRoleService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/userRolesRequest/EpUserRolesRequestDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/userRolesRequest/EpUserRolesRequestService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/userRolesRequestDet/EpUserRolesRequestDetDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/userRolesRequestDet/EpUserRolesRequestDetService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/widget/FnWidgetDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/widget/WidgetService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/widgetCatalog/EpWidgetCatalogDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/widgetCatalog/EpWidgetCatalogService.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/widgetCatalogParameter/EpWidgetCatalogParameterDao.java create mode 100644 portal-BE/src/main/java/org/onap/portal/service/widgetCatalogParameter/EpWidgetCatalogParameterService.java (limited to 'portal-BE') diff --git a/portal-BE/src/main/java/org/onap/portal/PortalApplication.java b/portal-BE/src/main/java/org/onap/portal/PortalApplication.java index cf6f9d7a..047880ab 100644 --- a/portal-BE/src/main/java/org/onap/portal/PortalApplication.java +++ b/portal-BE/src/main/java/org/onap/portal/PortalApplication.java @@ -48,7 +48,7 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories; @SpringBootApplication @EntityScan("org.onap.portal.domain") -@EnableJpaRepositories("org.onap.portal.dao") +@EnableJpaRepositories("org.onap.portal.service") public class PortalApplication { public static void main(String[] args) { 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 4b48ae41..b62e7f7a 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,7 +60,7 @@ public class FnLanguageServiceAOP { @Autowired private DataValidator dataValidator; - @Before("execution(* org.onap.portal.service.fn.FnLanguageService.save(..)) && args(fnLanguage)") + @Before("execution(* org.onap.portal.service.language.FnLanguageService.save(..)) && args(fnLanguage)") public void save(final FnLanguage fnLanguage) { if (fnLanguage == null) { LOGGER.info("User " + " try to save NULL fnLanguage"); @@ -75,7 +75,7 @@ public class FnLanguageServiceAOP { } } - @Before("execution(* org.onap.portal.service.fn.FnLanguageService.getLanguageList(..)) && args(principal)") + @Before("execution(* org.onap.portal.service.language.FnLanguageService.getLanguageList(..)) && args(principal)") public void getLanguageList(final Principal principal) { LOGGER.info("User " + principal.getName() + " try requested for all language list"); } 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 f891392e..5cbec719 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 @@ -68,7 +68,7 @@ public class FnUserServiceAOP { this.fnUserMapper = fnUserMapper; } - @Before("execution(* org.onap.portal.service.fn.FnUserService.saveFnUser(..)) && args(principal, fnUser)") + @Before("execution(* org.onap.portal.service.user.FnUserService.saveFnUser(..)) && args(principal, fnUser)") public void save(final Principal principal, final FnUser fnUser) { FnUser user; if (fnUser == null) { diff --git a/portal-BE/src/main/java/org/onap/portal/aop/service/WidgetServiceAOP.java b/portal-BE/src/main/java/org/onap/portal/aop/service/WidgetServiceAOP.java index 14172937..c1357e2a 100644 --- a/portal-BE/src/main/java/org/onap/portal/aop/service/WidgetServiceAOP.java +++ b/portal-BE/src/main/java/org/onap/portal/aop/service/WidgetServiceAOP.java @@ -23,7 +23,7 @@ public class WidgetServiceAOP { this.dataValidator = dataValidator; } - @Before("execution(* org.onap.portal.service.WidgetService.setOnboardingWidget(..)) && args(userId, onboardingWidget)") + @Before("execution(* org.onap.portal.service.widget.WidgetService.setOnboardingWidget(..)) && args(userId, onboardingWidget)") public void setOnboardingWidget(final Long userId, OnboardingWidget onboardingWidget) { if (!dataValidator.isValid(onboardingWidget)) { throw new IllegalArgumentException(dataValidator.getConstraintViolationsString(onboardingWidget)); 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 index ebd23cd9..3f5b3883 100644 --- a/portal-BE/src/main/java/org/onap/portal/configuration/DBInitializingBean.java +++ b/portal-BE/src/main/java/org/onap/portal/configuration/DBInitializingBean.java @@ -40,196 +40,142 @@ package org.onap.portal.configuration; +import org.onap.portal.domain.db.ep.*; +import org.onap.portal.domain.db.fn.*; +import org.onap.portal.service.app.FnAppService; +import org.onap.portal.service.appContactUs.FnAppContactUsService; +import org.onap.portal.service.appFunction.EpAppFunctionService; +import org.onap.portal.service.appRoleFunction.EpAppRoleFunctionService; +import org.onap.portal.service.auditLog.FnAuditLogService; +import org.onap.portal.service.basicAuthAccount.EpBasicAuthAccountService; +import org.onap.portal.service.commonWidgetData.FnCommonWidgetDataService; +import org.onap.portal.service.displayText.FnDisplayTextService; +import org.onap.portal.service.function.FnFunctionService; +import org.onap.portal.service.language.FnLanguageService; +import org.onap.portal.service.luActivity.FnLuActivityService; +import org.onap.portal.service.luAlertMethod.FnLuAlertMethodService; +import org.onap.portal.service.luMenuSet.FnLuMenuSetService; +import org.onap.portal.service.luPriority.FnLuPriorityService; +import org.onap.portal.service.luTabSet.FnLuTabSetService; +import org.onap.portal.service.luTimezone.FnLuTimezoneService; +import org.onap.portal.service.menu.FnMenuService; +import org.onap.portal.service.menuFunctional.FnMenuFunctionalService; +import org.onap.portal.service.menuFunctionalAncestors.FnMenuFunctionalAncestorsService; +import org.onap.portal.service.menuFunctionalRoles.FnMenuFunctionalRolesService; +import org.onap.portal.service.microservice.EpMicroserviceService; +import org.onap.portal.service.microserviceParameter.EpMicroserviceParameterService; +import org.onap.portal.service.persUserAppSel.FnPersUserAppSelService; +import org.onap.portal.service.persUserAppSort.EpPersUserAppSortService; +import org.onap.portal.service.qzCronTriggers.FnQzCronTriggersService; +import org.onap.portal.service.qzJobDetails.FnQzJobDetailsService; +import org.onap.portal.service.qzLocks.FnQzLocksService; +import org.onap.portal.service.qzSchedulerState.FnQzSchedulerStateService; +import org.onap.portal.service.qzTriggers.FnQzTriggersService; +import org.onap.portal.service.restrictedUrl.FnRestrictedUrlService; +import org.onap.portal.service.role.FnRoleService; +import org.onap.portal.service.roleComposite.FnRoleCompositeService; +import org.onap.portal.service.roleFunction.FnRoleFunctionService; +import org.onap.portal.service.sharedContext.FnSharedContextService; +import org.onap.portal.service.tab.FnTabService; +import org.onap.portal.service.tabSelected.FnTabSelectedService; +import org.onap.portal.service.user.FnUserService; +import org.onap.portal.service.userRole.FnUserRoleService; +import org.onap.portal.service.widgetCatalog.EpWidgetCatalogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.stereotype.Component; + 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; + private final FnAppService fnAppService; + private final EpAppFunctionService epAppFunctionService; + private final FnRoleService fnRoleService; + private final EpAppRoleFunctionService epAppRoleFunctionService; + private final EpBasicAuthAccountService epBasicAuthAccountService; + private final EpMicroserviceService epMicroserviceService; + private final EpMicroserviceParameterService epMicroserviceParameterService; + private final EpWidgetCatalogService epWidgetCatalogService; + private final FnAppContactUsService fnAppContactUsService; + private final FnCommonWidgetDataService fnCommonWidgetDataService; + private final FnLanguageService fnLanguageService; + private final FnDisplayTextService fnDisplayTextService; + private final FnFunctionService fnFunctionService; + private final FnLuActivityService fnLuActivityService; + private final FnLuAlertMethodService fnLuAlertMethodService; + private final FnLuMenuSetService fnLuMenuSetService; + private final FnLuPriorityService fnLuPriorityService; + private final FnLuTimezoneService fnLuTimezoneService; + private final FnMenuService fnMenuService; + private final FnMenuFunctionalService fnMenuFunctionalService; + private final FnMenuFunctionalAncestorsService fnMenuFunctionalAncestorsService; + private final FnMenuFunctionalRolesService fnMenuFunctionalRolesService; + private final FnQzJobDetailsService fnQzJobDetailsService; + private final FnQzLocksService fnQzLocksService; + private final FnQzSchedulerStateService fnQzSchedulerStateService; + private final FnQzTriggersService fnQzTriggersService; + private final FnQzCronTriggersService fnQzCronTriggersService; + private final FnRestrictedUrlService fnRestrictedUrlService; + private final FnRoleCompositeService fnRoleCompositeService; + private final FnRoleFunctionService fnRoleFunctionService; + private final FnSharedContextService fnSharedContextService; + private final FnLuTabSetService fnLuTabSetService; + private final FnTabService fnTabService; + private final FnTabSelectedService fnTabSelectedService; + private final FnUserService fnUserService; + private final EpPersUserAppSortService epPersUserAppSortService; + private final FnPersUserAppSelService fnPersUserAppSelService; + private final FnAuditLogService fnAuditLogService; + private final FnUserRoleService fnUserRoleService; @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; + public DBInitializingBean(FnAppService fnAppService, EpAppFunctionService epAppFunctionService, FnRoleService fnRoleService, EpAppRoleFunctionService epAppRoleFunctionService, EpBasicAuthAccountService epBasicAuthAccountService, EpMicroserviceService epMicroserviceService, EpMicroserviceParameterService epMicroserviceParameterService, EpWidgetCatalogService epWidgetCatalogService, FnAppContactUsService fnAppContactUsService, FnCommonWidgetDataService fnCommonWidgetDataService, FnLanguageService fnLanguageService, FnDisplayTextService fnDisplayTextService, FnFunctionService fnFunctionService, FnLuActivityService fnLuActivityService, FnLuAlertMethodService fnLuAlertMethodService, FnLuMenuSetService fnLuMenuSetService, FnLuPriorityService fnLuPriorityService, FnLuTimezoneService fnLuTimezoneService, FnMenuService fnMenuService, FnMenuFunctionalService fnMenuFunctionalService, FnMenuFunctionalAncestorsService fnMenuFunctionalAncestorsService, FnMenuFunctionalRolesService fnMenuFunctionalRolesService, FnQzJobDetailsService fnQzJobDetailsService, FnQzLocksService fnQzLocksService, FnQzSchedulerStateService fnQzSchedulerStateService, FnQzTriggersService fnQzTriggersService, FnQzCronTriggersService fnQzCronTriggersService, FnRestrictedUrlService fnRestrictedUrlService, FnRoleCompositeService fnRoleCompositeService, FnRoleFunctionService fnRoleFunctionService, FnSharedContextService fnSharedContextService, FnLuTabSetService fnLuTabSetService, FnTabService fnTabService, FnTabSelectedService fnTabSelectedService, FnUserService fnUserService, EpPersUserAppSortService epPersUserAppSortService, FnPersUserAppSelService fnPersUserAppSelService, FnAuditLogService fnAuditLogService, FnUserRoleService fnUserRoleService) { + this.fnAppService = fnAppService; + this.epAppFunctionService = epAppFunctionService; + this.fnRoleService = fnRoleService; + this.epAppRoleFunctionService = epAppRoleFunctionService; + this.epBasicAuthAccountService = epBasicAuthAccountService; + this.epMicroserviceService = epMicroserviceService; + this.epMicroserviceParameterService = epMicroserviceParameterService; + this.epWidgetCatalogService = epWidgetCatalogService; + this.fnAppContactUsService = fnAppContactUsService; + this.fnCommonWidgetDataService = fnCommonWidgetDataService; + this.fnLanguageService = fnLanguageService; + this.fnDisplayTextService = fnDisplayTextService; + this.fnFunctionService = fnFunctionService; + this.fnLuActivityService = fnLuActivityService; + this.fnLuAlertMethodService = fnLuAlertMethodService; + this.fnLuMenuSetService = fnLuMenuSetService; + this.fnLuPriorityService = fnLuPriorityService; + this.fnLuTimezoneService = fnLuTimezoneService; + this.fnMenuService = fnMenuService; + this.fnMenuFunctionalService = fnMenuFunctionalService; + this.fnMenuFunctionalAncestorsService = fnMenuFunctionalAncestorsService; + this.fnMenuFunctionalRolesService = fnMenuFunctionalRolesService; + this.fnQzJobDetailsService = fnQzJobDetailsService; + this.fnQzLocksService = fnQzLocksService; + this.fnQzSchedulerStateService = fnQzSchedulerStateService; + this.fnQzTriggersService = fnQzTriggersService; + this.fnQzCronTriggersService = fnQzCronTriggersService; + this.fnRestrictedUrlService = fnRestrictedUrlService; + this.fnRoleCompositeService = fnRoleCompositeService; + this.fnRoleFunctionService = fnRoleFunctionService; + this.fnSharedContextService = fnSharedContextService; + this.fnLuTabSetService = fnLuTabSetService; + this.fnTabService = fnTabService; + this.fnTabSelectedService = fnTabSelectedService; + this.fnUserService = fnUserService; + this.epPersUserAppSortService = epPersUserAppSortService; + this.fnPersUserAppSelService = fnPersUserAppSelService; + this.fnAuditLogService = fnAuditLogService; + this.fnUserRoleService = fnUserRoleService; } @Override @@ -472,7 +418,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini .authNamespace(null) .build(); List fnApps = new ArrayList<>(Arrays.asList(app, app2, app3, app4, app5, app6, app7, app8, app9, app10)); - fnAppDao.saveAll(fnApps); + fnAppService.saveAll(fnApps); // EP_APP_FUNCTION TABLE @@ -535,7 +481,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini function10, function11, function12, function13, function14, function15, function16, function17, function18, function19, function20, function21, function22, function23, function24, function25, function26, function27)); - epAppFunctionDao.saveAll(epAppFunctions); + epAppFunctionService.saveAll(epAppFunctions); // FN_ROLE TABLE @@ -565,7 +511,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List 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); + fnRoleService.saveAll(fnRoles); // EP_APP_ROLE_FUNCTION TABLE @@ -634,10 +580,10 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini epAppRoleFunction21, epAppRoleFunction22, epAppRoleFunction23, epAppRoleFunction24, epAppRoleFunction25, epAppRoleFunction26, epAppRoleFunction27, epAppRoleFunction28)); - epAppRoleFunctionDao.saveAll(epAppRoleFunctions); + epAppRoleFunctionService.saveAll(epAppRoleFunctions); EpBasicAuthAccount epBasicAuthAccount = EpBasicAuthAccount.builder().extAppName("JIRA").username("jira").password("6APqvG4AU2rfLgCvMdySwQ==").activeYn(true).build(); - epBasicAuthAccountDao.save(epBasicAuthAccount); + epBasicAuthAccountService.save(epBasicAuthAccount); // EP_MICROSERVICE TABLE @@ -648,7 +594,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List epMicroservices = new ArrayList<>(Arrays.asList(epMicroservice1, epMicroservice2, epMicroservice3, epMicroservice4)); - epMicroserviceDao.saveAll(epMicroservices); + epMicroserviceService.saveAll(epMicroservices); // ep_microservice_parameter table @@ -659,7 +605,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List epMicroserviceParameters = new ArrayList<>(Arrays.asList(parameter1, parameter2, parameter3, parameter4)); - epMicroserviceParameterDao.saveAll(epMicroserviceParameters); + epMicroserviceParameterService.saveAll(epMicroserviceParameters); // ep_widget_catalog table //TODO should we connect serviceId to EpMicroservice? @@ -671,7 +617,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List epWidgetCatalogs = new ArrayList<>(Arrays.asList(epWidgetCatalog1, epWidgetCatalog2, epWidgetCatalog3, epWidgetCatalog4)); - epWidgetCatalogDao.saveAll(epWidgetCatalogs); + epWidgetCatalogService.saveAll(epWidgetCatalogs); // ep_widget_catalog_files table //TODO @@ -691,7 +637,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List fnAppContactUses = new ArrayList<>(Arrays.asList(fnAppContactUs1, fnAppContactUs2, fnAppContactUs3, fnAppContactUs4, fnAppContactUs5, fnAppContactUs6, fnAppContactUs7, fnAppContactUs8)); - fnAppContactUsDao.saveAll(fnAppContactUses); + fnAppContactUsService.saveAll(fnAppContactUses); // fn_common_widget_data table @@ -708,15 +654,15 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List fnCommonWidgetDataList = new ArrayList<>(Arrays.asList(fnCommonWidgetData1, fnCommonWidgetData2, fnCommonWidgetData3, fnCommonWidgetData4, fnCommonWidgetData5, fnCommonWidgetData6, fnCommonWidgetData7, fnCommonWidgetData8, fnCommonWidgetData9, fnCommonWidgetData10)); - fnCommonWidgetDataDao.saveAll(fnCommonWidgetDataList); + fnCommonWidgetDataService.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); + fnLanguageService.save(language1); + fnLanguageService.save(language2); // fn_display_text table // TODO should we change languageId from long type to FnLanguage? @@ -754,7 +700,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini fnDisplayText18, fnDisplayText19, fnDisplayText20, fnDisplayText21, fnDisplayText22, fnDisplayText23, fnDisplayText24, fnDisplayText25, fnDisplayText26)); - fnDisplayTextDao.saveAll(fnDisplayTexts); + fnDisplayTextService.saveAll(fnDisplayTexts); // fn_function table @@ -792,7 +738,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini menuJobDesigner, menuLogout, menuMap, menuNotes, menuProcess, menuProfile, menuProfileCreate, menuProfileImport, menuReports, menuSample, menuTab, menuTask, menuTaskSearch, menuWebAnalytics, saveNotification, viewReports)); - fnFunctionDao.saveAll(fnFunctions); + fnFunctionService.saveAll(fnFunctions); // fn_lu_activity table @@ -830,7 +776,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini activity16, activity17, activity18, activity19, activity20, activity21, activity22, activity23, activity24, activity25, tabAccess, activity27, activity28)); - fnLuActivityDao.saveAll(luActivities); + fnLuActivityService.saveAll(luActivities); //fn_lu_alert_method table @@ -842,19 +788,19 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List alertMethods = new ArrayList<>(Arrays.asList(alertMethod1, alertMethod2, alertMethod3, alertMethod4, alertMethod5)); - fnLuAlertMethodDao.saveAll(alertMethods); + fnLuAlertMethodService.saveAll(alertMethods); // fn_lu_menu_set table FnLuMenuSet menuSet = FnLuMenuSet.builder().menuSetCd("APP").menuSetName("Application Menu").build(); - fnLuMenuSetDao.save(menuSet); + fnLuMenuSetService.save(menuSet); // fn_lu_tab_set table FnLuTabSet fnLuTabSet = FnLuTabSet.builder().tabSetCd("APP").tabSetName("Application Tabs").build(); - fnLuTabSetDao.save(fnLuTabSet); + fnLuTabSetService.save(fnLuTabSet); // fn_lu_priority table @@ -866,7 +812,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List priorities = new ArrayList<>(Arrays.asList(low, normal, high, urgent, fatal)); - fnLuPriorityDao.saveAll(priorities); + fnLuPriorityService.saveAll(priorities); // fn_lu_timezone table @@ -880,7 +826,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List timezones = new ArrayList<>(Arrays.asList(USEastern, USCentral, USMountain, USArizona, USPacific, USAlaska, USHawaii)); - fnLuTimezoneDao.saveAll(timezones); + fnLuTimezoneService.saveAll(timezones); // fn_menu table @@ -901,7 +847,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List fnMenus = new ArrayList<>(Arrays.asList(menu1, menu2, menu3, menu4, menu5, menu6, menu7, menu8, menu9, menu10, menu11, menu12, menu13, menu14)); - fnMenuDao.saveAll(fnMenus); + fnMenuService.saveAll(fnMenus); // fn_menu_functional table @@ -953,7 +899,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini menuFunctional313, menuFunctional316, menuFunctional148, menuFunctional317, menuFunctional318, menuFunctional319)); - fnMenuFunctionalDao.saveAll(menuFunctionals); + fnMenuFunctionalService.saveAll(menuFunctionals); // fn_menu_functional_ancestors table @@ -1086,7 +1032,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini ancestors150, ancestors151, ancestors152, ancestors158, ancestors159, ancestors160, ancestors161, ancestors162, ancestors163, ancestors164, ancestors165, ancestors166, ancestors167, ancestors168, ancestors169)); - fnMenuFunctionalAncestorsDao.saveAll(ancestors); + fnMenuFunctionalAncestorsService.saveAll(ancestors); // fn_menu_functional_roles table @@ -1128,7 +1074,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini functionalRoles22, functionalRoles23, functionalRoles24, functionalRoles25, functionalRoles26, functionalRoles27, functionalRoles39, functionalRoles40, functionalRoles42, functionalRoles43)); - fnMenuFunctionalRolesDao.saveAll(functionalRoles); + fnMenuFunctionalRolesService.saveAll(functionalRoles); // fn_qz_job_details table @@ -1142,7 +1088,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List jobDetails = new ArrayList<>(Arrays.asList(fnQzJobDetails1, fnQzJobDetails2)); - fnQzJobDetailsDao.saveAll(jobDetails); + fnQzJobDetailsService.saveAll(jobDetails); // fn_qz_locks table @@ -1151,7 +1097,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List locks = new ArrayList<>(Arrays.asList(fnQzLocks1, fnQzLocks2)); - fnQzLocksDao.saveAll(locks); + fnQzLocksService.saveAll(locks); // fn_qz_scheduler_state table @@ -1159,7 +1105,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini .instanceName("portal-portal-app-76c9f7bfb5-s8rhd1565254283688").lastCheckinTime(BigInteger.valueOf(1565691615399L)) .checkinInterval(BigInteger.valueOf(20000L)).build(); - fnQzSchedulerStateDao.save(schedulerState); + fnQzSchedulerStateService.save(schedulerState); // fn_qz_triggers table //TODO @@ -1168,7 +1114,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List fnQzTriggers = new ArrayList<>(Arrays.asList(trigger1, trigger2)); - // fnQzTriggersDao.saveAll(fnQzTriggers); + // fnQzTriggersService.saveAll(fnQzTriggers); // fn_qz_cron_triggers table //TODO @@ -1178,7 +1124,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List cronTriggers = new ArrayList<>(Arrays.asList(cronTrigger1, cronTrigger2)); - //fnQzCronTriggersDao.saveAll(cronTriggers); + //fnQzCronTriggersService.saveAll(cronTriggers); // fn_restricted_url table //TODO @@ -1231,13 +1177,13 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini url26, url27, url28, url29, url30, url31, url32, url33, url34, url35, url36, url37, url38, url39, url40, url41, url42, url43)); - //fnRestrictedUrlDao.saveAll(urls); + //fnRestrictedUrlService.saveAll(urls); // fn_role_composite table //TODO FnRoleComposite roleComposite = FnRoleComposite.builder().parentRoles(fnRole1).childRoles(fnRole16).build(); - //fnRoleCompositeDao.save(roleComposite); + //fnRoleCompositeService.save(roleComposite); // fn_role_function table @@ -1283,7 +1229,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini roleFunction23, roleFunction24, roleFunction25, roleFunction26, roleFunction27, roleFunction28, roleFunction29, roleFunction30, roleFunction31, roleFunction32, roleFunction33, roleFunction34)); - fnRoleFunctionDao.saveAll(roleFunctions); + fnRoleFunctionService.saveAll(roleFunctions); // fn_shared_context table @@ -1304,7 +1250,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List sharedContexts = new ArrayList<>(Arrays.asList(sharedContext1, sharedContext2, sharedContext3, sharedContext4, sharedContext5, sharedContext6, sharedContext7, sharedContext8, sharedContext9, sharedContext10, sharedContext11, sharedContext12)); - fnSharedContextDao.saveAll(sharedContexts); + fnSharedContextService.saveAll(sharedContexts); // fn_tab table @@ -1319,7 +1265,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List fnTabs = new ArrayList<>(Arrays.asList(TAB1, TAB2, TAB2_SUB1, TAB2_SUB1_S1, TAB2_SUB2, TAB2_SUB3, TAB3, TAB4)); - fnTabDao.saveAll(fnTabs); + fnTabService.saveAll(fnTabs); // fn_tab_selected table @@ -1337,7 +1283,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List tabSelecteds = new ArrayList<>(Arrays.asList(tabSelected1, tabSelected2, tabSelected3, tabSelected4, tabSelected5, tabSelected6, tabSelected7, tabSelected8, tabSelected9, tabSelected10)); -// fnTabSelectedDao.saveAll(tabSelecteds); +// fnTabSelectedService.saveAll(tabSelecteds); // fn_user table @@ -1356,13 +1302,13 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List fnUsers = new ArrayList<>(Arrays.asList(fnUser1, fnUser2, fnUser3, fnUser4, fnUser5, fnUser6, fnUser7, fnUser8, fnUser9, fnUser10, fnUser11, fnUser12)); - fnUserDao.saveAll(fnUsers); + fnUserService.saveAll(fnUsers); // ep_pers_user_app_sort table EpPersUserAppSort appSort = EpPersUserAppSort.builder().userID(fnUser1).sortPref(0).build(); - epPersUserAppSortDao.save(appSort); + epPersUserAppSortService.save(appSort); // fn_pers_user_app_sel table @@ -1373,7 +1319,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List appSels = new ArrayList<>(Arrays.asList(appSel1, appSel2, appSel3, appSel4)); - fnPersUserAppSelDao.saveAll(appSels); + fnPersUserAppSelService.saveAll(appSels); // fn_audit_log table @@ -1387,7 +1333,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini List auditLogs = new ArrayList<>(Arrays.asList(fnAuditLog1, fnAuditLog2, fnAuditLog3, fnAuditLog4, fnAuditLog5, fnAuditLog6, fnAuditLog7)); - fnAuditLogDao.saveAll(auditLogs); + fnAuditLogService.saveAll(auditLogs); // fn_user_role table @@ -1437,7 +1383,7 @@ public class DBInitializingBean implements org.springframework.beans.factory.Ini userRole25, userRole26, userRole27, userRole28, userRole29, userRole30, userRole31, userRole32, userRole33, userRole34, userRole35, userRole36, userRole37, userRole38, userRole39)); - fnUserRoleDao.saveAll(userRoles); + fnUserRoleService.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 a0542ec4..5fd919ba 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 @@ -40,7 +40,7 @@ package org.onap.portal.configuration; -import org.onap.portal.service.fn.FnUserService; +import org.onap.portal.service.user.FnUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; 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 f3b38187..93609844 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,9 +40,10 @@ package org.onap.portal.configuration; -import org.onap.portal.dao.fn.FnFunctionDao; +import org.onap.portal.service.function.FnFunctionService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; import org.springframework.core.Ordered; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; @@ -52,11 +53,11 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @ComponentScan("org.springframework.security.samples.mvc") public class WebMvcConfiguration implements WebMvcConfigurer { - private final FnFunctionDao fnFunctionDao; + private final FnFunctionService fnFunctionService; @Autowired - public WebMvcConfiguration(FnFunctionDao fnFunctionDao) { - this.fnFunctionDao = fnFunctionDao; + public WebMvcConfiguration(FnFunctionService fnFunctionService) { + this.fnFunctionService = fnFunctionService; } @Override 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 4a25e614..28c21d36 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 @@ -50,8 +50,8 @@ import org.onap.portal.domain.dto.PortalRestStatusEnum; import org.onap.portal.domain.dto.fn.FnLanguageDto; import org.onap.portal.domain.mapper.FnLanguageMapper; import org.onap.portal.domain.mapper.FnUserMapper; -import org.onap.portal.service.fn.FnLanguageService; -import org.onap.portal.service.fn.FnUserService; +import org.onap.portal.service.language.FnLanguageService; +import org.onap.portal.service.user.FnUserService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; 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 571ab20a..3f05b0a9 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 @@ -45,7 +45,7 @@ import org.onap.portal.domain.db.fn.FnUser; import org.onap.portal.domain.dto.PortalRestResponse; import org.onap.portal.domain.dto.PortalRestStatusEnum; import org.onap.portal.domain.dto.transport.ProfileDetail; -import org.onap.portal.service.fn.FnUserService; +import org.onap.portal.service.user.FnUserService; import org.onap.portal.validation.DataValidator; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.onboarding.util.CipherUtil; 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 dbba777e..1a2cb5d0 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 @@ -66,8 +66,8 @@ import org.onap.portal.logging.aop.EPEELFLoggerAdvice; import org.onap.portal.logging.logic.EPLogUtil; import org.onap.portal.service.AdminRolesService; import org.onap.portal.service.ApplicationsRestClientService; -import org.onap.portal.service.fn.FnUserRoleService; -import org.onap.portal.service.fn.FnUserService; +import org.onap.portal.service.userRole.FnUserRoleService; +import org.onap.portal.service.user.FnUserService; import org.onap.portal.utils.EPCommonSystemProperties; import org.onap.portal.utils.EcompPortalUtils; import org.onap.portal.utils.PortalConstants; 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 59779448..93d6dd56 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 @@ -59,9 +59,9 @@ import org.onap.portal.domain.dto.ecomp.WidgetParameterResult; import org.onap.portal.domain.dto.ecomp.WidgetServiceHeaders; import org.onap.portal.logging.aop.EPAuditLog; import org.onap.portal.service.WidgetMService; -import org.onap.portal.service.ep.EpMicroserviceParameterService; -import org.onap.portal.service.ep.EpWidgetCatalogParameterService; -import org.onap.portal.service.fn.FnUserService; +import org.onap.portal.service.microserviceParameter.EpMicroserviceParameterService; +import org.onap.portal.service.widgetCatalogParameter.EpWidgetCatalogParameterService; +import org.onap.portal.service.user.FnUserService; import org.onap.portal.utils.EPCommonSystemProperties; import org.onap.portal.utils.EcompPortalUtils; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; 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 6a92fbc3..db7039fe 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 @@ -50,12 +50,10 @@ import org.onap.portal.domain.dto.transport.FieldsValidator; import org.onap.portal.domain.dto.transport.OnboardingWidget; import org.onap.portal.domain.dto.transport.WidgetCatalogPersonalization; import org.onap.portal.logging.aop.EPAuditLog; -import org.onap.portal.service.AdminRolesService; import org.onap.portal.service.PersUserWidgetService; -import org.onap.portal.service.WidgetService; -import org.onap.portal.service.fn.FnUserService; +import org.onap.portal.service.widget.WidgetService; +import org.onap.portal.service.user.FnUserService; import org.onap.portal.utils.EcompPortalUtils; -import org.onap.portal.validation.DataValidator; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; 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 deleted file mode 100644 index c7782b56..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpAppFunctionDao.java +++ /dev/null @@ -1,58 +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.dao.ep; - -import java.util.List; -import org.onap.portal.domain.db.ep.EpAppFunction; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -@Repository -@Transactional -public interface EpAppFunctionDao extends JpaRepository { - - @Query - List 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 deleted file mode 100644 index 3296eb7e..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpAppRoleFunctionDao.java +++ /dev/null @@ -1,52 +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.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 { - -} 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 deleted file mode 100644 index cc3219c0..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpBasicAuthAccountDao.java +++ /dev/null @@ -1,52 +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.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 { - -} 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 deleted file mode 100644 index d68e1f84..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpMicroserviceDao.java +++ /dev/null @@ -1,52 +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.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 { - -} diff --git a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpMicroserviceParameterDao.java b/portal-BE/src/main/java/org/onap/portal/dao/ep/EpMicroserviceParameterDao.java deleted file mode 100644 index add897c9..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpMicroserviceParameterDao.java +++ /dev/null @@ -1,59 +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.dao.ep; - -import java.util.List; -import org.onap.portal.domain.db.ep.EpMicroserviceParameter; -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 EpMicroserviceParameterDao extends JpaRepository { - - @Query - void deleteByServiceId(@Param("SERVICEID") Long userId); - @Query - List getParametersById(@Param("SERVICEID") long serviceId); -} 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 deleted file mode 100644 index bc9da593..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpPersUserAppSortDao.java +++ /dev/null @@ -1,52 +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.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 { - -} diff --git a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpPersUserWidgetSelDao.java b/portal-BE/src/main/java/org/onap/portal/dao/ep/EpPersUserWidgetSelDao.java deleted file mode 100644 index 899fc1f0..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpPersUserWidgetSelDao.java +++ /dev/null @@ -1,58 +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.dao.ep; - -import java.util.List; -import java.util.Optional; -import org.onap.portal.domain.db.ep.EpPersUserWidgetSel; -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 EpPersUserWidgetSelDao extends JpaRepository { - - @Query - Optional> getEpPersUserWidgetSelForUserIdAndWidgetId(@Param("USERID") Long userId, @Param("WIDGETID") Long widgetId); -} diff --git a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpUserRolesRequestDao.java b/portal-BE/src/main/java/org/onap/portal/dao/ep/EpUserRolesRequestDao.java deleted file mode 100644 index 7924d431..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpUserRolesRequestDao.java +++ /dev/null @@ -1,56 +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.dao.ep; - -import java.util.List; -import org.onap.portal.domain.db.ep.EpUserRolesRequest; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -@Repository -@Transactional -public interface EpUserRolesRequestDao extends JpaRepository { - @Query - List userAppRolesRequestList(final @Param("userId") Long userId, final @Param("appId") Long appId); -} diff --git a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpUserRolesRequestDetDao.java b/portal-BE/src/main/java/org/onap/portal/dao/ep/EpUserRolesRequestDetDao.java deleted file mode 100644 index cfc97baa..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpUserRolesRequestDetDao.java +++ /dev/null @@ -1,58 +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.dao.ep; - -import java.util.List; -import org.onap.portal.domain.db.ep.EpUserRolesRequestDet; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -@Repository -@Transactional -public interface EpUserRolesRequestDetDao extends JpaRepository { - - @Query - List appRolesRequestDetailList(final @Param("reqId") Long reqId); - -} diff --git a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpWidgetCatalogParameterDao.java b/portal-BE/src/main/java/org/onap/portal/dao/ep/EpWidgetCatalogParameterDao.java deleted file mode 100644 index c5ec1248..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/ep/EpWidgetCatalogParameterDao.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.onap.portal.dao.ep; - -import java.util.List; -import java.util.Optional; -import org.onap.portal.domain.db.ep.EpWidgetCatalogParameter; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Modifying; -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 EpWidgetCatalogParameterDao extends JpaRepository { - - @Query - Optional> retrieveByParamId(@Param("PARAMID") Long paramId); - - @Query - @Modifying - void deleteWidgetCatalogParameter(@Param("PARAMID") Long paramId); - - @Query - Optional> getUserParamById(@Param("WIDGETID") Long widgetId, - @Param("USERID") Long userId, @Param("PARAMID") Long paramId); -} diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/EpWidgetCatalogDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/EpWidgetCatalogDao.java deleted file mode 100644 index 1e8de2bb..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/EpWidgetCatalogDao.java +++ /dev/null @@ -1,48 +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.dao.fn; - -import org.onap.portal.domain.db.ep.EpWidgetCatalog; -import org.springframework.data.jpa.repository.JpaRepository; - -public interface EpWidgetCatalogDao extends JpaRepository { - -} 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 deleted file mode 100644 index 39603eb7..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnAppContactUsDao.java +++ /dev/null @@ -1,52 +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.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 { - -} 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 deleted file mode 100644 index f86456f2..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnAppDao.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.onap.portal.dao.fn; - -import java.util.List; -import org.onap.portal.domain.db.fn.FnApp; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -@Repository -@Transactional -public interface FnAppDao extends JpaRepository { - - @Query - List getByUebKey(final @Param("uebKey") String uebKey); - - @Query - List 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 deleted file mode 100644 index 4e747b4f..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnAuditLogDao.java +++ /dev/null @@ -1,52 +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.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 { - -} 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 deleted file mode 100644 index deb062f0..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnCommonWidgetDataDao.java +++ /dev/null @@ -1,52 +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.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 { - -} 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 deleted file mode 100644 index fae8d684..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnDisplayTextDao.java +++ /dev/null @@ -1,52 +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.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 { - -} 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 deleted file mode 100644 index 6892de21..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnFunctionDao.java +++ /dev/null @@ -1,52 +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.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 { - -} 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 deleted file mode 100644 index c79fb0ed..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLanguageDao.java +++ /dev/null @@ -1,56 +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.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 { - @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 deleted file mode 100644 index abc8cff1..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuActivityDao.java +++ /dev/null @@ -1,52 +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.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 { - -} 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 deleted file mode 100644 index cfd22ce5..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuAlertMethodDao.java +++ /dev/null @@ -1,52 +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.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 { - -} 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 deleted file mode 100644 index adcb792a..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuMenuSetDao.java +++ /dev/null @@ -1,52 +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.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 { - -} 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 deleted file mode 100644 index 98253ceb..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuPriorityDao.java +++ /dev/null @@ -1,52 +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.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 { - -} 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 deleted file mode 100644 index bcc3a1b8..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuTabSetDao.java +++ /dev/null @@ -1,52 +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.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 { - -} diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuTimezoneDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuTimezoneDao.java deleted file mode 100644 index d98d893b..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuTimezoneDao.java +++ /dev/null @@ -1,52 +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.dao.fn; - -import org.onap.portal.domain.db.fn.FnLuTimezone; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -@Repository -@Transactional -public interface FnLuTimezoneDao extends JpaRepository { - -} 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 deleted file mode 100644 index bbd1b6ad..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuDao.java +++ /dev/null @@ -1,52 +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.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 { - -} 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 deleted file mode 100644 index 3ffc7bb9..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalAncestorsDao.java +++ /dev/null @@ -1,52 +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.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 { - -} diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalDao.java deleted file mode 100644 index 0c8ac4a9..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalDao.java +++ /dev/null @@ -1,56 +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.dao.fn; - -import java.util.List; -import org.onap.portal.domain.db.fn.FnMenuFunctional; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -@Transactional -@Repository -public interface FnMenuFunctionalDao extends JpaRepository { - @Query - List retrieveByMenuId(final @Param("menuId") Long menuId); -} diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalRolesDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalRolesDao.java deleted file mode 100644 index 10b189bb..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnMenuFunctionalRolesDao.java +++ /dev/null @@ -1,62 +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.dao.fn; - -import java.util.List; -import org.onap.portal.domain.db.fn.FnMenuFunctionalRoles; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -@Transactional -@Repository -public interface FnMenuFunctionalRolesDao extends JpaRepository { - - @Query - List retrieveByRoleId(final @Param("roleId") Long roleId); - - @Query - List retrieveByMenuId(final @Param("menuId") Long menuId); - - -} diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnPersUserAppSelDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnPersUserAppSelDao.java deleted file mode 100644 index ff7e6e72..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnPersUserAppSelDao.java +++ /dev/null @@ -1,52 +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.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 { - -} 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 deleted file mode 100644 index ec09ae54..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzCronTriggersDao.java +++ /dev/null @@ -1,53 +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.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 { - -} 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 deleted file mode 100644 index 3a3a4183..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzJobDetailsDao.java +++ /dev/null @@ -1,53 +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.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 { - -} 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 deleted file mode 100644 index 7063cf7e..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzLocksDao.java +++ /dev/null @@ -1,53 +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.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 { - -} 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 deleted file mode 100644 index 17bbd7fa..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzSchedulerStateDao.java +++ /dev/null @@ -1,53 +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.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 { - -} 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 deleted file mode 100644 index 55a86de2..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnQzTriggersDao.java +++ /dev/null @@ -1,53 +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.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 { - -} 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 deleted file mode 100644 index 1bf54d6d..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnRestrictedUrlDao.java +++ /dev/null @@ -1,53 +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.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 { - -} 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 deleted file mode 100644 index 89df2c41..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnRoleCompositeDao.java +++ /dev/null @@ -1,53 +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.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 { - -} 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 deleted file mode 100644 index f979be6e..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnRoleDao.java +++ /dev/null @@ -1,82 +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.dao.fn; - -import java.util.List; -import org.onap.portal.domain.db.fn.FnRole; -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 FnRoleDao extends JpaRepository { - - @Query - List retrieveAppRoleByAppRoleIdAndByAppId(final @Param("appId") Long appId, - final @Param("appRoleId") Long appRoleId); - - @Query - List getUserRoleOnUserIdAndAppId(final @Param("userId") Long userId, final @Param("appId") Long appId); - - @Query - List retrieveAppRoleByRoleIdWhereAppIdIsNull(final @Param("roleId") Long roleId); - - @Query - List retrieveAppRolesWhereAppIdIsNull(); - - @Query - List retrieveAppRolesByAppId(final @Param("appId") Long id); - - @Query - List retrieveActiveRolesOfApplication(final @Param("appId") Long appId); - - @Query - List retrieveAppRolesByRoleNameAndByAppId(final @Param("roleName") String roleName, final @Param("appId") Long appId); - - @Query - List 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 deleted file mode 100644 index eaafb78d..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnRoleFunctionDao.java +++ /dev/null @@ -1,52 +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.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 { - -} 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 deleted file mode 100644 index 765bc1dd..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnSharedContextDao.java +++ /dev/null @@ -1,52 +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.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 { - -} 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 deleted file mode 100644 index c6518a99..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnTabDao.java +++ /dev/null @@ -1,52 +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.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 { - -} 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 deleted file mode 100644 index 42da97e0..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnTabSelectedDao.java +++ /dev/null @@ -1,53 +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.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 { - -} 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 deleted file mode 100644 index f52075c1..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnUserDao.java +++ /dev/null @@ -1,71 +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.dao.fn; - -import java.util.List; -import java.util.Optional; -import org.onap.portal.domain.db.fn.FnUser; -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 FnUserDao extends JpaRepository { - - @Query - Optional findByLoginId(final @Param("loginId") String username); - - @Override - FnUser getOne(Long ID); - - @Query - Optional> getUserWithOrgUserId(final @Param("orgId") String orgId); - - @Query - Optional> getUsersByOrgIds(final @Param("orgIds") List orgIds); - - @Query - Optional> getActiveUsers(); - -} 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 deleted file mode 100644 index 402304b8..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnUserRoleDao.java +++ /dev/null @@ -1,71 +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.dao.fn; - -import java.util.List; -import java.util.Optional; -import org.onap.portal.domain.db.fn.FnUserRole; -import org.onap.portal.domain.dto.ecomp.UserRole; -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 FnUserRoleDao extends JpaRepository { - - @Query - Optional> getAdminUserRoles(final @Param("userId") Long userId, final @Param("roleId") Long roleId, final @Param("appId") Long appId); - - @Query - List isSuperAdmin(final @Param("orgUserId") String orgUserId, final @Param("roleId") Long roleId, final @Param("appId") Long appId); - - @Query - List retrieveByAppIdAndUserId(final @Param("appId") Long appId, final @Param("userId") String userId); - - @Query - List retrieveByAppIdAndRoleId(final @Param("appId") Long appId, final @Param("roleId") Long roleId); - - @Query - List retrieveByUserIdAndRoleId(final @Param("userId") Long userId, final @Param("roleId") Long roleId); -} diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnWidgetDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnWidgetDao.java deleted file mode 100644 index 9c3e7a1f..00000000 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnWidgetDao.java +++ /dev/null @@ -1,58 +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.dao.fn; - -import java.util.List; -import java.util.Optional; -import org.onap.portal.domain.db.fn.FnWidget; -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 FnWidgetDao extends JpaRepository { - - @Query - Optional> getForUrlNameAndAppId(final @Param("URL") String url, final @Param("NAME") String name, final @Param("APPID") Long appId); -} 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 2c7151a2..9c00b7a2 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 @@ -50,7 +50,7 @@ import javax.servlet.http.HttpServletRequest; import org.onap.portal.domain.db.fn.FnApp; import org.onap.portal.domain.db.fn.FnUser; import org.onap.portal.service.AppsCacheService; -import org.onap.portal.service.fn.FnUserService; +import org.onap.portal.service.user.FnUserService; import org.onap.portal.utils.EPCommonSystemProperties; import org.onap.portal.utils.EcompPortalUtils; import org.onap.portalsdk.core.exception.SessionExpiredException; 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 8049cd65..187e175e 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,7 +57,6 @@ 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; @@ -96,15 +95,15 @@ import org.onap.portal.exception.DeleteDomainObjectFailedException; import org.onap.portal.exception.SyncUserRolesException; import org.onap.portal.logging.format.EPAppMessagesEnum; import org.onap.portal.logging.logic.EPLogUtil; -import org.onap.portal.service.ep.EpAppFunctionService; -import org.onap.portal.service.ep.EpUserRolesRequestDetService; -import org.onap.portal.service.ep.EpUserRolesRequestService; -import org.onap.portal.service.fn.FnAppService; -import org.onap.portal.service.fn.FnMenuFunctionalRolesService; -import org.onap.portal.service.fn.FnMenuFunctionalService; -import org.onap.portal.service.fn.FnRoleService; -import org.onap.portal.service.fn.FnUserRoleService; -import org.onap.portal.service.fn.FnUserService; +import org.onap.portal.service.appFunction.EpAppFunctionService; +import org.onap.portal.service.userRolesRequestDet.EpUserRolesRequestDetService; +import org.onap.portal.service.userRolesRequest.EpUserRolesRequestService; +import org.onap.portal.service.app.FnAppService; +import org.onap.portal.service.menuFunctionalRoles.FnMenuFunctionalRolesService; +import org.onap.portal.service.menuFunctional.FnMenuFunctionalService; +import org.onap.portal.service.role.FnRoleService; +import org.onap.portal.service.userRole.FnUserRoleService; +import org.onap.portal.service.user.FnUserService; import org.onap.portal.utils.EPCommonSystemProperties; import org.onap.portal.utils.EPUserUtils; import org.onap.portal.utils.EcompPortalUtils; @@ -223,7 +222,7 @@ public class AdminRolesService { return false; } - boolean isUser(FnUser user) { + public boolean isUser(FnUser user) { try { FnUser currentUser = fnUserService.getUser(user.getId()).orElseThrow(Exception::new); if (currentUser != null && currentUser.getId() != null) { 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 83b5df99..b7dd4bfb 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 @@ -48,7 +48,7 @@ import java.util.stream.Collectors; import javax.annotation.PostConstruct; import org.onap.portal.domain.db.fn.FnApp; import org.onap.portal.domain.dto.transport.OnboardingApp; -import org.onap.portal.service.fn.FnAppService; +import org.onap.portal.service.app.FnAppService; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/portal-BE/src/main/java/org/onap/portal/service/EPRoleFunctionService.java b/portal-BE/src/main/java/org/onap/portal/service/EPRoleFunctionService.java new file mode 100644 index 00000000..6023a1c4 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/EPRoleFunctionService.java @@ -0,0 +1,103 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +package org.onap.portal.service; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +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.utils.EPUserUtils; +import org.onap.portalsdk.core.domain.RoleFunction; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.SystemProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +@Transactional +public class EPRoleFunctionService { + @Autowired + private DataAccessService dataAccessService; + + public DataAccessService getDataAccessService() { + return dataAccessService; + } + + public void setDataAccessService(DataAccessService dataAccessService) { + this.dataAccessService = dataAccessService; + } + + @SuppressWarnings("unchecked") + public List getRoleFunctions() { + return getDataAccessService().getList(RoleFunction.class, null); + } + + @SuppressWarnings("unchecked") + public Set getRoleFunctions(HttpServletRequest request, FnUser user) { + HashSet roleFunctions = null; + + HttpSession session = request.getSession(); + roleFunctions = (HashSet) session + .getAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME)); + + if (roleFunctions == null) { + HashMap roles = (HashMap) EPUserUtils.getRoles(request); + roleFunctions = new HashSet(); + + for (Object o : roles.keySet()) { + Long roleKey = (Long) o; + FnRole role = (FnRole) roles.get(roleKey); + + for (FnRoleFunction fnRoleFunction : role.getFnRoleFunctions()) { + FnRoleFunction function = fnRoleFunction; + roleFunctions.add(function.getFunctionCd()); + } + } + + session.setAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME), + roleFunctions); + } + + return roleFunctions; + } + +} 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 b6739234..b9f161fe 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 @@ -59,9 +59,9 @@ import org.onap.portal.domain.dto.transport.CentralV2Role; import org.onap.portal.domain.dto.transport.GlobalRoleWithApplicationRoleFunction; import org.onap.portal.exception.RoleFunctionException; import org.onap.portal.logging.logic.EPLogUtil; -import org.onap.portal.service.ep.EpAppFunctionService; -import org.onap.portal.service.fn.FnAppService; -import org.onap.portal.service.fn.FnRoleService; +import org.onap.portal.service.appFunction.EpAppFunctionService; +import org.onap.portal.service.app.FnAppService; +import org.onap.portal.service.role.FnRoleService; import org.onap.portal.utils.EPCommonSystemProperties; import org.onap.portal.utils.EPUserUtils; import org.onap.portal.utils.EcompPortalUtils; 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 28d63eb2..2a5d0aec 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 @@ -43,13 +43,13 @@ package org.onap.portal.service; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -import org.onap.portal.dao.ep.EpPersUserWidgetSelDao; -import org.onap.portal.dao.fn.EpWidgetCatalogDao; import org.onap.portal.domain.db.ep.EpPersUserWidgetSel; 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.portal.service.persUserWidgetSel.EpPersUserWidgetSelService; +import org.onap.portal.service.widgetCatalog.EpWidgetCatalogService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -61,14 +61,14 @@ import org.springframework.transaction.annotation.Transactional; public class PersUserWidgetService { private static final Logger LOGGER = LoggerFactory.getLogger(PersUserWidgetService.class); - private final EpPersUserWidgetSelDao epPersUserWidgetSelDao; - private final EpWidgetCatalogDao epWidgetCatalogDao; + private final EpPersUserWidgetSelService epPersUserWidgetSelService; + private final EpWidgetCatalogService epWidgetCatalogService; @Autowired - public PersUserWidgetService(final EpPersUserWidgetSelDao epPersUserWidgetSelDao, - final EpWidgetCatalogDao epWidgetCatalogDao) { - this.epPersUserWidgetSelDao = epPersUserWidgetSelDao; - this.epWidgetCatalogDao = epWidgetCatalogDao; + public PersUserWidgetService(final EpPersUserWidgetSelService epPersUserWidgetSelService, + final EpWidgetCatalogService epWidgetCatalogService) { + this.epPersUserWidgetSelService = epPersUserWidgetSelService; + this.epWidgetCatalogService = epWidgetCatalogService; } public void setPersUserAppValue(FnUser user, WidgetCatalogPersonalization personalization) { @@ -83,19 +83,19 @@ public class PersUserWidgetService { } if (persRow.getId() != null) { - epPersUserWidgetSelDao.deleteById(persRow.getId()); + epPersUserWidgetSelService.deleteById(persRow.getId()); } persRow.setStatusCode(personalization.getSelect() ? "S" : "H"); // Show / Hide EpPersUserWidgetSel epPersUserWidgetSel = new EpPersUserWidgetSel(); epPersUserWidgetSel.setUserId(user); epPersUserWidgetSel.setWidgetId( - epWidgetCatalogDao.findById(personalization.getWidgetId()).orElse(new EpWidgetCatalog())); - epPersUserWidgetSelDao.saveAndFlush(epPersUserWidgetSel); + epWidgetCatalogService.findById(personalization.getWidgetId()).orElse(new EpWidgetCatalog())); + epPersUserWidgetSelService.saveAndFlush(epPersUserWidgetSel); } private List getUserWidgetSelction(FnUser user, Long widgetId) { - return epPersUserWidgetSelDao + return epPersUserWidgetSelService .getEpPersUserWidgetSelForUserIdAndWidgetId(user.getId(), widgetId) .orElse(new ArrayList<>()) .stream() 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 deleted file mode 100644 index 6f8440e6..00000000 --- a/portal-BE/src/main/java/org/onap/portal/service/WidgetService.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Modifications Copyright (c) 2019 Samsung - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the "License"); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * - */ - -package org.onap.portal.service; - -import java.util.ArrayList; -import java.util.List; -import javax.persistence.EntityManager; -import javax.servlet.http.HttpServletResponse; -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.transport.FieldsValidator; -import org.onap.portal.domain.dto.transport.OnboardingWidget; -import org.onap.portal.service.fn.FnUserRoleService; -import org.onap.portal.utils.EPCommonSystemProperties; -import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -@EnableAspectJAutoProxy -@Transactional -public class WidgetService { - - private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetService.class); - private final Long ACCOUNT_ADMIN_ROLE_ID = 999L; - - 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," - + "widget.WDG_URL, widget.WIDGET_ID,widget.WDG_NAME,widget.APP_ID,app.APP_NAME,widget.WDG_WIDTH,widget.WDG_HEIGHT,widget.WDG_URL) from FN_WIDGET widget join FN_APP app ON widget.APP_ID = app.APP_ID"; - - private static final String urlField = "url"; - private static final Long DUBLICATED_FIELD_VALUE_ECOMP_ERROR = new Long( - EPCommonSystemProperties.DUBLICATED_FIELD_VALUE_ECOMP_ERROR); - private static final String nameField = "name"; - - private final AdminRolesService adminRolesService; - private final EntityManager entityManager; - private final FnWidgetDao fnWidgetDao; - private final FnUserRoleService fnUserRoleService; - - @Autowired - public WidgetService(final AdminRolesService adminRolesService, final EntityManager entityManager, - final FnWidgetDao fnWidgetDao, FnUserRoleService fnUserRoleService) { - this.adminRolesService = adminRolesService; - this.entityManager = entityManager; - this.fnWidgetDao = fnWidgetDao; - this.fnUserRoleService = fnUserRoleService; - } - - private static final Object syncRests = new Object(); - - public List getOnboardingWidgets(FnUser user, boolean managed) { - if (adminRolesService.isSuperAdmin(user.getOrgUserId())) { - return entityManager.createQuery(sqlWidgetsForAllApps(), OnboardingWidget.class).getResultList(); - } else if (managed) { - if (adminRolesService.isAccountAdmin(user)) { - return entityManager - .createQuery(sqlWidgetsForAllAppsWhereUserIsAdmin(), OnboardingWidget.class) - .setParameter("USERID", user.getId()).getResultList(); - } - } else if (adminRolesService.isAccountAdmin(user) || adminRolesService.isUser(user)) { - return entityManager - .createQuery(sqlWidgetsForAllAppsWhereUserHasAnyRole(), OnboardingWidget.class) - .setParameter("USERID", user.getId()).getResultList(); - } - return new ArrayList<>(); - } - - private String sqlWidgetsForAllApps() { - return "SELECT" + baseSqlToken; - } - - private String sqlWidgetsForAllAppsWhereUserIsAdmin() { - return "SELECT" + baseSqlToken - + " join FN_USER_ROLE ON FN_USER_ROLE.APP_ID = app.APP_ID where FN_USER_ROLE.USER_ID = :USERID AND FN_USER_ROLE.ROLE_ID = " - + ACCOUNT_ADMIN_ROLE_ID; - } - - private String sqlWidgetsForAllAppsWhereUserHasAnyRole() { - return "SELECT DISTINCT" + baseSqlToken - + " join FN_USER_ROLE ON FN_USER_ROLE.APP_ID = app.APP_ID where FN_USER_ROLE.USER_ID = " - + ":USERID"; - } - - @PreAuthorize("hasRole('System_Administrator')") - public FieldsValidator setOnboardingWidget(final Long userId, final OnboardingWidget onboardingWidget) { - return this.updateOrSaveWidget(true, userId, onboardingWidget); - } - - private FieldsValidator updateOrSaveWidget(boolean superAdmin, Long userId, OnboardingWidget onboardingWidget) { - FieldsValidator fieldsValidator = new FieldsValidator(); - if (!this.isUserAdminOfAppForWidget(superAdmin, userId, onboardingWidget.getAppId())) { - fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_FORBIDDEN); - return fieldsValidator; - } - synchronized (syncRests) { - if (onboardingWidget.getId() == null) { - this.validateOnboardingWidget(onboardingWidget, fieldsValidator); - } else { - FnWidget widget = fnWidgetDao.getOne(onboardingWidget.getId()); - if (widget == null || widget.getAppId() == null) { - fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_NOT_FOUND); - return fieldsValidator; - } - this.validateOnboardingWidget(onboardingWidget, fieldsValidator); - } - if (fieldsValidator.getHttpStatusCode() == HttpServletResponse.SC_OK) { - this.applyOnboardingWidget(onboardingWidget, fieldsValidator); - } - } - return fieldsValidator; - } - - private boolean isUserAdminOfAppForWidget(boolean superAdmin, Long userId, Long appId) { - if (!superAdmin) { - List userRoles = getAdminUserRoles(userId, appId); - return (userRoles.size() > 0); - } - return true; - } - - private List getAdminUserRoles(Long userId, Long appId) { - return fnUserRoleService.getAdminUserRoles(userId, ACCOUNT_ADMIN_ROLE_ID, appId); - } - - private void applyOnboardingWidget(OnboardingWidget onboardingWidget, FieldsValidator fieldsValidator) { - boolean result; - FnWidget widget; - if (onboardingWidget.getId() == null) { - widget = new FnWidget(); - } else { - widget = fnWidgetDao.getOne(onboardingWidget.getId()); - } - widget.setAppId(onboardingWidget.getAppId()); - widget.setName(onboardingWidget.getName()); - widget.setWidth(onboardingWidget.getWidth()); - widget.setHeight(onboardingWidget.getHeight()); - widget.setUrl(onboardingWidget.getUrl()); - result = widget.equals(fnWidgetDao.saveAndFlush(widget)); - if (!result) { - fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - } - } - - private void validateOnboardingWidget(OnboardingWidget onboardingWidget, FieldsValidator fieldsValidator) { - List widgets = getWidgets(onboardingWidget); - boolean dublicatedUrl = false; - boolean dublicatedName = false; - for (FnWidget widget : widgets) { - if (onboardingWidget.getId() != null && onboardingWidget.getId().equals(widget.getWidgetId())) { - // widget should not be compared with itself - continue; - } - if (!dublicatedUrl && widget.getUrl().equals(onboardingWidget.getUrl())) { - dublicatedUrl = true; - if (dublicatedName) { - break; - } - } - if (!dublicatedName && widget.getName().equalsIgnoreCase(onboardingWidget.getName()) && widget - .getAppId().equals(onboardingWidget.getAppId())) { - dublicatedName = true; - if (dublicatedUrl) { - break; - } - } - } - if (dublicatedUrl || dublicatedName) { - if (dublicatedUrl) { - fieldsValidator.addProblematicFieldName(urlField); - } - if (dublicatedName) { - fieldsValidator.addProblematicFieldName(nameField); - } - fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_CONFLICT); - fieldsValidator.setErrorCode(DUBLICATED_FIELD_VALUE_ECOMP_ERROR); - } - } - - private List getWidgets(final OnboardingWidget onboardingWidget) { - return fnWidgetDao.getForUrlNameAndAppId(onboardingWidget.getUrl(), onboardingWidget.getName(), onboardingWidget.getAppId()).orElse(new ArrayList<>()); - } - - public FieldsValidator deleteOnboardingWidget(FnUser user, Long onboardingWidgetId) { - FieldsValidator fieldsValidator = new FieldsValidator(); - synchronized (syncRests) { - FnWidget widget = fnWidgetDao.getOne(onboardingWidgetId); - if (widget != null && widget.getAppId() != null) { // widget exists - if (!this.isUserAdminOfAppForWidget(adminRolesService.isSuperAdmin(user.getOrgUserId()), user.getId(), - widget.getAppId())) { - fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_FORBIDDEN); - } else { - fnWidgetDao.deleteById(onboardingWidgetId); - fieldsValidator.setHttpStatusCode( - (long) HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - } - } - } - return fieldsValidator; - } - - public FnWidget saveOne(final FnWidget widget){ - return fnWidgetDao.saveAndFlush(widget); - } -} diff --git a/portal-BE/src/main/java/org/onap/portal/service/app/FnAppDao.java b/portal-BE/src/main/java/org/onap/portal/service/app/FnAppDao.java new file mode 100644 index 00000000..f57cc246 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/app/FnAppDao.java @@ -0,0 +1,21 @@ +package org.onap.portal.service.app; + +import java.util.List; +import org.onap.portal.domain.db.fn.FnApp; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +@Repository +@Transactional +interface FnAppDao extends JpaRepository { + + @Query + List getByUebKey(final @Param("uebKey") String uebKey); + + @Query + List getCentralizedApps(); + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/app/FnAppService.java b/portal-BE/src/main/java/org/onap/portal/service/app/FnAppService.java new file mode 100644 index 00000000..13d0911a --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/app/FnAppService.java @@ -0,0 +1,141 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.app; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import javax.persistence.EntityExistsException; +import javax.persistence.EntityManager; + +import org.onap.portal.domain.db.fn.FnApp; +import org.onap.portal.domain.dto.transport.OnboardingApp; +import org.onap.portal.utils.EPCommonSystemProperties; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.onboarding.util.CipherUtil; +import org.onap.portalsdk.core.util.SystemProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class FnAppService { + + private static final String SUPER_ADMIN_ROLE_ID = "1"; + + private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnAppService.class); + + private final FnAppDao fnAppDao; + private final EntityManager entityManager; + + @Autowired + public FnAppService(FnAppDao fnAppDao, EntityManager entityManager) { + this.fnAppDao = fnAppDao; + this.entityManager = entityManager; + } + + public List getAppsFullList() { + return fnAppDao.findAll(); + } + + public FnApp getById(final Long id) { + return Optional.of(fnAppDao.getOne(id)).orElseThrow(EntityExistsException::new); + } + + public List getByUebKey(final String uebKey){ + return Optional.of(fnAppDao.getByUebKey(uebKey)).orElse(new ArrayList<>()); + } + + public List getCentralizedApps(){ + return Optional.of(fnAppDao.getCentralizedApps()).orElse(new ArrayList<>()); + } + + public void createOnboardingFromApp(FnApp app, OnboardingApp onboardingApp) { + onboardingApp.setId(app.getId()); + onboardingApp.setName(app.getAppName()); + onboardingApp.setImageUrl(app.getAppImageUrl()); + onboardingApp.setDescription(app.getAppDescription()); + onboardingApp.setNotes(app.getAppNotes()); + onboardingApp.setUrl(app.getAppUrl()); + onboardingApp.setAlternateUrl(app.getAppAlternateUrl()); + onboardingApp.setRestUrl(app.getAppRestEndpoint()); + onboardingApp.setIsOpen(app.getOpen()); + onboardingApp.setIsEnabled(app.getEnabled()); + onboardingApp.setUsername(app.getAppUsername()); + onboardingApp.setAppPassword((app.getAppPassword().equals(EPCommonSystemProperties.APP_DISPLAY_PASSWORD)) + ? EPCommonSystemProperties.APP_DISPLAY_PASSWORD : decryptedPassword(app.getAppPassword(), app)); + onboardingApp.setUebTopicName(app.getUebTopicName()); + onboardingApp.setUebKey(app.getUebKey()); + onboardingApp.setUebSecret(app.getUebSecret()); + onboardingApp.setIsCentralAuth(app.getAuthCentral()); + onboardingApp.setNameSpace(app.getAuthNamespace()); + onboardingApp.setRestrictedApp(app.isRestrictedApp()); + } + + private String decryptedPassword(String encryptedAppPwd, FnApp app) { + String result = ""; + if (encryptedAppPwd != null && !encryptedAppPwd.isEmpty()) { + try { + result = CipherUtil.decryptPKC(encryptedAppPwd, + SystemProperties.getProperty(SystemProperties.Decryption_Key)); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, + "decryptedPassword failed for app " + app.getAppName(), e); + } + } + return result; + } + + public List getUserRemoteApps(String id) { +/* StringBuilder sb = new StringBuilder(); + sb.append("SELECT * FROM FnApp join FN_USER_ROLE ON FN_USER_ROLE.APP_ID = FN_APP.APP_ID where "); + sb.append("FN_USER_ROLE.USER_ID = ").append(id).append(" AND FN_USER_ROLE.ROLE_ID != ") + .append(SUPER_ADMIN_ROLE_ID); + sb.append(" AND FN_APP.ENABLED = 'Y'"); + + Query query = entityManager.createQuery(sb.toString()); + List adminApps = query.getResultList();*/ + return new ArrayList<>(); + } + + public List saveAll(List fnApps) { + return fnAppDao.saveAll(fnApps); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/appContactUs/FnAppContactUsDao.java b/portal-BE/src/main/java/org/onap/portal/service/appContactUs/FnAppContactUsDao.java new file mode 100644 index 00000000..7b57e953 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/appContactUs/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.service.appContactUs; + +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 +interface FnAppContactUsDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/appContactUs/FnAppContactUsService.java b/portal-BE/src/main/java/org/onap/portal/service/appContactUs/FnAppContactUsService.java new file mode 100644 index 00000000..600d8325 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/appContactUs/FnAppContactUsService.java @@ -0,0 +1,22 @@ +package org.onap.portal.service.appContactUs; + +import org.onap.portal.domain.db.fn.FnAppContactUs; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class FnAppContactUsService { + + private final FnAppContactUsDao fnAppContactUsDao; + + @Autowired + public FnAppContactUsService(FnAppContactUsDao fnAppContactUsDao) { + this.fnAppContactUsDao = fnAppContactUsDao; + } + + public List saveAll(List fnAppContactUses) { + return fnAppContactUsDao.saveAll(fnAppContactUses); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/appFunction/EpAppFunctionDao.java b/portal-BE/src/main/java/org/onap/portal/service/appFunction/EpAppFunctionDao.java new file mode 100644 index 00000000..1f8c64b4 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/appFunction/EpAppFunctionDao.java @@ -0,0 +1,58 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.appFunction; + +import java.util.List; +import org.onap.portal.domain.db.ep.EpAppFunction; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +@Repository +@Transactional +interface EpAppFunctionDao extends JpaRepository { + + @Query + List getAppRoleFunctionList(final @Param("roleId") Long roleId, final @Param("appId") Long appId); + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/appFunction/EpAppFunctionService.java b/portal-BE/src/main/java/org/onap/portal/service/appFunction/EpAppFunctionService.java new file mode 100644 index 00000000..aa5e258a --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/appFunction/EpAppFunctionService.java @@ -0,0 +1,83 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.appFunction; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.stream.Collectors; + +import org.onap.portal.domain.db.ep.EpAppFunction; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class EpAppFunctionService { + + private final EpAppFunctionDao epAppFunctionDao; + + @Autowired + public EpAppFunctionService(EpAppFunctionDao epAppFunctionDao) { + this.epAppFunctionDao = epAppFunctionDao; + } + + public List getAppRoleFunctionList(final Long roleId, final Long appId) { + + return Optional.of(epAppFunctionDao.getAppRoleFunctionList(roleId, appId)) + .orElse(new ArrayList<>()) + .stream() + .filter(distinctByKey(EpAppFunction::getAppId)) + .filter(distinctByKey(EpAppFunction::getFunctionCd)) + .filter(distinctByKey(EpAppFunction::getFunctionName)) + .collect(Collectors.toList()); + } + + private Predicate distinctByKey(Function keyExtractor) { + List seen = new ArrayList<>(); + return t -> seen.add(keyExtractor.apply(t)); + } + + public List saveAll(List epAppFunctions) { + return epAppFunctionDao.saveAll(epAppFunctions); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/appRoleFunction/EpAppRoleFunctionDao.java b/portal-BE/src/main/java/org/onap/portal/service/appRoleFunction/EpAppRoleFunctionDao.java new file mode 100644 index 00000000..801c9385 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/appRoleFunction/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.service.appRoleFunction; + +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 +interface EpAppRoleFunctionDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/appRoleFunction/EpAppRoleFunctionService.java b/portal-BE/src/main/java/org/onap/portal/service/appRoleFunction/EpAppRoleFunctionService.java new file mode 100644 index 00000000..cb5383bf --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/appRoleFunction/EpAppRoleFunctionService.java @@ -0,0 +1,62 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.appRoleFunction; + +import org.onap.portal.domain.db.ep.EpAppRoleFunction; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class EpAppRoleFunctionService { + + private final EpAppRoleFunctionDao epAppRoleFunctionDao; + + @Autowired + public EpAppRoleFunctionService(EpAppRoleFunctionDao epAppRoleFunctionDao) { + this.epAppRoleFunctionDao = epAppRoleFunctionDao; + } + + public List saveAll(List epAppRoleFunctions) { + return epAppRoleFunctionDao.saveAll(epAppRoleFunctions); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/auditLog/FnAuditLogDao.java b/portal-BE/src/main/java/org/onap/portal/service/auditLog/FnAuditLogDao.java new file mode 100644 index 00000000..f6f4a336 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/auditLog/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.service.auditLog; + +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 +interface FnAuditLogDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/auditLog/FnAuditLogService.java b/portal-BE/src/main/java/org/onap/portal/service/auditLog/FnAuditLogService.java new file mode 100644 index 00000000..ef51aab1 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/auditLog/FnAuditLogService.java @@ -0,0 +1,22 @@ +package org.onap.portal.service.auditLog; + +import org.onap.portal.domain.db.fn.FnAuditLog; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class FnAuditLogService { + + private final FnAuditLogDao fnAuditLogDao; + + @Autowired + public FnAuditLogService(FnAuditLogDao fnAuditLogDao) { + this.fnAuditLogDao = fnAuditLogDao; + } + + public List saveAll(List auditLogs) { + return fnAuditLogDao.saveAll(auditLogs); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/basicAuthAccount/EpBasicAuthAccountDao.java b/portal-BE/src/main/java/org/onap/portal/service/basicAuthAccount/EpBasicAuthAccountDao.java new file mode 100644 index 00000000..9c3a0a8e --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/basicAuthAccount/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.service.basicAuthAccount; + +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 +interface EpBasicAuthAccountDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/basicAuthAccount/EpBasicAuthAccountService.java b/portal-BE/src/main/java/org/onap/portal/service/basicAuthAccount/EpBasicAuthAccountService.java new file mode 100644 index 00000000..3b23e918 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/basicAuthAccount/EpBasicAuthAccountService.java @@ -0,0 +1,20 @@ +package org.onap.portal.service.basicAuthAccount; + +import org.onap.portal.domain.db.ep.EpBasicAuthAccount; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class EpBasicAuthAccountService { + + private final EpBasicAuthAccountDao epBasicAuthAccountDao; + + @Autowired + public EpBasicAuthAccountService(EpBasicAuthAccountDao epBasicAuthAccountDao) { + this.epBasicAuthAccountDao = epBasicAuthAccountDao; + } + + public EpBasicAuthAccount save(EpBasicAuthAccount epBasicAuthAccount) { + return epBasicAuthAccountDao.save(epBasicAuthAccount); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/commonWidgetData/FnCommonWidgetDataDao.java b/portal-BE/src/main/java/org/onap/portal/service/commonWidgetData/FnCommonWidgetDataDao.java new file mode 100644 index 00000000..f18082dc --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/commonWidgetData/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.service.commonWidgetData; + +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 +interface FnCommonWidgetDataDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/commonWidgetData/FnCommonWidgetDataService.java b/portal-BE/src/main/java/org/onap/portal/service/commonWidgetData/FnCommonWidgetDataService.java new file mode 100644 index 00000000..940d3adc --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/commonWidgetData/FnCommonWidgetDataService.java @@ -0,0 +1,22 @@ +package org.onap.portal.service.commonWidgetData; + +import org.onap.portal.domain.db.fn.FnCommonWidgetData; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class FnCommonWidgetDataService { + + private final FnCommonWidgetDataDao fnCommonWidgetDataDao; + + @Autowired + public FnCommonWidgetDataService(FnCommonWidgetDataDao fnCommonWidgetDataDao) { + this.fnCommonWidgetDataDao = fnCommonWidgetDataDao; + } + + public List saveAll(List fnCommonWidgetDataList) { + return fnCommonWidgetDataDao.saveAll(fnCommonWidgetDataList); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/displayText/FnDisplayTextDao.java b/portal-BE/src/main/java/org/onap/portal/service/displayText/FnDisplayTextDao.java new file mode 100644 index 00000000..00449dc4 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/displayText/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.service.displayText; + +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 +interface FnDisplayTextDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/displayText/FnDisplayTextService.java b/portal-BE/src/main/java/org/onap/portal/service/displayText/FnDisplayTextService.java new file mode 100644 index 00000000..45870ca3 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/displayText/FnDisplayTextService.java @@ -0,0 +1,22 @@ +package org.onap.portal.service.displayText; + +import org.onap.portal.domain.db.fn.FnDisplayText; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class FnDisplayTextService { + + private final FnDisplayTextDao fnDisplayTextDao; + + @Autowired + public FnDisplayTextService(FnDisplayTextDao fnDisplayTextDao) { + this.fnDisplayTextDao = fnDisplayTextDao; + } + + public List saveAll(List fnDisplayTexts) { + return fnDisplayTextDao.saveAll(fnDisplayTexts); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/ep/EpAppFunctionService.java b/portal-BE/src/main/java/org/onap/portal/service/ep/EpAppFunctionService.java deleted file mode 100644 index 012983d3..00000000 --- a/portal-BE/src/main/java/org/onap/portal/service/ep/EpAppFunctionService.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Modifications Copyright (c) 2019 Samsung - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the "License"); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * - */ - -package org.onap.portal.service.ep; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.function.Function; -import java.util.function.Predicate; -import java.util.stream.Collectors; -import org.onap.portal.dao.ep.EpAppFunctionDao; -import org.onap.portal.domain.db.ep.EpAppFunction; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class EpAppFunctionService { - - private final EpAppFunctionDao epAppFunctionDao; - - @Autowired - public EpAppFunctionService(EpAppFunctionDao epAppFunctionDao) { - this.epAppFunctionDao = epAppFunctionDao; - } - - public List getAppRoleFunctionList(final Long roleId, final Long appId) { - - return Optional.of(epAppFunctionDao.getAppRoleFunctionList(roleId, appId)) - .orElse(new ArrayList<>()) - .stream() - .filter(distinctByKey(EpAppFunction::getAppId)) - .filter(distinctByKey(EpAppFunction::getFunctionCd)) - .filter(distinctByKey(EpAppFunction::getFunctionName)) - .collect(Collectors.toList()); - } - - private Predicate distinctByKey(Function keyExtractor) { - List seen = new ArrayList<>(); - return t -> seen.add(keyExtractor.apply(t)); - } -} 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 deleted file mode 100644 index ea0e69b6..00000000 --- a/portal-BE/src/main/java/org/onap/portal/service/ep/EpMicroserviceParameterService.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Modifications Copyright (c) 2019 Samsung - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the "License"); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * - */ - -package org.onap.portal.service.ep; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; -import org.hibernate.criterion.Criterion; -import org.hibernate.criterion.Restrictions; -import org.onap.portal.dao.ep.EpMicroserviceParameterDao; -import org.onap.portal.domain.db.ep.EpMicroserviceParameter; -import org.onap.portal.domain.dto.ecomp.MicroserviceParameter; -import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -@Transactional -public class EpMicroserviceParameterService { - - final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EpWidgetCatalogParameterService.class); - - private final EpMicroserviceParameterDao epMicroserviceParameterDao; - - @Autowired - public EpMicroserviceParameterService( - final EpMicroserviceParameterDao epMicroserviceParameterDao) { - this.epMicroserviceParameterDao = epMicroserviceParameterDao; - } - - public List getParametersById(long serviceId) { - List restrictionsList = new ArrayList<>(); - Criterion contextIdCrit = Restrictions.eq("serviceId", serviceId); - restrictionsList.add(contextIdCrit); - List list = mapToMicroserviceParameterList(epMicroserviceParameterDao.getParametersById(serviceId)); - logger.debug(EELFLoggerDelegate.debugLogger, - "getParametersById: microservice parameters list size: " + list.size()); - return list; - } - - private MicroserviceParameter epWidgetCatalogParameterToMicroserviceParameter( - final EpMicroserviceParameter microservice) { - return new MicroserviceParameter(microservice.getId(), microservice.getServiceId().getId(), - microservice.getParaKey(), microservice.getParaValue()); - } - - private List mapToMicroserviceParameterList(final List list){ - return list.stream().map(this::epWidgetCatalogParameterToMicroserviceParameter).collect(Collectors.toList()); - } - - public EpMicroserviceParameter save(EpMicroserviceParameter epMicroserviceParameter){ - return epMicroserviceParameterDao.save(epMicroserviceParameter); - } - - @Transactional - public boolean deleteMicroserviceParameterById(final Long paramid){ - try { - epMicroserviceParameterDao.deleteById(paramid); - return true; - }catch (Exception e){ - logger.error(EELFLoggerDelegate.errorLogger, e.getMessage()); - return false; - } - } -} diff --git a/portal-BE/src/main/java/org/onap/portal/service/ep/EpUserRolesRequestDetService.java b/portal-BE/src/main/java/org/onap/portal/service/ep/EpUserRolesRequestDetService.java deleted file mode 100644 index 11c78b46..00000000 --- a/portal-BE/src/main/java/org/onap/portal/service/ep/EpUserRolesRequestDetService.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Modifications Copyright (c) 2019 Samsung - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the "License"); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * - */ - -package org.onap.portal.service.ep; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import org.onap.portal.dao.ep.EpUserRolesRequestDetDao; -import org.onap.portal.domain.db.ep.EpUserRolesRequestDet; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -@Transactional -public class EpUserRolesRequestDetService { - private final EpUserRolesRequestDetDao epUserRolesRequestDetDao; - - @Autowired - public EpUserRolesRequestDetService(EpUserRolesRequestDetDao epUserRolesRequestDetDao) { - this.epUserRolesRequestDetDao = epUserRolesRequestDetDao; - } - - public EpUserRolesRequestDet saveOne(EpUserRolesRequestDet epUserRolesRequestDet){ - return epUserRolesRequestDetDao.save(epUserRolesRequestDet); - } - - public List appRolesRequestDetailList(final Long reqId){ - return Optional.of(epUserRolesRequestDetDao.appRolesRequestDetailList(reqId)).orElse(new ArrayList<>()); - } -} diff --git a/portal-BE/src/main/java/org/onap/portal/service/ep/EpUserRolesRequestService.java b/portal-BE/src/main/java/org/onap/portal/service/ep/EpUserRolesRequestService.java deleted file mode 100644 index 4f5326d7..00000000 --- a/portal-BE/src/main/java/org/onap/portal/service/ep/EpUserRolesRequestService.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Modifications Copyright (c) 2019 Samsung - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the "License"); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * - */ - -package org.onap.portal.service.ep; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import org.onap.portal.dao.ep.EpUserRolesRequestDao; -import org.onap.portal.domain.db.ep.EpUserRolesRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -@Transactional -public class EpUserRolesRequestService { - private final EpUserRolesRequestDao epUserRolesRequestDao; - - @Autowired - public EpUserRolesRequestService(EpUserRolesRequestDao epUserRolesRequestDao) { - this.epUserRolesRequestDao = epUserRolesRequestDao; - } - - public EpUserRolesRequest saveOne(EpUserRolesRequest epUserRolesRequest){ - return epUserRolesRequestDao.save(epUserRolesRequest); - } - - public List userAppRolesRequestList(final Long userId, final Long appId){ - return Optional.of(epUserRolesRequestDao.userAppRolesRequestList(userId, appId)).orElse(new ArrayList<>()); - } -} 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 deleted file mode 100644 index 029c316e..00000000 --- a/portal-BE/src/main/java/org/onap/portal/service/ep/EpWidgetCatalogParameterService.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Modifications Copyright (c) 2019 Samsung - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the "License"); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * - */ - -package org.onap.portal.service.ep; - -import java.util.ArrayList; -import java.util.List; -import org.onap.portal.dao.ep.EpWidgetCatalogParameterDao; -import org.onap.portal.domain.db.ep.EpWidgetCatalogParameter; -import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -@Transactional -public class EpWidgetCatalogParameterService { - - final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EpWidgetCatalogParameterService.class); - - private final EpWidgetCatalogParameterDao epWidgetCatalogParameterDao; - private final EpMicroserviceParameterService epMicroserviceParameterService; - - @Autowired - public EpWidgetCatalogParameterService( - final EpWidgetCatalogParameterDao epWidgetCatalogParameterDao, - final EpMicroserviceParameterService epMicroserviceParameterService) { - this.epWidgetCatalogParameterDao = epWidgetCatalogParameterDao; - this.epMicroserviceParameterService = epMicroserviceParameterService; - } - - public List getUserParameterById(final Long paramId) { - return epWidgetCatalogParameterDao.retrieveByParamId(paramId).orElse(new ArrayList<>()); - } - - public boolean deleteUserParameterById(final Long paramId) { - return (deleteByParamId(paramId) && - epMicroserviceParameterService.deleteMicroserviceParameterById(paramId)); - } - - public EpWidgetCatalogParameter getById(final Long id){ - return epWidgetCatalogParameterDao.getOne(id); - } - - @Transactional - public boolean deleteByParamId(final Long paramId) { - try { - epWidgetCatalogParameterDao.deleteWidgetCatalogParameter(paramId); - return true; - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, e.getMessage()); - return false; - } - } - - public EpWidgetCatalogParameter getUserParamById(final Long widgetId, final Long userId, final Long paramId) { - EpWidgetCatalogParameter widgetParam = null; - List list = epWidgetCatalogParameterDao - .getUserParamById(widgetId, userId, paramId) - .orElse(null); - if (list != null && !list.isEmpty()) { - widgetParam = list.get(0); - } - logger.debug(EELFLoggerDelegate.debugLogger, - "getUserParamById: widget parameters: " + widgetParam); - return widgetParam; - } - - public void saveUserParameter(final EpWidgetCatalogParameter newParameter) { - epWidgetCatalogParameterDao.save(newParameter); - } -} diff --git a/portal-BE/src/main/java/org/onap/portal/service/ep/EpWidgetCatalogService.java b/portal-BE/src/main/java/org/onap/portal/service/ep/EpWidgetCatalogService.java deleted file mode 100644 index f0c273ad..00000000 --- a/portal-BE/src/main/java/org/onap/portal/service/ep/EpWidgetCatalogService.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.onap.portal.service.ep; - -import org.onap.portal.dao.fn.EpWidgetCatalogDao; -import org.onap.portal.domain.db.ep.EpWidgetCatalog; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class EpWidgetCatalogService { - - private final EpWidgetCatalogDao epWidgetCatalogDao; - - @Autowired - public EpWidgetCatalogService(EpWidgetCatalogDao epWidgetCatalogDao) { - this.epWidgetCatalogDao = epWidgetCatalogDao; - } - - public EpWidgetCatalog save(final EpWidgetCatalog epWidgetCatalog){ - return epWidgetCatalogDao.save(epWidgetCatalog); - } -} 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 deleted file mode 100644 index 6e3c2879..00000000 --- a/portal-BE/src/main/java/org/onap/portal/service/fn/FnAppService.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Modifications Copyright (c) 2019 Samsung - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the "License"); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * - */ - -package org.onap.portal.service.fn; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import javax.persistence.EntityExistsException; -import javax.persistence.EntityManager; -import org.onap.portal.dao.fn.FnAppDao; -import org.onap.portal.domain.db.fn.FnApp; -import org.onap.portal.domain.dto.transport.OnboardingApp; -import org.onap.portal.utils.EPCommonSystemProperties; -import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.onap.portalsdk.core.onboarding.util.CipherUtil; -import org.onap.portalsdk.core.util.SystemProperties; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class FnAppService { - - private static final String SUPER_ADMIN_ROLE_ID = "1"; - - private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnAppService.class); - - private final FnAppDao fnAppDao; - private final EntityManager entityManager; - - @Autowired - public FnAppService(final FnAppDao fnAppDao, EntityManager entityManager) { - this.fnAppDao = fnAppDao; - this.entityManager = entityManager; - } - - public List getAppsFullList() { - return fnAppDao.findAll(); - } - - public FnApp getById(final Long id) { - return Optional.of(fnAppDao.getOne(id)).orElseThrow(EntityExistsException::new); - } - - public List getByUebKey(final String uebKey){ - return Optional.of(fnAppDao.getByUebKey(uebKey)).orElse(new ArrayList<>()); - } - - public List getCentralizedApps(){ - return Optional.of(fnAppDao.getCentralizedApps()).orElse(new ArrayList<>()); - } - - public void createOnboardingFromApp(FnApp app, OnboardingApp onboardingApp) { - onboardingApp.setId(app.getId()); - onboardingApp.setName(app.getAppName()); - onboardingApp.setImageUrl(app.getAppImageUrl()); - onboardingApp.setDescription(app.getAppDescription()); - onboardingApp.setNotes(app.getAppNotes()); - onboardingApp.setUrl(app.getAppUrl()); - onboardingApp.setAlternateUrl(app.getAppAlternateUrl()); - onboardingApp.setRestUrl(app.getAppRestEndpoint()); - onboardingApp.setIsOpen(app.getOpen()); - onboardingApp.setIsEnabled(app.getEnabled()); - onboardingApp.setUsername(app.getAppUsername()); - onboardingApp.setAppPassword((app.getAppPassword().equals(EPCommonSystemProperties.APP_DISPLAY_PASSWORD)) - ? EPCommonSystemProperties.APP_DISPLAY_PASSWORD : decryptedPassword(app.getAppPassword(), app)); - onboardingApp.setUebTopicName(app.getUebTopicName()); - onboardingApp.setUebKey(app.getUebKey()); - onboardingApp.setUebSecret(app.getUebSecret()); - onboardingApp.setIsCentralAuth(app.getAuthCentral()); - onboardingApp.setNameSpace(app.getAuthNamespace()); - onboardingApp.setRestrictedApp(app.isRestrictedApp()); - } - - private String decryptedPassword(String encryptedAppPwd, FnApp app) { - String result = ""; - if (encryptedAppPwd != null && !encryptedAppPwd.isEmpty()) { - try { - result = CipherUtil.decryptPKC(encryptedAppPwd, - SystemProperties.getProperty(SystemProperties.Decryption_Key)); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "decryptedPassword failed for app " + app.getAppName(), e); - } - } - return result; - } - - List getUserRemoteApps(String id) { -/* StringBuilder sb = new StringBuilder(); - sb.append("SELECT * FROM FnApp join FN_USER_ROLE ON FN_USER_ROLE.APP_ID = FN_APP.APP_ID where "); - sb.append("FN_USER_ROLE.USER_ID = ").append(id).append(" AND FN_USER_ROLE.ROLE_ID != ") - .append(SUPER_ADMIN_ROLE_ID); - sb.append(" AND FN_APP.ENABLED = 'Y'"); - - Query query = entityManager.createQuery(sb.toString()); - List adminApps = query.getResultList();*/ - return new ArrayList<>(); - } -} 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 deleted file mode 100644 index c39a12b6..00000000 --- a/portal-BE/src/main/java/org/onap/portal/service/fn/FnLanguageService.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Modifications Copyright (c) 2019 Samsung - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the "License"); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * - */ - -package org.onap.portal.service.fn; - -import java.security.Principal; -import java.util.List; -import java.util.Optional; -import org.onap.portal.dao.fn.FnLanguageDao; -import org.onap.portal.domain.db.fn.FnLanguage; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -@EnableAspectJAutoProxy -@Transactional -public class FnLanguageService { - private final FnLanguageDao fnLanguageDao; - - @Autowired - public FnLanguageService(final FnLanguageDao fnLanguageDao) { - this.fnLanguageDao = fnLanguageDao; - } - - public Optional findById(final Long id){ - return fnLanguageDao.findById(id); - } - public List getLanguages(Principal principal){ - return fnLanguageDao.findAll(); - } - public FnLanguage save(final FnLanguage fnLanguage){ - return fnLanguageDao.saveAndFlush(fnLanguage); - } -} diff --git a/portal-BE/src/main/java/org/onap/portal/service/fn/FnLuTimezoneService.java b/portal-BE/src/main/java/org/onap/portal/service/fn/FnLuTimezoneService.java deleted file mode 100644 index ebb5d332..00000000 --- a/portal-BE/src/main/java/org/onap/portal/service/fn/FnLuTimezoneService.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Modifications Copyright (c) 2019 Samsung - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the "License"); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * - */ - -package org.onap.portal.service.fn; - -import java.util.Optional; -import org.onap.portal.dao.fn.FnLuTimezoneDao; -import org.onap.portal.domain.db.fn.FnLuTimezone; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -@Transactional -public class FnLuTimezoneService { - private final FnLuTimezoneDao fnLuTimezoneDao; - - @Autowired - public FnLuTimezoneService(final FnLuTimezoneDao fnLuTimezoneDao) { - this.fnLuTimezoneDao = fnLuTimezoneDao; - } - - public Optional getById(Long id){ - return fnLuTimezoneDao.findById(id); - } -} diff --git a/portal-BE/src/main/java/org/onap/portal/service/fn/FnMenuFunctionalRolesService.java b/portal-BE/src/main/java/org/onap/portal/service/fn/FnMenuFunctionalRolesService.java deleted file mode 100644 index c1747da1..00000000 --- a/portal-BE/src/main/java/org/onap/portal/service/fn/FnMenuFunctionalRolesService.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Modifications Copyright (c) 2019 Samsung - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the "License"); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * - */ - -package org.onap.portal.service.fn; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import org.onap.portal.dao.fn.FnMenuFunctionalRolesDao; -import org.onap.portal.domain.db.fn.FnMenuFunctionalRoles; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class FnMenuFunctionalRolesService { - private final FnMenuFunctionalRolesDao fnMenuFunctionalRolesDao; - - @Autowired - public FnMenuFunctionalRolesService(FnMenuFunctionalRolesDao fnMenuFunctionalRolesDao) { - this.fnMenuFunctionalRolesDao = fnMenuFunctionalRolesDao; - } - - public void deleteById(final Long id){ - fnMenuFunctionalRolesDao.deleteById(id); - } - - public void delete(final FnMenuFunctionalRoles id){ - fnMenuFunctionalRolesDao.delete(id); - } - - public List retrieveByroleId(final Long roleId){ - return Optional.of(fnMenuFunctionalRolesDao.retrieveByRoleId(roleId)).orElse(new ArrayList<>()); - } - - public List retrieveByMenuId(final Long menuId){ - return Optional.of(fnMenuFunctionalRolesDao.retrieveByMenuId(menuId)).orElse(new ArrayList<>()); - } - -} diff --git a/portal-BE/src/main/java/org/onap/portal/service/fn/FnMenuFunctionalService.java b/portal-BE/src/main/java/org/onap/portal/service/fn/FnMenuFunctionalService.java deleted file mode 100644 index 97f3188a..00000000 --- a/portal-BE/src/main/java/org/onap/portal/service/fn/FnMenuFunctionalService.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Modifications Copyright (c) 2019 Samsung - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the "License"); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * - */ - -package org.onap.portal.service.fn; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import org.onap.portal.dao.fn.FnMenuFunctionalDao; -import org.onap.portal.domain.db.fn.FnMenuFunctional; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class FnMenuFunctionalService { - - private final FnMenuFunctionalDao fnMenuFunctionalDao; - - @Autowired - public FnMenuFunctionalService(FnMenuFunctionalDao fnMenuFunctionalDao) { - this.fnMenuFunctionalDao = fnMenuFunctionalDao; - } - - public List retrieveByMenuId(final Long menuId) { - return Optional.of(fnMenuFunctionalDao.retrieveByMenuId(menuId)).orElse(new ArrayList<>()); - } - -} 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 deleted file mode 100644 index 39a886c2..00000000 --- a/portal-BE/src/main/java/org/onap/portal/service/fn/FnRoleService.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Modifications Copyright (c) 2019 Samsung - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the "License"); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * - */ - -package org.onap.portal.service.fn; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import javax.persistence.EntityExistsException; -import org.onap.portal.dao.fn.FnRoleDao; -import org.onap.portal.domain.db.fn.FnRole; -import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -@Transactional -public class FnRoleService { - - private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnRoleService.class); - - - private final FnRoleDao fnRoleDao; - - @Autowired - public FnRoleService(FnRoleDao fnRoleDao) { - this.fnRoleDao = fnRoleDao; - } - - public FnRole getById(final Long id) { - return fnRoleDao.findById(id).orElseThrow(EntityExistsException::new); - } - - public FnRole getRole(final Long appId, final Long appRoleId) { - List roles = Optional.of(fnRoleDao.retrieveAppRoleByAppRoleIdAndByAppId(appId, appRoleId)) - .orElse(new ArrayList<>()); - if (!roles.isEmpty()) { - logger.error(EELFLoggerDelegate.errorLogger, - String.format( - "search by appId=%s, appRoleid=%s should have returned 0 or 1 results. Got %d. This is an internal server error.", - appId, appRoleId, roles.size())); - logger.error(EELFLoggerDelegate.errorLogger, - "Trying to recover from duplicates by returning the first search result. This issue should be treated, it is probably not critical because duplicate roles should be similar."); - return roles.get(0); - } - return null; - } - - public List getAppRoles(Long appId) { - List applicationRoles; - try { - if (appId == 1) { - applicationRoles = retrieveAppRolesWhereAppIdIsNull(); - } else { - applicationRoles = retrieveAppRolesByAppId(appId); - } - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "getAppRoles: failed", e); - throw e; - } - return applicationRoles; - } - - public List retrieveAppRoleByAppRoleIdAndByAppId(final Long appId, final Long appRoleId) { - return Optional.of(fnRoleDao.retrieveAppRoleByAppRoleIdAndByAppId(appId, appRoleId)).orElse(new ArrayList<>()); - } - - public List getUserRoleOnUserIdAndAppId(final Long userId, final Long appId) { - return Optional.of(fnRoleDao.getUserRoleOnUserIdAndAppId(userId, appId)).orElse(new ArrayList<>()); - } - - public List retrieveAppRoleByRoleIdWhereAppIdIsNull(final Long roleId) { - return Optional.of(fnRoleDao.retrieveAppRoleByRoleIdWhereAppIdIsNull(roleId)).orElse(new ArrayList<>()); - } - - public List retrieveAppRolesWhereAppIdIsNull() { - return Optional.of(fnRoleDao.retrieveAppRolesWhereAppIdIsNull()).orElse(new ArrayList<>()); - } - - public List retrieveAppRolesByAppId(final Long id) { - return Optional.of(fnRoleDao.retrieveAppRolesByAppId(id)).orElse(new ArrayList<>()); - } - - public List retrieveAppRolesByRoleNameAndByAppId(final String roleName, final Long appId) { - return Optional.of(fnRoleDao.retrieveAppRolesByRoleNameAndByAppId(roleName, appId)).orElse(new ArrayList<>()); - } - - public List retrieveActiveRolesOfApplication(final Long appId) { - return Optional.of(fnRoleDao.retrieveActiveRolesOfApplication(appId)).orElse(new ArrayList<>()); - } - - public List getGlobalRolesOfPortal() { - List globalRoles = new ArrayList<>(); - try { - globalRoles = Optional.of(fnRoleDao.getGlobalRolesOfPortal()).orElse(new ArrayList<>()); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "getGlobalRolesOfPortal failed", e); - } - return globalRoles; - } - - public Long getSysAdminRoleId(){ - FnRole role = fnRoleDao.getSysAdminRoleId(); - return role.getId(); - } - - public void delete(FnRole role) { - fnRoleDao.delete(role); - } - - public FnRole saveOne(final FnRole role){ - return fnRoleDao.save(role); - } -} 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 deleted file mode 100644 index fac4b14a..00000000 --- a/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserRoleService.java +++ /dev/null @@ -1,539 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Modifications Copyright (c) 2019 Samsung - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the "License"); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * - */ - -package org.onap.portal.service.fn; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Optional; -import java.util.Set; -import java.util.SortedSet; -import java.util.stream.Collectors; -import javax.persistence.EntityManager; -import javax.persistence.Tuple; -import javax.servlet.http.HttpServletResponse; -import org.apache.cxf.transport.http.HTTPException; -import org.onap.portal.dao.fn.FnUserRoleDao; -import org.onap.portal.domain.db.ep.EpUserRolesRequest; -import org.onap.portal.domain.db.ep.EpUserRolesRequestDet; -import org.onap.portal.domain.db.fn.FnApp; -import org.onap.portal.domain.db.fn.FnRole; -import org.onap.portal.domain.db.fn.FnUser; -import org.onap.portal.domain.db.fn.FnUserRole; -import org.onap.portal.domain.dto.ecomp.EPUserAppCatalogRoles; -import org.onap.portal.domain.dto.ecomp.ExternalSystemAccess; -import org.onap.portal.domain.dto.transport.AppWithRolesForUser; -import org.onap.portal.domain.dto.transport.FieldsValidator; -import org.onap.portal.domain.dto.transport.RemoteRole; -import org.onap.portal.domain.dto.transport.RemoteUserWithRoles; -import org.onap.portal.domain.dto.transport.Role; -import org.onap.portal.domain.dto.transport.RoleInAppForUser; -import org.onap.portal.domain.dto.transport.UserApplicationRoles; -import org.onap.portal.service.ApplicationsRestClientService; -import org.onap.portal.service.ep.EpAppFunctionService; -import org.onap.portal.service.ep.EpUserRolesRequestDetService; -import org.onap.portal.service.ep.EpUserRolesRequestService; -import org.onap.portal.utils.EPCommonSystemProperties; -import org.onap.portal.utils.PortalConstants; -import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.onap.portalsdk.core.restful.domain.EcompRole; -import org.onap.portalsdk.core.util.SystemProperties; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -@Transactional -public class FnUserRoleService { - - private static final String GET_ROLE_FUNCTIONS_OF_USERFOR_ALLTHE_APPLICATIONS = - "select\n" - + " distinct ep.function_cd functionCd\n" - + "from\n" - + " fn_user_role fu,\n" - + " ep_app_role_function ep,\n" - + " ep_app_function ea\n" - + "where\n" - + " fu.role_id = ep.role_id\n" - + " and fu.app_id = ep.app_id\n" - + " and fu.user_id = 'userId'\n" - + " and ea.function_cd = ep.function_cd\n" - + " and exists (\n" - + " select\n" - + " fa.app_id\n" - + " from\n" - + " fn_user fu,\n" - + " fn_user_role ur,\n" - + " fn_app fa\n" - + " where\n" - + " fu.user_id = 'userId'\n" - + " and fu.user_id = ur.user_id\n" - + " and ur.app_id = fa.app_id\n" - + " and fa.enabled = 'Y'\n" - + " )"; - - private static final String USER_APP_CATALOG_ROLES = - "select\n" - + " A.reqId as reqId,\n" - + " B.requestedRoleId.id as requestedRoleId,\n" - + " A.requestStatus as requestStatus,\n" - + " A.appId.id as appId,\n" - + " (\n" - + " select\n" - + " roleName\n" - + " from\n" - + " FnRole\n" - + " where\n" - + " id = B.requestedRoleId.id\n" - + " ) as roleName\n" - + "from\n" - + " EpUserRolesRequest A\n" - + " left join EpUserRolesRequestDet B on A.reqId = B.reqId.reqId\n" - + "where\n" - + " A.userId.id = :userid\n" - + " and A.appId IN (\n" - + " select\n" - + " id\n" - + " from\n" - + " FnApp\n" - + " where\n" - + " appName = :appName\n" - + " )\n" - + " and A.requestStatus = 'P'\n"; - - private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnUserRoleService.class); - - private final FnUserRoleDao fnUserRoleDao; - private final FnAppService fnAppService; - private final FnRoleService fnRoleService; - private final FnUserService fnUserService; - private final EpUserRolesRequestService epUserRolesRequestService; - private final EpUserRolesRequestDetService epUserRolesRequestDetService; - private final EntityManager entityManager; - private final ApplicationsRestClientService applicationsRestClientService; - - @Autowired - public FnUserRoleService(FnUserRoleDao - fnUserRoleDao, - FnAppService fnAppService, - FnRoleService fnRoleService, - FnUserService fnUserService, - EpUserRolesRequestService epUserRolesRequestService, - EpUserRolesRequestDetService epUserRolesRequestDetService, - EntityManager entityManager, - ApplicationsRestClientService applicationsRestClientService) { - this.fnUserRoleDao = fnUserRoleDao; - this.fnAppService = fnAppService; - this.fnRoleService = fnRoleService; - this.fnUserService = fnUserService; - this.epUserRolesRequestService = epUserRolesRequestService; - this.epUserRolesRequestDetService = epUserRolesRequestDetService; - this.entityManager = entityManager; - this.applicationsRestClientService = applicationsRestClientService; - } - - public List getAdminUserRoles(final Long userId, final Long roleId, final Long appId) { - return fnUserRoleDao.getAdminUserRoles(userId, roleId, appId).orElse(new ArrayList<>()); - } - - public boolean isSuperAdmin(final String loginId, final Long roleId, final Long appId) { - List roles = getUserRolesForRoleIdAndAppId(roleId, appId).stream() - .filter(role -> role.getUserId().getOrgUserId().equals(loginId)).collect(Collectors.toList()); - return !roles.isEmpty(); - } - - public List getUserRolesForRoleIdAndAppId(final Long roleId, final Long appId) { - return Optional.of(fnUserRoleDao.retrieveByAppIdAndRoleId(appId, roleId)).orElse(new ArrayList<>()); - } - - public List retrieveByUserIdAndRoleId(final Long userId, final Long roleId){ - return Optional.of(fnUserRoleDao.retrieveByUserIdAndRoleId(userId, roleId)).orElse(new ArrayList<>()); - } - - public FnUserRole saveOne(final FnUserRole fnUserRole) { - return fnUserRoleDao.save(fnUserRole); - } - - public ExternalSystemAccess getExternalRequestAccess() { - ExternalSystemAccess res = null; - try { - res = new ExternalSystemAccess(EPCommonSystemProperties.EXTERNAL_ACCESS_ENABLE, - Boolean.parseBoolean( - SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_ACCESS_ENABLE))); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "getExternalRequestAccess failed" + e.getMessage()); - } - return res; - } - - public List getUserAppCatalogRoles(FnUser userid, String appName) { - List tuples = entityManager.createQuery(USER_APP_CATALOG_ROLES, Tuple.class) - .setParameter("userid", userid.getId()) - .setParameter("appName", appName) - .getResultList(); - return Optional.of(tuples.stream().map(this::tupleToEPUserAppCatalogRoles).collect(Collectors.toList())) - .orElse(new ArrayList<>()); - } - - private EPUserAppCatalogRoles tupleToEPUserAppCatalogRoles(Tuple tuple) { - return new EPUserAppCatalogRoles((Long) tuple.get("reqId"), (Long) tuple.get("requestedRoleId"), - (String) tuple.get("roleName"), (String) tuple.get("requestStatus"), (Long) tuple.get("appId")); - } - - private boolean postUserRolesToMylogins(AppWithRolesForUser userAppRolesData, - ApplicationsRestClientService applicationsRestClientService, Long appId, Long userId) - throws JsonProcessingException, HTTPException { - boolean result = false; - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - String userRolesAsString = mapper.writeValueAsString(userAppRolesData); - logger.error(EELFLoggerDelegate.errorLogger, - "Should not be reached here, as the endpoint is not defined yet from the Mylogins"); - applicationsRestClientService.post(AppWithRolesForUser.class, appId, userRolesAsString, - String.format("/user/%s/myLoginroles", userId)); - return result; - } - - public FieldsValidator putUserAppRolesRequest(AppWithRolesForUser newAppRolesForUser, FnUser user) { - FieldsValidator fieldsValidator = new FieldsValidator(); - List appRole; - try { - logger.error(EELFLoggerDelegate.errorLogger, - "Should not be reached here, still the endpoint is yet to be defined"); - boolean result = postUserRolesToMylogins(newAppRolesForUser, applicationsRestClientService, - newAppRolesForUser.getAppId(), user.getId()); - logger.debug(EELFLoggerDelegate.debugLogger, "putUserAppRolesRequest: result {}", result); - FnApp app = fnAppService.getById(newAppRolesForUser.getAppId()); - EpUserRolesRequest epUserRolesRequest = new EpUserRolesRequest(); - epUserRolesRequest.setCreatedDate(LocalDateTime.now()); - epUserRolesRequest.setUpdatedDate(LocalDateTime.now()); - epUserRolesRequest.setUserId(user); - epUserRolesRequest.setAppId(app); - epUserRolesRequest.setRequestStatus("P"); - List appRoleIdList = newAppRolesForUser.getAppRoles(); - Set appRoleDetails = new LinkedHashSet<>(); - epUserRolesRequestService.saveOne(epUserRolesRequest); - for (RoleInAppForUser userAppRoles : appRoleIdList) { - Boolean isAppliedVal = userAppRoles.getIsApplied(); - if (isAppliedVal) { - appRole = fnRoleService - .retrieveAppRoleByAppRoleIdAndByAppId(newAppRolesForUser.getAppId(), - userAppRoles.getRoleId()); - if (!appRole.isEmpty()) { - EpUserRolesRequestDet epAppRoleDetail = new EpUserRolesRequestDet(); - epAppRoleDetail.setRequestedRoleId(appRole.get(0)); - epAppRoleDetail.setRequestType("P"); - epAppRoleDetail.setReqId(epUserRolesRequest); - epUserRolesRequestDetService.saveOne(epAppRoleDetail); - } - } - } - epUserRolesRequest.setEpRequestIdDetail(appRoleDetails); - fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_OK); - - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "putUserAppRolesRequest failed", e); - fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - } - return fieldsValidator; - } - - public List importRolesFromRemoteApplication(Long appId) throws HTTPException { - FnRole[] appRolesFull = applicationsRestClientService.get(FnRole[].class, appId, "/rolesFull"); - List rolesList = Arrays.asList(appRolesFull); - for (FnRole externalAppRole : rolesList) { - - // Try to find an existing extern role for the app in the local - // onap DB. If so, then use its id to update the existing external - // application role record. - Long externAppId = externalAppRole.getId(); - FnRole existingAppRole = fnRoleService.getRole(appId, externAppId); - if (existingAppRole != null) { - logger.debug(EELFLoggerDelegate.debugLogger, - String.format( - "ecomp role already exists for app=%s; appRoleId=%s. No need to import this one.", - appId, externAppId)); - } - } - - return rolesList; - } - - public List getUsersFromAppEndpoint(Long appId) throws HTTPException { - ArrayList userApplicationRoles = new ArrayList<>(); - - FnApp app = fnAppService.getById(appId); - //If local or centralized application - if (PortalConstants.PORTAL_APP_ID.equals(appId) || app.getAuthCentral()) { - List userList = fnUserService.getActiveUsers(); - for (FnUser user : userList) { - UserApplicationRoles userWithAppRoles = convertToUserApplicationRoles(appId, user, app); - if (userWithAppRoles.getRoles() != null && userWithAppRoles.getRoles().size() > 0) { - userApplicationRoles.add(userWithAppRoles); - } - } - - } - // remote app - else { - RemoteUserWithRoles[] remoteUsers; - String remoteUsersString = applicationsRestClientService.getIncomingJsonString(appId, "/users"); - - remoteUsers = doGetUsers(remoteUsersString); - - userApplicationRoles = new ArrayList<>(); - for (RemoteUserWithRoles remoteUser : remoteUsers) { - UserApplicationRoles userWithRemoteAppRoles = convertToUserApplicationRoles(appId, - remoteUser); - if (userWithRemoteAppRoles.getRoles() != null - && userWithRemoteAppRoles.getRoles().size() > 0) { - userApplicationRoles.add(userWithRemoteAppRoles); - } else { - logger.debug(EELFLoggerDelegate.debugLogger, - "User " + userWithRemoteAppRoles.getOrgUserId() - + " doesn't have any roles assigned to any app."); - } - } - } - - return userApplicationRoles; - } - - private UserApplicationRoles convertToUserApplicationRoles(Long appId, RemoteUserWithRoles remoteUser) { - UserApplicationRoles userWithRemoteAppRoles = new UserApplicationRoles(); - userWithRemoteAppRoles.setAppId(appId); - userWithRemoteAppRoles.setOrgUserId(remoteUser.getOrgUserId()); - userWithRemoteAppRoles.setFirstName(remoteUser.getFirstName()); - userWithRemoteAppRoles.setLastName(remoteUser.getLastName()); - userWithRemoteAppRoles.setRoles(remoteUser.getRoles()); - return userWithRemoteAppRoles; - } - - private RemoteUserWithRoles[] doGetUsers(String remoteUsersString) { - - ObjectMapper mapper = new ObjectMapper(); - try { - return mapper.readValue(remoteUsersString, RemoteUserWithRoles[].class); - } catch (IOException e) { - logger.error(EELFLoggerDelegate.errorLogger, - "doGetUsers : Failed : Unexpected property in incoming JSON", - e); - logger.error(EELFLoggerDelegate.errorLogger, - "doGetUsers : Incoming JSON that caused it --> " + remoteUsersString); - } - - return new RemoteUserWithRoles[0]; - } - - private UserApplicationRoles convertToUserApplicationRoles(Long appId, FnUser user, FnApp app) { - UserApplicationRoles userWithRemoteAppRoles = new UserApplicationRoles(); - userWithRemoteAppRoles.setAppId(appId); - userWithRemoteAppRoles.setOrgUserId(user.getOrgUserId()); - userWithRemoteAppRoles.setFirstName(user.getFirstName()); - userWithRemoteAppRoles.setLastName(user.getLastName()); - userWithRemoteAppRoles.setRoles(convertToRemoteRoleList(user, app)); - return userWithRemoteAppRoles; - } - - private List convertToRemoteRoleList(FnUser user, FnApp app) { - List roleList = new ArrayList<>(); - SortedSet roleSet = user.getAppEPRoles(app); - for (FnRole role : roleSet) { - logger.debug(EELFLoggerDelegate.debugLogger, - "In convertToRemoteRoleList() - for user {}, found Name {}", user.getOrgUserId(), - role.getRoleName()); - RemoteRole rRole = new RemoteRole(); - rRole.setId(role.getId()); - rRole.setName(role.getRoleName()); - roleList.add(rRole); - } - - //Get the active roles of user for that application using query - List userEpRoleList = fnRoleService.getUserRoleOnUserIdAndAppId(user.getId(), app.getId()); - - for (FnRole remoteUserRoleList : userEpRoleList) { - - RemoteRole remoteRoleListId = roleList.stream() - .filter(x -> remoteUserRoleList.getId().equals(x.getId())) - .findAny().orElse(null); - if (remoteRoleListId == null) { - logger.debug(EELFLoggerDelegate.debugLogger, - "Adding the role to the rolelist () - for user {}, found Name {}", - user.getOrgUserId(), - - remoteUserRoleList.getRoleName()); - RemoteRole role = new RemoteRole(); - role.setId(remoteUserRoleList.getId()); - role.setName(remoteUserRoleList.getRoleName()); - - roleList.add(role); - } - - } - - logger.debug(EELFLoggerDelegate.debugLogger, - "rolelist size of the USER() - for user {}, found RoleListSize {}", user.getOrgUserId(), - roleList.size()); - return roleList; - } - - public List getRoleFunctionsOfUserforAlltheApplications(Long userId) { - List tuples = entityManager - .createQuery(GET_ROLE_FUNCTIONS_OF_USERFOR_ALLTHE_APPLICATIONS, Tuple.class) - .setParameter("userid", userId) - .getResultList(); - return Optional.of(tuples.stream().map(tuple -> tuple.get("functionCd")).collect(Collectors.toList())) - .orElse(new ArrayList<>()); - } - - public List retrieveByAppIdAndUserId(final Long appId, final String userId) { - return Optional.of(fnUserRoleDao.retrieveByAppIdAndUserId(appId, userId)).orElse(new ArrayList<>()); - } - - public String updateRemoteUserProfile(String orgUserId, long appId) { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - FnUser client = fnUserService.loadUserByUsername(orgUserId); - FnUser newUser = new FnUser(); - newUser.setActiveYn(client.getActiveYn()); - newUser.setFirstName(client.getFirstName()); - newUser.setLastName(client.getLastName()); - newUser.setLoginId(client.getLoginId()); - newUser.setLoginPwd(client.getLoginPwd()); - newUser.setMiddleName(client.getMiddleName()); - newUser.setEmail(client.getEmail()); - newUser.setOrgUserId(client.getLoginId()); - try { - String userAsString = mapper.writeValueAsString(newUser); - List appList = fnAppService.getUserRemoteApps(client.getId().toString()); - // applicationsRestClientService.post(EPUser.class, appId, - // userAsString, String.format("/user", orgUserId)); - for (FnApp eachApp : appList) { - try { - applicationsRestClientService.post(FnUser.class, eachApp.getId(), userAsString, - String.format("/user/%s", orgUserId)); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "Failed to update user: " + client.getOrgUserId() - + " in remote app. appId = " + eachApp.getId()); - } - } - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "updateRemoteUserProfile failed", e); - return "failure"; - } - return "success"; - } - - public void deleteById(final Long id) { - fnUserRoleDao.deleteById(id); - } - - public List constructRolesInAppForUserGet(List appRoles, FnRole[] userAppRoles, - Boolean extRequestValue) { - List rolesInAppForUser = new ArrayList<>(); - - Set userAppRolesMap = new HashSet<>(); - if (userAppRoles != null) { - for (FnRole ecompRole : userAppRoles) { - userAppRolesMap.add(ecompRole.getAppId()); - } - logger.debug(EELFLoggerDelegate.debugLogger, "In constructRolesInAppForUserGet() - userAppRolesMap = {}", - userAppRolesMap); - - } else { - logger.error(EELFLoggerDelegate.errorLogger, - "constructRolesInAppForUserGet has received userAppRoles list empty."); - } - - if (appRoles != null) { - for (Role ecompRole : appRoles) { - logger.debug(EELFLoggerDelegate.debugLogger, "In constructRolesInAppForUserGet() - appRoles not null = {}", - ecompRole); - - if (ecompRole.getId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID) && !extRequestValue) { - continue; - } - RoleInAppForUser roleForUser = new RoleInAppForUser(ecompRole.getId(), ecompRole.getRoleName()); - roleForUser.setIsApplied(userAppRolesMap.contains(ecompRole.getId())); - rolesInAppForUser.add(roleForUser); - logger.debug(EELFLoggerDelegate.debugLogger, "In constructRolesInAppForUserGet() - rolesInAppForUser = {}", - rolesInAppForUser); - - } - } else { - logger.error(EELFLoggerDelegate.errorLogger, - "constructRolesInAppForUser has received appRoles list empty."); - } - return rolesInAppForUser; - } - - public List constructRolesInAppForUserGet(EcompRole[] appRoles, EcompRole[] userAppRoles) { - List rolesInAppForUser = new ArrayList<>(); - - Set userAppRolesMap = new HashSet<>(); - if (userAppRoles != null) { - for (EcompRole ecompRole : userAppRoles) { - userAppRolesMap.add(ecompRole.getId()); - } - } else { - logger.error(EELFLoggerDelegate.errorLogger, - "constructRolesInAppForUserGet has received userAppRoles list empty"); - } - - if (appRoles != null) { - for (EcompRole ecompRole : appRoles) { - RoleInAppForUser roleForUser = new RoleInAppForUser(ecompRole.getId(), ecompRole.getName()); - roleForUser.setIsApplied(userAppRolesMap.contains(ecompRole.getId())); - rolesInAppForUser.add(roleForUser); - } - } else { - logger.error(EELFLoggerDelegate.errorLogger, "constructRolesInAppForUser has received appRoles list empty"); - } - return rolesInAppForUser; - } -} 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 deleted file mode 100644 index 16d32a67..00000000 --- a/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Modifications Copyright (c) 2019 Samsung - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the "License"); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * - */ - -package org.onap.portal.service.fn; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import org.onap.portal.dao.fn.FnUserDao; -import org.onap.portal.domain.db.fn.FnUser; -import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.core.userdetails.UsernameNotFoundException; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -@EnableAspectJAutoProxy -@Transactional -public class FnUserService implements UserDetailsService { - - private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnUserService.class); - - private final FnUserDao fnUserDao; - - @Autowired - public FnUserService(FnUserDao fnUserDao) { - this.fnUserDao = fnUserDao; - } - - public FnUser saveFnUser(final FnUser fnUser) { - return fnUserDao.save(fnUser); - } - - @Override - public FnUser loadUserByUsername(final String username) throws UsernameNotFoundException { - Optional fnUser = fnUserDao.findByLoginId(username); - if (fnUser.isPresent()) { - return fnUser.get(); - } else { - throw new UsernameNotFoundException("User not found for username: " + username); - } - } - - public Optional getUser(final Long id) { - return Optional.of(fnUserDao.getOne(id)); - } - - public List getUserWithOrgUserId(final String orgUserIdValue) { - return fnUserDao.getUserWithOrgUserId(orgUserIdValue).orElse(new ArrayList<>()); - } - - List getUsersByOrgIds(final List orgIds) { - return fnUserDao.getUsersByOrgIds(orgIds).orElse(new ArrayList<>()); - } - - - List getActiveUsers() { - return fnUserDao.getActiveUsers().orElse(new ArrayList<>()); - } - - public void deleteUser(final FnUser fnUser) { - fnUserDao.delete(fnUser); - } - - public boolean existById(final Long userId) { - return fnUserDao.existsById(userId); - } - - public List findAll() { - return fnUserDao.findAll(); - } - } \ No newline at end of file diff --git a/portal-BE/src/main/java/org/onap/portal/service/fn/old/EPRoleFunctionService.java b/portal-BE/src/main/java/org/onap/portal/service/fn/old/EPRoleFunctionService.java deleted file mode 100644 index b044dfb9..00000000 --- a/portal-BE/src/main/java/org/onap/portal/service/fn/old/EPRoleFunctionService.java +++ /dev/null @@ -1,105 +0,0 @@ -/*- - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the "License"); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * - */ -package org.onap.portal.service.fn.old; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; -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.utils.EPUserUtils; -import org.onap.portalsdk.core.domain.RoleFunction; -import org.onap.portalsdk.core.service.DataAccessService; -import org.onap.portalsdk.core.util.SystemProperties; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; - -@Transactional -public class EPRoleFunctionService { - @Autowired - private DataAccessService dataAccessService; - - - - public DataAccessService getDataAccessService() { - return dataAccessService; - } - - public void setDataAccessService(DataAccessService dataAccessService) { - this.dataAccessService = dataAccessService; - } - - @SuppressWarnings("unchecked") - public List getRoleFunctions() { - return getDataAccessService().getList(RoleFunction.class, null); - } - - @SuppressWarnings("unchecked") - public Set getRoleFunctions(HttpServletRequest request, FnUser user) { - HashSet roleFunctions = null; - - HttpSession session = request.getSession(); - roleFunctions = (HashSet) session - .getAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME)); - - if (roleFunctions == null) { - HashMap roles = (HashMap) EPUserUtils.getRoles(request); - roleFunctions = new HashSet(); - - for (Object o : roles.keySet()) { - Long roleKey = (Long) o; - FnRole role = (FnRole) roles.get(roleKey); - - for (FnRoleFunction fnRoleFunction : role.getFnRoleFunctions()) { - FnRoleFunction function = fnRoleFunction; - roleFunctions.add(function.getFunctionCd()); - } - } - - session.setAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME), - roleFunctions); - } - - return roleFunctions; - } - -} diff --git a/portal-BE/src/main/java/org/onap/portal/service/function/FnFunctionDao.java b/portal-BE/src/main/java/org/onap/portal/service/function/FnFunctionDao.java new file mode 100644 index 00000000..29ce30a3 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/function/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.service.function; + +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 +interface FnFunctionDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/function/FnFunctionService.java b/portal-BE/src/main/java/org/onap/portal/service/function/FnFunctionService.java new file mode 100644 index 00000000..d2361bea --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/function/FnFunctionService.java @@ -0,0 +1,22 @@ +package org.onap.portal.service.function; + +import org.onap.portal.domain.db.fn.FnFunction; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class FnFunctionService { + + private final FnFunctionDao fnFunctionDao; + + @Autowired + public FnFunctionService(FnFunctionDao fnFunctionDao) { + this.fnFunctionDao = fnFunctionDao; + } + + public List saveAll(List fnFunctions) { + return fnFunctionDao.saveAll(fnFunctions); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/language/FnLanguageDao.java b/portal-BE/src/main/java/org/onap/portal/service/language/FnLanguageDao.java new file mode 100644 index 00000000..dd6967f0 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/language/FnLanguageDao.java @@ -0,0 +1,56 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.language; + +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 +interface FnLanguageDao extends JpaRepository { + @Query + FnLanguage getByLanguageAlias(final @Param("alias") String alias); + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/language/FnLanguageService.java b/portal-BE/src/main/java/org/onap/portal/service/language/FnLanguageService.java new file mode 100644 index 00000000..9221810e --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/language/FnLanguageService.java @@ -0,0 +1,81 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.language; + +import java.security.Principal; +import java.util.List; +import java.util.Optional; + +import org.onap.portal.domain.db.fn.FnLanguage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@EnableAspectJAutoProxy +@Transactional +public class FnLanguageService { + private final FnLanguageDao fnLanguageDao; + + @Autowired + public FnLanguageService(final FnLanguageDao fnLanguageDao) { + this.fnLanguageDao = fnLanguageDao; + } + + public Optional findById(final Long id){ + return fnLanguageDao.findById(id); + } + public List getLanguages(Principal principal){ + return fnLanguageDao.findAll(); + } + public FnLanguage save(final FnLanguage fnLanguage){ + return fnLanguageDao.saveAndFlush(fnLanguage); + } + + public FnLanguage getByLanguageAlias(String language) { + return fnLanguageDao.getByLanguageAlias(language); + } + + public void delete(FnLanguage fnLanguage) { + fnLanguageDao.delete(fnLanguage); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/luActivity/FnLuActivityDao.java b/portal-BE/src/main/java/org/onap/portal/service/luActivity/FnLuActivityDao.java new file mode 100644 index 00000000..fd6b37f6 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/luActivity/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.service.luActivity; + +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 +interface FnLuActivityDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/luActivity/FnLuActivityService.java b/portal-BE/src/main/java/org/onap/portal/service/luActivity/FnLuActivityService.java new file mode 100644 index 00000000..0ce68009 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/luActivity/FnLuActivityService.java @@ -0,0 +1,22 @@ +package org.onap.portal.service.luActivity; + +import org.onap.portal.domain.db.fn.FnLuActivity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class FnLuActivityService { + + private final FnLuActivityDao fnLuActivityDao; + + @Autowired + public FnLuActivityService(FnLuActivityDao fnLuActivityDao) { + this.fnLuActivityDao = fnLuActivityDao; + } + + public List saveAll(List luActivities) { + return fnLuActivityDao.saveAll(luActivities); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/luAlertMethod/FnLuAlertMethodDao.java b/portal-BE/src/main/java/org/onap/portal/service/luAlertMethod/FnLuAlertMethodDao.java new file mode 100644 index 00000000..026d02f1 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/luAlertMethod/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.service.luAlertMethod; + +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 +interface FnLuAlertMethodDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/luAlertMethod/FnLuAlertMethodService.java b/portal-BE/src/main/java/org/onap/portal/service/luAlertMethod/FnLuAlertMethodService.java new file mode 100644 index 00000000..649ea987 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/luAlertMethod/FnLuAlertMethodService.java @@ -0,0 +1,22 @@ +package org.onap.portal.service.luAlertMethod; + +import org.onap.portal.domain.db.fn.FnLuAlertMethod; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class FnLuAlertMethodService { + + private final FnLuAlertMethodDao fnLuAlertMethodDao; + + @Autowired + public FnLuAlertMethodService(FnLuAlertMethodDao fnLuAlertMethodDao) { + this.fnLuAlertMethodDao = fnLuAlertMethodDao; + } + + public List saveAll(List alertMethods) { + return fnLuAlertMethodDao.saveAll(alertMethods); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/luMenuSet/FnLuMenuSetDao.java b/portal-BE/src/main/java/org/onap/portal/service/luMenuSet/FnLuMenuSetDao.java new file mode 100644 index 00000000..d925a83c --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/luMenuSet/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.service.luMenuSet; + +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 +interface FnLuMenuSetDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/luMenuSet/FnLuMenuSetService.java b/portal-BE/src/main/java/org/onap/portal/service/luMenuSet/FnLuMenuSetService.java new file mode 100644 index 00000000..3433cde5 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/luMenuSet/FnLuMenuSetService.java @@ -0,0 +1,20 @@ +package org.onap.portal.service.luMenuSet; + +import org.onap.portal.domain.db.fn.FnLuMenuSet; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class FnLuMenuSetService { + + private final FnLuMenuSetDao fnLuMenuSetDao; + + @Autowired + public FnLuMenuSetService(FnLuMenuSetDao fnLuMenuSetDao) { + this.fnLuMenuSetDao = fnLuMenuSetDao; + } + + public FnLuMenuSet save(FnLuMenuSet menuSet) { + return fnLuMenuSetDao.save(menuSet); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/luPriority/FnLuPriorityDao.java b/portal-BE/src/main/java/org/onap/portal/service/luPriority/FnLuPriorityDao.java new file mode 100644 index 00000000..951ca1f3 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/luPriority/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.service.luPriority; + +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 +interface FnLuPriorityDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/luPriority/FnLuPriorityService.java b/portal-BE/src/main/java/org/onap/portal/service/luPriority/FnLuPriorityService.java new file mode 100644 index 00000000..998589cb --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/luPriority/FnLuPriorityService.java @@ -0,0 +1,22 @@ +package org.onap.portal.service.luPriority; + +import org.onap.portal.domain.db.fn.FnLuPriority; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class FnLuPriorityService { + + private final FnLuPriorityDao fnLuPriorityDao; + + @Autowired + public FnLuPriorityService(FnLuPriorityDao fnLuPriorityDao) { + this.fnLuPriorityDao = fnLuPriorityDao; + } + + public List saveAll(List priorities) { + return fnLuPriorityDao.saveAll(priorities); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/luTabSet/FnLuTabSetDao.java b/portal-BE/src/main/java/org/onap/portal/service/luTabSet/FnLuTabSetDao.java new file mode 100644 index 00000000..13388010 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/luTabSet/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.service.luTabSet; + +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 +interface FnLuTabSetDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/luTabSet/FnLuTabSetService.java b/portal-BE/src/main/java/org/onap/portal/service/luTabSet/FnLuTabSetService.java new file mode 100644 index 00000000..b9c131a0 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/luTabSet/FnLuTabSetService.java @@ -0,0 +1,20 @@ +package org.onap.portal.service.luTabSet; + +import org.onap.portal.domain.db.fn.FnLuTabSet; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class FnLuTabSetService { + + private final FnLuTabSetDao fnLuTabSetDao; + + @Autowired + public FnLuTabSetService(FnLuTabSetDao fnLuTabSetDao) { + this.fnLuTabSetDao = fnLuTabSetDao; + } + + public FnLuTabSet save(FnLuTabSet fnLuTabSet) { + return fnLuTabSetDao.save(fnLuTabSet); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/luTimezone/FnLuTimezoneDao.java b/portal-BE/src/main/java/org/onap/portal/service/luTimezone/FnLuTimezoneDao.java new file mode 100644 index 00000000..3c35feef --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/luTimezone/FnLuTimezoneDao.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.service.luTimezone; + +import org.onap.portal.domain.db.fn.FnLuTimezone; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +@Repository +@Transactional +interface FnLuTimezoneDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/luTimezone/FnLuTimezoneService.java b/portal-BE/src/main/java/org/onap/portal/service/luTimezone/FnLuTimezoneService.java new file mode 100644 index 00000000..c4180ffa --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/luTimezone/FnLuTimezoneService.java @@ -0,0 +1,68 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.luTimezone; + +import java.util.List; +import java.util.Optional; + +import org.onap.portal.domain.db.fn.FnLuTimezone; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional +public class FnLuTimezoneService { + private final FnLuTimezoneDao fnLuTimezoneDao; + + @Autowired + public FnLuTimezoneService(final FnLuTimezoneDao fnLuTimezoneDao) { + this.fnLuTimezoneDao = fnLuTimezoneDao; + } + + public Optional getById(Long id){ + return fnLuTimezoneDao.findById(id); + } + + public List saveAll(List timezones) { + return fnLuTimezoneDao.saveAll(timezones); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/menu/FnMenuDao.java b/portal-BE/src/main/java/org/onap/portal/service/menu/FnMenuDao.java new file mode 100644 index 00000000..a861b3db --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/menu/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.service.menu; + +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 +interface FnMenuDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/menu/FnMenuService.java b/portal-BE/src/main/java/org/onap/portal/service/menu/FnMenuService.java new file mode 100644 index 00000000..ad7a34bb --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/menu/FnMenuService.java @@ -0,0 +1,22 @@ +package org.onap.portal.service.menu; + +import org.onap.portal.domain.db.fn.FnMenu; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class FnMenuService { + + private final FnMenuDao fnMenuDao; + + @Autowired + public FnMenuService(FnMenuDao fnMenuDao) { + this.fnMenuDao = fnMenuDao; + } + + public List saveAll(List fnMenus) { + return fnMenuDao.saveAll(fnMenus); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/menuFunctional/FnMenuFunctionalDao.java b/portal-BE/src/main/java/org/onap/portal/service/menuFunctional/FnMenuFunctionalDao.java new file mode 100644 index 00000000..424d90df --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/menuFunctional/FnMenuFunctionalDao.java @@ -0,0 +1,56 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.menuFunctional; + +import java.util.List; +import org.onap.portal.domain.db.fn.FnMenuFunctional; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +@Transactional +@Repository +interface FnMenuFunctionalDao extends JpaRepository { + @Query + List retrieveByMenuId(final @Param("menuId") Long menuId); +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/menuFunctional/FnMenuFunctionalService.java b/portal-BE/src/main/java/org/onap/portal/service/menuFunctional/FnMenuFunctionalService.java new file mode 100644 index 00000000..1abf3eef --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/menuFunctional/FnMenuFunctionalService.java @@ -0,0 +1,68 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.menuFunctional; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.onap.portal.domain.db.fn.FnMenuFunctional; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class FnMenuFunctionalService { + + private final FnMenuFunctionalDao fnMenuFunctionalDao; + + @Autowired + public FnMenuFunctionalService(FnMenuFunctionalDao fnMenuFunctionalDao) { + this.fnMenuFunctionalDao = fnMenuFunctionalDao; + } + + public List retrieveByMenuId(final Long menuId) { + return Optional.of(fnMenuFunctionalDao.retrieveByMenuId(menuId)).orElse(new ArrayList<>()); + } + + public List saveAll(List menuFunctionals) { + return fnMenuFunctionalDao.saveAll(menuFunctionals); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/menuFunctionalAncestors/FnMenuFunctionalAncestorsDao.java b/portal-BE/src/main/java/org/onap/portal/service/menuFunctionalAncestors/FnMenuFunctionalAncestorsDao.java new file mode 100644 index 00000000..2b248a90 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/menuFunctionalAncestors/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.service.menuFunctionalAncestors; + +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 +interface FnMenuFunctionalAncestorsDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/menuFunctionalAncestors/FnMenuFunctionalAncestorsService.java b/portal-BE/src/main/java/org/onap/portal/service/menuFunctionalAncestors/FnMenuFunctionalAncestorsService.java new file mode 100644 index 00000000..070169f0 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/menuFunctionalAncestors/FnMenuFunctionalAncestorsService.java @@ -0,0 +1,22 @@ +package org.onap.portal.service.menuFunctionalAncestors; + +import org.onap.portal.domain.db.fn.FnMenuFunctionalAncestors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class FnMenuFunctionalAncestorsService { + + private final FnMenuFunctionalAncestorsDao fnMenuFunctionalAncestorsDao; + + @Autowired + public FnMenuFunctionalAncestorsService(FnMenuFunctionalAncestorsDao fnMenuFunctionalAncestorsDao) { + this.fnMenuFunctionalAncestorsDao = fnMenuFunctionalAncestorsDao; + } + + public List saveAll(List ancestors) { + return fnMenuFunctionalAncestorsDao.saveAll(ancestors); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/menuFunctionalRoles/FnMenuFunctionalRolesDao.java b/portal-BE/src/main/java/org/onap/portal/service/menuFunctionalRoles/FnMenuFunctionalRolesDao.java new file mode 100644 index 00000000..385552d2 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/menuFunctionalRoles/FnMenuFunctionalRolesDao.java @@ -0,0 +1,62 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.menuFunctionalRoles; + +import java.util.List; +import org.onap.portal.domain.db.fn.FnMenuFunctionalRoles; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +@Transactional +@Repository +interface FnMenuFunctionalRolesDao extends JpaRepository { + + @Query + List retrieveByRoleId(final @Param("roleId") Long roleId); + + @Query + List retrieveByMenuId(final @Param("menuId") Long menuId); + + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/menuFunctionalRoles/FnMenuFunctionalRolesService.java b/portal-BE/src/main/java/org/onap/portal/service/menuFunctionalRoles/FnMenuFunctionalRolesService.java new file mode 100644 index 00000000..3a2c62a5 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/menuFunctionalRoles/FnMenuFunctionalRolesService.java @@ -0,0 +1,79 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.menuFunctionalRoles; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.onap.portal.domain.db.fn.FnMenuFunctionalRoles; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class FnMenuFunctionalRolesService { + private final FnMenuFunctionalRolesDao fnMenuFunctionalRolesDao; + + @Autowired + public FnMenuFunctionalRolesService(FnMenuFunctionalRolesDao fnMenuFunctionalRolesDao) { + this.fnMenuFunctionalRolesDao = fnMenuFunctionalRolesDao; + } + + public void deleteById(final Long id){ + fnMenuFunctionalRolesDao.deleteById(id); + } + + public void delete(final FnMenuFunctionalRoles id){ + fnMenuFunctionalRolesDao.delete(id); + } + + public List retrieveByroleId(final Long roleId){ + return Optional.of(fnMenuFunctionalRolesDao.retrieveByRoleId(roleId)).orElse(new ArrayList<>()); + } + + public List retrieveByMenuId(final Long menuId){ + return Optional.of(fnMenuFunctionalRolesDao.retrieveByMenuId(menuId)).orElse(new ArrayList<>()); + } + + public List saveAll(List functionalRoles) { + return fnMenuFunctionalRolesDao.saveAll(functionalRoles); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/microservice/EpMicroserviceDao.java b/portal-BE/src/main/java/org/onap/portal/service/microservice/EpMicroserviceDao.java new file mode 100644 index 00000000..70c4c05e --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/microservice/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.service.microservice; + +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 +interface EpMicroserviceDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/microservice/EpMicroserviceService.java b/portal-BE/src/main/java/org/onap/portal/service/microservice/EpMicroserviceService.java new file mode 100644 index 00000000..1b999f85 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/microservice/EpMicroserviceService.java @@ -0,0 +1,22 @@ +package org.onap.portal.service.microservice; + +import org.onap.portal.domain.db.ep.EpMicroservice; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class EpMicroserviceService { + + private final EpMicroserviceDao epMicroserviceDao; + + @Autowired + public EpMicroserviceService(EpMicroserviceDao epMicroserviceDao) { + this.epMicroserviceDao = epMicroserviceDao; + } + + public List saveAll(List epMicroservices) { + return epMicroserviceDao.saveAll(epMicroservices); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/microserviceParameter/EpMicroserviceParameterDao.java b/portal-BE/src/main/java/org/onap/portal/service/microserviceParameter/EpMicroserviceParameterDao.java new file mode 100644 index 00000000..ad054d95 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/microserviceParameter/EpMicroserviceParameterDao.java @@ -0,0 +1,59 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.microserviceParameter; + +import java.util.List; +import org.onap.portal.domain.db.ep.EpMicroserviceParameter; +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 +interface EpMicroserviceParameterDao extends JpaRepository { + + @Query + void deleteByServiceId(@Param("SERVICEID") Long userId); + @Query + List getParametersById(@Param("SERVICEID") long serviceId); +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/microserviceParameter/EpMicroserviceParameterService.java b/portal-BE/src/main/java/org/onap/portal/service/microserviceParameter/EpMicroserviceParameterService.java new file mode 100644 index 00000000..f4359c5d --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/microserviceParameter/EpMicroserviceParameterService.java @@ -0,0 +1,108 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.microserviceParameter; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Restrictions; +import org.onap.portal.domain.db.ep.EpMicroserviceParameter; +import org.onap.portal.domain.dto.ecomp.MicroserviceParameter; +import org.onap.portal.service.widgetCatalogParameter.EpWidgetCatalogParameterService; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional +public class EpMicroserviceParameterService { + + final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EpWidgetCatalogParameterService.class); + + private final EpMicroserviceParameterDao epMicroserviceParameterDao; + + @Autowired + public EpMicroserviceParameterService( + final EpMicroserviceParameterDao epMicroserviceParameterDao) { + this.epMicroserviceParameterDao = epMicroserviceParameterDao; + } + + public List getParametersById(long serviceId) { + List restrictionsList = new ArrayList<>(); + Criterion contextIdCrit = Restrictions.eq("serviceId", serviceId); + restrictionsList.add(contextIdCrit); + List list = mapToMicroserviceParameterList(epMicroserviceParameterDao.getParametersById(serviceId)); + logger.debug(EELFLoggerDelegate.debugLogger, + "getParametersById: microservice parameters list size: " + list.size()); + return list; + } + + private MicroserviceParameter epWidgetCatalogParameterToMicroserviceParameter( + final EpMicroserviceParameter microservice) { + return new MicroserviceParameter(microservice.getId(), microservice.getServiceId().getId(), + microservice.getParaKey(), microservice.getParaValue()); + } + + private List mapToMicroserviceParameterList(final List list){ + return list.stream().map(this::epWidgetCatalogParameterToMicroserviceParameter).collect(Collectors.toList()); + } + + public EpMicroserviceParameter save(EpMicroserviceParameter epMicroserviceParameter){ + return epMicroserviceParameterDao.save(epMicroserviceParameter); + } + + @Transactional + public boolean deleteMicroserviceParameterById(final Long paramid){ + try { + epMicroserviceParameterDao.deleteById(paramid); + return true; + }catch (Exception e){ + logger.error(EELFLoggerDelegate.errorLogger, e.getMessage()); + return false; + } + } + + public List saveAll(List epMicroserviceParameters) { + return epMicroserviceParameterDao.saveAll(epMicroserviceParameters); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/persUserAppSel/FnPersUserAppSelDao.java b/portal-BE/src/main/java/org/onap/portal/service/persUserAppSel/FnPersUserAppSelDao.java new file mode 100644 index 00000000..b6110748 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/persUserAppSel/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.service.persUserAppSel; + +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 +interface FnPersUserAppSelDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/persUserAppSel/FnPersUserAppSelService.java b/portal-BE/src/main/java/org/onap/portal/service/persUserAppSel/FnPersUserAppSelService.java new file mode 100644 index 00000000..41c281dd --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/persUserAppSel/FnPersUserAppSelService.java @@ -0,0 +1,22 @@ +package org.onap.portal.service.persUserAppSel; + +import org.onap.portal.domain.db.fn.FnPersUserAppSel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class FnPersUserAppSelService { + + private final FnPersUserAppSelDao fnPersUserAppSelDao; + + @Autowired + public FnPersUserAppSelService(FnPersUserAppSelDao fnPersUserAppSelDao) { + this.fnPersUserAppSelDao = fnPersUserAppSelDao; + } + + public List saveAll(List appSels) { + return fnPersUserAppSelDao.saveAll(appSels); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/persUserAppSort/EpPersUserAppSortDao.java b/portal-BE/src/main/java/org/onap/portal/service/persUserAppSort/EpPersUserAppSortDao.java new file mode 100644 index 00000000..e117fc3f --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/persUserAppSort/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.service.persUserAppSort; + +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 +interface EpPersUserAppSortDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/persUserAppSort/EpPersUserAppSortService.java b/portal-BE/src/main/java/org/onap/portal/service/persUserAppSort/EpPersUserAppSortService.java new file mode 100644 index 00000000..05d32e6d --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/persUserAppSort/EpPersUserAppSortService.java @@ -0,0 +1,20 @@ +package org.onap.portal.service.persUserAppSort; + +import org.onap.portal.domain.db.ep.EpPersUserAppSort; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class EpPersUserAppSortService { + + private final EpPersUserAppSortDao epPersUserAppSortDao; + + @Autowired + public EpPersUserAppSortService(EpPersUserAppSortDao epPersUserAppSortDao) { + this.epPersUserAppSortDao = epPersUserAppSortDao; + } + + public EpPersUserAppSort save(EpPersUserAppSort appSort) { + return epPersUserAppSortDao.save(appSort); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/persUserWidgetSel/EpPersUserWidgetSelDao.java b/portal-BE/src/main/java/org/onap/portal/service/persUserWidgetSel/EpPersUserWidgetSelDao.java new file mode 100644 index 00000000..cab80d83 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/persUserWidgetSel/EpPersUserWidgetSelDao.java @@ -0,0 +1,58 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.persUserWidgetSel; + +import java.util.List; +import java.util.Optional; +import org.onap.portal.domain.db.ep.EpPersUserWidgetSel; +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 +interface EpPersUserWidgetSelDao extends JpaRepository { + + @Query + Optional> getEpPersUserWidgetSelForUserIdAndWidgetId(@Param("USERID") Long userId, @Param("WIDGETID") Long widgetId); +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/persUserWidgetSel/EpPersUserWidgetSelService.java b/portal-BE/src/main/java/org/onap/portal/service/persUserWidgetSel/EpPersUserWidgetSelService.java new file mode 100644 index 00000000..cd940d1c --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/persUserWidgetSel/EpPersUserWidgetSelService.java @@ -0,0 +1,32 @@ +package org.onap.portal.service.persUserWidgetSel; + +import org.onap.portal.domain.db.ep.EpPersUserWidgetSel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +@Service +public class EpPersUserWidgetSelService { + + private final EpPersUserWidgetSelDao epPersUserWidgetSelDao; + + @Autowired + public EpPersUserWidgetSelService(EpPersUserWidgetSelDao epPersUserWidgetSelDao) { + this.epPersUserWidgetSelDao = epPersUserWidgetSelDao; + } + + public void deleteById(Long id) { + epPersUserWidgetSelDao.deleteById(id); + } + + public EpPersUserWidgetSel saveAndFlush(EpPersUserWidgetSel epPersUserWidgetSel) { + return epPersUserWidgetSelDao.saveAndFlush(epPersUserWidgetSel); + } + + public Optional> getEpPersUserWidgetSelForUserIdAndWidgetId(Long id, Long widgetId) { + return epPersUserWidgetSelDao.getEpPersUserWidgetSelForUserIdAndWidgetId(id, widgetId); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/qzCronTriggers/FnQzCronTriggersDao.java b/portal-BE/src/main/java/org/onap/portal/service/qzCronTriggers/FnQzCronTriggersDao.java new file mode 100644 index 00000000..a994050f --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/qzCronTriggers/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.service.qzCronTriggers; + +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 +interface FnQzCronTriggersDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/qzCronTriggers/FnQzCronTriggersService.java b/portal-BE/src/main/java/org/onap/portal/service/qzCronTriggers/FnQzCronTriggersService.java new file mode 100644 index 00000000..8cfdef24 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/qzCronTriggers/FnQzCronTriggersService.java @@ -0,0 +1,15 @@ +package org.onap.portal.service.qzCronTriggers; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class FnQzCronTriggersService { + + private final FnQzCronTriggersDao fnQzCronTriggersDao; + + @Autowired + public FnQzCronTriggersService(FnQzCronTriggersDao fnQzCronTriggersDao) { + this.fnQzCronTriggersDao = fnQzCronTriggersDao; + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/qzJobDetails/FnQzJobDetailsDao.java b/portal-BE/src/main/java/org/onap/portal/service/qzJobDetails/FnQzJobDetailsDao.java new file mode 100644 index 00000000..5212031f --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/qzJobDetails/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.service.qzJobDetails; + +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 +interface FnQzJobDetailsDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/qzJobDetails/FnQzJobDetailsService.java b/portal-BE/src/main/java/org/onap/portal/service/qzJobDetails/FnQzJobDetailsService.java new file mode 100644 index 00000000..f83f8e75 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/qzJobDetails/FnQzJobDetailsService.java @@ -0,0 +1,22 @@ +package org.onap.portal.service.qzJobDetails; + +import org.onap.portal.domain.db.fn.FnQzJobDetails; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class FnQzJobDetailsService { + + private final FnQzJobDetailsDao fnQzJobDetailsDao; + + @Autowired + public FnQzJobDetailsService(FnQzJobDetailsDao fnQzJobDetailsDao) { + this.fnQzJobDetailsDao = fnQzJobDetailsDao; + } + + public List saveAll(List jobDetails) { + return fnQzJobDetailsDao.saveAll(jobDetails); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/qzLocks/FnQzLocksDao.java b/portal-BE/src/main/java/org/onap/portal/service/qzLocks/FnQzLocksDao.java new file mode 100644 index 00000000..e4df13af --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/qzLocks/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.service.qzLocks; + +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 +interface FnQzLocksDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/qzLocks/FnQzLocksService.java b/portal-BE/src/main/java/org/onap/portal/service/qzLocks/FnQzLocksService.java new file mode 100644 index 00000000..a582f6df --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/qzLocks/FnQzLocksService.java @@ -0,0 +1,22 @@ +package org.onap.portal.service.qzLocks; + +import org.onap.portal.domain.db.fn.FnQzLocks; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class FnQzLocksService { + + private final FnQzLocksDao fnQzLocksDao; + + @Autowired + public FnQzLocksService(FnQzLocksDao fnQzLocksDao) { + this.fnQzLocksDao = fnQzLocksDao; + } + + public List saveAll(List locks) { + return fnQzLocksDao.saveAll(locks); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/qzSchedulerState/FnQzSchedulerStateDao.java b/portal-BE/src/main/java/org/onap/portal/service/qzSchedulerState/FnQzSchedulerStateDao.java new file mode 100644 index 00000000..56a2e84f --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/qzSchedulerState/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.service.qzSchedulerState; + +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 +interface FnQzSchedulerStateDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/qzSchedulerState/FnQzSchedulerStateService.java b/portal-BE/src/main/java/org/onap/portal/service/qzSchedulerState/FnQzSchedulerStateService.java new file mode 100644 index 00000000..54519793 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/qzSchedulerState/FnQzSchedulerStateService.java @@ -0,0 +1,20 @@ +package org.onap.portal.service.qzSchedulerState; + +import org.onap.portal.domain.db.fn.FnQzSchedulerState; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class FnQzSchedulerStateService { + + private final FnQzSchedulerStateDao fnQzSchedulerStateDao; + + @Autowired + public FnQzSchedulerStateService(FnQzSchedulerStateDao fnQzSchedulerStateDao) { + this.fnQzSchedulerStateDao = fnQzSchedulerStateDao; + } + + public FnQzSchedulerState save(FnQzSchedulerState schedulerState) { + return fnQzSchedulerStateDao.save(schedulerState); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/qzTriggers/FnQzTriggersDao.java b/portal-BE/src/main/java/org/onap/portal/service/qzTriggers/FnQzTriggersDao.java new file mode 100644 index 00000000..c731f70d --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/qzTriggers/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.service.qzTriggers; + +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 +interface FnQzTriggersDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/qzTriggers/FnQzTriggersService.java b/portal-BE/src/main/java/org/onap/portal/service/qzTriggers/FnQzTriggersService.java new file mode 100644 index 00000000..4f175afe --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/qzTriggers/FnQzTriggersService.java @@ -0,0 +1,15 @@ +package org.onap.portal.service.qzTriggers; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class FnQzTriggersService { + + private final FnQzTriggersDao fnQzTriggersDao; + + @Autowired + public FnQzTriggersService(FnQzTriggersDao fnQzTriggersDao) { + this.fnQzTriggersDao = fnQzTriggersDao; + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/restrictedUrl/FnRestrictedUrlDao.java b/portal-BE/src/main/java/org/onap/portal/service/restrictedUrl/FnRestrictedUrlDao.java new file mode 100644 index 00000000..d836c488 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/restrictedUrl/FnRestrictedUrlDao.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.service.restrictedUrl; + +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 +interface FnRestrictedUrlDao extends JpaRepository { +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/restrictedUrl/FnRestrictedUrlService.java b/portal-BE/src/main/java/org/onap/portal/service/restrictedUrl/FnRestrictedUrlService.java new file mode 100644 index 00000000..8f04dbfe --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/restrictedUrl/FnRestrictedUrlService.java @@ -0,0 +1,15 @@ +package org.onap.portal.service.restrictedUrl; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class FnRestrictedUrlService { + + private final FnRestrictedUrlDao fnRestrictedUrlDao; + + @Autowired + public FnRestrictedUrlService(FnRestrictedUrlDao fnRestrictedUrlDao) { + this.fnRestrictedUrlDao = fnRestrictedUrlDao; + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/role/FnRoleDao.java b/portal-BE/src/main/java/org/onap/portal/service/role/FnRoleDao.java new file mode 100644 index 00000000..e12391d8 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/role/FnRoleDao.java @@ -0,0 +1,82 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.role; + +import java.util.List; +import org.onap.portal.domain.db.fn.FnRole; +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 +interface FnRoleDao extends JpaRepository { + + @Query + List retrieveAppRoleByAppRoleIdAndByAppId(final @Param("appId") Long appId, + final @Param("appRoleId") Long appRoleId); + + @Query + List getUserRoleOnUserIdAndAppId(final @Param("userId") Long userId, final @Param("appId") Long appId); + + @Query + List retrieveAppRoleByRoleIdWhereAppIdIsNull(final @Param("roleId") Long roleId); + + @Query + List retrieveAppRolesWhereAppIdIsNull(); + + @Query + List retrieveAppRolesByAppId(final @Param("appId") Long id); + + @Query + List retrieveActiveRolesOfApplication(final @Param("appId") Long appId); + + @Query + List retrieveAppRolesByRoleNameAndByAppId(final @Param("roleName") String roleName, final @Param("appId") Long appId); + + @Query + List getGlobalRolesOfPortal(); + + @Query + FnRole getSysAdminRoleId(); +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/role/FnRoleService.java b/portal-BE/src/main/java/org/onap/portal/service/role/FnRoleService.java new file mode 100644 index 00000000..d73ae66e --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/role/FnRoleService.java @@ -0,0 +1,155 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.role; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import javax.persistence.EntityExistsException; + +import org.onap.portal.domain.db.fn.FnRole; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional +public class FnRoleService { + + private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnRoleService.class); + + private final FnRoleDao fnRoleDao; + + @Autowired + public FnRoleService(FnRoleDao fnRoleDao) { + this.fnRoleDao = fnRoleDao; + } + + public FnRole getById(final Long id) { + return fnRoleDao.findById(id).orElseThrow(EntityExistsException::new); + } + + public FnRole getRole(final Long appId, final Long appRoleId) { + List roles = Optional.of(fnRoleDao.retrieveAppRoleByAppRoleIdAndByAppId(appId, appRoleId)) + .orElse(new ArrayList<>()); + if (!roles.isEmpty()) { + logger.error(EELFLoggerDelegate.errorLogger, + String.format( + "search by appId=%s, appRoleid=%s should have returned 0 or 1 results. Got %d. This is an internal server error.", + appId, appRoleId, roles.size())); + logger.error(EELFLoggerDelegate.errorLogger, + "Trying to recover from duplicates by returning the first search result. This issue should be treated, it is probably not critical because duplicate roles should be similar."); + return roles.get(0); + } + return null; + } + + public List getAppRoles(Long appId) { + List applicationRoles; + try { + if (appId == 1) { + applicationRoles = retrieveAppRolesWhereAppIdIsNull(); + } else { + applicationRoles = retrieveAppRolesByAppId(appId); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getAppRoles: failed", e); + throw e; + } + return applicationRoles; + } + + public List retrieveAppRoleByAppRoleIdAndByAppId(final Long appId, final Long appRoleId) { + return Optional.of(fnRoleDao.retrieveAppRoleByAppRoleIdAndByAppId(appId, appRoleId)).orElse(new ArrayList<>()); + } + + public List getUserRoleOnUserIdAndAppId(final Long userId, final Long appId) { + return Optional.of(fnRoleDao.getUserRoleOnUserIdAndAppId(userId, appId)).orElse(new ArrayList<>()); + } + + public List retrieveAppRoleByRoleIdWhereAppIdIsNull(final Long roleId) { + return Optional.of(fnRoleDao.retrieveAppRoleByRoleIdWhereAppIdIsNull(roleId)).orElse(new ArrayList<>()); + } + + public List retrieveAppRolesWhereAppIdIsNull() { + return Optional.of(fnRoleDao.retrieveAppRolesWhereAppIdIsNull()).orElse(new ArrayList<>()); + } + + public List retrieveAppRolesByAppId(final Long id) { + return Optional.of(fnRoleDao.retrieveAppRolesByAppId(id)).orElse(new ArrayList<>()); + } + + public List retrieveAppRolesByRoleNameAndByAppId(final String roleName, final Long appId) { + return Optional.of(fnRoleDao.retrieveAppRolesByRoleNameAndByAppId(roleName, appId)).orElse(new ArrayList<>()); + } + + public List retrieveActiveRolesOfApplication(final Long appId) { + return Optional.of(fnRoleDao.retrieveActiveRolesOfApplication(appId)).orElse(new ArrayList<>()); + } + + public List getGlobalRolesOfPortal() { + List globalRoles = new ArrayList<>(); + try { + globalRoles = Optional.of(fnRoleDao.getGlobalRolesOfPortal()).orElse(new ArrayList<>()); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getGlobalRolesOfPortal failed", e); + } + return globalRoles; + } + + public Long getSysAdminRoleId(){ + FnRole role = fnRoleDao.getSysAdminRoleId(); + return role.getId(); + } + + public void delete(FnRole role) { + fnRoleDao.delete(role); + } + + public FnRole saveOne(final FnRole role){ + return fnRoleDao.save(role); + } + + public List saveAll(List fnRoles) { + return fnRoleDao.saveAll(fnRoles); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/roleComposite/FnRoleCompositeDao.java b/portal-BE/src/main/java/org/onap/portal/service/roleComposite/FnRoleCompositeDao.java new file mode 100644 index 00000000..61c4e139 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/roleComposite/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.service.roleComposite; + +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 +interface FnRoleCompositeDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/roleComposite/FnRoleCompositeService.java b/portal-BE/src/main/java/org/onap/portal/service/roleComposite/FnRoleCompositeService.java new file mode 100644 index 00000000..ed15259e --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/roleComposite/FnRoleCompositeService.java @@ -0,0 +1,15 @@ +package org.onap.portal.service.roleComposite; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class FnRoleCompositeService { + + private final FnRoleCompositeDao fnRoleCompositeDao; + + @Autowired + public FnRoleCompositeService(FnRoleCompositeDao fnRoleCompositeDao) { + this.fnRoleCompositeDao = fnRoleCompositeDao; + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/roleFunction/FnRoleFunctionDao.java b/portal-BE/src/main/java/org/onap/portal/service/roleFunction/FnRoleFunctionDao.java new file mode 100644 index 00000000..2928d8a1 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/roleFunction/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.service.roleFunction; + +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 +interface FnRoleFunctionDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/roleFunction/FnRoleFunctionService.java b/portal-BE/src/main/java/org/onap/portal/service/roleFunction/FnRoleFunctionService.java new file mode 100644 index 00000000..a91dee82 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/roleFunction/FnRoleFunctionService.java @@ -0,0 +1,22 @@ +package org.onap.portal.service.roleFunction; + +import org.onap.portal.domain.db.fn.FnRoleFunction; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class FnRoleFunctionService { + + private final FnRoleFunctionDao fnRoleFunctionDao; + + @Autowired + public FnRoleFunctionService(FnRoleFunctionDao fnRoleFunctionDao) { + this.fnRoleFunctionDao = fnRoleFunctionDao; + } + + public List saveAll(List roleFunctions) { + return fnRoleFunctionDao.saveAll(roleFunctions); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/sharedContext/FnSharedContextDao.java b/portal-BE/src/main/java/org/onap/portal/service/sharedContext/FnSharedContextDao.java new file mode 100644 index 00000000..8faac5b6 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/sharedContext/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.service.sharedContext; + +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 +interface FnSharedContextDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/sharedContext/FnSharedContextService.java b/portal-BE/src/main/java/org/onap/portal/service/sharedContext/FnSharedContextService.java new file mode 100644 index 00000000..7a427ae9 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/sharedContext/FnSharedContextService.java @@ -0,0 +1,22 @@ +package org.onap.portal.service.sharedContext; + +import org.onap.portal.domain.db.fn.FnSharedContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class FnSharedContextService { + + private final FnSharedContextDao fnSharedContextDao; + + @Autowired + public FnSharedContextService(FnSharedContextDao fnSharedContextDao) { + this.fnSharedContextDao = fnSharedContextDao; + } + + public List saveAll(List sharedContexts) { + return fnSharedContextDao.saveAll(sharedContexts); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/tab/FnTabDao.java b/portal-BE/src/main/java/org/onap/portal/service/tab/FnTabDao.java new file mode 100644 index 00000000..ad9e7b6f --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/tab/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.service.tab; + +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 +interface FnTabDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/tab/FnTabService.java b/portal-BE/src/main/java/org/onap/portal/service/tab/FnTabService.java new file mode 100644 index 00000000..ed90831d --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/tab/FnTabService.java @@ -0,0 +1,22 @@ +package org.onap.portal.service.tab; + +import org.onap.portal.domain.db.fn.FnTab; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class FnTabService { + + private final FnTabDao fnTabDao; + + @Autowired + public FnTabService(FnTabDao fnTabDao) { + this.fnTabDao = fnTabDao; + } + + public List saveAll(List fnTabs) { + return fnTabDao.saveAll(fnTabs); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/tabSelected/FnTabSelectedDao.java b/portal-BE/src/main/java/org/onap/portal/service/tabSelected/FnTabSelectedDao.java new file mode 100644 index 00000000..a11b30c3 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/tabSelected/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.service.tabSelected; + +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 +interface FnTabSelectedDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/tabSelected/FnTabSelectedService.java b/portal-BE/src/main/java/org/onap/portal/service/tabSelected/FnTabSelectedService.java new file mode 100644 index 00000000..92c6f56b --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/tabSelected/FnTabSelectedService.java @@ -0,0 +1,15 @@ +package org.onap.portal.service.tabSelected; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class FnTabSelectedService { + + private final FnTabSelectedDao fnTabSelectedDao; + + @Autowired + public FnTabSelectedService(FnTabSelectedDao fnTabSelectedDao) { + this.fnTabSelectedDao = fnTabSelectedDao; + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/user/FnUserDao.java b/portal-BE/src/main/java/org/onap/portal/service/user/FnUserDao.java new file mode 100644 index 00000000..f7a150d3 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/user/FnUserDao.java @@ -0,0 +1,71 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.user; + +import java.util.List; +import java.util.Optional; +import org.onap.portal.domain.db.fn.FnUser; +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 +interface FnUserDao extends JpaRepository { + + @Query + Optional findByLoginId(final @Param("loginId") String username); + + @Override + FnUser getOne(Long ID); + + @Query + Optional> getUserWithOrgUserId(final @Param("orgId") String orgId); + + @Query + Optional> getUsersByOrgIds(final @Param("orgIds") List orgIds); + + @Query + Optional> getActiveUsers(); + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/user/FnUserService.java b/portal-BE/src/main/java/org/onap/portal/service/user/FnUserService.java new file mode 100644 index 00000000..975bd219 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/user/FnUserService.java @@ -0,0 +1,124 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.user; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.onap.portal.domain.db.fn.FnUser; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@EnableAspectJAutoProxy +@Transactional +public class FnUserService implements UserDetailsService { + + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnUserService.class); + + private final FnUserDao fnUserDao; + + @Autowired + public FnUserService(FnUserDao fnUserDao) { + this.fnUserDao = fnUserDao; + } + + public FnUser saveFnUser(final FnUser fnUser) { + return fnUserDao.save(fnUser); + } + + @Override + public FnUser loadUserByUsername(final String username) throws UsernameNotFoundException { + Optional fnUser = fnUserDao.findByLoginId(username); + if (fnUser.isPresent()) { + return fnUser.get(); + } else { + throw new UsernameNotFoundException("User not found for username: " + username); + } + } + + public Optional getUser(final Long id) { + return Optional.of(fnUserDao.getOne(id)); + } + + public List getUserWithOrgUserId(final String orgUserIdValue) { + return fnUserDao.getUserWithOrgUserId(orgUserIdValue).orElse(new ArrayList<>()); + } + + public List getUsersByOrgIds(final List orgIds) { + return fnUserDao.getUsersByOrgIds(orgIds).orElse(new ArrayList<>()); + } + + + public List getActiveUsers() { + return fnUserDao.getActiveUsers().orElse(new ArrayList<>()); + } + + public void deleteUser(final FnUser fnUser) { + fnUserDao.delete(fnUser); + } + + public boolean existById(final Long userId) { + return fnUserDao.existsById(userId); + } + + public List findAll() { + return fnUserDao.findAll(); + } + + public List saveAll(List fnUsers) { + return fnUserDao.saveAll(fnUsers); + } + + public FnUser save(FnUser user) { + return fnUserDao.save(user); + } + + public void delete(FnUser user) { + fnUserDao.delete(user); + } +} \ No newline at end of file diff --git a/portal-BE/src/main/java/org/onap/portal/service/userRole/FnUserRoleDao.java b/portal-BE/src/main/java/org/onap/portal/service/userRole/FnUserRoleDao.java new file mode 100644 index 00000000..141658a2 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/userRole/FnUserRoleDao.java @@ -0,0 +1,71 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.userRole; + +import java.util.List; +import java.util.Optional; +import org.onap.portal.domain.db.fn.FnUserRole; +import org.onap.portal.domain.dto.ecomp.UserRole; +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 +interface FnUserRoleDao extends JpaRepository { + + @Query + Optional> getAdminUserRoles(final @Param("userId") Long userId, final @Param("roleId") Long roleId, final @Param("appId") Long appId); + + @Query + List isSuperAdmin(final @Param("orgUserId") String orgUserId, final @Param("roleId") Long roleId, final @Param("appId") Long appId); + + @Query + List retrieveByAppIdAndUserId(final @Param("appId") Long appId, final @Param("userId") String userId); + + @Query + List retrieveByAppIdAndRoleId(final @Param("appId") Long appId, final @Param("roleId") Long roleId); + + @Query + List retrieveByUserIdAndRoleId(final @Param("userId") Long userId, final @Param("roleId") Long roleId); +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/userRole/FnUserRoleService.java b/portal-BE/src/main/java/org/onap/portal/service/userRole/FnUserRoleService.java new file mode 100644 index 00000000..eb7ece2b --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/userRole/FnUserRoleService.java @@ -0,0 +1,544 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.userRole; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Optional; +import java.util.Set; +import java.util.SortedSet; +import java.util.stream.Collectors; +import javax.persistence.EntityManager; +import javax.persistence.Tuple; +import javax.servlet.http.HttpServletResponse; +import org.apache.cxf.transport.http.HTTPException; +import org.onap.portal.domain.db.ep.EpUserRolesRequest; +import org.onap.portal.domain.db.ep.EpUserRolesRequestDet; +import org.onap.portal.domain.db.fn.FnApp; +import org.onap.portal.domain.db.fn.FnRole; +import org.onap.portal.domain.db.fn.FnUser; +import org.onap.portal.domain.db.fn.FnUserRole; +import org.onap.portal.domain.dto.ecomp.EPUserAppCatalogRoles; +import org.onap.portal.domain.dto.ecomp.ExternalSystemAccess; +import org.onap.portal.domain.dto.transport.AppWithRolesForUser; +import org.onap.portal.domain.dto.transport.FieldsValidator; +import org.onap.portal.domain.dto.transport.RemoteRole; +import org.onap.portal.domain.dto.transport.RemoteUserWithRoles; +import org.onap.portal.domain.dto.transport.Role; +import org.onap.portal.domain.dto.transport.RoleInAppForUser; +import org.onap.portal.domain.dto.transport.UserApplicationRoles; +import org.onap.portal.service.ApplicationsRestClientService; +import org.onap.portal.service.userRolesRequestDet.EpUserRolesRequestDetService; +import org.onap.portal.service.userRolesRequest.EpUserRolesRequestService; +import org.onap.portal.service.app.FnAppService; +import org.onap.portal.service.role.FnRoleService; +import org.onap.portal.service.user.FnUserService; +import org.onap.portal.utils.EPCommonSystemProperties; +import org.onap.portal.utils.PortalConstants; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.restful.domain.EcompRole; +import org.onap.portalsdk.core.util.SystemProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional +public class FnUserRoleService { + + private static final String GET_ROLE_FUNCTIONS_OF_USERFOR_ALLTHE_APPLICATIONS = + "select\n" + + " distinct ep.function_cd functionCd\n" + + "from\n" + + " fn_user_role fu,\n" + + " ep_app_role_function ep,\n" + + " ep_app_function ea\n" + + "where\n" + + " fu.role_id = ep.role_id\n" + + " and fu.app_id = ep.app_id\n" + + " and fu.user_id = 'userId'\n" + + " and ea.function_cd = ep.function_cd\n" + + " and exists (\n" + + " select\n" + + " fa.app_id\n" + + " from\n" + + " fn_user fu,\n" + + " fn_user_role ur,\n" + + " fn_app fa\n" + + " where\n" + + " fu.user_id = 'userId'\n" + + " and fu.user_id = ur.user_id\n" + + " and ur.app_id = fa.app_id\n" + + " and fa.enabled = 'Y'\n" + + " )"; + + private static final String USER_APP_CATALOG_ROLES = + "select\n" + + " A.reqId as reqId,\n" + + " B.requestedRoleId.id as requestedRoleId,\n" + + " A.requestStatus as requestStatus,\n" + + " A.appId.id as appId,\n" + + " (\n" + + " select\n" + + " roleName\n" + + " from\n" + + " FnRole\n" + + " where\n" + + " id = B.requestedRoleId.id\n" + + " ) as roleName\n" + + "from\n" + + " EpUserRolesRequest A\n" + + " left join EpUserRolesRequestDet B on A.reqId = B.reqId.reqId\n" + + "where\n" + + " A.userId.id = :userid\n" + + " and A.appId IN (\n" + + " select\n" + + " id\n" + + " from\n" + + " FnApp\n" + + " where\n" + + " appName = :appName\n" + + " )\n" + + " and A.requestStatus = 'P'\n"; + + private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnUserRoleService.class); + + private final FnUserRoleDao fnUserRoleDao; + private final FnAppService fnAppService; + private final FnRoleService fnRoleService; + private final FnUserService fnUserService; + private final EpUserRolesRequestService epUserRolesRequestService; + private final EpUserRolesRequestDetService epUserRolesRequestDetService; + private final EntityManager entityManager; + private final ApplicationsRestClientService applicationsRestClientService; + + @Autowired + public FnUserRoleService(FnUserRoleDao + fnUserRoleDao, + FnAppService fnAppService, + FnRoleService fnRoleService, + FnUserService fnUserService, + EpUserRolesRequestService epUserRolesRequestService, + EpUserRolesRequestDetService epUserRolesRequestDetService, + EntityManager entityManager, + ApplicationsRestClientService applicationsRestClientService) { + this.fnUserRoleDao = fnUserRoleDao; + this.fnAppService = fnAppService; + this.fnRoleService = fnRoleService; + this.fnUserService = fnUserService; + this.epUserRolesRequestService = epUserRolesRequestService; + this.epUserRolesRequestDetService = epUserRolesRequestDetService; + this.entityManager = entityManager; + this.applicationsRestClientService = applicationsRestClientService; + } + + public List getAdminUserRoles(final Long userId, final Long roleId, final Long appId) { + return fnUserRoleDao.getAdminUserRoles(userId, roleId, appId).orElse(new ArrayList<>()); + } + + public boolean isSuperAdmin(final String loginId, final Long roleId, final Long appId) { + List roles = getUserRolesForRoleIdAndAppId(roleId, appId).stream() + .filter(role -> role.getUserId().getOrgUserId().equals(loginId)).collect(Collectors.toList()); + return !roles.isEmpty(); + } + + public List getUserRolesForRoleIdAndAppId(final Long roleId, final Long appId) { + return Optional.of(fnUserRoleDao.retrieveByAppIdAndRoleId(appId, roleId)).orElse(new ArrayList<>()); + } + + public List retrieveByUserIdAndRoleId(final Long userId, final Long roleId){ + return Optional.of(fnUserRoleDao.retrieveByUserIdAndRoleId(userId, roleId)).orElse(new ArrayList<>()); + } + + public FnUserRole saveOne(final FnUserRole fnUserRole) { + return fnUserRoleDao.save(fnUserRole); + } + + public ExternalSystemAccess getExternalRequestAccess() { + ExternalSystemAccess res = null; + try { + res = new ExternalSystemAccess(EPCommonSystemProperties.EXTERNAL_ACCESS_ENABLE, + Boolean.parseBoolean( + SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_ACCESS_ENABLE))); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getExternalRequestAccess failed" + e.getMessage()); + } + return res; + } + + public List getUserAppCatalogRoles(FnUser userid, String appName) { + List tuples = entityManager.createQuery(USER_APP_CATALOG_ROLES, Tuple.class) + .setParameter("userid", userid.getId()) + .setParameter("appName", appName) + .getResultList(); + return Optional.of(tuples.stream().map(this::tupleToEPUserAppCatalogRoles).collect(Collectors.toList())) + .orElse(new ArrayList<>()); + } + + private EPUserAppCatalogRoles tupleToEPUserAppCatalogRoles(Tuple tuple) { + return new EPUserAppCatalogRoles((Long) tuple.get("reqId"), (Long) tuple.get("requestedRoleId"), + (String) tuple.get("roleName"), (String) tuple.get("requestStatus"), (Long) tuple.get("appId")); + } + + private boolean postUserRolesToMylogins(AppWithRolesForUser userAppRolesData, + ApplicationsRestClientService applicationsRestClientService, Long appId, Long userId) + throws JsonProcessingException, HTTPException { + boolean result = false; + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + String userRolesAsString = mapper.writeValueAsString(userAppRolesData); + logger.error(EELFLoggerDelegate.errorLogger, + "Should not be reached here, as the endpoint is not defined yet from the Mylogins"); + applicationsRestClientService.post(AppWithRolesForUser.class, appId, userRolesAsString, + String.format("/user/%s/myLoginroles", userId)); + return result; + } + + public FieldsValidator putUserAppRolesRequest(AppWithRolesForUser newAppRolesForUser, FnUser user) { + FieldsValidator fieldsValidator = new FieldsValidator(); + List appRole; + try { + logger.error(EELFLoggerDelegate.errorLogger, + "Should not be reached here, still the endpoint is yet to be defined"); + boolean result = postUserRolesToMylogins(newAppRolesForUser, applicationsRestClientService, + newAppRolesForUser.getAppId(), user.getId()); + logger.debug(EELFLoggerDelegate.debugLogger, "putUserAppRolesRequest: result {}", result); + FnApp app = fnAppService.getById(newAppRolesForUser.getAppId()); + EpUserRolesRequest epUserRolesRequest = new EpUserRolesRequest(); + epUserRolesRequest.setCreatedDate(LocalDateTime.now()); + epUserRolesRequest.setUpdatedDate(LocalDateTime.now()); + epUserRolesRequest.setUserId(user); + epUserRolesRequest.setAppId(app); + epUserRolesRequest.setRequestStatus("P"); + List appRoleIdList = newAppRolesForUser.getAppRoles(); + Set appRoleDetails = new LinkedHashSet<>(); + epUserRolesRequestService.saveOne(epUserRolesRequest); + for (RoleInAppForUser userAppRoles : appRoleIdList) { + Boolean isAppliedVal = userAppRoles.getIsApplied(); + if (isAppliedVal) { + appRole = fnRoleService + .retrieveAppRoleByAppRoleIdAndByAppId(newAppRolesForUser.getAppId(), + userAppRoles.getRoleId()); + if (!appRole.isEmpty()) { + EpUserRolesRequestDet epAppRoleDetail = new EpUserRolesRequestDet(); + epAppRoleDetail.setRequestedRoleId(appRole.get(0)); + epAppRoleDetail.setRequestType("P"); + epAppRoleDetail.setReqId(epUserRolesRequest); + epUserRolesRequestDetService.saveOne(epAppRoleDetail); + } + } + } + epUserRolesRequest.setEpRequestIdDetail(appRoleDetails); + fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_OK); + + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "putUserAppRolesRequest failed", e); + fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + } + return fieldsValidator; + } + + public List importRolesFromRemoteApplication(Long appId) throws HTTPException { + FnRole[] appRolesFull = applicationsRestClientService.get(FnRole[].class, appId, "/rolesFull"); + List rolesList = Arrays.asList(appRolesFull); + for (FnRole externalAppRole : rolesList) { + + // Try to find an existing extern role for the app in the local + // onap DB. If so, then use its id to update the existing external + // application role record. + Long externAppId = externalAppRole.getId(); + FnRole existingAppRole = fnRoleService.getRole(appId, externAppId); + if (existingAppRole != null) { + logger.debug(EELFLoggerDelegate.debugLogger, + String.format( + "ecomp role already exists for app=%s; appRoleId=%s. No need to import this one.", + appId, externAppId)); + } + } + + return rolesList; + } + + public List getUsersFromAppEndpoint(Long appId) throws HTTPException { + ArrayList userApplicationRoles = new ArrayList<>(); + + FnApp app = fnAppService.getById(appId); + //If local or centralized application + if (PortalConstants.PORTAL_APP_ID.equals(appId) || app.getAuthCentral()) { + List userList = fnUserService.getActiveUsers(); + for (FnUser user : userList) { + UserApplicationRoles userWithAppRoles = convertToUserApplicationRoles(appId, user, app); + if (userWithAppRoles.getRoles() != null && userWithAppRoles.getRoles().size() > 0) { + userApplicationRoles.add(userWithAppRoles); + } + } + + } + // remote app + else { + RemoteUserWithRoles[] remoteUsers; + String remoteUsersString = applicationsRestClientService.getIncomingJsonString(appId, "/users"); + + remoteUsers = doGetUsers(remoteUsersString); + + userApplicationRoles = new ArrayList<>(); + for (RemoteUserWithRoles remoteUser : remoteUsers) { + UserApplicationRoles userWithRemoteAppRoles = convertToUserApplicationRoles(appId, + remoteUser); + if (userWithRemoteAppRoles.getRoles() != null + && userWithRemoteAppRoles.getRoles().size() > 0) { + userApplicationRoles.add(userWithRemoteAppRoles); + } else { + logger.debug(EELFLoggerDelegate.debugLogger, + "User " + userWithRemoteAppRoles.getOrgUserId() + + " doesn't have any roles assigned to any app."); + } + } + } + + return userApplicationRoles; + } + + private UserApplicationRoles convertToUserApplicationRoles(Long appId, RemoteUserWithRoles remoteUser) { + UserApplicationRoles userWithRemoteAppRoles = new UserApplicationRoles(); + userWithRemoteAppRoles.setAppId(appId); + userWithRemoteAppRoles.setOrgUserId(remoteUser.getOrgUserId()); + userWithRemoteAppRoles.setFirstName(remoteUser.getFirstName()); + userWithRemoteAppRoles.setLastName(remoteUser.getLastName()); + userWithRemoteAppRoles.setRoles(remoteUser.getRoles()); + return userWithRemoteAppRoles; + } + + private RemoteUserWithRoles[] doGetUsers(String remoteUsersString) { + + ObjectMapper mapper = new ObjectMapper(); + try { + return mapper.readValue(remoteUsersString, RemoteUserWithRoles[].class); + } catch (IOException e) { + logger.error(EELFLoggerDelegate.errorLogger, + "doGetUsers : Failed : Unexpected property in incoming JSON", + e); + logger.error(EELFLoggerDelegate.errorLogger, + "doGetUsers : Incoming JSON that caused it --> " + remoteUsersString); + } + + return new RemoteUserWithRoles[0]; + } + + private UserApplicationRoles convertToUserApplicationRoles(Long appId, FnUser user, FnApp app) { + UserApplicationRoles userWithRemoteAppRoles = new UserApplicationRoles(); + userWithRemoteAppRoles.setAppId(appId); + userWithRemoteAppRoles.setOrgUserId(user.getOrgUserId()); + userWithRemoteAppRoles.setFirstName(user.getFirstName()); + userWithRemoteAppRoles.setLastName(user.getLastName()); + userWithRemoteAppRoles.setRoles(convertToRemoteRoleList(user, app)); + return userWithRemoteAppRoles; + } + + private List convertToRemoteRoleList(FnUser user, FnApp app) { + List roleList = new ArrayList<>(); + SortedSet roleSet = user.getAppEPRoles(app); + for (FnRole role : roleSet) { + logger.debug(EELFLoggerDelegate.debugLogger, + "In convertToRemoteRoleList() - for user {}, found Name {}", user.getOrgUserId(), + role.getRoleName()); + RemoteRole rRole = new RemoteRole(); + rRole.setId(role.getId()); + rRole.setName(role.getRoleName()); + roleList.add(rRole); + } + + //Get the active roles of user for that application using query + List userEpRoleList = fnRoleService.getUserRoleOnUserIdAndAppId(user.getId(), app.getId()); + + for (FnRole remoteUserRoleList : userEpRoleList) { + + RemoteRole remoteRoleListId = roleList.stream() + .filter(x -> remoteUserRoleList.getId().equals(x.getId())) + .findAny().orElse(null); + if (remoteRoleListId == null) { + logger.debug(EELFLoggerDelegate.debugLogger, + "Adding the role to the rolelist () - for user {}, found Name {}", + user.getOrgUserId(), + + remoteUserRoleList.getRoleName()); + RemoteRole role = new RemoteRole(); + role.setId(remoteUserRoleList.getId()); + role.setName(remoteUserRoleList.getRoleName()); + + roleList.add(role); + } + + } + + logger.debug(EELFLoggerDelegate.debugLogger, + "rolelist size of the USER() - for user {}, found RoleListSize {}", user.getOrgUserId(), + roleList.size()); + return roleList; + } + + public List getRoleFunctionsOfUserforAlltheApplications(Long userId) { + List tuples = entityManager + .createQuery(GET_ROLE_FUNCTIONS_OF_USERFOR_ALLTHE_APPLICATIONS, Tuple.class) + .setParameter("userid", userId) + .getResultList(); + return Optional.of(tuples.stream().map(tuple -> tuple.get("functionCd")).collect(Collectors.toList())) + .orElse(new ArrayList<>()); + } + + public List retrieveByAppIdAndUserId(final Long appId, final String userId) { + return Optional.of(fnUserRoleDao.retrieveByAppIdAndUserId(appId, userId)).orElse(new ArrayList<>()); + } + + public String updateRemoteUserProfile(String orgUserId, long appId) { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + FnUser client = fnUserService.loadUserByUsername(orgUserId); + FnUser newUser = new FnUser(); + newUser.setActiveYn(client.getActiveYn()); + newUser.setFirstName(client.getFirstName()); + newUser.setLastName(client.getLastName()); + newUser.setLoginId(client.getLoginId()); + newUser.setLoginPwd(client.getLoginPwd()); + newUser.setMiddleName(client.getMiddleName()); + newUser.setEmail(client.getEmail()); + newUser.setOrgUserId(client.getLoginId()); + try { + String userAsString = mapper.writeValueAsString(newUser); + List appList = fnAppService.getUserRemoteApps(client.getId().toString()); + // applicationsRestClientService.post(EPUser.class, appId, + // userAsString, String.format("/user", orgUserId)); + for (FnApp eachApp : appList) { + try { + applicationsRestClientService.post(FnUser.class, eachApp.getId(), userAsString, + String.format("/user/%s", orgUserId)); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Failed to update user: " + client.getOrgUserId() + + " in remote app. appId = " + eachApp.getId()); + } + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "updateRemoteUserProfile failed", e); + return "failure"; + } + return "success"; + } + + public void deleteById(final Long id) { + fnUserRoleDao.deleteById(id); + } + + public List constructRolesInAppForUserGet(List appRoles, FnRole[] userAppRoles, + Boolean extRequestValue) { + List rolesInAppForUser = new ArrayList<>(); + + Set userAppRolesMap = new HashSet<>(); + if (userAppRoles != null) { + for (FnRole ecompRole : userAppRoles) { + userAppRolesMap.add(ecompRole.getAppId()); + } + logger.debug(EELFLoggerDelegate.debugLogger, "In constructRolesInAppForUserGet() - userAppRolesMap = {}", + userAppRolesMap); + + } else { + logger.error(EELFLoggerDelegate.errorLogger, + "constructRolesInAppForUserGet has received userAppRoles list empty."); + } + + if (appRoles != null) { + for (Role ecompRole : appRoles) { + logger.debug(EELFLoggerDelegate.debugLogger, "In constructRolesInAppForUserGet() - appRoles not null = {}", + ecompRole); + + if (ecompRole.getId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID) && !extRequestValue) { + continue; + } + RoleInAppForUser roleForUser = new RoleInAppForUser(ecompRole.getId(), ecompRole.getRoleName()); + roleForUser.setIsApplied(userAppRolesMap.contains(ecompRole.getId())); + rolesInAppForUser.add(roleForUser); + logger.debug(EELFLoggerDelegate.debugLogger, "In constructRolesInAppForUserGet() - rolesInAppForUser = {}", + rolesInAppForUser); + + } + } else { + logger.error(EELFLoggerDelegate.errorLogger, + "constructRolesInAppForUser has received appRoles list empty."); + } + return rolesInAppForUser; + } + + public List constructRolesInAppForUserGet(EcompRole[] appRoles, EcompRole[] userAppRoles) { + List rolesInAppForUser = new ArrayList<>(); + + Set userAppRolesMap = new HashSet<>(); + if (userAppRoles != null) { + for (EcompRole ecompRole : userAppRoles) { + userAppRolesMap.add(ecompRole.getId()); + } + } else { + logger.error(EELFLoggerDelegate.errorLogger, + "constructRolesInAppForUserGet has received userAppRoles list empty"); + } + + if (appRoles != null) { + for (EcompRole ecompRole : appRoles) { + RoleInAppForUser roleForUser = new RoleInAppForUser(ecompRole.getId(), ecompRole.getName()); + roleForUser.setIsApplied(userAppRolesMap.contains(ecompRole.getId())); + rolesInAppForUser.add(roleForUser); + } + } else { + logger.error(EELFLoggerDelegate.errorLogger, "constructRolesInAppForUser has received appRoles list empty"); + } + return rolesInAppForUser; + } + + public List saveAll(List userRoles) { + return fnUserRoleDao.saveAll(userRoles); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/userRolesRequest/EpUserRolesRequestDao.java b/portal-BE/src/main/java/org/onap/portal/service/userRolesRequest/EpUserRolesRequestDao.java new file mode 100644 index 00000000..5fefa885 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/userRolesRequest/EpUserRolesRequestDao.java @@ -0,0 +1,56 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.userRolesRequest; + +import java.util.List; +import org.onap.portal.domain.db.ep.EpUserRolesRequest; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +@Repository +@Transactional +interface EpUserRolesRequestDao extends JpaRepository { + @Query + List userAppRolesRequestList(final @Param("userId") Long userId, final @Param("appId") Long appId); +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/userRolesRequest/EpUserRolesRequestService.java b/portal-BE/src/main/java/org/onap/portal/service/userRolesRequest/EpUserRolesRequestService.java new file mode 100644 index 00000000..ab363266 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/userRolesRequest/EpUserRolesRequestService.java @@ -0,0 +1,69 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.userRolesRequest; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.onap.portal.domain.db.ep.EpUserRolesRequest; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional +public class EpUserRolesRequestService { + private final EpUserRolesRequestDao epUserRolesRequestDao; + + @Autowired + public EpUserRolesRequestService(EpUserRolesRequestDao epUserRolesRequestDao) { + this.epUserRolesRequestDao = epUserRolesRequestDao; + } + + public EpUserRolesRequest saveOne(EpUserRolesRequest epUserRolesRequest){ + return epUserRolesRequestDao.save(epUserRolesRequest); + } + + public List userAppRolesRequestList(final Long userId, final Long appId){ + return Optional.of(epUserRolesRequestDao.userAppRolesRequestList(userId, appId)).orElse(new ArrayList<>()); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/userRolesRequestDet/EpUserRolesRequestDetDao.java b/portal-BE/src/main/java/org/onap/portal/service/userRolesRequestDet/EpUserRolesRequestDetDao.java new file mode 100644 index 00000000..8d04bf92 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/userRolesRequestDet/EpUserRolesRequestDetDao.java @@ -0,0 +1,58 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.userRolesRequestDet; + +import java.util.List; +import org.onap.portal.domain.db.ep.EpUserRolesRequestDet; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +@Repository +@Transactional +interface EpUserRolesRequestDetDao extends JpaRepository { + + @Query + List appRolesRequestDetailList(final @Param("reqId") Long reqId); + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/userRolesRequestDet/EpUserRolesRequestDetService.java b/portal-BE/src/main/java/org/onap/portal/service/userRolesRequestDet/EpUserRolesRequestDetService.java new file mode 100644 index 00000000..f8641f06 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/userRolesRequestDet/EpUserRolesRequestDetService.java @@ -0,0 +1,68 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.userRolesRequestDet; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import org.onap.portal.domain.db.ep.EpUserRolesRequestDet; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional +public class EpUserRolesRequestDetService { + private final EpUserRolesRequestDetDao epUserRolesRequestDetDao; + + @Autowired + public EpUserRolesRequestDetService(EpUserRolesRequestDetDao epUserRolesRequestDetDao) { + this.epUserRolesRequestDetDao = epUserRolesRequestDetDao; + } + + public EpUserRolesRequestDet saveOne(EpUserRolesRequestDet epUserRolesRequestDet){ + return epUserRolesRequestDetDao.save(epUserRolesRequestDet); + } + + public List appRolesRequestDetailList(final Long reqId){ + return Optional.of(epUserRolesRequestDetDao.appRolesRequestDetailList(reqId)).orElse(new ArrayList<>()); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/widget/FnWidgetDao.java b/portal-BE/src/main/java/org/onap/portal/service/widget/FnWidgetDao.java new file mode 100644 index 00000000..053479ea --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/widget/FnWidgetDao.java @@ -0,0 +1,58 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.widget; + +import java.util.List; +import java.util.Optional; +import org.onap.portal.domain.db.fn.FnWidget; +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 +interface FnWidgetDao extends JpaRepository { + + @Query + Optional> getForUrlNameAndAppId(final @Param("URL") String url, final @Param("NAME") String name, final @Param("APPID") Long appId); +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/widget/WidgetService.java b/portal-BE/src/main/java/org/onap/portal/service/widget/WidgetService.java new file mode 100644 index 00000000..05917eb4 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/widget/WidgetService.java @@ -0,0 +1,251 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.widget; + +import java.util.ArrayList; +import java.util.List; +import javax.persistence.EntityManager; +import javax.servlet.http.HttpServletResponse; + +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.transport.FieldsValidator; +import org.onap.portal.domain.dto.transport.OnboardingWidget; +import org.onap.portal.service.AdminRolesService; +import org.onap.portal.service.userRole.FnUserRoleService; +import org.onap.portal.utils.EPCommonSystemProperties; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@EnableAspectJAutoProxy +@Transactional +public class WidgetService { + + private final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetService.class); + private final Long ACCOUNT_ADMIN_ROLE_ID = 999L; + + 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," + + "widget.WDG_URL, widget.WIDGET_ID,widget.WDG_NAME,widget.APP_ID,app.APP_NAME,widget.WDG_WIDTH,widget.WDG_HEIGHT,widget.WDG_URL) from FN_WIDGET widget join FN_APP app ON widget.APP_ID = app.APP_ID"; + + private static final String urlField = "url"; + private static final Long DUBLICATED_FIELD_VALUE_ECOMP_ERROR = new Long( + EPCommonSystemProperties.DUBLICATED_FIELD_VALUE_ECOMP_ERROR); + private static final String nameField = "name"; + + private final AdminRolesService adminRolesService; + private final EntityManager entityManager; + private final FnWidgetDao fnWidgetDao; + private final FnUserRoleService fnUserRoleService; + + @Autowired + public WidgetService(final AdminRolesService adminRolesService, final EntityManager entityManager, + final FnWidgetDao fnWidgetDao, FnUserRoleService fnUserRoleService) { + this.adminRolesService = adminRolesService; + this.entityManager = entityManager; + this.fnWidgetDao = fnWidgetDao; + this.fnUserRoleService = fnUserRoleService; + } + + private static final Object syncRests = new Object(); + + public List getOnboardingWidgets(FnUser user, boolean managed) { + if (adminRolesService.isSuperAdmin(user.getOrgUserId())) { + return entityManager.createQuery(sqlWidgetsForAllApps(), OnboardingWidget.class).getResultList(); + } else if (managed) { + if (adminRolesService.isAccountAdmin(user)) { + return entityManager + .createQuery(sqlWidgetsForAllAppsWhereUserIsAdmin(), OnboardingWidget.class) + .setParameter("USERID", user.getId()).getResultList(); + } + } else if (adminRolesService.isAccountAdmin(user) || adminRolesService.isUser(user)) { + return entityManager + .createQuery(sqlWidgetsForAllAppsWhereUserHasAnyRole(), OnboardingWidget.class) + .setParameter("USERID", user.getId()).getResultList(); + } + return new ArrayList<>(); + } + + private String sqlWidgetsForAllApps() { + return "SELECT" + baseSqlToken; + } + + private String sqlWidgetsForAllAppsWhereUserIsAdmin() { + return "SELECT" + baseSqlToken + + " join FN_USER_ROLE ON FN_USER_ROLE.APP_ID = app.APP_ID where FN_USER_ROLE.USER_ID = :USERID AND FN_USER_ROLE.ROLE_ID = " + + ACCOUNT_ADMIN_ROLE_ID; + } + + private String sqlWidgetsForAllAppsWhereUserHasAnyRole() { + return "SELECT DISTINCT" + baseSqlToken + + " join FN_USER_ROLE ON FN_USER_ROLE.APP_ID = app.APP_ID where FN_USER_ROLE.USER_ID = " + + ":USERID"; + } + + @PreAuthorize("hasRole('System_Administrator')") + public FieldsValidator setOnboardingWidget(final Long userId, final OnboardingWidget onboardingWidget) { + return this.updateOrSaveWidget(true, userId, onboardingWidget); + } + + private FieldsValidator updateOrSaveWidget(boolean superAdmin, Long userId, OnboardingWidget onboardingWidget) { + FieldsValidator fieldsValidator = new FieldsValidator(); + if (!this.isUserAdminOfAppForWidget(superAdmin, userId, onboardingWidget.getAppId())) { + fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_FORBIDDEN); + return fieldsValidator; + } + synchronized (syncRests) { + if (onboardingWidget.getId() == null) { + this.validateOnboardingWidget(onboardingWidget, fieldsValidator); + } else { + FnWidget widget = fnWidgetDao.getOne(onboardingWidget.getId()); + if (widget == null || widget.getAppId() == null) { + fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_NOT_FOUND); + return fieldsValidator; + } + this.validateOnboardingWidget(onboardingWidget, fieldsValidator); + } + if (fieldsValidator.getHttpStatusCode() == HttpServletResponse.SC_OK) { + this.applyOnboardingWidget(onboardingWidget, fieldsValidator); + } + } + return fieldsValidator; + } + + private boolean isUserAdminOfAppForWidget(boolean superAdmin, Long userId, Long appId) { + if (!superAdmin) { + List userRoles = getAdminUserRoles(userId, appId); + return (userRoles.size() > 0); + } + return true; + } + + private List getAdminUserRoles(Long userId, Long appId) { + return fnUserRoleService.getAdminUserRoles(userId, ACCOUNT_ADMIN_ROLE_ID, appId); + } + + private void applyOnboardingWidget(OnboardingWidget onboardingWidget, FieldsValidator fieldsValidator) { + boolean result; + FnWidget widget; + if (onboardingWidget.getId() == null) { + widget = new FnWidget(); + } else { + widget = fnWidgetDao.getOne(onboardingWidget.getId()); + } + widget.setAppId(onboardingWidget.getAppId()); + widget.setName(onboardingWidget.getName()); + widget.setWidth(onboardingWidget.getWidth()); + widget.setHeight(onboardingWidget.getHeight()); + widget.setUrl(onboardingWidget.getUrl()); + result = widget.equals(fnWidgetDao.saveAndFlush(widget)); + if (!result) { + fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + } + } + + private void validateOnboardingWidget(OnboardingWidget onboardingWidget, FieldsValidator fieldsValidator) { + List widgets = getWidgets(onboardingWidget); + boolean dublicatedUrl = false; + boolean dublicatedName = false; + for (FnWidget widget : widgets) { + if (onboardingWidget.getId() != null && onboardingWidget.getId().equals(widget.getWidgetId())) { + // widget should not be compared with itself + continue; + } + if (!dublicatedUrl && widget.getUrl().equals(onboardingWidget.getUrl())) { + dublicatedUrl = true; + if (dublicatedName) { + break; + } + } + if (!dublicatedName && widget.getName().equalsIgnoreCase(onboardingWidget.getName()) && widget + .getAppId().equals(onboardingWidget.getAppId())) { + dublicatedName = true; + if (dublicatedUrl) { + break; + } + } + } + if (dublicatedUrl || dublicatedName) { + if (dublicatedUrl) { + fieldsValidator.addProblematicFieldName(urlField); + } + if (dublicatedName) { + fieldsValidator.addProblematicFieldName(nameField); + } + fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_CONFLICT); + fieldsValidator.setErrorCode(DUBLICATED_FIELD_VALUE_ECOMP_ERROR); + } + } + + private List getWidgets(final OnboardingWidget onboardingWidget) { + return fnWidgetDao.getForUrlNameAndAppId(onboardingWidget.getUrl(), onboardingWidget.getName(), onboardingWidget.getAppId()).orElse(new ArrayList<>()); + } + + public FieldsValidator deleteOnboardingWidget(FnUser user, Long onboardingWidgetId) { + FieldsValidator fieldsValidator = new FieldsValidator(); + synchronized (syncRests) { + FnWidget widget = fnWidgetDao.getOne(onboardingWidgetId); + if (widget != null && widget.getAppId() != null) { // widget exists + if (!this.isUserAdminOfAppForWidget(adminRolesService.isSuperAdmin(user.getOrgUserId()), user.getId(), + widget.getAppId())) { + fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_FORBIDDEN); + } else { + fnWidgetDao.deleteById(onboardingWidgetId); + fieldsValidator.setHttpStatusCode( + (long) HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + } + } + } + return fieldsValidator; + } + + public FnWidget saveOne(final FnWidget widget){ + return fnWidgetDao.saveAndFlush(widget); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/widgetCatalog/EpWidgetCatalogDao.java b/portal-BE/src/main/java/org/onap/portal/service/widgetCatalog/EpWidgetCatalogDao.java new file mode 100644 index 00000000..63bc5de8 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/widgetCatalog/EpWidgetCatalogDao.java @@ -0,0 +1,48 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.widgetCatalog; + +import org.onap.portal.domain.db.ep.EpWidgetCatalog; +import org.springframework.data.jpa.repository.JpaRepository; + +interface EpWidgetCatalogDao extends JpaRepository { + +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/widgetCatalog/EpWidgetCatalogService.java b/portal-BE/src/main/java/org/onap/portal/service/widgetCatalog/EpWidgetCatalogService.java new file mode 100644 index 00000000..2b17ea79 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/widgetCatalog/EpWidgetCatalogService.java @@ -0,0 +1,31 @@ +package org.onap.portal.service.widgetCatalog; + +import org.onap.portal.domain.db.ep.EpWidgetCatalog; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Optional; + +@Service +public class EpWidgetCatalogService { + + private final EpWidgetCatalogDao epWidgetCatalogDao; + + @Autowired + public EpWidgetCatalogService(EpWidgetCatalogDao epWidgetCatalogDao) { + this.epWidgetCatalogDao = epWidgetCatalogDao; + } + + public EpWidgetCatalog save(final EpWidgetCatalog epWidgetCatalog){ + return epWidgetCatalogDao.save(epWidgetCatalog); + } + + public Optional findById(Long widgetId) { + return epWidgetCatalogDao.findById(widgetId); + } + + public List saveAll(List epWidgetCatalogs) { + return epWidgetCatalogDao.saveAll(epWidgetCatalogs); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/widgetCatalogParameter/EpWidgetCatalogParameterDao.java b/portal-BE/src/main/java/org/onap/portal/service/widgetCatalogParameter/EpWidgetCatalogParameterDao.java new file mode 100644 index 00000000..6f388372 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/widgetCatalogParameter/EpWidgetCatalogParameterDao.java @@ -0,0 +1,27 @@ +package org.onap.portal.service.widgetCatalogParameter; + +import java.util.List; +import java.util.Optional; +import org.onap.portal.domain.db.ep.EpWidgetCatalogParameter; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +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 +interface EpWidgetCatalogParameterDao extends JpaRepository { + + @Query + Optional> retrieveByParamId(@Param("PARAMID") Long paramId); + + @Query + @Modifying + void deleteWidgetCatalogParameter(@Param("PARAMID") Long paramId); + + @Query + Optional> getUserParamById(@Param("WIDGETID") Long widgetId, + @Param("USERID") Long userId, @Param("PARAMID") Long paramId); +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/widgetCatalogParameter/EpWidgetCatalogParameterService.java b/portal-BE/src/main/java/org/onap/portal/service/widgetCatalogParameter/EpWidgetCatalogParameterService.java new file mode 100644 index 00000000..cf9b9fc7 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/widgetCatalogParameter/EpWidgetCatalogParameterService.java @@ -0,0 +1,109 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.service.widgetCatalogParameter; + +import java.util.ArrayList; +import java.util.List; +import org.onap.portal.domain.db.ep.EpWidgetCatalogParameter; +import org.onap.portal.service.microserviceParameter.EpMicroserviceParameterService; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional +public class EpWidgetCatalogParameterService { + + final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EpWidgetCatalogParameterService.class); + + private final EpWidgetCatalogParameterDao epWidgetCatalogParameterDao; + private final EpMicroserviceParameterService epMicroserviceParameterService; + + @Autowired + public EpWidgetCatalogParameterService( + final EpWidgetCatalogParameterDao epWidgetCatalogParameterDao, + final EpMicroserviceParameterService epMicroserviceParameterService) { + this.epWidgetCatalogParameterDao = epWidgetCatalogParameterDao; + this.epMicroserviceParameterService = epMicroserviceParameterService; + } + + public List getUserParameterById(final Long paramId) { + return epWidgetCatalogParameterDao.retrieveByParamId(paramId).orElse(new ArrayList<>()); + } + + public boolean deleteUserParameterById(final Long paramId) { + return (deleteByParamId(paramId) && + epMicroserviceParameterService.deleteMicroserviceParameterById(paramId)); + } + + public EpWidgetCatalogParameter getById(final Long id){ + return epWidgetCatalogParameterDao.getOne(id); + } + + @Transactional + public boolean deleteByParamId(final Long paramId) { + try { + epWidgetCatalogParameterDao.deleteWidgetCatalogParameter(paramId); + return true; + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, e.getMessage()); + return false; + } + } + + public EpWidgetCatalogParameter getUserParamById(final Long widgetId, final Long userId, final Long paramId) { + EpWidgetCatalogParameter widgetParam = null; + List list = epWidgetCatalogParameterDao + .getUserParamById(widgetId, userId, paramId) + .orElse(null); + if (list != null && !list.isEmpty()) { + widgetParam = list.get(0); + } + logger.debug(EELFLoggerDelegate.debugLogger, + "getUserParamById: widget parameters: " + widgetParam); + return widgetParam; + } + + public void saveUserParameter(final EpWidgetCatalogParameter newParameter) { + epWidgetCatalogParameterDao.save(newParameter); + } +} 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 fea71337..027cebe7 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 @@ -63,7 +63,7 @@ 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.portal.service.EPRoleFunctionService; import org.onap.portalsdk.core.domain.RoleFunction; import org.onap.portalsdk.core.exception.SessionExpiredException; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; diff --git a/portal-BE/src/test/java/org/onap/portal/controller/LanguageControllerTest.java b/portal-BE/src/test/java/org/onap/portal/controller/LanguageControllerTest.java index e00dc5ca..ca0cf920 100644 --- a/portal-BE/src/test/java/org/onap/portal/controller/LanguageControllerTest.java +++ b/portal-BE/src/test/java/org/onap/portal/controller/LanguageControllerTest.java @@ -45,13 +45,13 @@ import static org.junit.jupiter.api.Assertions.assertNull; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; -import org.onap.portal.dao.fn.FnLanguageDao; import org.onap.portal.domain.db.fn.FnLanguage; import org.onap.portal.domain.db.fn.FnUser; import org.onap.portal.domain.dto.PortalRestResponse; import org.onap.portal.domain.dto.PortalRestStatusEnum; import org.onap.portal.domain.dto.fn.FnLanguageDto; -import org.onap.portal.service.fn.FnUserService; +import org.onap.portal.service.language.FnLanguageService; +import org.onap.portal.service.user.FnUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -69,7 +69,7 @@ class LanguageControllerTest { @Autowired private LanguageController languageController; @Autowired - private FnLanguageDao fnLanguageDao; + private FnLanguageService fnLanguageService; @Autowired private FnUserService fnUserService; @@ -89,7 +89,7 @@ class LanguageControllerTest { assertEquals(expected.getMessage(), actual.getMessage()); assertEquals(expected.getStatus(), actual.getStatus()); //Clean up - fnLanguageDao.delete(fnLanguage); + fnLanguageService.delete(fnLanguage); } @Test @@ -109,7 +109,7 @@ class LanguageControllerTest { assertEquals(expected.getMessage(), actual.getMessage()); assertEquals(expected.getStatus(), actual.getStatus()); //Clean up - fnLanguageDao.delete(fnLanguage); + fnLanguageService.delete(fnLanguage); } @Test @@ -138,7 +138,7 @@ class LanguageControllerTest { //Clean up - fnLanguageDao.delete(fnLanguage); + fnLanguageService.delete(fnLanguage); } @Test @@ -162,7 +162,7 @@ class LanguageControllerTest { //Clean up - fnLanguageDao.delete(fnLanguage); + fnLanguageService.delete(fnLanguage); } diff --git a/portal-BE/src/test/java/org/onap/portal/controller/UserControllerTest.java b/portal-BE/src/test/java/org/onap/portal/controller/UserControllerTest.java index 0316683f..7c654ad4 100644 --- a/portal-BE/src/test/java/org/onap/portal/controller/UserControllerTest.java +++ b/portal-BE/src/test/java/org/onap/portal/controller/UserControllerTest.java @@ -47,7 +47,7 @@ import org.onap.portal.domain.db.fn.FnUser; import org.onap.portal.domain.dto.PortalRestResponse; import org.onap.portal.domain.dto.PortalRestStatusEnum; import org.onap.portal.domain.dto.transport.ProfileDetail; -import org.onap.portal.service.fn.FnUserService; +import org.onap.portal.service.user.FnUserService; import org.onap.portalsdk.core.onboarding.exception.CipherUtilException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; diff --git a/portal-BE/src/test/java/org/onap/portal/controller/UserRolesControllerTest.java b/portal-BE/src/test/java/org/onap/portal/controller/UserRolesControllerTest.java index e83c2470..e9f9627e 100644 --- a/portal-BE/src/test/java/org/onap/portal/controller/UserRolesControllerTest.java +++ b/portal-BE/src/test/java/org/onap/portal/controller/UserRolesControllerTest.java @@ -45,11 +45,11 @@ import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.onap.portal.domain.dto.ecomp.ExternalSystemAccess; -import org.onap.portal.service.fn.FnAppService; -import org.onap.portal.service.fn.FnLanguageService; -import org.onap.portal.service.fn.FnRoleService; -import org.onap.portal.service.fn.FnUserRoleService; -import org.onap.portal.service.fn.FnUserService; +import org.onap.portal.service.app.FnAppService; +import org.onap.portal.service.language.FnLanguageService; +import org.onap.portal.service.role.FnRoleService; +import org.onap.portal.service.userRole.FnUserRoleService; +import org.onap.portal.service.user.FnUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; diff --git a/portal-BE/src/test/java/org/onap/portal/controller/WidgetsCatalogControllerTest.java b/portal-BE/src/test/java/org/onap/portal/controller/WidgetsCatalogControllerTest.java index 27ce3484..65525dbe 100644 --- a/portal-BE/src/test/java/org/onap/portal/controller/WidgetsCatalogControllerTest.java +++ b/portal-BE/src/test/java/org/onap/portal/controller/WidgetsCatalogControllerTest.java @@ -51,18 +51,17 @@ import java.util.List; import javax.transaction.Transactional; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.portal.dao.fn.FnLanguageDao; import org.onap.portal.domain.db.ep.EpMicroserviceParameter; import org.onap.portal.domain.db.ep.EpWidgetCatalog; import org.onap.portal.domain.db.ep.EpWidgetCatalogParameter; import org.onap.portal.domain.db.fn.FnLanguage; import org.onap.portal.domain.db.fn.FnUser; import org.onap.portal.domain.dto.ecomp.WidgetCatalog; -import org.onap.portal.service.ep.EpMicroserviceParameterService; -import org.onap.portal.service.ep.EpWidgetCatalogParameterService; -import org.onap.portal.service.ep.EpWidgetCatalogService; -import org.onap.portal.service.fn.FnLanguageService; -import org.onap.portal.service.fn.FnUserService; +import org.onap.portal.service.microserviceParameter.EpMicroserviceParameterService; +import org.onap.portal.service.widgetCatalogParameter.EpWidgetCatalogParameterService; +import org.onap.portal.service.widgetCatalog.EpWidgetCatalogService; +import org.onap.portal.service.language.FnLanguageService; +import org.onap.portal.service.user.FnUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -88,8 +87,6 @@ public class WidgetsCatalogControllerTest { private EpMicroserviceParameterService epMicroserviceParameterService; @Autowired private EpWidgetCatalogService epWidgetCatalogService; - @Autowired - private FnLanguageDao fnLanguageDao; @Test public void getUserWidgetCatalog() { @@ -172,7 +169,7 @@ public class WidgetsCatalogControllerTest { EpMicroserviceParameter parameter = new EpMicroserviceParameter(); epMicroserviceParameterService.save(parameter); FnUser user = buildFnUser(); - FnLanguage language = fnLanguageDao.getByLanguageAlias("EN"); + FnLanguage language = fnLanguageService.getByLanguageAlias("EN"); user.setLanguageId(language); fnUserService.saveFnUser(user); EpWidgetCatalogParameter data = EpWidgetCatalogParameter.builder() diff --git a/portal-BE/src/test/java/org/onap/portal/controller/WidgetsControllerTest.java b/portal-BE/src/test/java/org/onap/portal/controller/WidgetsControllerTest.java index 168fcc7a..9da6e733 100644 --- a/portal-BE/src/test/java/org/onap/portal/controller/WidgetsControllerTest.java +++ b/portal-BE/src/test/java/org/onap/portal/controller/WidgetsControllerTest.java @@ -53,8 +53,6 @@ import javax.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.portal.dao.fn.FnLanguageDao; -import org.onap.portal.dao.fn.FnUserDao; import org.onap.portal.domain.db.fn.FnLanguage; import org.onap.portal.domain.db.fn.FnUser; import org.onap.portal.domain.db.fn.FnWidget; @@ -62,8 +60,9 @@ import org.onap.portal.domain.dto.transport.FieldsValidator; import org.onap.portal.domain.dto.transport.OnboardingWidget; import org.onap.portal.domain.dto.transport.WidgetCatalogPersonalization; import org.onap.portal.framework.MockitoTestSuite; -import org.onap.portal.service.WidgetService; -import org.onap.portal.service.fn.FnLanguageService; +import org.onap.portal.service.user.FnUserService; +import org.onap.portal.service.widget.WidgetService; +import org.onap.portal.service.language.FnLanguageService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -89,14 +88,11 @@ public class WidgetsControllerTest { @Autowired private WidgetsController widgetsController; @Autowired - private FnUserDao fnUserDao; - @Autowired - private FnLanguageDao fnLanguageDao; - @Autowired private WidgetService widgetService; @Autowired private FnLanguageService fnLanguageService; - + @Autowired + FnUserService fnUserService; private FnLanguage language; private FnUser questUser; private FnUser notQuestUser; @@ -120,14 +116,14 @@ public class WidgetsControllerTest { public void getOnboardingWidgetsQuestUserTest() { UsernamePasswordAuthenticationToken questPrincipal = new UsernamePasswordAuthenticationToken("questUser", "demo123"); - fnUserDao.save(questUser); + fnUserService.save(questUser); List onboardingWidgets = widgetsController .getOnboardingWidgets(questPrincipal, request, response); assertNull(onboardingWidgets); //Clean up - fnUserDao.delete(questUser); - fnLanguageDao.delete(language); + fnUserService.delete(questUser); + fnLanguageService.delete(language); } @Test @@ -135,7 +131,7 @@ public class WidgetsControllerTest { UsernamePasswordAuthenticationToken notQuestprincipal = new UsernamePasswordAuthenticationToken( "notQuestUser", "demo123"); - fnUserDao.save(notQuestUser); + fnUserService.save(notQuestUser); List expected = new ArrayList<>(); when(request.getHeader("X-Widgets-Type")).thenReturn("managed"); @@ -143,7 +139,7 @@ public class WidgetsControllerTest { .getOnboardingWidgets(notQuestprincipal, request, response); assertEquals(expected, actual); - fnUserDao.delete(notQuestUser); + fnUserService.delete(notQuestUser); } @Test @@ -151,19 +147,19 @@ public class WidgetsControllerTest { UsernamePasswordAuthenticationToken notQuestprincipal = new UsernamePasswordAuthenticationToken( "notQuestUser", "demo123"); - fnUserDao.save(notQuestUser); + fnUserService.save(notQuestUser); when(request.getHeader("X-Widgets-Type")).thenReturn("test"); List actual = widgetsController .getOnboardingWidgets(notQuestprincipal, request, response); assertNull(actual); - fnUserDao.delete(notQuestUser); + fnUserService.delete(notQuestUser); } @Test public void putOnboardingWidgetSameWidget() { //Given - fnUserDao.save(notQuestUser); + fnUserService.save(notQuestUser); when(request.getHeader("X-Widgets-Type")).thenReturn("managed"); OnboardingWidget onboardingWidget = OnboardingWidget.builder() @@ -199,7 +195,7 @@ public class WidgetsControllerTest { @Test public void putOnboardingWidgetAOP() { //Given - fnUserDao.save(notQuestUser); + fnUserService.save(notQuestUser); when(request.getHeader("X-Widgets-Type")).thenReturn("managed"); OnboardingWidget onboardingWidget = OnboardingWidget.builder() @@ -236,7 +232,7 @@ public class WidgetsControllerTest { @Test public void putOnboardingWidgetAOPXSSTest() { //Given - fnUserDao.save(notQuestUser); + fnUserService.save(notQuestUser); when(request.getHeader("X-Widgets-Type")).thenReturn("managed"); OnboardingWidget onboardingWidget = OnboardingWidget.builder() @@ -264,7 +260,7 @@ public class WidgetsControllerTest { @Test public void postOnboardingWidgetXSS() { //Given - fnUserDao.save(notQuestUser); + fnUserService.save(notQuestUser); when(request.getHeader("X-Widgets-Type")).thenReturn("managed"); OnboardingWidget onboardingWidget = OnboardingWidget.builder() @@ -290,7 +286,7 @@ public class WidgetsControllerTest { @Test public void postOnboardingWidget() { //Given - fnUserDao.save(notQuestUser); + fnUserService.save(notQuestUser); when(request.getHeader("X-Widgets-Type")).thenReturn("managed"); OnboardingWidget onboardingWidget = OnboardingWidget.builder() @@ -315,7 +311,7 @@ public class WidgetsControllerTest { @Test public void deleteOnboardingWidgetSCFORBIDDEN() { //Given - fnUserDao.save(notQuestUser); + fnUserService.save(notQuestUser); when(request.getHeader("X-Widgets-Type")).thenReturn("managed"); OnboardingWidget onboardingWidget = OnboardingWidget.builder() diff --git a/portal-BE/src/test/java/org/onap/portal/service/ep/EpMicroserviceParameterServiceTest.java b/portal-BE/src/test/java/org/onap/portal/service/ep/EpMicroserviceParameterServiceTest.java index b4427ef3..e11a696c 100644 --- a/portal-BE/src/test/java/org/onap/portal/service/ep/EpMicroserviceParameterServiceTest.java +++ b/portal-BE/src/test/java/org/onap/portal/service/ep/EpMicroserviceParameterServiceTest.java @@ -45,6 +45,7 @@ import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.onap.portal.domain.db.ep.EpMicroserviceParameter; +import org.onap.portal.service.microserviceParameter.EpMicroserviceParameterService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.TestPropertySource; diff --git a/portal-BE/src/test/java/org/onap/portal/service/ep/EpWidgetCatalogParameterServiceTest.java b/portal-BE/src/test/java/org/onap/portal/service/ep/EpWidgetCatalogParameterServiceTest.java index ad1ee60d..7c7b0b7a 100644 --- a/portal-BE/src/test/java/org/onap/portal/service/ep/EpWidgetCatalogParameterServiceTest.java +++ b/portal-BE/src/test/java/org/onap/portal/service/ep/EpWidgetCatalogParameterServiceTest.java @@ -43,19 +43,20 @@ package org.onap.portal.service.ep; import static org.junit.jupiter.api.Assertions.assertEquals; import java.time.LocalDateTime; -import java.util.Collections; -import java.util.HashSet; + import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.onap.portal.controller.WidgetsCatalogController; -import org.onap.portal.dao.fn.FnLanguageDao; import org.onap.portal.domain.db.ep.EpMicroserviceParameter; import org.onap.portal.domain.db.ep.EpWidgetCatalog; import org.onap.portal.domain.db.ep.EpWidgetCatalogParameter; import org.onap.portal.domain.db.fn.FnLanguage; import org.onap.portal.domain.db.fn.FnUser; -import org.onap.portal.service.fn.FnLanguageService; -import org.onap.portal.service.fn.FnUserService; +import org.onap.portal.service.language.FnLanguageService; +import org.onap.portal.service.microserviceParameter.EpMicroserviceParameterService; +import org.onap.portal.service.user.FnUserService; +import org.onap.portal.service.widgetCatalog.EpWidgetCatalogService; +import org.onap.portal.service.widgetCatalogParameter.EpWidgetCatalogParameterService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -77,7 +78,7 @@ class EpWidgetCatalogParameterServiceTest { private final FnUserService fnUserService; private final EpMicroserviceParameterService epMicroserviceParameterService; private final EpWidgetCatalogService epWidgetCatalogService; - private final FnLanguageDao fnLanguageDao; + private final FnLanguageService fnLanguageService; @Autowired public EpWidgetCatalogParameterServiceTest( @@ -85,13 +86,13 @@ class EpWidgetCatalogParameterServiceTest { WidgetsCatalogController widgetsCatalogController, FnUserService fnUserService, EpMicroserviceParameterService epMicroserviceParameterService, - EpWidgetCatalogService epWidgetCatalogService, FnLanguageDao fnLanguageDao) { + EpWidgetCatalogService epWidgetCatalogService, FnLanguageService fnLanguageService) { this.epWidgetCatalogParameterService = epWidgetCatalogParameterService; this.widgetsCatalogController = widgetsCatalogController; this.fnUserService = fnUserService; this.epMicroserviceParameterService = epMicroserviceParameterService; this.epWidgetCatalogService = epWidgetCatalogService; - this.fnLanguageDao = fnLanguageDao; + this.fnLanguageService = fnLanguageService; } @Test @@ -154,7 +155,7 @@ class EpWidgetCatalogParameterServiceTest { } private FnUser buildFnUser() { - FnLanguage language = fnLanguageDao.getByLanguageAlias("EN"); + FnLanguage language = fnLanguageService.getByLanguageAlias("EN"); return FnUser.builder() .lastLoginDate(LocalDateTime.now()) .activeYn(true) diff --git a/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserRoleServiceTest.java b/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserRoleServiceTest.java index fbb09e15..68b1a80b 100644 --- a/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserRoleServiceTest.java +++ b/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserRoleServiceTest.java @@ -49,6 +49,8 @@ import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.onap.portal.domain.db.fn.FnUser; import org.onap.portal.domain.dto.ecomp.EPUserAppCatalogRoles; +import org.onap.portal.service.user.FnUserService; +import org.onap.portal.service.userRole.FnUserRoleService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.TestPropertySource; diff --git a/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserServiceTest.java b/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserServiceTest.java index 56cbe815..49c018e7 100644 --- a/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserServiceTest.java +++ b/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserServiceTest.java @@ -48,10 +48,12 @@ import java.util.Arrays; import java.util.List; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; -import org.onap.portal.dao.fn.FnLanguageDao; +import org.onap.portal.service.language.FnLanguageService; import org.onap.portal.domain.db.fn.FnLanguage; import org.onap.portal.domain.db.fn.FnLuTimezone; import org.onap.portal.domain.db.fn.FnUser; +import org.onap.portal.service.luTimezone.FnLuTimezoneService; +import org.onap.portal.service.user.FnUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -71,8 +73,6 @@ class FnUserServiceTest { private FnLuTimezoneService fnLuTimezoneService; @Autowired private FnLanguageService fnLanguageService; - @Autowired - private FnLanguageDao fnLanguageDao; @Test void saveUser(){ @@ -96,7 +96,7 @@ class FnUserServiceTest { expected.setCountryCd("US"); expected.setLanguageId(fnLanguageService.findById(1L).orElse(new FnLanguage())); expected.setGuest(false); - FnLanguage language = fnLanguageDao.getByLanguageAlias("EN"); + FnLanguage language = fnLanguageService.getByLanguageAlias("EN"); expected.setLanguageId(language); //When -- cgit 1.2.3-korg