diff options
Diffstat (limited to 'ecomp-portal-BE-common')
-rw-r--r-- | ecomp-portal-BE-common/.gitignore | 5 | ||||
-rw-r--r-- | ecomp-portal-BE-common/pom.xml | 41 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/jarutil/ExtractJar.java | 6 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/command/EPLoginBean.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/command/EPLoginBean.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/command/PostSearchBean.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/command/PostSearchBean.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/ExternalSecurityConfig.java | 74 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/NotificationCleanup.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/NotificationCleanup.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/NotificationCleanupConfig.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/NotificationCleanupConfig.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/PortalCentralAccessConfiguration.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/PortalCentralAccessConfiguration.java) | 18 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/SwaggerConfig.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/SwaggerConfig.java) | 20 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/SwaggerMVCConfig.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/SwaggerMVCConfig.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/EPFusionBaseController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPFusionBaseController.java) | 20 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/EPRestrictedBaseController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPRestrictedBaseController.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/EPRestrictedRESTfulBaseController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPRestrictedRESTfulBaseController.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/EPUnRestrictedBaseController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPUnRestrictedBaseController.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/sessionmgt/SessionCommunicationController.java) | 18 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/externalsystemapproval/model/ExternalSystemRoleApproval.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/externalsystemapproval/model/ExternalSystemRoleApproval.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/externalsystemapproval/model/ExternalSystemUser.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/externalsystemapproval/model/ExternalSystemUser.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/model/Result.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/model/Result.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppCatalogController.java) | 34 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppContactUsController.java) | 40 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppsController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsController.java) | 138 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppsControllerExternalRequest.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequest.java) | 36 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuditLogController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AuditLogController.java) | 31 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BEPropertyReaderController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BEPropertyReaderController.java) | 19 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BasicAuthAccountController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthAccountController.java) | 28 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BasicAuthenticationController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthenticationController.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/CommonWidgetController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/CommonWidgetController.java) | 22 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ConsulClientController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ConsulClientController.java) | 18 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardController.java) | 102 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardSearchResultController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultController.java) | 32 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/EncryptAdminController.java | 220 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAccessRolesController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAccessRolesController.java) | 598 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAppsRestfulController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulController.java) | 59 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/FunctionalMenuController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/FunctionalMenuController.java) | 54 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/GetAccessController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/GetAccessController.java) | 25 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/HealthCheckController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/HealthCheckController.java) | 24 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ManifestController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ManifestController.java) | 17 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceController.java) | 30 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceProxyController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceProxyController.java) | 20 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/PortalAdminController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java) | 44 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RoleManageController.java | 747 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RolesApprovalSystemController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RolesApprovalSystemController.java) | 32 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SchedulerAuxController.java | 141 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SchedulerController.java | 348 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SharedContextRestController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SharedContextRestController.java) | 22 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/TicketEventController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/TicketEventController.java) | 28 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserController.java) | 36 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserNotificationController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserNotificationController.java) | 43 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserRolesController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRolesController.java) | 70 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WebAnalyticsExtAppController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppController.java) | 40 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogController.java) | 42 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogMarkupController.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupController.java) | 22 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java | 186 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/AdminUserApp.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AdminUserApp.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/AdminUserApplications.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AdminUserApplications.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/App.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/App.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/AppContactUs.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppContactUs.java) | 17 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/AppIdAndNameTransportModel.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppIdAndNameTransportModel.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/AppsResponse.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppsResponse.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/BEProperty.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/BEProperty.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/BasicAuthCredentials.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/BasicAuthCredentials.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/CentralV2RoleFunction.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/CentralRoleFunction.java) | 129 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/CentralizedApp.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/lm/FusionLicenseManagerImplTest.java) | 65 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPApp.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPApp.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPAppRoleFunction.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPAppRoleFunction.java) | 26 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPEndpoint.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPEndpoint.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPEndpointAccount.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPEndpointAccount.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPRole.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPRole.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUser.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUser.java) | 14 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserApp.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserApp.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserAppCatalogRoles.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppCatalogRoles.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserAppRoles.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRoles.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequest.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequestDetail.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequestDetail.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserAppsManualSortPreference.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppsManualSortPreference.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserAppsSortPreference.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppsSortPreference.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserNotification.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserNotification.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPWidgetsManualSortPreference.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPWidgetsManualSortPreference.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EcompApp.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompApp.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EcompAppRole.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAppRole.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EcompAppRoleId.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAppRoleId.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EcompAuditLog.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAuditLog.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/ExternalRoleDetails.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/ExternalRoleDetails.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/ExternalSystemAccess.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/ExternalSystemAccess.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/FunctionalMenuItemWithAppID.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/FunctionalMenuItemWithAppID.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/GetAccessResult.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/GetAccessResult.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/GetAccessResultId.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/GetAccessResultId.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/MicroserviceData.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/MicroserviceData.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/MicroserviceParameter.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/MicroserviceParameter.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/PersUserAppSelection.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/PersUserAppSelection.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/PersUserWidgetSelection.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/PersUserWidgetSelection.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/RoleApp.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/RoleApp.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/SharedContext.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/SharedContext.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/UserIdRoleId.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserIdRoleId.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/UserRole.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserRole.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/UserRoles.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserRoles.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/Widget.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/Widget.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/WidgetCatalog.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetCatalog.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/WidgetCatalogParameter.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetCatalogParameter.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/WidgetParameterResult.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetParameterResult.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/WidgetServiceHeaders.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetServiceHeaders.java) | 15 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/AppCatalogItem.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppCatalogItem.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/AppCategoryFunctionsItem.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppCategoryFunctionsItem.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/AppContactUsItem.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppContactUsItem.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/CommonWidgetsEnum.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/CommonWidgetsEnum.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/PortalRestResponse.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/PortalRestResponse.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/PortalRestStatusEnum.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/PortalRestStatusEnum.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/SearchResultItem.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/SearchResultItem.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/DeleteDomainObjectFailedException.java | 47 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/DuplicateRecordException.java | 47 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/ExternalAuthSystemException.java | 47 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/InactiveApplicationException.java | 47 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/InvalidApplicationException.java | 47 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/InvalidRoleException.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterfaceFactory.java) | 20 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/InvalidUserException.java | 47 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/NoHealthyServiceException.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/exceptions/NoHealthyServiceException.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/NonCentralizedAppException.java | 56 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/RoleFunctionException.java | 53 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/SecurityVulnerabilitiesException.java | 45 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/interceptor/PortalResourceInterceptor.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/interceptor/PortalResourceInterceptor.java) | 103 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/listener/HealthMonitor.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/HealthMonitor.java) | 22 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/listener/UserContextListener.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/UserContextListener.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/listener/UserSessionListener.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/UserSessionListener.java) | 18 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/aop/EPAuditLog.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPAuditLog.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java) | 53 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/aop/EPMetricsLog.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPMetricsLog.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/format/ApplicationCodes.properties (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/ApplicationCodes.properties) | 40 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/format/EPAppMessagesEnum.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPAppMessagesEnum.java) | 26 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/format/EPErrorCodesEnum.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPErrorCodesEnum.java) | 13 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/logic/EPLogUtil.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/logic/EPLogUtil.java) | 37 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/RestObject.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/RestObject.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerProperties.java | 164 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerResponseWrapper.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerResponseWrapper.java) | 28 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInt.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInt.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInterface.java | 270 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInterfaceFactory.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterfaceFactory.java) | 15 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInterfaceIfc.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterfaceIfc.java) | 14 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerUtil.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerUtil.java) | 105 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/client/HttpBasicClient.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/client/HttpBasicClient.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/client/HttpsBasicClient.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/client/HttpsBasicClient.java) | 20 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/policy/rest/RequestDetails.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/rest/RequestDetails.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/restobjects/GetTimeSlotsRestObject.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/GetTimeSlotsRestObject.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/restobjects/PostCreateNewVnfRestObject.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/PostCreateNewVnfRestObject.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/restobjects/PostSubmitVnfChangeRestObject.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/PostSubmitVnfChangeRestObject.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/restobjects/RestObject.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/RestObject.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/util/CustomJacksonJaxBJsonProvider.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/util/CustomJacksonJaxBJsonProvider.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/wrapper/GetTimeSlotsWrapper.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/GetTimeSlotsWrapper.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/wrapper/PostCreateNewVnfWrapper.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/PostCreateNewVnfWrapper.java) | 58 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/wrapper/PostSubmitVnfChangeTimeSlotsWrapper.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/PostSubmitVnfChangeTimeSlotsWrapper.java) | 61 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/wrapper/SchedulerResponseWrapper.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/SchedulerResponseWrapper.java) | 85 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/RestObject.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/RestObject.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxResponseWrapper.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyResponseWrapper.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxRestInt.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInt.java) | 18 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxRestInterface.java | 278 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxRestInterfaceFactory.java | 50 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxRestInterfaceIfc.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterfaceIfc.java) | 92 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxUtil.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyUtil.java) | 31 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AdminRolesService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AdminRolesService.java) | 17 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AdminRolesServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AdminRolesServiceImpl.java) | 88 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AppContactUsService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppContactUsService.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AppContactUsServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppContactUsServiceImpl.java) | 21 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ApplicationsRestClientService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientService.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ApplicationsRestClientServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientServiceImpl.java) | 38 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AppsCacheService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheService.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AppsCacheServiceImple.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheServiceImple.java) | 17 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthAccountService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthAccountService.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthAccountServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthAccountServiceImpl.java) | 41 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthenticationCredentialService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthenticationCredentialService.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthenticationCredentialServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthenticationCredentialServiceImpl.java) | 20 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ConsulHealthService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ConsulHealthService.java) | 11 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ConsulHealthServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ConsulHealthServiceImpl.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/DashboardSearchService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/DashboardSearchService.java) | 14 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/DashboardSearchServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/DashboardSearchServiceImpl.java) | 17 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAppCommonServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAppCommonServiceImpl.java) | 285 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAppService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAppService.java) | 51 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAuditService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAuditService.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAuditServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAuditServiceImpl.java) | 19 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPLdapService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLdapService.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPLdapServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLdapServiceImpl.java) | 31 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPLeftMenuService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLeftMenuService.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPLeftMenuServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLeftMenuServiceImpl.java) | 76 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPLoginService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLoginService.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPLoginServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLoginServiceImpl.java) | 34 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleFunctionService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionService.java) | 17 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleFunctionServiceCentralizedImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceCentralizedImpl.java) | 75 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleFunctionServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceImpl.java) | 20 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleService.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleServiceImpl.java) | 21 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesService.java) | 187 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java | 3497 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/FunctionalMenuService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/FunctionalMenuService.java) | 28 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/FunctionalMenuServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/FunctionalMenuServiceImpl.java) | 84 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/GetAccessService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/GetAccessService.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/GetAccessServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/GetAccessServiceImpl.java) | 17 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ManifestService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ManifestService.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ManifestServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ManifestServiceImpl.java) | 13 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceProxyService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyService.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceProxyServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyServiceImpl.java) | 30 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceService.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceServiceImpl.java) | 46 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/PersUserAppService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserAppService.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/PersUserAppServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserAppServiceImpl.java) | 48 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/PersUserWidgetService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserWidgetService.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/PersUserWidgetServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserWidgetServiceImpl.java) | 39 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/PortalAdminService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PortalAdminService.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/PortalAdminServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PortalAdminServiceImpl.java) | 109 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/SearchService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SearchService.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SearchServiceImpl.java) | 22 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/SharedContextService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SharedContextService.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/SharedContextServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SharedContextServiceImpl.java) | 17 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/TicketEventService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/TicketEventService.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserNotificationService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserNotificationService.java) | 18 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserNotificationServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserNotificationServiceImpl.java) | 32 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserRolesCommonServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java) | 856 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserRolesService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesService.java) | 32 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserService.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserServiceImpl.java) | 61 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/WidgetParameterService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetParameterService.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/WidgetParameterServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetParameterServiceImpl.java) | 16 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/WidgetService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetService.java) | 14 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/WidgetServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetServiceImpl.java) | 66 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/AllAppsWithRolesForUser.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AllAppsWithRolesForUser.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/Analytics.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/Analytics.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/AppCatalogPersonalization.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalization.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/AppNameIdIsAdmin.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdmin.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/AppWithRolesForUser.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUser.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/AppsListWithAdminRole.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRole.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/BulkUploadRoleFunction.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunction.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/BulkUploadUserRoles.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRoles.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/BusinessCardApplicationRole.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRole.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/BusinessCardApplicationRolesList.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesList.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralApp.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralApp.java) | 136 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralRole.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralRole.java) | 245 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralRoleFunction.java | 251 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralUser.java | 965 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralUserApp.java | 144 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralV2Role.java | 246 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralV2User.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralUser.java) | 890 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralV2UserApp.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserApp.java) | 58 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CommonWidget.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CommonWidget.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CommonWidgetMeta.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CommonWidgetMeta.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EPAppsManualPreference.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreference.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EPAppsSortPreference.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreference.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EPDeleteAppsManualSortPref.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPref.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EPUserAppCurrentRoles.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRoles.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EPWidgetsSortPreference.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreference.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EcompUserAppRoles.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserAppRoles.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EcompUserRoles.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserRoles.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EpNotificationItem.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItem.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EpNotificationItemExtVO.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVO.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EpNotificationItemVO.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVO.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EpRoleNotificationItem.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItem.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EventWidget.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EventWidget.java) | 7 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EventWidgetMeta.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EventWidgetMeta.java) | 7 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAccessPerms.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPerms.java) | 50 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAccessPermsDetail.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetail.java) | 31 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAccessRole.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRole.java) | 19 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAccessRolePerms.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePerms.java) | 23 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAccessUser.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUser.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAccessUserRoleDetail.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetail.java) | 21 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAuthUserRole.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/properties/VidProperties.java) | 48 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalRequestFieldsValidator.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRequestFieldsValidator.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalRoleDescription.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescription.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/FavoritesFunctionalMenuItem.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FavoritesFunctionalMenuItem.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/FavoritesFunctionalMenuItemJson.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FavoritesFunctionalMenuItemJson.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/FieldsValidator.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FieldsValidator.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/FunctionalMenuItem.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItem.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/FunctionalMenuItemWithRoles.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemWithRoles.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/FunctionalMenuRole.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRole.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/GlobalRoleWithApplicationRoleFunction.java | 130 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/LocalRole.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/LocalRole.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/OnboardingApp.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingApp.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/OnboardingWidget.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingWidget.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/PortalAdmin.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/PortalAdmin.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/PortalAdminUserRole.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/PortalAdminUserRole.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ProfileDetail.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ProfileDetail.java) | 33 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/RemoteRole.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RemoteRole.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/RemoteUserWithRoles.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRoles.java) | 15 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/RoleInAppForUser.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RoleInAppForUser.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/RolesInAppForUser.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RolesInAppForUser.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/UserApplicationRoles.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/UserApplicationRoles.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/UserWithNameSurnameTitle.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitle.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/WidgetCatalogPersonalization.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalization.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ueb/EPUebHelper.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebHelper.java) | 40 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ueb/EPUebMsgTypes.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebMsgTypes.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/CustomLoggingFilter.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/CustomLoggingFilter.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EPCommonSystemProperties.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EPCommonSystemProperties.java) | 15 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java) | 157 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompVersion.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompVersion.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/HashMapFromList.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/HashMapFromList.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/ParallelExecutor.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/ParallelExecutor.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/PortalConstants.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/PortalConstants.java) | 9 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/AdminAuthExtension.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java) | 11 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/EPProfileService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/EPProfileService.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/EPProfileServiceImpl.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/EPProfileServiceImpl.java) | 18 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/RemoteWebServiceCallService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/RemoteWebServiceCallService.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/CoreTimeoutHandler.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/CoreTimeoutHandler.java) | 16 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/ManageService.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/ManageService.java) | 33 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/SessionCommunication.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/SessionCommunication.java) | 26 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/TimeoutHandler.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/TimeoutHandler.java) | 26 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/util/EPUserUtils.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/util/EPUserUtils.java) | 92 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/util/SystemType.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/util/SystemType.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PolicyController.java | 121 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RoleManageController.java | 201 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SchedulerController.java | 266 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerProperties.java | 56 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterface.java | 237 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyProperties.java | 63 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterface.java | 272 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImpl.java | 2338 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/openecomp/portalsdk/core/lm/FusionLicenseManagerUtils.java | 93 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/webapp/WEB-INF/defs/definitions.xml | 6 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/defs/definitions.xml | 6 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml | 579 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml | 30 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/Workflow.hbm.xml | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/webapp/WEB-INF/jsp/error.jsp | 6 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/webapp/WEB-INF/jsp/index.jsp | 6 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/webapp/WEB-INF/web.xml | 6 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/webapp/index.jsp | 6 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/command/EPLoginBeanTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/command/EPLoginBeanTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/command/PostSearchBeanTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/command/PostSearchBeanTest.java) | 13 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/config/NotificationCleanupTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/config/NotificationCleanupTest.java) | 34 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/config/PortalCentralAccessConfigurationTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/config/PortalCentralAccessConfigurationTest.java) | 15 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AppCatalogControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppCatalogControllerTest.java) | 42 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AppContactUsControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppContactUsControllerTest.java) | 32 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AppsControllerExternalRequestTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequestTest.java) | 38 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AppsControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppsControllerTest.java) | 70 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AuditLogControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AuditLogControllerTest.java) | 20 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/BEPropertyReaderControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/BEPropertyReaderControllerTest.java) | 20 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/BasicAuthAccountControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/BasicAuthAccountControllerTest.java) | 34 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/CommonWidgetControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/CommonWidgetControllerTest.java) | 24 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ConsulClientControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ConsulClientControllerTest.java) | 22 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/DashboardControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/DashboardControllerTest.java) | 54 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/DashboardSearchResultControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultControllerTest.java) | 32 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/EPFusionBaseControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/EPFusionBaseControllerTest.java) | 30 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/EPRestrictedBaseControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/EPRestrictedBaseControllerTest.java) | 11 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ExternalAccessRolesControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ExternalAccessRolesControllerTest.java) | 352 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ExternalAppsRestfulControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulControllerTest.java) | 48 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/FunctionalMenuControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/FunctionalMenuControllerTest.java) | 58 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/GetAccessControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/GetAccessControllerTest.java) | 24 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ManifestControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ManifestControllerTest.java) | 16 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/MicroserviceControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/MicroserviceControllerTest.java) | 33 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/MicroserviceProxyControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/MicroserviceProxyControllerTest.java) | 22 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/PolicyControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/PolicyControllerTest.java) | 97 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/PortalAdminControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/PortalAdminControllerTest.java) | 39 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/RoleManageControllerTest.java | 525 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/RolesApprovalSystemControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/RolesApprovalSystemControllerTest.java) | 24 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/SchedulerControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SchedulerControllerTest.java) | 21 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/SessionCommunicationControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SessionCommunicationControllerTest.java) | 19 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/SharedContextRestClient.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestClient.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/SharedContextRestControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestControllerTest.java) | 21 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/SharedContextTestProperties.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextTestProperties.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/TicketEventControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/TicketEventControllerTest.java) | 25 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/UserControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserControllerTest.java) | 40 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/UserNotificationControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserNotificationControllerTest.java) | 40 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/UserRolesControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserRolesControllerTest.java) | 46 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WebAnalyticsExtAppControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppControllerTest.java) | 36 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WidgetsCatalogControllerTest.java | 139 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WidgetsCatalogMarkupControllerTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupControllerTest.java) | 22 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/shared-context-test.properties | 28 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/core/MockEPUser.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/core/MockEPUser.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/core/PopulateSampleTestData.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/lm/FusionLicenseManagerImpl.java) | 123 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/core/RemoveSampleTestData.java (renamed from ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/lm/LicenseableClassImpl.java) | 96 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/core/RestURLsTestSuite.java | 353 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/AdminUserAppTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AdminUserAppTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/AdminUserApplicationsTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AdminUserApplicationsTest.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/AppContactUsTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AppContactUsTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/CentralRoleFunctionTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/CentralRoleFunctionTest.java) | 21 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/CentralV2RoleFunctionTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/lm/LicenseableClassImplTest.java) | 51 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPAppRoleFunctionTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPAppRoleFunctionTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPAppTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPAppTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPEndpointAccountTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPEndpointAccountTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPEndpointTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPEndpointTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPRoleTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPRoleTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppCatalogRolesTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppCatalogRolesTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequestDetailTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequestDetailTest.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppRolesTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppTest.java) | 14 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppsManualSortPreferenceTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppsManualSortPreferenceTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppsSortPreferenceTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppsSortPreferenceTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserNotificationTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserNotificationTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPWidgetsManualSortPreferenceTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPWidgetsManualSortPreferenceTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EcompAppRoleIdTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EcompAppRoleIdTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EcompAppRoleTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EcompAppRoleTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/ExternalRoleDetailsTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalRoleDetailsTest.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/ExternalSystemAccessTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalSystemAccessTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/ExternalSystemRoleApprovalTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalSystemRoleApprovalTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/FunctionalMenuItemWithAppIDTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/FunctionalMenuItemWithAppIDTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/GetAccessResultIdTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/GetAccessResultIdTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/MicroserviceDataTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/MicroserviceDataTest.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/MicroserviceParameterTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/MicroserviceParameterTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/PersUserAppSelectionTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/PersUserAppSelectionTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/PersUserWidgetSelectionTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/PersUserWidgetSelectionTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/ResultTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ResultTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/SharedContextTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/SharedContextTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/UserIdRoleIdTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/UserIdRoleIdTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/WidgetCatalogParameterTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetCatalogParameterTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/WidgetCatalogTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetCatalogTest.java) | 14 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/WidgetParameterResultTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetParameterResultTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/WidgetTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NoHealthyServiceExceptionTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/exceptions/NoHealthyServiceExceptionTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/framework/ApplicationCommonContextTestSuite.java | 191 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/framework/MockitoTestSuite.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/framework/MockitoTestSuite.java) | 8 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/listener/HealthMonitorTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/listener/HealthMonitorTest.java) | 9 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/model/AppCatalogItemTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppCatalogItemTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/model/AppCategoryFunctionsItemTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppCategoryFunctionsItemTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/model/AppContactUsItemTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppContactUsItemTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/model/SearchResultItemTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/SearchResultItemTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/AppContactUsServiceImplTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/AppContactUsServiceImplTest.java) | 26 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/DashboardSearchServiceImplTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/DashboardSearchServiceImplTest.java) | 22 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/EPRoleFunctionServiceCentralizedImplTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceCentralizedImplTest.java) | 38 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/EPRoleFunctionServiceImplTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceImplTest.java) | 26 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/EPRoleServiceImplTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleServiceImplTest.java) | 20 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImplTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImplTest.java) | 128 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/FunctionalMenuMockServiceImplTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/FunctionalMenuMockServiceImplTest.java) | 28 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/FunctionalMenuServiceImplTest.java | 92 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/GetAccessServiceImplTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/GetAccessServiceImplTest.java) | 20 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/ManifestServiceImplTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/ManifestServiceImplTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/PersUserAppServiceImplTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/PersUserAppServiceImplTest.java) | 28 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/AnalyticsTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AnalyticsTest.java) | 11 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/AppCatalogPersonalizationTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalizationTest.java) | 9 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/AppNameIdIsAdminTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdminTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/AppWithRolesForUserTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUserTest.java) | 11 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/AppsListWithAdminRoleTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRoleTest.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/BulkUploadRoleFunctionTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunctionTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/BulkUploadUserRolesTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRolesTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/BusinessCardApplicationRoleTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRoleTest.java) | 9 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/BusinessCardApplicationRolesListTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesListTest.java) | 9 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/CentralAppTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralAppTest.java) | 65 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/CentralRoleTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralRoleTest.java) | 76 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/CentralUserAppTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralUserAppTest.java) | 42 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/CentralUserTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralUserTest.java) | 38 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EPAppsManualPreferenceTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreferenceTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EPAppsSortPreferenceTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreferenceTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EPDeleteAppsManualSortPrefTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPrefTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EPUserAppCurrentRolesTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRolesTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EPWidgetsSortPreferenceTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreferenceTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EcompUserAppRolesTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EcompUserAppRolesTest.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EpNotificationItemExtVOTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVOTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EpNotificationItemTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemTest.java) | 11 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EpNotificationItemVOTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVOTest.java) | 11 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EpRoleNotificationItemTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItemTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalAccessPermsDetailTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetailTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalAccessPermsTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalAccessRolePermsTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePermsTest.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalAccessRoleTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessRoleTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalAccessUserRoleDetailTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetailTest.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalAccessUserTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalRoleDescriptionTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescriptionTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/FunctionalMenuItemTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/FunctionalMenuRoleTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRoleTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/RemoteUserWithRolesTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRolesTest.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/RoleInAppForUserTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/RoleInAppForUserTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/UserApplicationRolesTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/UserApplicationRolesTest.java) | 12 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/UserWithNameSurnameTitleTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitleTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/WidgetCatalogPersonalizationTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalizationTest.java) | 10 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/utils/EcompPortalUtilsTest.java (renamed from ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/utils/EcompPortalUtilsTest.java) | 9 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/RoleManageControllerTest.java | 226 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/shared-context-test.properties | 46 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/LicenseableClassImplTest.java | 98 |
463 files changed, 17026 insertions, 9279 deletions
diff --git a/ecomp-portal-BE-common/.gitignore b/ecomp-portal-BE-common/.gitignore index ae81c23b..e92d1a05 100644 --- a/ecomp-portal-BE-common/.gitignore +++ b/ecomp-portal-BE-common/.gitignore @@ -3,5 +3,6 @@ .classpath .project .settings/ -/logs -/debug-logs +/debug-logs/ +/logs/ +/bin/ diff --git a/ecomp-portal-BE-common/pom.xml b/ecomp-portal-BE-common/pom.xml index 3d1db4db..d7917795 100644 --- a/ecomp-portal-BE-common/pom.xml +++ b/ecomp-portal-BE-common/pom.xml @@ -1,13 +1,14 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> + <parent> <groupId>org.onap.portal</groupId> <artifactId>onap-portal-parent</artifactId> - <version>1.3.0</version> + <version>2.2</version> </parent> - <artifactId>ecompportal-be-common</artifactId> + <artifactId>portal-be-common</artifactId> <packaging>war</packaging> <properties> @@ -48,6 +49,19 @@ </execution> </executions> </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>3.0.0</version> + <executions> + <execution> + <goals> + <goal>test-jar</goal> + </goals> + </execution> + </executions> + </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -566,8 +580,27 @@ <version>${jacocoVersion}</version> <classifier>runtime</classifier> </dependency> + <dependency> + <groupId>org.owasp.esapi</groupId> + <artifactId>esapi</artifactId> + <version>2.1.0.1</version> + </dependency> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-core</artifactId> + <version>${springframework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-web</artifactId> + <version>${springframework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-config</artifactId> + <version>${springframework.version}</version> + </dependency> + </dependencies> - <!-- No deployment descriptor. --> - </project> diff --git a/ecomp-portal-BE-common/src/main/java/jarutil/ExtractJar.java b/ecomp-portal-BE-common/src/main/java/jarutil/ExtractJar.java index 4e069214..50e2720e 100644 --- a/ecomp-portal-BE-common/src/main/java/jarutil/ExtractJar.java +++ b/ecomp-portal-BE-common/src/main/java/jarutil/ExtractJar.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/command/EPLoginBean.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/command/EPLoginBean.java index 54a17fc2..99677b3d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/command/EPLoginBean.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/command/EPLoginBean.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.command; +package org.onap.portalapp.command; import java.util.Set; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalsdk.core.domain.support.FusionCommand; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalsdk.core.domain.support.FusionCommand; public class EPLoginBean extends FusionCommand { private String loginId; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/command/PostSearchBean.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/command/PostSearchBean.java index 38aae80f..6fc8f2a5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/command/PostSearchBean.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/command/PostSearchBean.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.command; +package org.onap.portalapp.command; import java.util.List; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalsdk.core.command.support.SearchBase; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalsdk.core.command.support.SearchBase; import com.fasterxml.jackson.databind.annotation.JsonSerialize; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/ExternalSecurityConfig.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/ExternalSecurityConfig.java new file mode 100644 index 00000000..f509dd21 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/ExternalSecurityConfig.java @@ -0,0 +1,74 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.config; + +import java.util.regex.Pattern; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.web.csrf.CookieCsrfTokenRepository; +import org.springframework.security.web.util.matcher.RegexRequestMatcher; +import org.springframework.security.web.util.matcher.RequestMatcher; + + +@Configuration +@EnableWebSecurity +public class ExternalSecurityConfig extends WebSecurityConfigurerAdapter { + @Override + protected void configure(HttpSecurity http) throws Exception { + RequestMatcher csrfRequestMatcher = new RequestMatcher() { + private RegexRequestMatcher requestMatcher = new RegexRequestMatcher("/portalApi/.*", null); + private Pattern allowedMethods = Pattern.compile("^(GET|HEAD|TRACE|OPTIONS)$"); + @Override + public boolean matches(HttpServletRequest request) { + if(allowedMethods.matcher(request.getMethod()).matches()) + return false; + + if(requestMatcher.matches(request)) + return true; + + return false; + } + }; + http.csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()).requireCsrfProtectionMatcher(csrfRequestMatcher); + } +} diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/NotificationCleanup.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/NotificationCleanup.java index 2c11824a..60148f9e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/NotificationCleanup.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/NotificationCleanup.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.config; +package org.onap.portalapp.config; import java.util.TimerTask; -import org.openecomp.portalapp.portal.service.UserNotificationService; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.portal.service.UserNotificationService; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; public class NotificationCleanup extends TimerTask { private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(NotificationCleanup.class); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/NotificationCleanupConfig.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/NotificationCleanupConfig.java index 016a55e0..1cf4091c 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/NotificationCleanupConfig.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/NotificationCleanupConfig.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.config; +package org.onap.portalapp.config; import java.util.Timer; import java.util.TimerTask; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/PortalCentralAccessConfiguration.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/PortalCentralAccessConfiguration.java index 0b701a29..f19f238e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/PortalCentralAccessConfiguration.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/PortalCentralAccessConfiguration.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,13 +35,13 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.config; +package org.onap.portalapp.config; -import org.openecomp.portalapp.portal.service.EPRoleFunctionService; -import org.openecomp.portalapp.portal.service.EPRoleFunctionServiceCentralizedImpl; -import org.openecomp.portalapp.portal.service.EPRoleFunctionServiceImpl; -import org.openecomp.portalsdk.core.service.CentralAccessCondition; -import org.openecomp.portalsdk.core.service.LocalAccessCondition; +import org.onap.portalapp.portal.service.EPRoleFunctionService; +import org.onap.portalapp.portal.service.EPRoleFunctionServiceCentralizedImpl; +import org.onap.portalapp.portal.service.EPRoleFunctionServiceImpl; +import org.onap.portalsdk.core.service.CentralAccessCondition; +import org.onap.portalsdk.core.service.LocalAccessCondition; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/SwaggerConfig.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/SwaggerConfig.java index 94659d71..96aaaebe 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/SwaggerConfig.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/SwaggerConfig.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.config; +package org.onap.portalapp.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -64,12 +64,12 @@ public class SwaggerConfig { private ApiInfo apiInfo() { return new ApiInfoBuilder() - .title("ECOMP Portal API Documentation") - .description("ECOMP Portal API Documentation") - .version("1.2.6") - .termsOfServiceUrl("http://terms-of-services.url") - .license("LICENSE") - .licenseUrl("http://url-to-license.com") + .title("ONAP Portal API") + .description("ONAP Portal API Documentation") + .version("2.1") + .termsOfServiceUrl("http://www.onap.org") + .license("Apache 2.0") + .licenseUrl("https://www.apache.org/licenses/LICENSE-2.0") .build(); } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/SwaggerMVCConfig.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/SwaggerMVCConfig.java index 399d5863..668c3f35 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/SwaggerMVCConfig.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/SwaggerMVCConfig.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.config; +package org.onap.portalapp.config; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.EnableWebMvc; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPFusionBaseController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/EPFusionBaseController.java index fb84bf62..a425812f 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPFusionBaseController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/EPFusionBaseController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.controller; +package org.onap.portalapp.controller; import java.util.ArrayList; import java.util.HashMap; @@ -46,12 +46,12 @@ import java.util.Set; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.controller.FusionBaseController; -import org.openecomp.portalsdk.core.domain.MenuData; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.controller.FusionBaseController; +import org.onap.portalsdk.core.domain.MenuData; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPRestrictedBaseController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/EPRestrictedBaseController.java index 0d81b50b..82931249 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPRestrictedBaseController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/EPRestrictedBaseController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.controller; +package org.onap.portalapp.controller; public class EPRestrictedBaseController extends EPFusionBaseController{ diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPRestrictedRESTfulBaseController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/EPRestrictedRESTfulBaseController.java index af88055b..1532f688 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPRestrictedRESTfulBaseController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/EPRestrictedRESTfulBaseController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.controller; +package org.onap.portalapp.controller; public class EPRestrictedRESTfulBaseController extends EPFusionBaseController{ diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPUnRestrictedBaseController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/EPUnRestrictedBaseController.java index f6ba65c9..7d0c18f6 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPUnRestrictedBaseController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/EPUnRestrictedBaseController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.controller; +package org.onap.portalapp.controller; public class EPUnRestrictedBaseController extends EPFusionBaseController{ protected String viewName; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/sessionmgt/SessionCommunicationController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java index 4ce72b0b..e17c67c5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/sessionmgt/SessionCommunicationController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,16 +35,16 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.controller.sessionmgt; +package org.onap.portalapp.controller.sessionmgt; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalapp.controller.EPRestrictedRESTfulBaseController; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.utils.PortalConstants; -import org.openecomp.portalapp.service.sessionmgt.ManageService; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.controller.EPRestrictedRESTfulBaseController; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalapp.service.sessionmgt.ManageService; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/externalsystemapproval/model/ExternalSystemRoleApproval.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/externalsystemapproval/model/ExternalSystemRoleApproval.java index 9309dbe5..5c6ca1ad 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/externalsystemapproval/model/ExternalSystemRoleApproval.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/externalsystemapproval/model/ExternalSystemRoleApproval.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.externalsystemapproval.model; +package org.onap.portalapp.externalsystemapproval.model; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/externalsystemapproval/model/ExternalSystemUser.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/externalsystemapproval/model/ExternalSystemUser.java index 660af6a4..47128ca5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/externalsystemapproval/model/ExternalSystemUser.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/externalsystemapproval/model/ExternalSystemUser.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.externalsystemapproval.model; +package org.onap.portalapp.externalsystemapproval.model; import java.util.ArrayList; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/model/Result.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/model/Result.java index 55d55996..ce50d564 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/model/Result.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/model/Result.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.model; +package org.onap.portalapp.model; public class Result { private String result; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppCatalogController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java index 35390b19..80a236df 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppCatalogController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.io.IOException; import java.util.List; @@ -43,19 +43,19 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalapp.controller.EPRestrictedBaseController; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.AppCatalogItem; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.EPAppService; -import org.openecomp.portalapp.portal.service.PersUserAppService; -import org.openecomp.portalapp.portal.transport.AppCatalogPersonalization; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.ecomp.model.AppCatalogItem; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.EPAppService; +import org.onap.portalapp.portal.service.PersUserAppService; +import org.onap.portalapp.portal.transport.AppCatalogPersonalization; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.web.bind.annotation.RequestBody; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppContactUsController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java index 611e1bb0..409b75d2 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppContactUsController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.util.Collections; import java.util.Comparator; @@ -45,16 +45,16 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; import org.json.JSONObject; -import org.openecomp.portalapp.controller.EPRestrictedBaseController; -import org.openecomp.portalapp.portal.ecomp.model.AppCategoryFunctionsItem; -import org.openecomp.portalapp.portal.ecomp.model.AppContactUsItem; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.AppContactUsService; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.portal.ecomp.model.AppCategoryFunctionsItem; +import org.onap.portalapp.portal.ecomp.model.AppContactUsItem; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.service.AppContactUsService; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.web.bind.annotation.PathVariable; @@ -203,9 +203,9 @@ public class AppContactUsController extends EPRestrictedBaseController { try { saveAppContactUs = contactUsService.saveAppContactUs(contactUs); } catch (Exception e) { - return new PortalRestResponse<String>(PortalRestStatusEnum.OK, saveAppContactUs, e.getMessage()); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, saveAppContactUs, e.getMessage()); } - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, saveAppContactUs, ""); + return new PortalRestResponse<String>(PortalRestStatusEnum.OK, saveAppContactUs, ""); } @RequestMapping(value = "/saveAll", method = RequestMethod.POST, produces = "application/json") @@ -215,9 +215,9 @@ public class AppContactUsController extends EPRestrictedBaseController { try { saveAppContactUs = contactUsService.saveAppContactUs(contactUsList); } catch (Exception e) { - return new PortalRestResponse<String>(PortalRestStatusEnum.OK, saveAppContactUs, e.getMessage()); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, saveAppContactUs, e.getMessage()); } - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, saveAppContactUs, ""); + return new PortalRestResponse<String>(PortalRestStatusEnum.OK, saveAppContactUs, ""); } /** @@ -234,9 +234,9 @@ public class AppContactUsController extends EPRestrictedBaseController { try { saveAppContactUs = contactUsService.deleteContactUs(id); } catch (Exception e) { - return new PortalRestResponse<String>(PortalRestStatusEnum.OK, saveAppContactUs, e.getMessage()); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, saveAppContactUs, e.getMessage()); } - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, saveAppContactUs, ""); + return new PortalRestResponse<String>(PortalRestStatusEnum.OK, saveAppContactUs, ""); } }
\ No newline at end of file diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppsController.java index e9a1a951..3ddfc7c3 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppsController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.io.IOException; import java.util.List; @@ -44,30 +44,31 @@ import java.util.Set; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalapp.controller.EPRestrictedBaseController; -import org.openecomp.portalapp.portal.domain.AdminUserApplications; -import org.openecomp.portalapp.portal.domain.AppIdAndNameTransportModel; -import org.openecomp.portalapp.portal.domain.AppsResponse; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EcompApp; -import org.openecomp.portalapp.portal.domain.UserRoles; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.EPAppService; -import org.openecomp.portalapp.portal.service.EPLeftMenuService; -import org.openecomp.portalapp.portal.transport.EPAppsManualPreference; -import org.openecomp.portalapp.portal.transport.EPAppsSortPreference; -import org.openecomp.portalapp.portal.transport.EPDeleteAppsManualSortPref; -import org.openecomp.portalapp.portal.transport.EPWidgetsSortPreference; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.LocalRole; -import org.openecomp.portalapp.portal.transport.OnboardingApp; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.portalsdk.core.web.support.AppUtils; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.portal.domain.AdminUserApplications; +import org.onap.portalapp.portal.domain.AppIdAndNameTransportModel; +import org.onap.portalapp.portal.domain.AppsResponse; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EcompApp; +import org.onap.portalapp.portal.domain.UserRoles; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.EPAppService; +import org.onap.portalapp.portal.service.EPLeftMenuService; +import org.onap.portalapp.portal.transport.EPAppsManualPreference; +import org.onap.portalapp.portal.transport.EPAppsSortPreference; +import org.onap.portalapp.portal.transport.EPDeleteAppsManualSortPref; +import org.onap.portalapp.portal.transport.EPWidgetsSortPreference; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.LocalRole; +import org.onap.portalapp.portal.transport.OnboardingApp; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.util.SystemProperties; +import org.onap.portalsdk.core.web.support.AppUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.http.HttpEntity; @@ -564,16 +565,87 @@ public class AppsController extends EPRestrictedBaseController { */ @RequestMapping(value = { "/portalApi/appRoles/{appId}" }, method = { RequestMethod.GET }, produces = "application/json") - public List<LocalRole> getAppRoles(HttpServletRequest request, @PathVariable("appId") Long appId) { + public List<LocalRole> getAppRoles(HttpServletRequest request, @PathVariable("appId") Long appId, + HttpServletResponse response) { List<LocalRole> roleList = null; + EPUser user = EPUserUtils.getUserSession(request); + EPApp requestedApp = appService.getApp(appId); + if (user != null && (adminRolesService.isAccountAdminOfApplication(user, requestedApp) + || (adminRolesService.isSuperAdmin(user) && requestedApp.getId() == PortalConstants.PORTAL_APP_ID))) { + try { + roleList = appService.getAppRoles(appId); + EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/appRoles/" + appId, "GET result =", + roleList); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getAppRoles failed", e); + } + } else { + EcompPortalUtils.setBadPermissions(user, response, "getAppRoles"); + } + return roleList; + } + + /** + * + * Return single app information with appName as parameter + * + * @param request + * @param response + * @return EPApp object + */ + @RequestMapping(value = { "/portalApi/singleAppInfo" }, method = { + RequestMethod.GET }, produces = "application/json") + public EPApp getSingleAppInfo(HttpServletRequest request, HttpServletResponse response) { + EPApp app = null; + EPUser user = EPUserUtils.getUserSession(request); try { - roleList = appService.getAppRoles(appId); - EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/appRoles/" + appId, "GET result =", roleList); + String appName = request.getParameter("appParam"); + app = appService.getAppDetailByAppName(appName); + if (user != null && (adminRolesService.isAccountAdminOfApplication(user, app) + || (adminRolesService.isSuperAdmin(user) && app.getId() == PortalConstants.PORTAL_APP_ID))) + EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/singleAppInfo" + appName, "GET result =", app); + else{ + app= null; + EcompPortalUtils.setBadPermissions(user, response, "createAdmin"); + } + } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "getAppRoles failed", e); + logger.error(EELFLoggerDelegate.errorLogger, "getSingleAppInfo failed", e); } + return app; + } - return roleList; + /** + * + * Return single app information with appId as parameter + * + * @param request + * @param response + * @return EPApp object + */ + @RequestMapping(value = { "/portalApi/singleAppInfoById" }, method = { + RequestMethod.GET }, produces = "application/json") + public EPApp getSingleAppInfoById(HttpServletRequest request, HttpServletResponse response) { + EPApp app = null; + EPUser user = EPUserUtils.getUserSession(request); + try { + String appId = request.getParameter("appParam"); + app = appService.getApp(Long.valueOf(appId)); + if(!EcompPortalUtils.checkIfRemoteCentralAccessAllowed()) { + app.setCentralAuth(false); + } + if (user != null && (adminRolesService.isAccountAdminOfApplication(user, app) + || (adminRolesService.isSuperAdmin(user) && app.getId() == PortalConstants.PORTAL_APP_ID))) + EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/singleAppInfoById" + appId, "GET result =", app); + else{ + app= null; + EcompPortalUtils.setBadPermissions(user, response, "createAdmin"); + } + + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getSingleAppInfo failed", e); + } + return app; } /** diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequest.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppsControllerExternalRequest.java index d7295041..34aa481e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequest.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppsControllerExternalRequest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,27 +35,27 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.EPAppService; -import org.openecomp.portalapp.portal.service.PortalAdminService; -import org.openecomp.portalapp.portal.service.UserService; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.OnboardingApp; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.portal.utils.PortalConstants; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.EPAppService; +import org.onap.portalapp.portal.service.PortalAdminService; +import org.onap.portalapp.portal.service.UserService; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.OnboardingApp; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AuditLogController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuditLogController.java index aa8d7bfd..e0232850 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AuditLogController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuditLogController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import javax.servlet.http.HttpServletRequest; @@ -45,18 +45,17 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; - -import org.openecomp.portalsdk.core.domain.AuditLog; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.AuditService; -import org.openecomp.portalapp.controller.EPRestrictedBaseController; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.logging.aop.EPEELFLoggerAdvice; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.portal.utils.PortalConstants; -import org.openecomp.portalapp.util.EPUserUtils; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.logging.aop.EPEELFLoggerAdvice; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.domain.AuditLog; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.service.AuditService; @RestController @RequestMapping("/portalApi/auditLog") diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BEPropertyReaderController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BEPropertyReaderController.java index 2d8fd182..6b5d31d7 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BEPropertyReaderController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BEPropertyReaderController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import javax.servlet.http.HttpServletRequest; @@ -43,12 +43,11 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; - -import org.openecomp.portalsdk.core.controller.FusionBaseController; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.portalapp.portal.domain.BEProperty; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.domain.BEProperty; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalsdk.core.controller.FusionBaseController; +import org.onap.portalsdk.core.util.SystemProperties; @RestController @RequestMapping("/portalApi/properties") diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthAccountController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BasicAuthAccountController.java index 6004d698..f02d8fce 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthAccountController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BasicAuthAccountController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.util.ArrayList; import java.util.List; @@ -43,16 +43,16 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalapp.controller.EPRestrictedBaseController; -import org.openecomp.portalapp.portal.domain.BasicAuthCredentials; -import org.openecomp.portalapp.portal.domain.EPEndpoint; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.BasicAuthAccountService; -import org.openecomp.portalapp.util.EPUserUtils; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.portal.domain.BasicAuthCredentials; +import org.onap.portalapp.portal.domain.EPEndpoint; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.BasicAuthAccountService; +import org.onap.portalapp.util.EPUserUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.web.bind.annotation.PathVariable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthenticationController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BasicAuthenticationController.java index ad0829f3..94e38286 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthenticationController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BasicAuthenticationController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; /** * Marker interface to indicate that requests to this controller present HTTP diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/CommonWidgetController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/CommonWidgetController.java index 9d046cb4..0ede833b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/CommonWidgetController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/CommonWidgetController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,17 +35,17 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import javax.servlet.http.HttpServletRequest; -import org.openecomp.portalapp.controller.EPRestrictedBaseController; -import org.openecomp.portalapp.portal.controller.DashboardController.WidgetCategory; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.DashboardSearchService; -import org.openecomp.portalapp.portal.transport.CommonWidgetMeta; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.portal.controller.DashboardController.WidgetCategory; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.service.DashboardSearchService; +import org.onap.portalapp.portal.transport.CommonWidgetMeta; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ConsulClientController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ConsulClientController.java index e1b39f38..3a8f6c8d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ConsulClientController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ConsulClientController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.util.ArrayList; import java.util.List; @@ -43,11 +43,11 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalapp.controller.EPRestrictedBaseController; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.ConsulHealthService; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.service.ConsulHealthService; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardController.java index aaeea44c..d8e8aeb0 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -47,28 +47,30 @@ import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalapp.controller.EPRestrictedBaseController; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EcompAuditLog; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.ecomp.model.SearchResultItem; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.logging.aop.EPEELFLoggerAdvice; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.portal.service.DashboardSearchService; -import org.openecomp.portalapp.portal.transport.CommonWidget; -import org.openecomp.portalapp.portal.transport.CommonWidgetMeta; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.portal.utils.PortalConstants; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.domain.AuditLog; -import org.openecomp.portalsdk.core.domain.support.CollaborateList; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.AuditService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EcompAuditLog; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.ecomp.model.SearchResultItem; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.logging.aop.EPEELFLoggerAdvice; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.DashboardSearchService; +import org.onap.portalapp.portal.transport.CommonWidget; +import org.onap.portalapp.portal.transport.CommonWidgetMeta; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.domain.AuditLog; +import org.onap.portalsdk.core.domain.support.CollaborateList; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.service.AuditService; +import org.onap.portalsdk.core.util.SystemProperties; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; @@ -93,6 +95,9 @@ public class DashboardController extends EPRestrictedBaseController { @Autowired private AuditService auditService; + @Autowired + private AdminRolesService adminRolesService; + public enum WidgetCategory { EVENTS, NEWS, IMPORTANTRESOURCES; } @@ -166,16 +171,23 @@ public class DashboardController extends EPRestrictedBaseController { * @return Rest response wrapped around a String; e.g., "success" or "ERROR" */ @RequestMapping(value = "/widgetData", method = RequestMethod.POST, produces = "application/json") - public PortalRestResponse<String> saveWidgetData(@RequestBody CommonWidget commonWidget) { + public PortalRestResponse<String> saveWidgetData(@RequestBody CommonWidget commonWidget, HttpServletRequest request, + HttpServletResponse response) { logger.debug(EELFLoggerDelegate.debugLogger, "saveWidgetData: argument is {}", commonWidget); - if (commonWidget.getCategory() == null || commonWidget.getCategory().trim().equals("")) - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "ERROR", - "Category cannot be null or empty"); - String err = validateCommonWidget(commonWidget); - if (err != null) - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, err, null); - return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "success", - searchService.saveWidgetData(commonWidget)); + EPUser user = EPUserUtils.getUserSession(request); + if (adminRolesService.isSuperAdmin(user)) { + if (commonWidget.getCategory() == null || commonWidget.getCategory().trim().isEmpty()) + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "ERROR", + "Category cannot be null or empty"); + String err = validateCommonWidget(commonWidget); + if (err != null) + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, err, null); + return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "success", + searchService.saveWidgetData(commonWidget)); + } else { + EcompPortalUtils.setBadPermissions(user, response, "saveWidgetData"); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed", null); + } } /** @@ -201,17 +213,15 @@ public class DashboardController extends EPRestrictedBaseController { return "HREF does not start with http"; if (cw.getSortOrder() == null) return "Sort order is null"; - if (WidgetCategory.EVENTS.name().equals(cw.getCategory())) { - if (cw.getEventDate() == null || cw.getEventDate().trim().length() == 0) - return "Date is missing"; - try { - yearMonthDayFormat.setLenient(false); - Date date = yearMonthDayFormat.parse(cw.getEventDate()); - if (date == null) - return "Failed to parse date " + cw.getEventDate(); - } catch (ParseException ex) { - return ex.toString(); - } + if (cw.getEventDate() == null || cw.getEventDate().trim().length() == 0) + return "Date is missing"; + try { + yearMonthDayFormat.setLenient(false); + Date date = yearMonthDayFormat.parse(cw.getEventDate()); + if (date == null) + return "Failed to parse date " + cw.getEventDate(); + } catch (ParseException ex) { + return "Invalid date format " +ex.toString(); } return null; } @@ -299,7 +309,7 @@ public class DashboardController extends EPRestrictedBaseController { String userId = user.getOrgUserId(); activeUsers = searchService.getRelatedUsers(userId); - HashSet<String> usersSet = CollaborateList.getInstance().getAllUserName(); + HashSet<String> usersSet = (HashSet<String>) CollaborateList.getInstance().getAllUserName(); for (String users : activeUsers) { if (usersSet.contains(users)) { onlineUsers.add(users); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardSearchResultController.java index 313ae683..b26bd1bc 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardSearchResultController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -47,17 +47,17 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; -import org.openecomp.portalapp.controller.EPRestrictedBaseController; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.ecomp.model.SearchResultItem; -import org.openecomp.portalapp.portal.service.DashboardSearchService; -import org.openecomp.portalapp.portal.transport.CommonWidget; -import org.openecomp.portalapp.portal.transport.CommonWidgetMeta; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.domain.support.CollaborateList; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.ecomp.model.SearchResultItem; +import org.onap.portalapp.portal.service.DashboardSearchService; +import org.onap.portalapp.portal.transport.CommonWidget; +import org.onap.portalapp.portal.transport.CommonWidgetMeta; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.domain.support.CollaborateList; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -220,7 +220,7 @@ public class DashboardSearchResultController extends EPRestrictedBaseController String userId = user.getOrgUserId(); activeUsers = searchService.getRelatedUsers(userId); - HashSet<String> usersSet = CollaborateList.getInstance().getAllUserName(); + HashSet<String> usersSet = (HashSet<String>) CollaborateList.getInstance().getAllUserName(); for (String users : activeUsers) { if (usersSet.contains(users)) { onlineUsers.add(users); diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/EncryptAdminController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/EncryptAdminController.java new file mode 100644 index 00000000..65b24707 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/EncryptAdminController.java @@ -0,0 +1,220 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.controller; + +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang.StringUtils; +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.onboarding.exception.CipherUtilException; +import org.onap.portalsdk.core.onboarding.util.CipherUtil; +import org.onap.portalsdk.core.service.DataAccessService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping(PortalConstants.REST_AUX_API) +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +@EPAuditLog +public class EncryptAdminController implements BasicAuthenticationController { + @Autowired + DataAccessService dataAccessService; + @Autowired + protected SessionFactory sessionFactory; + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EncryptAdminController.class); + + @RequestMapping(value = { "/executeEncryptQuery" }, method = RequestMethod.POST) + public Map<Long, String> executeEncrypt(HttpServletRequest request, HttpServletResponse response) + throws CipherUtilException { + + return fetchRecords(); + } + + public Map<Long, String> fetchRecords() throws CipherUtilException { + List appPassword = null; + Session localSession = null; + Map<Long, String> responsemap; + try { + localSession = sessionFactory.openSession(); + responsemap = new LinkedHashMap<Long, String>(); + appPassword = dataAccessService.executeNamedQuery("getAppPassword", null, null); + if (appPassword != null) { + Iterator i = appPassword.iterator(); + while (i.hasNext()) { + Object[] user = (Object[]) i.next(); + Long app_id = (Long) user[0]; + String app_password = (String) user[1]; + if (app_id != null && StringUtils.isNotEmpty(app_password)) { + try { + final String pass = CipherUtil.encryptPKC(CipherUtil.decrypt(app_password)); + Query query = null; + try { + localSession.getTransaction().begin(); + query = localSession.createSQLQuery( + "UPDATE fn_app m SET m.app_password= :pass " + " where m.app_id = :app_id"); + query.setParameter("pass", pass); + query.setParameter("app_id", app_id); + int result = query.executeUpdate(); + localSession.getTransaction().commit(); + logger.debug(EELFLoggerDelegate.debugLogger, + "--------------getAppPassword-------query successfull------------------" + + query); + + } catch (Exception e) { + localSession.getTransaction().rollback(); + logger.debug(EELFLoggerDelegate.debugLogger, + "--------------getAppPassword--------query failed-----------------" + query); + responsemap.put(app_id, "-------query failed-----------------" + query); + logger.error(EELFLoggerDelegate.errorLogger, + "getAppPassword error while executing the query", e); + + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, + "getAppPassword error while executing the query", e); + } + } + } + } + appPassword = dataAccessService.executeNamedQuery("getBasicauthAccount", null, null); + if (appPassword != null) { + Iterator i = appPassword.iterator(); + while (i.hasNext()) { + Object[] user = (Object[]) i.next(); + Long app_id = (Long) user[0]; + String password = (String) user[1]; + if (app_id != null && StringUtils.isNotEmpty(password)) { + try { + final String pass = CipherUtil.encryptPKC(CipherUtil.decrypt(password)); + Query query = null; + try { + localSession.getTransaction().begin(); + query = localSession + .createSQLQuery("UPDATE ep_basic_auth_account m SET m.password = :pass" + + " where m.id = :app_id"); + query.setParameter("pass", pass); + query.setParameter("app_id", app_id); + int result = query.executeUpdate(); + localSession.getTransaction().commit(); + logger.debug(EELFLoggerDelegate.debugLogger, + "--------------getAppPassword-------query successfull------------------" + + query); + + } catch (Exception e) { + localSession.getTransaction().rollback(); + logger.debug(EELFLoggerDelegate.debugLogger, + "--------------getAppPassword--------query failed-----------------" + query); + responsemap.put(app_id, "-------query failed-----------------" + query); + logger.error(EELFLoggerDelegate.errorLogger, + "getAppPassword error while executing the query", e); + + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, + "getAppPassword error while executing the query", e); + } + + } + + } + } + appPassword = dataAccessService.executeNamedQuery("getMicroserviceInfo", null, null); + if (appPassword != null) { + Iterator i = appPassword.iterator(); + while (i.hasNext()) { + Object[] user = (Object[]) i.next(); + Long app_id = (Long) user[0]; + String password = (String) user[1]; + if (app_id != null && StringUtils.isNotEmpty(password)) { + try { + final String pass = CipherUtil.encryptPKC(CipherUtil.decrypt(password)); + Query query = null; + try { + localSession.getTransaction().begin(); + query = localSession.createSQLQuery( + "UPDATE ep_microservice m SET m.password = :pass" + " WHERE m.id = :app_id"); + query.setParameter("pass", pass); + query.setParameter("app_id", app_id); + int result = query.executeUpdate(); + localSession.getTransaction().commit(); + logger.debug(EELFLoggerDelegate.debugLogger, + "--------------getAppPassword-------query successfull------------------" + + query); + + } catch (Exception e) { + localSession.getTransaction().rollback(); + logger.debug(EELFLoggerDelegate.debugLogger, + "--------------getAppPassword--------query failed-----------------" + query); + responsemap.put(app_id, "-------query failed-----------------" + query); + logger.error(EELFLoggerDelegate.errorLogger, + "getAppPassword error while executing the query", e); + + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, + "getAppPassword error while executing the query", e); + } + + } + + } + } + + } finally { + EcompPortalUtils.closeLocalSession(localSession, "updateRecords"); + } + return responsemap; + } +} diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAccessRolesController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAccessRolesController.java index 5770d163..0be015ee 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAccessRolesController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAccessRolesController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,45 +35,57 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; -import java.util.ArrayList; + +import java.io.IOException; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalapp.portal.domain.CentralRoleFunction; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EcompAuditLog; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.logging.aop.EPEELFLoggerAdvice; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.portal.service.ExternalAccessRolesService; -import org.openecomp.portalapp.portal.transport.CentralRole; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.portal.utils.PortalConstants; -import org.openecomp.portalsdk.core.domain.AuditLog; -import org.openecomp.portalsdk.core.domain.Role; -import org.openecomp.portalsdk.core.domain.RoleFunction; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.restful.domain.EcompUser; -import org.openecomp.portalsdk.core.service.AuditService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.apache.commons.lang.StringUtils; +import org.onap.portalapp.portal.domain.CentralV2RoleFunction; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EcompAuditLog; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.exceptions.InvalidRoleException; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.logging.aop.EPEELFLoggerAdvice; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.service.ExternalAccessRolesService; +import org.onap.portalapp.portal.transport.CentralRole; +import org.onap.portalapp.portal.transport.CentralRoleFunction; +import org.onap.portalapp.portal.transport.CentralUser; +import org.onap.portalapp.portal.transport.CentralV2Role; +import org.onap.portalapp.portal.transport.ExternalRequestFieldsValidator; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalsdk.core.domain.AuditLog; +import org.onap.portalsdk.core.domain.Role; +import org.onap.portalsdk.core.domain.RoleFunction; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.restful.domain.EcompUser; +import org.onap.portalsdk.core.service.AuditService; +import org.onap.portalsdk.core.util.SystemProperties; import org.slf4j.MDC; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.RestTemplate; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import io.swagger.annotations.ApiOperation; @@ -85,7 +97,15 @@ import io.swagger.annotations.ApiOperation; @EPAuditLog public class ExternalAccessRolesController implements BasicAuthenticationController { + private static final String ROLE_INVALID_CHARS = "%=():,\"\""; + + private static final String SUCCESSFULLY_DELETED = "Successfully Deleted"; + + private static final String INVALID_UEB_KEY = "Invalid uebkey!"; + private static final String LOGIN_ID = "LoginId"; + + RestTemplate template = new RestTemplate(); @Autowired private AuditService auditService; @@ -97,108 +117,236 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl @Autowired private ExternalAccessRolesService externalAccessRolesService; - @ApiOperation(value = "Gets user role for an application.", response = String.class, responseContainer = "List") - @RequestMapping(value = { "/user/{loginId}" }, method = RequestMethod.GET, produces = "application/json") - public String getUser(HttpServletRequest request, HttpServletResponse response, + @ApiOperation(value = "Gets user role for an application.", response = CentralUser.class, responseContainer="List") + @RequestMapping(value = { + "/user/{loginId}" }, method = RequestMethod.GET, produces = "application/json") + public CentralUser getUser(HttpServletRequest request, HttpServletResponse response, @PathVariable("loginId") String loginId) throws Exception { - String answer = null; + CentralUser answer = null; try { - answer = externalAccessRolesService.getUserWithRoles(loginId, request.getHeader(UEBKEY)); + fieldsValidation(request); + answer = externalAccessRolesService.getUserRoles(loginId, request.getHeader(UEBKEY)); } catch (Exception e) { + sendErrorResponse(response, e); logger.error(EELFLoggerDelegate.errorLogger, "getUser failed", e); } return answer; } - - @ApiOperation(value = "Gets roles for an application.", response = CentralRole.class, responseContainer = "Json") - @RequestMapping(value = { "/roles" }, method = RequestMethod.GET, produces = "application/json") + + @ApiOperation(value = "Gets user roles for an application which is upgraded to newer version.", response = String.class, responseContainer="List") + @RequestMapping(value = { + "/v2/user/{loginId}" }, method = RequestMethod.GET, produces = "application/json") + public String getV2UserList(HttpServletRequest request, HttpServletResponse response, + @PathVariable("loginId") String loginId) throws Exception { + String answer = null; + try { + fieldsValidation(request); + answer = externalAccessRolesService.getV2UserWithRoles(loginId, request.getHeader(UEBKEY)); + } catch (Exception e) { + sendErrorResponse(response, e); + logger.error(EELFLoggerDelegate.errorLogger, "getV2UserList failed", e); + } + return answer; + } + + @ApiOperation(value = "Gets roles for an application.", response = CentralRole.class, responseContainer="Json") + @RequestMapping(value = { + "/roles" }, method = RequestMethod.GET, produces = "application/json") public List<CentralRole> getRolesForApp(HttpServletRequest request, HttpServletResponse response) throws Exception { logger.debug(EELFLoggerDelegate.debugLogger, "Request received for getRolesForApp"); - List<EPApp> applicationList = new ArrayList<>(); - applicationList = externalAccessRolesService.getApp(request.getHeader(UEBKEY)); - EPApp app = applicationList.get(0); - externalAccessRolesService.syncApplicationRolesWithEcompDB(app); - List<CentralRole> answer = null; + List<CentralV2Role> v2CenRole = null; + List<CentralRole> cenRole = null; try { - answer = externalAccessRolesService.getRolesForApp(request.getHeader(UEBKEY)); - } catch (HttpClientErrorException e) { - if ("Application not found".equalsIgnoreCase(e.getMessage())) { - response.setStatus(HttpServletResponse.SC_NOT_FOUND); - } - response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + fieldsValidation(request); + EPApp app = externalAccessRolesService.getApp(request.getHeader(UEBKEY)).get(0); + // Sync all roles from external system into Ecomp portal DB + logger.debug(EELFLoggerDelegate.debugLogger, "getRolesForApp: Entering into syncApplicationRolesWithEcompDB"); + externalAccessRolesService.syncApplicationRolesWithEcompDB(app); + logger.debug(EELFLoggerDelegate.debugLogger, "getRolesForApp: Finished syncApplicationRolesWithEcompDB"); + v2CenRole = externalAccessRolesService.getRolesForApp(request.getHeader(UEBKEY)); + cenRole = externalAccessRolesService.convertV2CentralRoleListToOldVerisonCentralRoleList(v2CenRole); + } catch (Exception e) { + sendErrorResponse(response, e); logger.error(EELFLoggerDelegate.errorLogger, "getRolesForApp failed", e); } logger.debug(EELFLoggerDelegate.debugLogger, "Request completed for getRolesForApp"); + return cenRole; + } + + @ApiOperation(value = "Gets roles for an application which is upgraded to newer version.", response = CentralV2Role.class, responseContainer="Json") + @RequestMapping(value = { + "/v2/roles" }, method = RequestMethod.GET, produces = "application/json") + public List<CentralV2Role> getV2RolesForApp(HttpServletRequest request, HttpServletResponse response) throws Exception { + logger.debug(EELFLoggerDelegate.debugLogger, "Request received for getV2RolesForApp"); + List<CentralV2Role> answer = null; + try { + fieldsValidation(request); + EPApp app = externalAccessRolesService.getApp(request.getHeader(UEBKEY)).get(0); + // Sync all roles from external system into Ecomp portal DB + logger.debug(EELFLoggerDelegate.debugLogger, "getV2RolesForApp: Entering into syncApplicationRolesWithEcompDB"); + externalAccessRolesService.syncApplicationRolesWithEcompDB(app); + logger.debug(EELFLoggerDelegate.debugLogger, "getV2RolesForApp: Finished syncApplicationRolesWithEcompDB"); + answer = externalAccessRolesService.getRolesForApp(request.getHeader(UEBKEY)); + } catch (Exception e) { + sendErrorResponse(response, e); + logger.error(EELFLoggerDelegate.errorLogger, "getV2RolesForApp failed", e); + } + logger.debug(EELFLoggerDelegate.debugLogger, "Request completed for getV2RolesForApp"); return answer; } - @ApiOperation(value = "Gets all role functions for an application.", response = CentralRoleFunction.class, responseContainer = "Json") - @RequestMapping(value = { "/functions" }, method = RequestMethod.GET, produces = "application/json") - public List<CentralRoleFunction> getRoleFunctionsList(HttpServletRequest request, HttpServletResponse response) + @ApiOperation(value = "Gets all role functions for an application for older version.", response = CentralRoleFunction.class, responseContainer="Json") + @RequestMapping(value = { + "/functions" }, method = RequestMethod.GET, produces = "application/json") + public List<RoleFunction> getRoleFunctionsList(HttpServletRequest request, HttpServletResponse response) throws Exception { - List<CentralRoleFunction> answer = null; + List<CentralV2RoleFunction> answer = null; + List<RoleFunction> roleFuncList = null; logger.debug(EELFLoggerDelegate.debugLogger, "Request received for getRoleFunctionsList"); try { + fieldsValidation(request); + EPApp app = externalAccessRolesService.getApp(request.getHeader(UEBKEY)).get(0); + // Sync all functions from external system into Ecomp portal DB + logger.debug(EELFLoggerDelegate.debugLogger, "getRoleFunctionsList: Entering into syncRoleFunctionFromExternalAccessSystem"); + externalAccessRolesService.syncRoleFunctionFromExternalAccessSystem(app); + logger.debug(EELFLoggerDelegate.debugLogger, "getRoleFunctionsList: Finished syncRoleFunctionFromExternalAccessSystem"); answer = externalAccessRolesService.getRoleFuncList(request.getHeader(UEBKEY)); - } catch (HttpClientErrorException e) { - response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + roleFuncList = externalAccessRolesService.convertCentralRoleFunctionToRoleFunctionObject(answer); + } catch (Exception e) { + sendErrorResponse(response, e); logger.error(EELFLoggerDelegate.errorLogger, "getRoleFunctionsList failed", e); } logger.debug(EELFLoggerDelegate.debugLogger, "Request completed for getRoleFunctionsList"); - return answer; - } + return roleFuncList; + } + + @ApiOperation(value = "Gets all role functions for an application which is upgraded to newer version.", response = CentralV2RoleFunction.class, responseContainer="Json") + @RequestMapping(value = { + "/v2/functions" }, method = RequestMethod.GET, produces = "application/json") + public List<CentralV2RoleFunction> getV2RoleFunctionsList(HttpServletRequest request, HttpServletResponse response) + throws Exception { + List<CentralV2RoleFunction> cenRoleFuncList = null; + logger.debug(EELFLoggerDelegate.debugLogger, "Request received for getV2RoleFunctionsList"); + try { + fieldsValidation(request); + EPApp app = externalAccessRolesService.getApp(request.getHeader(UEBKEY)).get(0); + // Sync all functions from external system into Ecomp portal DB + logger.debug(EELFLoggerDelegate.debugLogger, "getV2RoleFunctionsList: Entering into syncRoleFunctionFromExternalAccessSystem"); + externalAccessRolesService.syncRoleFunctionFromExternalAccessSystem(app); + logger.debug(EELFLoggerDelegate.debugLogger, "getV2RoleFunctionsList: Finished syncRoleFunctionFromExternalAccessSystem"); + cenRoleFuncList = externalAccessRolesService.getRoleFuncList(request.getHeader(UEBKEY)); + } catch (Exception e) { + sendErrorResponse(response, e); + logger.error(EELFLoggerDelegate.errorLogger, "getV2RoleFunctionsList failed", e); + } + logger.debug(EELFLoggerDelegate.debugLogger, "Request completed for getV2RoleFunctionsList"); + return cenRoleFuncList; + } - @ApiOperation(value = "Gets role information for an application.", response = CentralRole.class, responseContainer = "Json") - @RequestMapping(value = { "/role/{role_id}" }, method = RequestMethod.GET, produces = "application/json") + @ApiOperation(value = "Gets role information for an application.", response = CentralRole.class, responseContainer="Json") + @RequestMapping(value = { + "/role/{role_id}" }, method = RequestMethod.GET, produces = "application/json") public CentralRole getRoleInfo(HttpServletRequest request, HttpServletResponse response, @PathVariable("role_id") Long roleId) throws Exception { - CentralRole answer = null; + CentralV2Role answer = null; + CentralRole cenRole = null; logger.debug(EELFLoggerDelegate.debugLogger, "Request received for getRoleInfo"); - try { + fieldsValidation(request); answer = externalAccessRolesService.getRoleInfo(roleId, request.getHeader(UEBKEY)); - } catch (HttpClientErrorException e) { - response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + cenRole = externalAccessRolesService.convertV2CentralRoleToOldVerisonCentralRole(answer); + } catch (Exception e) { + sendErrorResponse(response, e); logger.error(EELFLoggerDelegate.errorLogger, "getRoleInfo failed", e); } logger.debug(EELFLoggerDelegate.debugLogger, "Request completed for getRoleInfo"); + return cenRole; + } + + @ApiOperation(value = "Gets v2 role information for an application which is upgraded to newer version.", response = CentralV2Role.class, responseContainer="Json") + @RequestMapping(value = { + "/v2/role/{role_id}" }, method = RequestMethod.GET, produces = "application/json") + public CentralV2Role getV2RoleInfo(HttpServletRequest request, HttpServletResponse response, + @PathVariable("role_id") Long roleId) throws Exception { + CentralV2Role answer = null; + logger.debug(EELFLoggerDelegate.debugLogger, "Request received for getV2RoleInfo"); + try { + fieldsValidation(request); + answer = externalAccessRolesService.getRoleInfo(roleId, request.getHeader(UEBKEY)); + } catch (Exception e) { + sendErrorResponse(response, e); + logger.error(EELFLoggerDelegate.errorLogger, "getV2RoleInfo failed", e); + } + logger.debug(EELFLoggerDelegate.debugLogger, "Request completed for getV2RoleInfo"); return answer; } - + @ApiOperation(value = "Gets role information for an application provided by function code.", response = CentralRoleFunction.class, responseContainer = "Json") @RequestMapping(value = { "/function/{code}" }, method = RequestMethod.GET, produces = "application/json") public CentralRoleFunction getRoleFunction(HttpServletRequest request, HttpServletResponse response, @PathVariable("code") String code) throws Exception { - CentralRoleFunction centralRoleFunction = null; + CentralV2RoleFunction centralV2RoleFunction = null; + CentralRoleFunction centralRoleFunction = new CentralRoleFunction(); try { - centralRoleFunction = externalAccessRolesService.getRoleFunction(code, request.getHeader(UEBKEY)); - } catch (HttpClientErrorException e) { - response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - logger.error(EELFLoggerDelegate.errorLogger, "getRoleInfo failed", e); + fieldsValidation(request); + centralV2RoleFunction = externalAccessRolesService.getRoleFunction(code, request.getHeader(UEBKEY)); + if(centralV2RoleFunction != null && EcompPortalUtils.getFunctionCode(centralV2RoleFunction.getCode()).equals(code)) { + BeanUtils.copyProperties(centralV2RoleFunction, centralRoleFunction, "type","action"); + } + } catch (Exception e) { + sendErrorResponse(response, e); + logger.error(EELFLoggerDelegate.errorLogger, "getRoleFunction failed", e); } return centralRoleFunction; } + + @ApiOperation(value = "Gets role information for an application provided by function code.", response = CentralV2RoleFunction.class, responseContainer = "Json") + @RequestMapping(value = { "/v2/function/{code}" }, method = RequestMethod.GET, produces = "application/json") + public CentralV2RoleFunction getV2RoleFunction(HttpServletRequest request, HttpServletResponse response, + @PathVariable("code") String code) throws Exception { + CentralV2RoleFunction centralV2RoleFunction = null; + try { + fieldsValidation(request); + centralV2RoleFunction = externalAccessRolesService.getRoleFunction(code, request.getHeader(UEBKEY)); + if(centralV2RoleFunction == null || !EcompPortalUtils.getFunctionCode(centralV2RoleFunction.getCode()).equals(code)) { + centralV2RoleFunction = new CentralV2RoleFunction(); + } + } catch (Exception e) { + sendErrorResponse(response, e); + logger.error(EELFLoggerDelegate.errorLogger, "getV2RoleFunction failed", e); + } + return centralV2RoleFunction; + } @ApiOperation(value = "Saves role function for an application.", response = PortalRestResponse.class, responseContainer = "Json") @RequestMapping(value = { "/roleFunction" }, method = RequestMethod.POST, produces = "application/json") public PortalRestResponse<String> saveRoleFunction(HttpServletRequest request, HttpServletResponse response, @RequestBody String roleFunc) throws Exception { - - ObjectMapper mapper = new ObjectMapper(); - List<EPApp> applicationList = externalAccessRolesService.getApp(request.getHeader(UEBKEY)); - EPApp requestedApp = applicationList.get(0); - Long appId = requestedApp.getId(); try { + fieldsValidation(request); String data = roleFunc; - CentralRoleFunction availableRoleFunction = mapper.readValue(data, CentralRoleFunction.class); - availableRoleFunction.setAppId(appId); - boolean saveOrUpdateResponse = externalAccessRolesService.saveCentralRoleFunction(availableRoleFunction, - requestedApp); + ObjectMapper mapper = new ObjectMapper(); + List<EPApp> applicationList = externalAccessRolesService.getApp(request.getHeader(UEBKEY)); + EPApp requestedApp = applicationList.get(0); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + CentralV2RoleFunction availableRoleFunction = mapper.readValue(data, CentralV2RoleFunction.class); + CentralV2RoleFunction domainRoleFunction = externalAccessRolesService.getRoleFunction(availableRoleFunction.getCode(), + requestedApp.getUebKey()); + boolean saveOrUpdateResponse = false; + if (domainRoleFunction != null) { + domainRoleFunction.setName(availableRoleFunction.getName()); + saveOrUpdateResponse = externalAccessRolesService.saveCentralRoleFunction(domainRoleFunction, + requestedApp); + } else { + availableRoleFunction.setAppId(requestedApp.getId()); + saveOrUpdateResponse = externalAccessRolesService.saveCentralRoleFunction(availableRoleFunction, + requestedApp); + } if (saveOrUpdateResponse) { EPUser user = externalAccessRolesService.getUser(request.getHeader(LOGIN_ID)).get(0); EPApp app = externalAccessRolesService.getApp(request.getHeader(UEBKEY)).get(0); - CentralRoleFunction function = externalAccessRolesService + CentralV2RoleFunction function = externalAccessRolesService .getRoleFunction(availableRoleFunction.getCode(), request.getHeader(UEBKEY)); String activityCode = (function.getCode() == null) ? EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_ADD_FUNCTION @@ -232,17 +380,23 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl "Failed to saveRoleFunction for '" + availableRoleFunction.getCode() + "'", "Failed"); } } catch (Exception e) { + if (e.getMessage().contains(INVALID_UEB_KEY)) { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + }else { + response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + } logger.error(EELFLoggerDelegate.errorLogger, "saveRoleFunction failed", e); return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed"); } return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully Saved", "Success"); } - + @ApiOperation(value = "Deletes role function for an application.", response = PortalRestResponse.class, responseContainer = "Json") @RequestMapping(value = { "/roleFunction/{code}" }, method = RequestMethod.DELETE, produces = "application/json") public PortalRestResponse<String> deleteRoleFunction(HttpServletRequest request, HttpServletResponse response, @PathVariable("code") String code) throws Exception { try { + fieldsValidation(request); EPUser user = externalAccessRolesService.getUser(request.getHeader(LOGIN_ID)).get(0); EPApp app = externalAccessRolesService.getApp(request.getHeader(UEBKEY)).get(0); boolean getDelFuncResponse = externalAccessRolesService.deleteCentralRoleFunction(code, app); @@ -274,25 +428,33 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to deleteRoleFunction for '" + code + "'", "Failed"); } - } catch (HttpClientErrorException e) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + } catch (Exception e) { + if (e.getMessage().contains(INVALID_UEB_KEY)) { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + } else { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + } logger.error(EELFLoggerDelegate.errorLogger, "deleteRoleFunction failed", e); - return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, - "Failed to deleteRoleFunction for '" + code + "'", "Failed"); + return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed"); } - return new PortalRestResponse<>(PortalRestStatusEnum.OK, "Successfully Deleted", "Success"); - - } + return new PortalRestResponse<>(PortalRestStatusEnum.OK, SUCCESSFULLY_DELETED, "Success"); + } + @ApiOperation(value = "Saves role for an application.", response = PortalRestResponse.class, responseContainer = "Json") @RequestMapping(value = { "/role" }, method = RequestMethod.POST, produces = "application/json") public PortalRestResponse<String> saveRole(HttpServletRequest request, HttpServletResponse response, @RequestBody Role role) throws Exception { try { + fieldsValidation(request); + ExternalRequestFieldsValidator saveRoleResult = null; EPUser user = externalAccessRolesService.getUser(request.getHeader(LOGIN_ID)).get(0); EPApp app = externalAccessRolesService.getApp(request.getHeader(UEBKEY)).get(0); - boolean getAddResponse = externalAccessRolesService.saveRoleForApplication(role, request.getHeader(UEBKEY)); - if (getAddResponse) { + if(role.getId()!=null && StringUtils.containsAny(role.getName(), ROLE_INVALID_CHARS)) { + throw new InvalidRoleException("Invalid role name found for '" + role.getName() + "'. Any one of the following characters '%,(),=,:,comma, and double quotes' are not allowed"); + } + saveRoleResult = externalAccessRolesService.saveRoleForApplication(role, request.getHeader(UEBKEY)); + if (saveRoleResult.isResult()) { String activityCode = (role.getId() == null) ? EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_ADD_ROLE : EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_UPDATE_ROLE_AND_FUNCTION; logger.info(EELFLoggerDelegate.applicationLogger, "saveRole: succeeded for app {}, role {}", @@ -317,24 +479,35 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP); MDC.remove(SystemProperties.MDC_TIMER); } else { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, - "Failed to saveRole for '" + role.getName() + "'", "Failed"); - + if(saveRoleResult.getDetailMessage().contains("406")){ + response.setStatus(HttpServletResponse.SC_NOT_ACCEPTABLE); + return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, + "Failed to create a role for '" + role.getName() + "'. Any one of the following characters '%,(),=,:,comma, and double quotes' are not allowed" + , "Failed"); + } else{ + response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, + "Failed to saveRole for '" + role.getName() + "'", "Failed"); + } } } catch (Exception e) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + if (e.getMessage().contains(INVALID_UEB_KEY)) { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + }else { + response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + } logger.error(EELFLoggerDelegate.errorLogger, "saveRole failed", e); - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to saveRole", "Failed"); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed"); } return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully Saved", "Success"); } - + @ApiOperation(value = "Deletes role for an application.", response = PortalRestResponse.class, responseContainer = "Json") @RequestMapping(value = { "/deleteRole/{code}" }, method = RequestMethod.DELETE, produces = "application/json") - public PortalRestResponse<String> deleteRole(HttpServletRequest request, HttpServletResponse response, + public PortalRestResponse<String> deleteRole(HttpServletRequest request, HttpServletResponse response, @PathVariable String code) throws Exception { try { + fieldsValidation(request); boolean deleteResponse = externalAccessRolesService.deleteRoleForApplication(code, request.getHeader(UEBKEY)); if (deleteResponse) { @@ -368,184 +541,267 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl "Failed to deleteRole for '" + code + "'", "Failed"); } } catch (Exception e) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + if (e.getMessage().contains(INVALID_UEB_KEY)) { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + } else { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + } logger.error(EELFLoggerDelegate.errorLogger, "deleteRole failed", e); - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to deleteRole", "Failed"); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed"); } - return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully Deleted", "Success"); - + return new PortalRestResponse<String>(PortalRestStatusEnum.OK, SUCCESSFULLY_DELETED, "Success"); } - - @ApiOperation(value = "Gets active roles for an application.", response = CentralRole.class, responseContainer = "Json") + + @ApiOperation(value = "Gets active roles for an application.", response = CentralV2Role.class, responseContainer = "Json") @RequestMapping(value = { "/activeRoles" }, method = RequestMethod.GET, produces = "application/json") - public List<CentralRole> getActiveRoles(HttpServletRequest request, HttpServletResponse response) throws Exception { - List<CentralRole> cenRole = null; + public List<CentralV2Role> getActiveRoles(HttpServletRequest request, HttpServletResponse response) throws Exception { + List<CentralV2Role> cenRole = null; try { + fieldsValidation(request); cenRole = externalAccessRolesService.getActiveRoles(request.getHeader(UEBKEY)); - } catch (HttpClientErrorException e) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + } catch (Exception e) { + sendErrorResponse(response, e); logger.error(EELFLoggerDelegate.errorLogger, "getActiveRoles failed", e); } return cenRole; - + } - + @ApiOperation(value = "deletes user roles for an application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { - "/deleteDependcyRoleRecord/{roleId}" }, method = RequestMethod.DELETE, produces = "application/json") - public PortalRestResponse<String> deleteDependencyRoleRecord(HttpServletRequest request, - HttpServletResponse response, @PathVariable("roleId") Long roleId) throws Exception { + @RequestMapping(value = { "/deleteDependcyRoleRecord/{roleId}" }, method = RequestMethod.DELETE, produces = "application/json") + public PortalRestResponse<String> deleteDependencyRoleRecord(HttpServletRequest request, HttpServletResponse response, + @PathVariable("roleId") Long roleId) throws Exception { + ExternalRequestFieldsValidator removeResult = null; try { - boolean deleteResponse = externalAccessRolesService.deleteDependencyRoleRecord(roleId, + fieldsValidation(request); + removeResult = externalAccessRolesService.deleteDependencyRoleRecord(roleId, request.getHeader(UEBKEY), request.getHeader(LOGIN_ID)); - if (!deleteResponse) { + if (!removeResult.isResult()) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, "Failed to deleteDependencyRoleRecord", "Failed"); } - } catch (HttpClientErrorException e) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + } catch (Exception e) { + if (e.getMessage().contains(INVALID_UEB_KEY)) { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + } else { + response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + } logger.error(EELFLoggerDelegate.errorLogger, "deleteDependencyRoleRecord failed", e); - return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, "Failed to deleteDependencyRoleRecord", - "Failed"); + return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed"); } - return new PortalRestResponse<>(PortalRestStatusEnum.OK, "Successfully Deleted", "Success"); + return new PortalRestResponse<>(PortalRestStatusEnum.OK, SUCCESSFULLY_DELETED, "Success"); } - + + + @ApiOperation(value = "deletes roles for an application.", response = PortalRestResponse.class, responseContainer = "Json") + @RequestMapping(value = { "/v2/deleteRole/{roleId}" }, method = RequestMethod.DELETE, produces = "application/json") + public PortalRestResponse<String> deleteRole(HttpServletRequest request, HttpServletResponse response, + @PathVariable("roleId") Long roleId) throws Exception { + ExternalRequestFieldsValidator removeResult = null; + try { + fieldsValidation(request); + removeResult = externalAccessRolesService.deleteDependencyRoleRecord(roleId, + request.getHeader(UEBKEY), request.getHeader(LOGIN_ID)); + if (!removeResult.isResult()) { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, "Failed to deleteRole", + "Failed"); + } + } catch (Exception e) { + if (e.getMessage().contains(INVALID_UEB_KEY)) { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + } else { + response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + } + logger.error(EELFLoggerDelegate.errorLogger, "deleteRole failed", e); + return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed"); + } + return new PortalRestResponse<>(PortalRestStatusEnum.OK, SUCCESSFULLY_DELETED, "Success"); + } + + @ApiOperation(value = "Bulk upload functions for an application.", response = PortalRestResponse.class, responseContainer = "Json") @RequestMapping(value = { "/upload/portal/functions" }, method = RequestMethod.POST, produces = "application/json") - public PortalRestResponse<String> bulkUploadFunctions(HttpServletRequest request, HttpServletResponse response) - throws Exception { + public PortalRestResponse<String> bulkUploadFunctions(HttpServletRequest request, HttpServletResponse response) throws Exception { Integer result = 0; try { result = externalAccessRolesService.bulkUploadFunctions(request.getHeader(UEBKEY)); - } catch (HttpClientErrorException e) { + } catch (Exception e) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadFunctions failed", e); - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadFunctions", - "Failed"); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadFunctions", "Failed"); } - return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: " + result, "Success"); + return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: "+result, "Success"); } - + @ApiOperation(value = "Bulk upload roles for an application.", response = PortalRestResponse.class, responseContainer = "Json") @RequestMapping(value = { "/upload/portal/roles" }, method = RequestMethod.POST, produces = "application/json") - public PortalRestResponse<String> bulkUploadRoles(HttpServletRequest request, HttpServletResponse response) - throws Exception { + public PortalRestResponse<String> bulkUploadRoles(HttpServletRequest request, HttpServletResponse response) throws Exception { Integer result = 0; try { result = externalAccessRolesService.bulkUploadRoles(request.getHeader(UEBKEY)); - } catch (HttpClientErrorException e) { + } catch (Exception e) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRoles failed", e); return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadRoles", "Failed"); } - return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: " + result, "Success"); + return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: "+result, "Success"); } - + @ApiOperation(value = "Bulk upload role functions for an application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { - "/upload/portal/roleFunctions" }, method = RequestMethod.POST, produces = "application/json") - public PortalRestResponse<String> bulkUploadRoleFunctions(HttpServletRequest request, HttpServletResponse response) - throws Exception { + @RequestMapping(value = { "/upload/portal/roleFunctions" }, method = RequestMethod.POST, produces = "application/json") + public PortalRestResponse<String> bulkUploadRoleFunctions(HttpServletRequest request, HttpServletResponse response) throws Exception { Integer result = 0; try { result = externalAccessRolesService.bulkUploadRolesFunctions(request.getHeader(UEBKEY)); - } catch (HttpClientErrorException e) { + } catch (Exception e) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRoleFunctions failed", e); - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadRoleFunctions", - "Failed"); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadRoleFunctions", "Failed"); } - return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: " + result, "Success"); + return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: "+result, "Success"); } - + @ApiOperation(value = "Bulk upload user roles for an application.", response = PortalRestResponse.class, responseContainer = "Json") @RequestMapping(value = { "/upload/portal/userRoles" }, method = RequestMethod.POST, produces = "application/json") - public PortalRestResponse<String> bulkUploadUserRoles(HttpServletRequest request, HttpServletResponse response) - throws Exception { + public PortalRestResponse<String> bulkUploadUserRoles(HttpServletRequest request, HttpServletResponse response) throws Exception { Integer result = 0; try { result = externalAccessRolesService.bulkUploadUserRoles(request.getHeader(UEBKEY)); - } catch (HttpClientErrorException e) { + } catch (Exception e) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadUserRoles failed", e); - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadUserRoles", - "Failed"); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadUserRoles", "Failed"); } - return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: " + result, "Success"); + return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: "+result, "Success"); } - + + @ApiOperation(value = "Bulk upload users for renamed role of an application.", response = PortalRestResponse.class, responseContainer = "Json") + @RequestMapping(value = { "/upload/portal/userRole/{roleId}" }, method = RequestMethod.POST, produces = "application/json") + public PortalRestResponse<String> bulkUploadUsersSingleRole(HttpServletRequest request, HttpServletResponse response, @PathVariable Long roleId) throws Exception { + Integer result = 0; + try { + String roleName = request.getHeader("RoleName"); + result = externalAccessRolesService.bulkUploadUsersSingleRole(request.getHeader(UEBKEY), roleId, roleName); + } catch (Exception e) { + response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadUsersSingleRole failed", e); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadUsersSingleRole", "Failed"); + } + return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: "+result, "Success"); + } + @ApiOperation(value = "Bulk upload functions for an partner application.", response = PortalRestResponse.class, responseContainer = "Json") @RequestMapping(value = { "/upload/partner/functions" }, method = RequestMethod.POST, produces = "application/json") - public PortalRestResponse<String> bulkUploadPartnerFunctions(HttpServletRequest request, - HttpServletResponse response, @RequestBody List<RoleFunction> upload) throws Exception { + public PortalRestResponse<String> bulkUploadPartnerFunctions(HttpServletRequest request, HttpServletResponse response, @RequestBody List<RoleFunction> upload) throws Exception { try { externalAccessRolesService.bulkUploadPartnerFunctions(request.getHeader(UEBKEY), upload); - } catch (HttpClientErrorException e) { + } catch (Exception e) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadFunctions failed", e); - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadFunctions", - "Failed"); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadFunctions", "Failed"); } return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added", "Success"); } - + @ApiOperation(value = "Bulk upload roles for an partner application.", response = PortalRestResponse.class, responseContainer = "Json") @RequestMapping(value = { "/upload/partner/roles" }, method = RequestMethod.POST, produces = "application/json") - public PortalRestResponse<String> bulkUploadPartnerRoles(HttpServletRequest request, HttpServletResponse response, - @RequestBody List<Role> upload) throws Exception { + public PortalRestResponse<String> bulkUploadPartnerRoles(HttpServletRequest request, HttpServletResponse response, @RequestBody List<Role> upload) throws Exception { try { externalAccessRolesService.bulkUploadPartnerRoles(request.getHeader(UEBKEY), upload); - } catch (HttpClientErrorException e) { + } catch (Exception e) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRoles failed", e); return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadRoles", "Failed"); } return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added", "Success"); } - + @ApiOperation(value = "Bulk upload role functions for an partner application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { - "/upload/partner/roleFunctions" }, method = RequestMethod.POST, produces = "application/json") - public PortalRestResponse<String> bulkUploadPartnerRoleFunctions(HttpServletRequest request, - HttpServletResponse response, @RequestBody List<Role> upload) throws Exception { + @RequestMapping(value = { "/upload/partner/roleFunctions" }, method = RequestMethod.POST, produces = "application/json") + public PortalRestResponse<String> bulkUploadPartnerRoleFunctions(HttpServletRequest request, HttpServletResponse response, @RequestBody List<Role> upload) throws Exception { try { externalAccessRolesService.bulkUploadPartnerRoleFunctions(request.getHeader(UEBKEY), upload); - } catch (HttpClientErrorException e) { + } catch (Exception e) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRoles failed", e); - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, - "Failed to bulkUploadPartnerRoleFunctions", "Failed"); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadPartnerRoleFunctions", "Failed"); } return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added", "Success"); } - + @ApiOperation(value = "Gets all functions along with global functions", response = List.class, responseContainer = "Json") @RequestMapping(value = { "/menuFunctions" }, method = RequestMethod.GET, produces = "application/json") - public List<String> getMenuFunctions(HttpServletRequest request, HttpServletResponse response) throws Exception { + public List<String> getMenuFunctions(HttpServletRequest request, HttpServletResponse response) throws Exception { List<String> functionsList = null; try { + fieldsValidation(request); functionsList = externalAccessRolesService.getMenuFunctionsList(request.getHeader(UEBKEY)); - } catch (HttpClientErrorException e) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + } catch (Exception e) { + sendErrorResponse(response, e); logger.error(EELFLoggerDelegate.errorLogger, "getMenuFunctions failed", e); } return functionsList; } - + @ApiOperation(value = "Gets all active Users of application", response = String.class, responseContainer = "Json") @RequestMapping(value = { "/users" }, method = RequestMethod.GET, produces = "application/json") - public List<EcompUser> getUsersOfApplication(HttpServletRequest request, HttpServletResponse response) - throws Exception { + public List<EcompUser> getUsersOfApplication(HttpServletRequest request, HttpServletResponse response) throws Exception { List<EcompUser> users = null; try { users = externalAccessRolesService.getAllAppUsers(request.getHeader(UEBKEY)); - } catch (Exception e) { + } catch (Exception e) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); logger.error(EELFLoggerDelegate.errorLogger, "getUsersOfApplication failed", e); throw new Exception(e.getMessage()); } return users; } + + /** + * + * It checks the input uebkey of the application and throws exception if it is invalid key + * + * @param request + * @throws Exception + */ + private void fieldsValidation(HttpServletRequest request) throws Exception{ + List<EPApp> app = externalAccessRolesService.getApp(request.getHeader(UEBKEY)); + if(app.isEmpty()){ + throw new Exception(INVALID_UEB_KEY); + } + if(!app.isEmpty() && app.get(0).getCentralAuth()){ + ResponseEntity<String> response = externalAccessRolesService.getNameSpaceIfExists(app.get(0)); + if (response.getStatusCode().value() == HttpServletResponse.SC_NOT_FOUND) + throw new Exception("Invalid NameSpace"); + } + } + + /** + * + * It returns http response with appropriate message + * + * @param response + * @param e + * @throws IOException + */ + private void sendErrorResponse(HttpServletResponse response, Exception e) throws IOException { + response.setContentType("application/json"); + response.setCharacterEncoding("UTF-8"); + final Map<String,String> uebkeyResponse = new HashMap<>(); + ObjectMapper mapper = new ObjectMapper(); + String reason = ""; + if (e.getMessage().contains(INVALID_UEB_KEY)) { + uebkeyResponse.put("error",INVALID_UEB_KEY); + reason = mapper.writeValueAsString(uebkeyResponse); + response.getWriter().write(reason); + response.setStatus(HttpServletResponse.SC_NOT_FOUND); + } else { + uebkeyResponse.put("error",e.getMessage()); + reason = mapper.writeValueAsString(uebkeyResponse); + response.getWriter().write(reason); + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + } + } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAppsRestfulController.java index c30b41a7..bd2b0a1a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAppsRestfulController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,35 +35,37 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.io.IOException; import java.util.ArrayList; import java.util.Calendar; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalapp.controller.EPRestrictedRESTfulBaseController; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.EPLoginService; -import org.openecomp.portalapp.portal.service.EPRoleService; -import org.openecomp.portalapp.portal.service.FunctionalMenuService; -import org.openecomp.portalapp.portal.service.UserNotificationService; -import org.openecomp.portalapp.portal.transport.EpNotificationItem; -import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItemJson; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.FunctionalMenuItem; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.portal.utils.PortalConstants; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.crossapi.PortalAPIResponse; +import org.onap.portalapp.controller.EPRestrictedRESTfulBaseController; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.EPLoginService; +import org.onap.portalapp.portal.service.EPRoleService; +import org.onap.portalapp.portal.service.FunctionalMenuService; +import org.onap.portalapp.portal.service.UserNotificationService; +import org.onap.portalapp.portal.transport.EpNotificationItem; +import org.onap.portalapp.portal.transport.FavoritesFunctionalMenuItemJson; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.FunctionalMenuItem; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.onboarding.crossapi.PortalAPIResponse; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; @@ -144,9 +146,14 @@ public class ExternalAppsRestfulController extends EPRestrictedRESTfulBaseContro private EPApp findEpApp(String uebKey) { List<?> list = null; - StringBuffer criteria = new StringBuffer(); - criteria.append(" where ueb_key = '" + uebKey + "'"); - list = getDataAccessService().getList(EPApp.class, criteria.toString(), null, null); + Map<String, String> params = new HashMap<>(); + params.put("appKey", uebKey); + try { + list = this.getDataAccessService().executeNamedQuery("getMyAppDetailsByUebKey", params, null); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getMyAppDetailsByUebKey failed", e); + } + return (list == null || list.size() == 0) ? null : (EPApp) list.get(0); } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/FunctionalMenuController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/FunctionalMenuController.java index 5243cad3..1b54ebb4 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/FunctionalMenuController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/FunctionalMenuController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.io.IOException; import java.text.SimpleDateFormat; @@ -51,28 +51,28 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.json.JSONObject; -import org.openecomp.portalapp.controller.EPRestrictedBaseController; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.SharedContext; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.FunctionalMenuService; -import org.openecomp.portalapp.portal.service.SearchService; -import org.openecomp.portalapp.portal.service.SharedContextService; -import org.openecomp.portalapp.portal.transport.BusinessCardApplicationRole; -import org.openecomp.portalapp.portal.transport.BusinessCardApplicationRolesList; -import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItem; -import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItemJson; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.FunctionalMenuItem; -import org.openecomp.portalapp.portal.transport.FunctionalMenuItemWithRoles; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.SharedContext; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.FunctionalMenuService; +import org.onap.portalapp.portal.service.SearchService; +import org.onap.portalapp.portal.service.SharedContextService; +import org.onap.portalapp.portal.transport.BusinessCardApplicationRole; +import org.onap.portalapp.portal.transport.BusinessCardApplicationRolesList; +import org.onap.portalapp.portal.transport.FavoritesFunctionalMenuItem; +import org.onap.portalapp.portal.transport.FavoritesFunctionalMenuItemJson; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.FunctionalMenuItem; +import org.onap.portalapp.portal.transport.FunctionalMenuItemWithRoles; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.web.bind.annotation.PathVariable; @@ -311,7 +311,7 @@ public class FunctionalMenuController extends EPRestrictedBaseController { @RequestMapping(value = { "/portalApi/functionalMenuItemDetails/{menuId}" }, method = RequestMethod.GET, produces = "application/json") public FunctionalMenuItem getFunctionalMenuItemDetails(HttpServletRequest request, - @PathVariable("menuId") Integer menuId, HttpServletResponse response) { + @PathVariable("menuId") Long menuId, HttpServletResponse response) { // TODO: return FunctionalMenuItemJson // TODO: modify FunctionalMenuItem to not include the transient fields FunctionalMenuItem menuItem = null; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/GetAccessController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/GetAccessController.java index 71f745a9..b590c5ea 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/GetAccessController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/GetAccessController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.io.IOException; import java.util.Collections; @@ -49,15 +49,14 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalapp.controller.EPUnRestrictedBaseController; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.GetAccessResult; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.GetAccessService; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.util.EPUserUtils; +import org.onap.portalapp.controller.EPUnRestrictedBaseController; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.GetAccessResult; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.service.GetAccessService; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; @RestController @org.springframework.context.annotation.Configuration diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/HealthCheckController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/HealthCheckController.java index ddb3a315..80e16b59 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/HealthCheckController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/HealthCheckController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.util.ArrayList; import java.util.List; @@ -48,15 +48,15 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +import org.onap.portalapp.controller.EPUnRestrictedBaseController; +import org.onap.portalapp.portal.listener.HealthMonitor; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalapp.controller.EPUnRestrictedBaseController; -import org.openecomp.portalapp.portal.listener.HealthMonitor; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.logging.format.EPAppMessagesEnum; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import com.google.gson.Gson; /** diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ManifestController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ManifestController.java index a40c3dc0..7f68ab21 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ManifestController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ManifestController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.util.HashMap; import java.util.Map; @@ -50,11 +50,10 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; - -import org.openecomp.portalsdk.core.controller.RestrictedBaseController; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.ManifestService; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.service.ManifestService; +import org.onap.portalsdk.core.controller.RestrictedBaseController; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; /** * This controller responds to a request for the web application manifest, diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceController.java index 44e3223e..4530266a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,24 +35,24 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalapp.controller.EPRestrictedBaseController; -import org.openecomp.portalapp.portal.domain.MicroserviceData; -import org.openecomp.portalapp.portal.domain.WidgetCatalog; -import org.openecomp.portalapp.portal.domain.WidgetServiceHeaders; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.ConsulHealthService; -import org.openecomp.portalapp.portal.service.MicroserviceService; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.portal.domain.MicroserviceData; +import org.onap.portalapp.portal.domain.WidgetCatalog; +import org.onap.portalapp.portal.domain.WidgetServiceHeaders; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.service.ConsulHealthService; +import org.onap.portalapp.portal.service.MicroserviceService; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.core.ParameterizedTypeReference; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceProxyController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceProxyController.java index 8655deb0..934d8f50 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceProxyController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceProxyController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,19 +35,19 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalapp.controller.EPUnRestrictedBaseController; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.MicroserviceProxyService; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.controller.EPUnRestrictedBaseController; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.service.MicroserviceProxyService; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.web.bind.annotation.PathVariable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/PortalAdminController.java index 29c3aed4..e77f8f95 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/PortalAdminController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,31 +35,31 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalapp.controller.EPRestrictedBaseController; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EcompAuditLog; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.logging.aop.EPEELFLoggerAdvice; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.PortalAdminService; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.PortalAdmin; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.domain.AuditLog; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.AuditService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EcompAuditLog; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.logging.aop.EPEELFLoggerAdvice; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.PortalAdminService; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.PortalAdmin; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.domain.AuditLog; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.service.AuditService; +import org.onap.portalsdk.core.util.SystemProperties; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RoleManageController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RoleManageController.java new file mode 100644 index 00000000..1433fb21 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RoleManageController.java @@ -0,0 +1,747 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.controller; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang.StringUtils; +import org.json.JSONObject; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.controller.core.RoleController; +import org.onap.portalapp.controller.core.RoleListController; +import org.onap.portalapp.portal.domain.CentralV2RoleFunction; +import org.onap.portalapp.portal.domain.CentralizedApp; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EcompAuditLog; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.exceptions.DuplicateRecordException; +import org.onap.portalapp.portal.exceptions.InvalidApplicationException; +import org.onap.portalapp.portal.exceptions.InvalidRoleException; +import org.onap.portalapp.portal.exceptions.NonCentralizedAppException; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.logging.aop.EPEELFLoggerAdvice; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.EPAppService; +import org.onap.portalapp.portal.service.ExternalAccessRolesService; +import org.onap.portalapp.portal.transport.CentralV2Role; +import org.onap.portalapp.portal.transport.ExternalRequestFieldsValidator; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.domain.AuditLog; +import org.onap.portalsdk.core.domain.Role; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.service.AuditService; +import org.onap.portalsdk.core.util.SystemProperties; +import org.onap.portalsdk.core.web.support.JsonMessage; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.servlet.ModelAndView; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.type.TypeFactory; + +/** + * Proxies REST calls to role-management functions that arrive on paths + * /portalApi/* over to controller methods provided by the SDK-Core library. + * Those controller methods are mounted on paths not exposed by the Portal FE. + */ +@RestController +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +@EPAuditLog +public class RoleManageController extends EPRestrictedBaseController { + private static final String ROLE_INVALID_CHARS = "%=():,\"\""; + + private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RoleManageController.class); + + @Autowired + private RoleController roleController; + + @Autowired + private RoleListController roleListController; + + @Autowired + private EPAppService appService; + + @Autowired + private AuditService auditService; + + @Autowired + private ExternalAccessRolesService externalAccessRolesService; + + + @Autowired + private AdminRolesService adminRolesService; + + /** + * Calls an SDK-Core library method that gets the available roles and writes + * them to the request object. Portal specifies a Hibernate mappings from + * the Role class to the fn_role_v view, which ensures that only Portal + * (app_id is null) roles are fetched. + * + * Any method declared void (no return value) or returning null causes the + * audit log aspect method to declare failure. TODO: should return a JSON + * string. + * + * @param request + * @param response + * @throws Exception + */ + + @RequestMapping(value = { "/portalApi/get_roles/{appId}" }, method = RequestMethod.GET) + public void getRoles(HttpServletRequest request, HttpServletResponse response, @PathVariable("appId") Long appId) throws Exception { + try { + EPUser user = EPUserUtils.getUserSession(request); + EPApp requestedApp = appService.getApp(appId); + if (isAuthorizedUser(user, requestedApp)) { + fieldsValidation(requestedApp); + if (requestedApp.getCentralAuth()) { + List<CentralV2Role> answer = null; + Map<String, Object> model = new HashMap<>(); + ObjectMapper mapper = new ObjectMapper(); + answer = externalAccessRolesService.getRolesForApp(requestedApp.getUebKey()); + model.put("availableRoles", answer); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } else + throw new NonCentralizedAppException(requestedApp.getName()); + } else { + logger.info(EELFLoggerDelegate.auditLogger, "RoleManageController.getRoles, Unauthorized user"); + SendErrorForUnauthorizedUser(response, user); + } + + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getRoles failed", e); + } + } + + + + @RequestMapping(value = { "/portalApi/role_list/toggleRole/{appId}/{roleId}" }, method = RequestMethod.POST) + public Map<String, Object> toggleRole(HttpServletRequest request, HttpServletResponse response, @PathVariable("appId") Long appId, + @PathVariable("roleId") Long roleId) throws Exception { + EPApp requestedApp = null; + String restcallStatus = null; + HashMap<String, Object> responseMap = new HashMap<>(); + EPUser user = EPUserUtils.getUserSession(request); + try { + requestedApp = appService.getApp(appId); + if (isAuthorizedUser(user, requestedApp)) { + fieldsValidation(requestedApp); + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + CentralV2Role domainRole = externalAccessRolesService.getRoleInfo(roleId, requestedApp.getUebKey()); + // role. toggle active ind + boolean active = domainRole.isActive(); + domainRole.setActive(!active); + + String result = mapper.writeValueAsString(domainRole); + Role newRole = externalAccessRolesService.ConvertCentralRoleToRole(result); + ExternalRequestFieldsValidator externalRequestFieldsValidator = externalAccessRolesService + .saveRoleForApplication(newRole, requestedApp.getUebKey()); + boolean getAddResponse = externalRequestFieldsValidator.isResult(); + if (getAddResponse) { + restcallStatus = "Success"; + logger.info(EELFLoggerDelegate.auditLogger, "Toggle active status for role " + domainRole.getId()); + } else { + restcallStatus = "Toggle Role Failed"; + logger.info(EELFLoggerDelegate.auditLogger, "Toggle Role Failed " + domainRole.getId()); + } + responseMap.put("restcallStatus", restcallStatus); + responseMap.put("availableRoles", externalAccessRolesService.getRolesForApp(requestedApp.getUebKey())); + } else { + logger.info(EELFLoggerDelegate.auditLogger, "RoleManageController.toggleRole, Unauthorized user"); + EcompPortalUtils.setBadPermissions(user, response, "createAdmin"); + responseMap.put("restcallStatus", " Unauthorized user"); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "toggleRole failed", e); + throw e; + } + return responseMap; + } + + @RequestMapping(value = { "/portalApi/role_list/removeRole/{appId}/{roleId}" }, method = RequestMethod.POST) + public Map<String, Object> removeRole(HttpServletRequest request, HttpServletResponse response, @PathVariable("appId") Long appId, + @PathVariable("roleId") Long roleId) throws Exception { + + EPUser user = EPUserUtils.getUserSession(request); + EPApp requestedApp = null; + String restCallStatus = null; + HashMap<String, Object> responseMap = new HashMap<>(); + ExternalRequestFieldsValidator externalRequestFieldsValidator = null; + try { + requestedApp = appService.getApp(appId); + if (isAuthorizedUser(user, requestedApp)) { + fieldsValidation(requestedApp); + if (requestedApp.getCentralAuth()) { + externalRequestFieldsValidator = externalAccessRolesService.deleteDependencyRoleRecord(roleId, + requestedApp.getUebKey(), user.getOrgUserId()); + boolean deleteResponse = externalRequestFieldsValidator.isResult(); + if (deleteResponse) { + restCallStatus = "Success"; + EPUser requestedUser = (EPUser) externalAccessRolesService.getUser(user.getOrgUserId()).get(0); + EPApp app = (EPApp) externalAccessRolesService.getApp(requestedApp.getUebKey()).get(0); + logger.info(EELFLoggerDelegate.applicationLogger, "deleteRole: succeeded for app {}, role {}", + app.getId(), roleId); + String activityCode = EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_DELETE_ROLE; + AuditLog auditLog = getAuditInfo(requestedUser, activityCode); + auditLog.setComments(EcompPortalUtils.truncateString( + "Deleted role for app:" + app.getId() + " and role:'" + roleId + "'", + PortalConstants.AUDIT_LOG_COMMENT_SIZE)); + auditService.logActivity(auditLog, null); + MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, + EPEELFLoggerAdvice.getCurrentDateTimeUTC()); + MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, + EPEELFLoggerAdvice.getCurrentDateTimeUTC()); + EcompPortalUtils.calculateDateTimeDifferenceForLog( + MDC.get(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP), + MDC.get(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP)); + logger.info(EELFLoggerDelegate.auditLogger, + EPLogUtil.formatAuditLogMessage("RoleManageController.removeRole", + EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_DELETE_ROLE, + String.valueOf(requestedUser.getId()), requestedUser.getOrgUserId(), + roleId.toString())); + MDC.remove(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP); + MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP); + MDC.remove(SystemProperties.MDC_TIMER); + } else { + restCallStatus = "Remove Role failed"; + responseMap.put("error", externalRequestFieldsValidator.getDetailMessage()); + logger.error(EELFLoggerDelegate.errorLogger, "removeRole failed"); + } + responseMap.put("restCallStatus", restCallStatus); + responseMap.put("availableRoles", + externalAccessRolesService.getRolesForApp(requestedApp.getUebKey())); + } else + throw new NonCentralizedAppException(requestedApp.getName()); + } else { + logger.info(EELFLoggerDelegate.auditLogger, "RoleManageController.removeRole, Unauthorized user"); + EcompPortalUtils.setBadPermissions(user, response, "createAdmin"); + responseMap.put("restCallStatus", " Unauthorized user"); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "removeRole failed", e); + throw e; + } + return responseMap; + } + + @RequestMapping(value = { "/portalApi/role/saveRole/{appId}" }, method = RequestMethod.POST) + public Map<String, Object> saveRole(HttpServletRequest request, HttpServletResponse response, + @PathVariable("appId") Long appId) throws Exception { + EPUser user = EPUserUtils.getUserSession(request); + String responseString = null; + HashMap<String, Object> responseMap = new HashMap<>(); + try { + EPApp requestedApp = appService.getApp(appId); + if (isAuthorizedUser(user, requestedApp)) { + fieldsValidation(requestedApp); + if (requestedApp != null && requestedApp.getCentralAuth().equals(true)) { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + CentralV2Role role = mapper.readValue(root.get("role").toString(), CentralV2Role.class); + + List<CentralV2Role> childRoles = mapper.readValue(root.get("childRoles").toString(), + TypeFactory.defaultInstance().constructCollectionType(List.class, CentralV2Role.class)); + List<CentralV2RoleFunction> roleFunctions = mapper.readValue(root.get("roleFunctions").toString(), + TypeFactory.defaultInstance().constructCollectionType(List.class, + CentralV2RoleFunction.class)); + if (role.getId() != null && StringUtils.containsAny(role.getName(), ROLE_INVALID_CHARS)) { + throw new InvalidRoleException("Invalid role name found for '" + role.getName() + + "'. Any one of the following characters '%,(),=,:,comma, and double quotes' are not allowed"); + } + CentralV2Role domainRole; + if (role.getId() != null) { + domainRole = externalAccessRolesService.getRoleInfo(role.getId(), requestedApp.getUebKey()); + domainRole.setName(role.getName()); + domainRole.setPriority(role.getPriority()); + } else { + // check for existing role of same name + List<CentralV2Role> roles = externalAccessRolesService.getRolesForApp(requestedApp.getUebKey()); + for (CentralV2Role existRole : roles) + if (existRole.getName().equalsIgnoreCase(role.getName())) + throw new DuplicateRecordException("role already exists: " + existRole.getName()); + + domainRole = new CentralV2Role(); + domainRole.setName(role.getName()); + domainRole.setPriority(role.getPriority()); + if (role.getChildRoles() != null && role.getChildRoles().size() > 0) { + for (Object childRole : childRoles) { + domainRole.addChildRole((CentralV2Role) childRole); + } + } + } + if (role.getRoleFunctions() != null && role.getRoleFunctions().size() > 0) { + domainRole.setRoleFunctions(new TreeSet<CentralV2RoleFunction>()); + for (CentralV2RoleFunction roleFunction : roleFunctions) { + if (roleFunction.getType() == null && roleFunction.getAction() == null) { + throw new InvalidRoleException("Invalid role function type:" + roleFunction.getType() + + " and action: " + roleFunction.getAction() + " found while saving!"); + } + roleFunction.setCode(externalAccessRolesService.encodeFunctionCode(roleFunction.getCode())); + roleFunction.setCode(roleFunction.getType() + "|" + roleFunction.getCode() + "|" + + roleFunction.getAction()); + domainRole.addRoleFunction((CentralV2RoleFunction) roleFunction); + } + } else { + domainRole.setRoleFunctions(new TreeSet<>()); + } + String result = mapper.writeValueAsString(domainRole); + Role newRole = externalAccessRolesService.ConvertCentralRoleToRole(result); + ExternalRequestFieldsValidator externalRequestFieldsValidator = externalAccessRolesService + .saveRoleForApplication(newRole, requestedApp.getUebKey()); + boolean getAddResponse = externalRequestFieldsValidator.isResult(); + if (getAddResponse) { + String activityCode = (role.getId() == null) ? EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_ADD_ROLE + : EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_UPDATE_ROLE_AND_FUNCTION; + logger.info(EELFLoggerDelegate.applicationLogger, "saveRole: succeeded for app {}, role {}", + requestedApp.getId(), role.getName()); + AuditLog auditLog = new AuditLog(); + auditLog.setUserId(user.getId()); + auditLog.setActivityCode(activityCode); + auditLog.setComments(EcompPortalUtils.truncateString( + "saveRole role for app:" + requestedApp.getId() + " and role:'" + role.getName() + "'", + PortalConstants.AUDIT_LOG_COMMENT_SIZE)); + auditLog.setAffectedRecordId(user.getOrgUserId()); + auditService.logActivity(auditLog, null); + MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, + EPEELFLoggerAdvice.getCurrentDateTimeUTC()); + MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, + EPEELFLoggerAdvice.getCurrentDateTimeUTC()); + EcompPortalUtils.calculateDateTimeDifferenceForLog( + MDC.get(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP), + MDC.get(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP)); + logger.info(EELFLoggerDelegate.auditLogger, + EPLogUtil.formatAuditLogMessage("RoleManageController.saveRole", activityCode, + String.valueOf(user.getId()), user.getOrgUserId(), role.getName())); + MDC.remove(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP); + MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP); + MDC.remove(SystemProperties.MDC_TIMER); + responseMap.put("status", "Success"); + responseMap.put("role", domainRole); + } else { + if (externalRequestFieldsValidator.getDetailMessage().contains("406")) { + externalRequestFieldsValidator.setDetailMessage("Failed to save role for '" + role.getName() + + "'. Any one of the following characters '%,(),=,:,comma, and double quotes' are not allowed"); + } + responseMap.put("status", "SaveRole Failed"); + responseMap.put("role", responseString); + responseMap.put("error", externalRequestFieldsValidator.getDetailMessage()); + logger.error(EELFLoggerDelegate.errorLogger, "saveRole failed"); + } + } + } else { + logger.info(EELFLoggerDelegate.auditLogger, "RoleManageController.saveRole, Unauthorized user"); + EcompPortalUtils.setBadPermissions(user, response, "createAdmin"); + responseMap.put("error", " Unauthorized user"); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "saveRole failed", e); + responseMap.put("error", e.getMessage()); + } + return responseMap; + } + + @RequestMapping(value = { "/portalApi/role/removeRoleFunction" }, method = RequestMethod.POST) + public ModelAndView removeRoleRoleFunction(HttpServletRequest request, HttpServletResponse response) + throws Exception { + return getRoleController().removeRoleFunction(request, response); + } + + @RequestMapping(value = { "/portalApi/role/addRoleFunction" }, method = RequestMethod.POST) + public ModelAndView addRoleRoRoleFunction(HttpServletRequest request, HttpServletResponse response) + throws Exception { + return getRoleController().addRoleFunction(request, response); + } + + @RequestMapping(value = { "/portalApi/role/removeChildRole" }, method = RequestMethod.POST) + public ModelAndView removeChildRole(HttpServletRequest request, HttpServletResponse response) throws Exception { + return getRoleController().removeChildRole(request, response); + } + + @RequestMapping(value = { "/portalApi/role/addChildRole" }, method = RequestMethod.POST) + public ModelAndView addChildRole(HttpServletRequest request, HttpServletResponse response) throws Exception { + return getRoleController().addChildRole(request, response); + } + + @RequestMapping(value = { "/portalApi/get_role/{appId}/{roleId}" }, method = RequestMethod.GET) + public void getRole(HttpServletRequest request, HttpServletResponse response, @PathVariable("appId") Long appId, + @PathVariable("roleId") Long roleId) throws Exception { + try { + EPUser user = EPUserUtils.getUserSession(request); + ObjectMapper mapper = new ObjectMapper(); + EPApp requestedApp = appService.getApp(appId); + if (isAuthorizedUser(user, requestedApp)) { + fieldsValidation(requestedApp); + if (requestedApp.getCentralAuth()) { + CentralV2Role answer = externalAccessRolesService.getRoleInfo(roleId, requestedApp.getUebKey()); + logger.info(EELFLoggerDelegate.applicationLogger, "role_id" + roleId); + Map<String, Object> model = new HashMap<>(); + model.put("availableRoleFunctions", mapper.writeValueAsString( + externalAccessRolesService.getRoleFuncList(requestedApp.getUebKey()))); + model.put("availableRoles", + mapper.writeValueAsString(getAvailableChildRoles(requestedApp.getUebKey(), roleId))); + model.put("role", mapper.writeValueAsString(answer)); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } else + throw new NonCentralizedAppException(requestedApp.getName()); + } else { + logger.info(EELFLoggerDelegate.auditLogger, + "RoleManageController.getRoleFunctionList, Unauthorized user"); + SendErrorForUnauthorizedUser(response, user); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getRole failed", e); + throw e; + } + } + + @RequestMapping(value = { "/portalApi/get_role_functions/{appId}" }, method = RequestMethod.GET) + public void getRoleFunctionList(HttpServletRequest request, HttpServletResponse response, + @PathVariable("appId") Long appId) throws Exception { + try { + EPUser user = EPUserUtils.getUserSession(request); + EPApp requestedApp = appService.getApp(appId); + if (isAuthorizedUser(user, requestedApp)) { + fieldsValidation(requestedApp); + if (requestedApp.getCentralAuth()) { + List<CentralV2RoleFunction> answer = null; + Map<String, Object> model = new HashMap<>(); + ObjectMapper mapper = new ObjectMapper(); + answer = externalAccessRolesService.getRoleFuncList(requestedApp.getUebKey()); + model.put("availableRoleFunctions", answer); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } else + throw new NonCentralizedAppException(requestedApp.getName()); + } else { + logger.info(EELFLoggerDelegate.auditLogger, + "RoleManageController.getRoleFunctionList, Unauthorized user"); + EcompPortalUtils.setBadPermissions(user, response, "createAdmin"); + response.getWriter().write("Unauthorized User"); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getRoleFunctionList failed", e); + throw e; + } + } + + @RequestMapping(value = { "/portalApi/role_function_list/saveRoleFunction/{appId}" }, method = RequestMethod.POST) + public PortalRestResponse<String> saveRoleFunction(HttpServletRequest request, HttpServletResponse response, @RequestBody CentralV2RoleFunction roleFunc, + @PathVariable("appId") Long appId) throws Exception { + EPUser user = EPUserUtils.getUserSession(request); + boolean saveOrUpdateResponse = false; + try { + EPApp requestedApp = appService.getApp(appId); + if (isAuthorizedUser(user, requestedApp)) { + fieldsValidation(requestedApp); + if (requestedApp.getCentralAuth()) { + saveOrUpdateResponse = externalAccessRolesService.saveCentralRoleFunction(roleFunc, requestedApp); + if (saveOrUpdateResponse) { + EPUser requestedUser = externalAccessRolesService.getUser(user.getOrgUserId()).get(0); + EPApp app = externalAccessRolesService.getApp(requestedApp.getUebKey()).get(0); + CentralV2RoleFunction function = externalAccessRolesService.getRoleFunction(roleFunc.getCode(), + requestedApp.getUebKey()); + String activityCode = (function.getCode() == null) + ? EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_ADD_FUNCTION + : EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_UPDATE_FUNCTION; + logger.info(EELFLoggerDelegate.applicationLogger, + "saveRoleFunction: succeeded for app {}, function {}", app.getId(), roleFunc.getCode()); + AuditLog auditLog = getAuditInfo(requestedUser, activityCode); + auditLog.setComments(EcompPortalUtils.truncateString("saveRoleFunction role for app:" + + app.getId() + " and function:'" + roleFunc.getCode() + "'", + PortalConstants.AUDIT_LOG_COMMENT_SIZE)); + auditService.logActivity(auditLog, null); + MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, + EPEELFLoggerAdvice.getCurrentDateTimeUTC()); + MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, + EPEELFLoggerAdvice.getCurrentDateTimeUTC()); + EcompPortalUtils.calculateDateTimeDifferenceForLog( + MDC.get(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP), + MDC.get(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP)); + logger.info(EELFLoggerDelegate.auditLogger, + EPLogUtil.formatAuditLogMessage("RoleManageController.saveRoleFunction", activityCode, + String.valueOf(requestedUser.getId()), requestedUser.getOrgUserId(), + roleFunc.getCode())); + MDC.remove(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP); + MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP); + MDC.remove(SystemProperties.MDC_TIMER); + } + } else + throw new NonCentralizedAppException(requestedApp.getName() + " is not Centralized Application"); + } else { + logger.info(EELFLoggerDelegate.auditLogger, + "RoleManageController.saveRoleFunction, Unauthorized user"); + EcompPortalUtils.setBadPermissions(user, response, "createAdmin"); + return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, "Unauthorized User", "Failure"); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "saveRoleFunction: Failed", e); + return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failure"); + } + return new PortalRestResponse<>(PortalRestStatusEnum.OK, "Saved Successfully!", "Success"); + } + + @RequestMapping(value = { "/portalApi/role_function_list/removeRoleFunction/{appId}" }, method = RequestMethod.POST) + public PortalRestResponse<String> removeRoleFunction(HttpServletRequest request, HttpServletResponse response, + @RequestBody String roleFunc, @PathVariable("appId") Long appId) throws Exception { + EPUser user = EPUserUtils.getUserSession(request); + try { + EPApp requestedApp = appService.getApp(appId); + if (isAuthorizedUser(user, requestedApp)) { + fieldsValidation(requestedApp); + if (requestedApp.getCentralAuth()) { + ObjectMapper mapper = new ObjectMapper(); + String data = roleFunc; + CentralV2RoleFunction availableRoleFunction = mapper.readValue(data, CentralV2RoleFunction.class); + CentralV2RoleFunction domainRoleFunction = externalAccessRolesService + .getRoleFunction(availableRoleFunction.getCode(), requestedApp.getUebKey()); + boolean getDelFuncResponse = externalAccessRolesService + .deleteCentralRoleFunction(domainRoleFunction.getCode(), requestedApp); + if (getDelFuncResponse) { + logger.info(EELFLoggerDelegate.applicationLogger, + "deleteRoleFunction: succeeded for app {}, role {}", requestedApp.getId(), + domainRoleFunction.getCode()); + String activityCode = EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_DELETE_FUNCTION; + AuditLog auditLog = getAuditInfo(user, activityCode); + auditLog.setComments( + EcompPortalUtils.truncateString( + "Deleted function for app:" + requestedApp.getId() + " and function code:'" + + domainRoleFunction.getCode() + "'", + PortalConstants.AUDIT_LOG_COMMENT_SIZE)); + auditService.logActivity(auditLog, null); + MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, + EPEELFLoggerAdvice.getCurrentDateTimeUTC()); + MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, + EPEELFLoggerAdvice.getCurrentDateTimeUTC()); + EcompPortalUtils.calculateDateTimeDifferenceForLog( + MDC.get(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP), + MDC.get(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP)); + logger.info(EELFLoggerDelegate.auditLogger, + EPLogUtil.formatAuditLogMessage("RoleManageController.removeRoleFunction", + EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_DELETE_FUNCTION, + String.valueOf(user.getId()), user.getOrgUserId(), + domainRoleFunction.getCode())); + MDC.remove(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP); + MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP); + MDC.remove(SystemProperties.MDC_TIMER); + logger.info(EELFLoggerDelegate.auditLogger, + "Remove role function " + domainRoleFunction.getName()); + } + } else + throw new NonCentralizedAppException(requestedApp.getName() + " is not Centralized Application"); + } else { + logger.info(EELFLoggerDelegate.auditLogger, + "RoleManageController.removeRoleFunction, Unauthorized user"); + EcompPortalUtils.setBadPermissions(user, response, "createAdmin"); + return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, "Unauthorized User", "Failure"); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "removeRoleFunction failed", e); + return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failure"); + } + return new PortalRestResponse<>(PortalRestStatusEnum.OK, "Deleted Successfully!", "Success"); + } + + @RequestMapping(value = { "/portalApi/centralizedApps" }, method = RequestMethod.GET) + public List<CentralizedApp> getCentralizedAppRoles(HttpServletRequest request, HttpServletResponse response, String userId) throws IOException { + EPUser user = EPUserUtils.getUserSession(request); + List<CentralizedApp> applicationsList = null; + if (adminRolesService.isAccountAdmin(user) || adminRolesService.isSuperAdmin(user)) { + applicationsList = externalAccessRolesService.getCentralizedAppsOfUser(userId); + } else { + logger.info(EELFLoggerDelegate.auditLogger, + "RoleManageController.getCentralizedAppRoles, Unauthorized user"); + EcompPortalUtils.setBadPermissions(user, response, "createAdmin"); + } + return applicationsList; + } + + public RoleListController getRoleListController() { + return roleListController; + } + + public void setRoleListController(RoleListController roleListController) { + this.roleListController = roleListController; + } + + public RoleController getRoleController() { + return roleController; + } + + public void setRoleController(RoleController roleController) { + this.roleController = roleController; + } + + + @RequestMapping(value = { "/portalApi/syncRoles" }, method = RequestMethod.POST, produces = "application/json") + public PortalRestResponse<String> syncRoles(HttpServletRequest request, HttpServletResponse response, + @RequestBody Long appId) { + EPUser user = EPUserUtils.getUserSession(request); + try { + EPApp app = appService.getApp(appId); + if (isAuthorizedUser(user, app)) { + fieldsValidation(app); + externalAccessRolesService.syncApplicationRolesWithEcompDB(app); + } else { + logger.info(EELFLoggerDelegate.auditLogger, + "RoleManageController.syncRoles, Unauthorized user:" + user.getOrgUserId()); + EcompPortalUtils.setBadPermissions(user, response, "createAdmin"); + return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, "Unauthorized User", "Failure"); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "failed syncRoles", e); + return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed"); + } + return new PortalRestResponse<>(PortalRestStatusEnum.OK, "Sync roles completed successfully!", "Success"); + } + + @RequestMapping(value = { "/portalApi/syncFunctions" }, method = RequestMethod.POST, produces = "application/json") + public PortalRestResponse<String> syncFunctions(HttpServletRequest request, HttpServletResponse response, + @RequestBody Long appId) { + EPUser user = EPUserUtils.getUserSession(request); + try { + EPApp app = appService.getApp(appId); + if (isAuthorizedUser(user, app)) { + fieldsValidation(app); + externalAccessRolesService.syncRoleFunctionFromExternalAccessSystem(app);; + } else { + logger.info(EELFLoggerDelegate.auditLogger, + "RoleManageController.syncFunctions, Unauthorized user:" + user.getOrgUserId()); + EcompPortalUtils.setBadPermissions(user, response, "createAdmin"); + return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, "Unauthorized User", "Failure"); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "failed syncFunctions", e); + return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, e.getMessage(), "Failed"); + } + return new PortalRestResponse<>(PortalRestStatusEnum.OK, "Sync Functions completed successfully!", "Success"); + } + + public List<CentralV2Role> getAvailableChildRoles(String uebKey, Long roleId) throws Exception { + List<CentralV2Role> availableChildRoles = externalAccessRolesService.getRolesForApp(uebKey); + if (roleId == null || roleId == 0) { + return availableChildRoles; + } + CentralV2Role currentRole = externalAccessRolesService.getRoleInfo(roleId, uebKey); + Set<CentralV2Role> allParentRoles = new TreeSet<>(); + allParentRoles = getAllParentRolesAsList(currentRole, allParentRoles); + Iterator<CentralV2Role> availableChildRolesIterator = availableChildRoles.iterator(); + while (availableChildRolesIterator.hasNext()) { + CentralV2Role role = availableChildRolesIterator.next(); + if (!role.isActive() || allParentRoles.contains(role) || role.getId().equals(roleId)) { + availableChildRolesIterator.remove(); + } + } + return availableChildRoles; + } + + private Set<CentralV2Role> getAllParentRolesAsList(CentralV2Role role, Set<CentralV2Role> allParentRoles) { + Set<CentralV2Role> parentRoles = role.getParentRoles(); + allParentRoles.addAll(parentRoles); + Iterator<CentralV2Role> parentRolesIterator = parentRoles.iterator(); + while (parentRolesIterator.hasNext()) { + getAllParentRolesAsList(parentRolesIterator.next(), allParentRoles); + } + return allParentRoles; + } + + public AuditLog getAuditInfo(EPUser user, String activityCode) + { + AuditLog auditLog = new AuditLog(); + auditLog.setUserId(user.getId()); + auditLog.setActivityCode(activityCode); + auditLog.setAffectedRecordId(user.getOrgUserId()); + + return auditLog; + } + + private void fieldsValidation(EPApp app) throws Exception{ + app.getUebKey(); + List<EPApp> appInfo = externalAccessRolesService.getApp(app.getUebKey()); + if(appInfo.isEmpty()){ + throw new InvalidApplicationException("Invalid uebkey"); + } + if(!appInfo.isEmpty() && EcompPortalUtils.checkIfRemoteCentralAccessAllowed() && appInfo.get(0).getCentralAuth()){ + ResponseEntity<String> response = externalAccessRolesService.getNameSpaceIfExists(appInfo.get(0)); + if (response.getStatusCode().value() == HttpServletResponse.SC_NOT_FOUND) + throw new InvalidApplicationException("Invalid NameSpace"); + } + } + + private boolean isAuthorizedUser(EPUser user, EPApp requestedApp) { + if (user != null && (adminRolesService.isAccountAdminOfApplication(user, requestedApp) + || (adminRolesService.isSuperAdmin(user) && requestedApp.getId() == PortalConstants.PORTAL_APP_ID))) + return true; + return false; + } + + private void SendErrorForUnauthorizedUser(HttpServletResponse response, EPUser user) throws IOException { + EcompPortalUtils.setBadPermissions(user, response, "createAdmin"); + response.getWriter().write("Unauthorized User"); + } +} diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RolesApprovalSystemController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RolesApprovalSystemController.java index c9abc3b0..b4babfdf 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RolesApprovalSystemController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RolesApprovalSystemController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -36,21 +36,21 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.util.ArrayList; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalapp.externalsystemapproval.model.ExternalSystemRoleApproval; -import org.openecomp.portalapp.externalsystemapproval.model.ExternalSystemUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.UserRolesService; -import org.openecomp.portalapp.portal.transport.ExternalRequestFieldsValidator; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.externalsystemapproval.model.ExternalSystemRoleApproval; +import org.onap.portalapp.externalsystemapproval.model.ExternalSystemUser; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.service.UserRolesService; +import org.onap.portalapp.portal.transport.ExternalRequestFieldsValidator; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; @@ -104,6 +104,10 @@ public class RolesApprovalSystemController implements BasicAuthenticationControl response.setStatus(HttpServletResponse.SC_NOT_FOUND); return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "save user profile failed"); + } else if(e.getMessage().contains("500")){ + response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, + e.getMessage(), "save user profile failed"); } else if (e.getMessage().contains("405")) { response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED); return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), @@ -147,6 +151,10 @@ public class RolesApprovalSystemController implements BasicAuthenticationControl response.setStatus(HttpServletResponse.SC_NOT_FOUND); return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "save user profile failed"); + } else if(e.getMessage().contains("500")){ + response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, + e.getMessage(), "save user profile failed"); } else if (e.getMessage().contains("405")) { response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED); return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, e.getMessage(), "save user profile failed"); diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SchedulerAuxController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SchedulerAuxController.java new file mode 100644 index 00000000..c676fa98 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SchedulerAuxController.java @@ -0,0 +1,141 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.controller; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import javax.servlet.http.HttpServletRequest; + +import org.json.simple.JSONObject; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.scheduler.SchedulerProperties; +import org.onap.portalapp.portal.scheduleraux.RestObject; +import org.onap.portalapp.portal.scheduleraux.SchedulerAuxResponseWrapper; +import org.onap.portalapp.portal.scheduleraux.SchedulerAuxRestInterfaceFactory; +import org.onap.portalapp.portal.scheduleraux.SchedulerAuxRestInterfaceIfc; +import org.onap.portalapp.portal.scheduleraux.SchedulerAuxUtil; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +/*import org.openecomp.vid.policy.PolicyProperties; +import org.openecomp.vid.policy.PolicyResponseWrapper; +import org.openecomp.vid.policy.PolicyRestInterfaceFactory; +import org.openecomp.vid.policy.PolicyRestInterfaceIfc; +import org.openecomp.vid.policy.PolicyUtil;*/ +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +/** + * Controller to handle Policy requests. + */ + +@RestController +@RequestMapping(PortalConstants.PORTAL_AUX_API) +@Configuration +@EnableAspectJAutoProxy +@EPAuditLog +public class SchedulerAuxController extends EPRestrictedBaseController { + + /** The logger. */ + private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SchedulerAuxController.class); + + @RequestMapping(value = "/get_policy", method = RequestMethod.GET, produces = "application/json") + public ResponseEntity<String> getPolicyInfo(HttpServletRequest request) throws Exception { + try { + + logger.debug(EELFLoggerDelegate.debugLogger, + "SchedulerAux Controller Call Started: " + SchedulerProperties.SCHEDULERAUX_GET_CONFIG_VAL); + String path = SchedulerProperties.getProperty(SchedulerProperties.SCHEDULERAUX_GET_CONFIG_VAL); + SchedulerAuxResponseWrapper policyResWrapper = getPolicyConfig(path); + + logger.debug(EELFLoggerDelegate.debugLogger, "SchedulerAux Request END : Response: ", + new ResponseEntity<String>(policyResWrapper.getResponse(), HttpStatus.OK).toString()); + + return (new ResponseEntity<String>(policyResWrapper.getResponse(), + HttpStatus.valueOf(policyResWrapper.getStatus()))); + } catch (Exception e) { + SchedulerAuxResponseWrapper policyResWrapper = new SchedulerAuxResponseWrapper(); + policyResWrapper.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); + policyResWrapper.setEntity(e.getMessage()); + logger.error(EELFLoggerDelegate.errorLogger, "Exception with getpolicy ", e); + return (new ResponseEntity<String>(policyResWrapper.getResponse(), HttpStatus.INTERNAL_SERVER_ERROR)); + } + } + + protected static SchedulerAuxResponseWrapper getPolicyConfig(String path) throws Exception { + String methodName = "getPolicyConfig"; + String uuid = UUID.randomUUID().toString(); + logger.debug(EELFLoggerDelegate.debugLogger, "starting getPolicyConfig "); + + try { + // STARTING REST API CALL AS AN FACTORY INSTACE + SchedulerAuxRestInterfaceIfc policyRestController = SchedulerAuxRestInterfaceFactory.getInstance(); + JSONObject request = new JSONObject(); + String policyName = SchedulerProperties.getProperty(SchedulerProperties.SCHEDULER_POLICY_NAME); + request.put("policyName", policyName); + RestObject<String> restObjStr = new RestObject<String>(); + String str = new String(); + restObjStr.set(str); + policyRestController.<String>Post(str, request, uuid, path, restObjStr); + SchedulerAuxResponseWrapper policyRespWrapper = SchedulerAuxUtil.wrapResponse(restObjStr); + logger.debug(EELFLoggerDelegate.debugLogger, "Getpolicy Request END : Response: ", methodName, + policyRespWrapper.getResponse()); + if (policyRespWrapper.getStatus() != 200) { + String message = String.format( + " get policy Information failed . MethodName: %s, PolicyRespWrapperResponse: %s", methodName, + policyRespWrapper.getResponse()); + logger.error(EELFLoggerDelegate.errorLogger, message); + EPLogUtil.schedulerAccessAlarm(logger, policyRespWrapper.getStatus()); + } + return policyRespWrapper; + } catch (Exception e) { + String message = String.format(" EXCEPTION in getPolicyConfig . MethodName: %s and Exception: %s", methodName, e); + logger.error(EELFLoggerDelegate.errorLogger, "EXCEPTION in getPolicyConfig", message); + throw e; + } + } +} diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SchedulerController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SchedulerController.java new file mode 100644 index 00000000..f7d90db1 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SchedulerController.java @@ -0,0 +1,348 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.controller; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.json.simple.JSONObject; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.scheduler.SchedulerProperties; +import org.onap.portalapp.portal.scheduler.SchedulerRestInterface; +import org.onap.portalapp.portal.scheduler.SchedulerUtil; +import org.onap.portalapp.portal.scheduler.restobjects.GetTimeSlotsRestObject; +import org.onap.portalapp.portal.scheduler.restobjects.PostCreateNewVnfRestObject; +import org.onap.portalapp.portal.scheduler.restobjects.PostSubmitVnfChangeRestObject; +import org.onap.portalapp.portal.scheduler.wrapper.GetTimeSlotsWrapper; +import org.onap.portalapp.portal.scheduler.wrapper.PostCreateNewVnfWrapper; +import org.onap.portalapp.portal.scheduler.wrapper.PostSubmitVnfChangeTimeSlotsWrapper; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping(PortalConstants.PORTAL_AUX_API) +@Configuration +@EnableAspectJAutoProxy +@EPAuditLog +public class SchedulerController extends EPRestrictedBaseController { + + @Autowired + private SchedulerRestInterface schedulerRestController; + + private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SchedulerController.class); + + /** The request date format. */ + public DateFormat requestDateFormat = new SimpleDateFormat("EEE, dd MMM YYYY HH:mm:ss z"); + + @RequestMapping(value = "/get_time_slots/{scheduler_request}", method = RequestMethod.GET, produces = "application/json") + public ResponseEntity<String> getTimeSlots(HttpServletRequest request, + @PathVariable("scheduler_request") String scheduler_request) throws Exception { + try { + + Date startingTime = new Date(); + String startTimeRequest = requestDateFormat.format(startingTime); + logger.debug(EELFLoggerDelegate.debugLogger, "Controller Scheduler GET Timeslots for startTimeRequest: ", + startTimeRequest); + logger.debug(EELFLoggerDelegate.debugLogger, "Original Request : \n ", scheduler_request); + String path = SchedulerProperties.getProperty(SchedulerProperties.SCHEDULER_GET_TIME_SLOTS) + + scheduler_request; + + GetTimeSlotsWrapper schedulerResWrapper = getTimeSlots(scheduler_request, path, scheduler_request); + + Date endTime = new Date(); + String endTimeRequest = requestDateFormat.format(endTime); + logger.debug(EELFLoggerDelegate.debugLogger, "Controller Scheduler - GET for EndTimeRequest", + endTimeRequest); + return (new ResponseEntity<String>(schedulerResWrapper.getResponse(), + HttpStatus.valueOf(schedulerResWrapper.getStatus()))); + } catch (Exception e) { + GetTimeSlotsWrapper schedulerResWrapper=new GetTimeSlotsWrapper(); + schedulerResWrapper.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); + schedulerResWrapper.setEntity(e.getMessage()); + logger.error(EELFLoggerDelegate.errorLogger, "Exception with getTimeslots", e); + return (new ResponseEntity<String>(schedulerResWrapper.getResponse(), HttpStatus.INTERNAL_SERVER_ERROR)); + } + + } + + protected GetTimeSlotsWrapper getTimeSlots(String request, String path, String uuid) throws Exception { + + try { + // STARTING REST API CALL AS AN FACTORY INSTACE + logger.debug(EELFLoggerDelegate.debugLogger, "Get Time Slots Request START"); + + GetTimeSlotsRestObject<String> restObjStr = new GetTimeSlotsRestObject<String>(); + String str = new String(); + + restObjStr.set(str); + + schedulerRestController.Get(str, uuid, path, restObjStr); + GetTimeSlotsWrapper schedulerRespWrapper = SchedulerUtil.getTimeSlotsWrapResponse(restObjStr); + logger.debug(EELFLoggerDelegate.debugLogger, "Get Time Slots Request END : Response: ", + schedulerRespWrapper.getResponse()); + if (schedulerRespWrapper.getStatus() != 200 && schedulerRespWrapper.getStatus() != 204 + && schedulerRespWrapper.getStatus() != 202) { + String message = String.format( + " getTimeslots Information failed . SchedulerResponseWrapper for gettimeslots: %s", schedulerRespWrapper.getResponse()); + logger.error(EELFLoggerDelegate.errorLogger, message); + EPLogUtil.schedulerAccessAlarm(logger, schedulerRespWrapper.getStatus()); + + } + return schedulerRespWrapper; + + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Get Time Slots Request ERROR : Exception:",e); + throw e; + } + } + + @SuppressWarnings("unchecked") + @RequestMapping(value = "/post_create_new_vnf_change", method = RequestMethod.POST, produces = "application/json") + public ResponseEntity<String> postCreateNewVNFChange(HttpServletRequest request, + @RequestBody JSONObject scheduler_request) throws Exception { + try { + Date startingTime = new Date(); + String startTimeRequest = requestDateFormat.format(startingTime); + + logger.debug(EELFLoggerDelegate.debugLogger, "Controller Scheduler POST : post_create_new_vnf_change", + startTimeRequest); + + // Generating uuid + String uuid = UUID.randomUUID().toString(); + + scheduler_request.put("scheduleId", uuid); + logger.debug(EELFLoggerDelegate.debugLogger, "UUID : ", uuid); + + // adding uuid to the request payload + scheduler_request.put("scheduleId", uuid); + logger.debug(EELFLoggerDelegate.debugLogger, "Original Request ", scheduler_request.toString()); + + String path = SchedulerProperties + .getProperty(SchedulerProperties.SCHEDULER_CREATE_NEW_VNF_CHANGE_INSTANCE_VAL) + uuid; + + PostCreateNewVnfWrapper responseWrapper = postSchedulingRequest(scheduler_request, path, uuid); + + Date endTime = new Date(); + String endTimeRequest = requestDateFormat.format(endTime); + logger.debug(EELFLoggerDelegate.debugLogger, "Controller Scheduler - POST", endTimeRequest); + + return new ResponseEntity<String>(responseWrapper.getResponse(), + HttpStatus.valueOf(responseWrapper.getStatus())); + } catch (Exception e) { + PostCreateNewVnfWrapper responseWrapper=new PostCreateNewVnfWrapper(); + responseWrapper.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); + responseWrapper.setEntity(e.getMessage()); + logger.error(EELFLoggerDelegate.errorLogger, "Exception with postCreateNewVNFChange ", e); + return (new ResponseEntity<String>(responseWrapper.getResponse(), HttpStatus.INTERNAL_SERVER_ERROR)); + + } + + } + + protected PostCreateNewVnfWrapper postSchedulingRequest(JSONObject request, String path, String uuid) + throws Exception { + + try { + // STARTING REST API CALL AS AN FACTORY INSTACE + + PostCreateNewVnfRestObject<String> restObjStr = new PostCreateNewVnfRestObject<String>(); + String str = new String(); + + restObjStr.set(str); + schedulerRestController.<String>Post(str, request, path, restObjStr); + + int status = restObjStr.getStatusCode(); + if (status >= 200 && status <= 299) { + restObjStr.setUUID(uuid); + } + + PostCreateNewVnfWrapper responseWrapper = SchedulerUtil.postCreateNewVnfWrapResponse(restObjStr); + + logger.debug(EELFLoggerDelegate.debugLogger, " Post Create New Vnf Scheduling Request END : Response: ", + responseWrapper.getResponse()); + if (responseWrapper.getStatus() != 200 && responseWrapper.getStatus() != 202 && responseWrapper.getStatus() != 204) { + logger.error(EELFLoggerDelegate.errorLogger, "PostCreateNewVnfWrapper Information failed", responseWrapper.getResponse()); + EPLogUtil.schedulerAccessAlarm(logger, responseWrapper.getStatus()); + + } + return responseWrapper; + + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "PostCreateNewVnfWrapper failed . Post Create New Vnf Scheduling Request ERROR :",e); + throw e; + } + } + + @RequestMapping(value = "/submit_vnf_change_timeslots", method = RequestMethod.POST, produces = "application/json") + public ResponseEntity<String> postSubmitVnfChangeTimeslots(HttpServletRequest request, + @RequestBody JSONObject scheduler_request) throws Exception { + try { + Date startingTime = new Date(); + String startTimeRequest = requestDateFormat.format(startingTime); + logger.debug(EELFLoggerDelegate.debugLogger, " Controller Scheduler POST : submit_vnf_change_timeslots", + startTimeRequest); + + // Generating uuid + String uuid = (String) scheduler_request.get("scheduleId"); + logger.debug(EELFLoggerDelegate.debugLogger, "UUID : ", uuid); + + scheduler_request.remove("scheduleId"); + logger.debug(EELFLoggerDelegate.debugLogger, "Original Request for the schedulerId: ", + scheduler_request.toString()); + + String path = SchedulerProperties.getProperty(SchedulerProperties.SCHEDULER_SUBMIT_NEW_VNF_CHANGE) + .replace("{scheduleId}", uuid); + + PostSubmitVnfChangeTimeSlotsWrapper responseWrapper = postSubmitSchedulingRequest(scheduler_request, path, + uuid); + + Date endTime = new Date(); + String endTimeRequest = requestDateFormat.format(endTime); + logger.debug(EELFLoggerDelegate.debugLogger, " Controller Scheduler - POST Submit for end time request", + endTimeRequest); + + return (new ResponseEntity<String>(responseWrapper.getResponse(),HttpStatus.valueOf(responseWrapper.getStatus()))); + } catch (Exception e) { + PostSubmitVnfChangeTimeSlotsWrapper responseWrapper=new PostSubmitVnfChangeTimeSlotsWrapper(); + responseWrapper.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); + responseWrapper.setEntity(e.getMessage()); + logger.error(EELFLoggerDelegate.errorLogger, "Exception with Post submit Vnf change Timeslots", e); + return (new ResponseEntity<String>(responseWrapper.getResponse(), HttpStatus.INTERNAL_SERVER_ERROR)); + + } + } + + protected PostSubmitVnfChangeTimeSlotsWrapper postSubmitSchedulingRequest(JSONObject request, String path, + String uuid) throws Exception { + + try { + // STARTING REST API CALL AS AN FACTORY INSTACE + + PostSubmitVnfChangeRestObject<String> restObjStr = new PostSubmitVnfChangeRestObject<String>(); + String str = new String(); + + restObjStr.set(str); + schedulerRestController.<String>Post(str, request, path, restObjStr); + + int status = restObjStr.getStatusCode(); + if (status >= 200 && status <= 299) { + status=(status==204)?200:status; + restObjStr.setStatusCode(status); + restObjStr.setUUID(uuid); + } + + PostSubmitVnfChangeTimeSlotsWrapper responseWrapper = SchedulerUtil + .postSubmitNewVnfWrapResponse(restObjStr); + logger.debug(EELFLoggerDelegate.debugLogger, "Post Submit Scheduling Request END : Response = ", + responseWrapper.getResponse()); + if (responseWrapper.getStatus() != 200 && responseWrapper.getStatus() != 202 + && responseWrapper.getStatus() != 204) { + logger.error(EELFLoggerDelegate.errorLogger, "PostCreateNewVnfWrapper Information failed", responseWrapper.getResponse()); + EPLogUtil.schedulerAccessAlarm(logger, responseWrapper.getStatus()); + + } + return responseWrapper; + + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, " PostCreateNewVnfWrapper failed . Post Submit Scheduling Request ERROR :",e); + throw e; + } + } + + /** + * Get Scheduler UI constant values from properties file + * + * @return Rest response wrapped around a String; e.g., "success" or "ERROR" + */ + @RequestMapping(value = "/get_scheduler_constant", method = RequestMethod.GET, produces = "application/json") + public PortalRestResponse<Map<String, String>> getSchedulerConstant(HttpServletRequest request, + HttpServletResponse response) { + logger.debug(EELFLoggerDelegate.debugLogger, "get scheduler constant"); + + PortalRestResponse<Map<String, String>> portalRestResponse = null; + String errorMsg = " is not defined in property file. Please check the property file and make sure all the schedule constant values are defined"; + HashMap<String, String> constantMap = new HashMap<>(); + constantMap.put(SchedulerProperties.SCHEDULER_DOMAIN_NAME, "domainName"); + constantMap.put(SchedulerProperties.SCHEDULER_SCHEDULE_NAME, "scheduleName"); + constantMap.put(SchedulerProperties.SCHEDULER_WORKFLOW_NAME, "workflowName"); + constantMap.put(SchedulerProperties.SCHEDULER_CALLBACK_URL, "callbackUrl"); + constantMap.put(SchedulerProperties.SCHEDULER_APPROVAL_TYPE, "approvalType"); + constantMap.put(SchedulerProperties.SCHEDULER_APPROVAL_SUBMIT_STATUS, "approvalSubmitStatus"); + constantMap.put(SchedulerProperties.SCHEDULER_APPROVAL_REJECT_STATUS, "approvalRejectStatus"); + constantMap.put(SchedulerProperties.SCHEDULER_POLICY_NAME, "policyName"); + constantMap.put(SchedulerProperties.SCHEDULER_INTERVAL_GET_TIMESLOT_RATE, "intervalRate"); + constantMap.put(SchedulerProperties.SCHEDULER_GROUP_ID, "groupId"); + try { + Map<String, String> map = new HashMap<>(); + for (Map.Entry<String, String> entry : constantMap.entrySet()) { + if (SchedulerProperties.containsProperty(entry.getKey())) + map.put(entry.getValue(), SchedulerProperties.getProperty(entry.getKey())); + else + throw new Exception(entry.getKey() + errorMsg); + } + portalRestResponse = new PortalRestResponse<Map<String, String>>(PortalRestStatusEnum.OK, "success", map); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getSchedulerConstant failed", e); + portalRestResponse = new PortalRestResponse<Map<String, String>>(PortalRestStatusEnum.ERROR, e.getMessage(), + null); + } + return portalRestResponse; + } + +} diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SharedContextRestController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SharedContextRestController.java index 352912aa..9a684966 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SharedContextRestController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SharedContextRestController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.io.IOException; import java.util.ArrayList; @@ -46,13 +46,13 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalapp.controller.EPRestrictedRESTfulBaseController; -import org.openecomp.portalapp.portal.domain.SharedContext; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.SharedContextService; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.PortalConstants; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.controller.EPRestrictedRESTfulBaseController; +import org.onap.portalapp.portal.domain.SharedContext; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.service.SharedContextService; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/TicketEventController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/TicketEventController.java index 76154c6a..522c7aea 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/TicketEventController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/TicketEventController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.util.Arrays; import java.util.Calendar; @@ -47,16 +47,16 @@ import java.util.Set; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.TicketEventService; -import org.openecomp.portalapp.portal.service.UserNotificationService; -import org.openecomp.portalapp.portal.transport.EpNotificationItem; -import org.openecomp.portalapp.portal.transport.EpRoleNotificationItem; -import org.openecomp.portalapp.portal.utils.PortalConstants; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.service.TicketEventService; +import org.onap.portalapp.portal.service.UserNotificationService; +import org.onap.portalapp.portal.transport.EpNotificationItem; +import org.onap.portalapp.portal.transport.EpRoleNotificationItem; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserController.java index 0db19e1c..cbcd2639 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,22 +35,22 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import javax.servlet.http.HttpServletRequest; -import org.openecomp.portalapp.controller.EPRestrictedBaseController; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.UserService; -import org.openecomp.portalapp.portal.transport.ProfileDetail; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.service.UserService; +import org.onap.portalapp.portal.transport.ProfileDetail; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.util.EPUserUtils; +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.context.annotation.EnableAspectJAutoProxy; import org.springframework.web.bind.annotation.RequestBody; @@ -83,7 +83,7 @@ public class UserController extends EPRestrictedBaseController { try { EPUser user = EPUserUtils.getUserSession(request); ProfileDetail profileDetail = new ProfileDetail(user.getFirstName(), user.getLastName(), - user.getMiddleInitial(), user.getEmail(), user.getLoginId(), CipherUtil.decrypt(user.getLoginPwd())); + user.getMiddleInitial(), user.getEmail(), user.getLoginId(), CipherUtil.decryptPKC(user.getLoginPwd())); portalRestResponse = new PortalRestResponse<ProfileDetail>(PortalRestStatusEnum.OK, "success", profileDetail); EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/loggedinUser", "result =", profileDetail); @@ -124,7 +124,7 @@ public class UserController extends EPRestrictedBaseController { user.setEmail(profileDetail.getEmail()); user.setMiddleInitial(profileDetail.getMiddleName()); user.setLoginId(profileDetail.getLoginId()); - user.setLoginPwd(CipherUtil.encrypt(profileDetail.getLoginPassword())); + user.setLoginPwd(CipherUtil.encryptPKC(profileDetail.getLoginPassword())); userService.saveUser(user); // Update user info in the session request.getSession().setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserNotificationController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserNotificationController.java index 3b5ba0c7..d25ad2c7 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserNotificationController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserNotificationController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.util.ArrayList; import java.util.HashMap; @@ -53,24 +53,23 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.portalsdk.core.web.support.UserUtils; -import org.openecomp.portalapp.controller.EPRestrictedBaseController; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EcompAppRole; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.FunctionalMenuService; -import org.openecomp.portalapp.portal.service.UserNotificationService; -import org.openecomp.portalapp.portal.transport.EpNotificationItem; -import org.openecomp.portalapp.portal.transport.EpNotificationItemVO; -import org.openecomp.portalapp.portal.transport.EpRoleNotificationItem; -import org.openecomp.portalapp.portal.transport.FunctionalMenuRole; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.util.EPUserUtils; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EcompAppRole; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.service.FunctionalMenuService; +import org.onap.portalapp.portal.service.UserNotificationService; +import org.onap.portalapp.portal.transport.EpNotificationItem; +import org.onap.portalapp.portal.transport.EpNotificationItemVO; +import org.onap.portalapp.portal.transport.EpRoleNotificationItem; +import org.onap.portalapp.portal.transport.FunctionalMenuRole; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.util.SystemProperties; +import org.onap.portalsdk.core.web.support.UserUtils; @RestController @org.springframework.context.annotation.Configuration diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRolesController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserRolesController.java index b907909e..167fa2e8 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRolesController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserRolesController.java @@ -1,12 +1,12 @@ /*- * ============LICENSE_START========================================== - * ONAP Portal SDK + * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.util.ArrayList; import java.util.Arrays; @@ -47,36 +47,36 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.cxf.transport.http.HTTPException; -import org.openecomp.portalapp.controller.EPRestrictedBaseController; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EPUserAppCatalogRoles; -import org.openecomp.portalapp.portal.domain.EcompAuditLog; -import org.openecomp.portalapp.portal.domain.ExternalSystemAccess; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.logging.aop.EPEELFLoggerAdvice; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.ApplicationsRestClientService; -import org.openecomp.portalapp.portal.service.SearchService; -import org.openecomp.portalapp.portal.service.UserRolesService; -import org.openecomp.portalapp.portal.transport.AppNameIdIsAdmin; -import org.openecomp.portalapp.portal.transport.AppWithRolesForUser; -import org.openecomp.portalapp.portal.transport.AppsListWithAdminRole; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.RoleInAppForUser; -import org.openecomp.portalapp.portal.transport.UserApplicationRoles; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.portal.utils.PortalConstants; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.domain.AuditLog; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.restful.domain.EcompRole; -import org.openecomp.portalsdk.core.service.AuditService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPUserAppCatalogRoles; +import org.onap.portalapp.portal.domain.EcompAuditLog; +import org.onap.portalapp.portal.domain.ExternalSystemAccess; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.logging.aop.EPEELFLoggerAdvice; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.ApplicationsRestClientService; +import org.onap.portalapp.portal.service.SearchService; +import org.onap.portalapp.portal.service.UserRolesService; +import org.onap.portalapp.portal.transport.AppNameIdIsAdmin; +import org.onap.portalapp.portal.transport.AppWithRolesForUser; +import org.onap.portalapp.portal.transport.AppsListWithAdminRole; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.RoleInAppForUser; +import org.onap.portalapp.portal.transport.UserApplicationRoles; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.domain.AuditLog; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.restful.domain.EcompRole; +import org.onap.portalsdk.core.service.AuditService; +import org.onap.portalsdk.core.util.SystemProperties; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WebAnalyticsExtAppController.java index 23b0e49e..35e26c04 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WebAnalyticsExtAppController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.io.InputStream; import java.nio.charset.StandardCharsets; @@ -45,22 +45,22 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.apache.commons.io.IOUtils; -import org.openecomp.portalapp.controller.EPRestrictedRESTfulBaseController; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EcompAuditLog; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.logging.aop.EPEELFLoggerAdvice; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.portal.service.AppsCacheService; -import org.openecomp.portalapp.portal.service.ConsulHealthService; -import org.openecomp.portalapp.portal.transport.Analytics; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.portal.utils.PortalConstants; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.crossapi.PortalAPIResponse; -import org.openecomp.portalsdk.core.service.AuditService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.controller.EPRestrictedRESTfulBaseController; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EcompAuditLog; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.logging.aop.EPEELFLoggerAdvice; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.service.AppsCacheService; +import org.onap.portalapp.portal.service.ConsulHealthService; +import org.onap.portalapp.portal.transport.Analytics; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.onboarding.crossapi.PortalAPIResponse; +import org.onap.portalsdk.core.service.AuditService; +import org.onap.portalsdk.core.util.SystemProperties; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogController.java index 229ef1f3..15e19829 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.io.File; import java.io.FileInputStream; @@ -49,23 +49,23 @@ import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalapp.controller.EPRestrictedBaseController; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.MicroserviceParameter; -import org.openecomp.portalapp.portal.domain.WidgetCatalog; -import org.openecomp.portalapp.portal.domain.WidgetCatalogParameter; -import org.openecomp.portalapp.portal.domain.WidgetParameterResult; -import org.openecomp.portalapp.portal.domain.WidgetServiceHeaders; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.ConsulHealthService; -import org.openecomp.portalapp.portal.service.MicroserviceService; -import org.openecomp.portalapp.portal.service.WidgetParameterService; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.MicroserviceParameter; +import org.onap.portalapp.portal.domain.WidgetCatalog; +import org.onap.portalapp.portal.domain.WidgetCatalogParameter; +import org.onap.portalapp.portal.domain.WidgetParameterResult; +import org.onap.portalapp.portal.domain.WidgetServiceHeaders; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.service.ConsulHealthService; +import org.onap.portalapp.portal.service.MicroserviceService; +import org.onap.portalapp.portal.service.WidgetParameterService; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.EnableAspectJAutoProxy; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogMarkupController.java index aefc3d07..f7210881 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogMarkupController.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,18 +35,18 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalapp.controller.EPUnRestrictedBaseController; -import org.openecomp.portalapp.portal.domain.WidgetServiceHeaders; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.ConsulHealthService; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.controller.EPUnRestrictedBaseController; +import org.onap.portalapp.portal.domain.WidgetServiceHeaders; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.service.ConsulHealthService; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.EnableAspectJAutoProxy; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java new file mode 100644 index 00000000..fec16b0c --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java @@ -0,0 +1,186 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.controller; + +import java.io.IOException; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.cxf.common.util.StringUtils; +import org.onap.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.PersUserWidgetService; +import org.onap.portalapp.portal.service.WidgetService; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.OnboardingWidget; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +@EPAuditLog +public class WidgetsController extends EPRestrictedBaseController { + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetsController.class); + + @Autowired + private AdminRolesService adminRolesService; + @Autowired + private WidgetService widgetService; + @Autowired + private PersUserWidgetService persUserWidgetService; + + @RequestMapping(value = { "/portalApi/widgets" }, method = RequestMethod.GET, produces = "application/json") + public List<OnboardingWidget> getOnboardingWidgets(HttpServletRequest request, HttpServletResponse response) { + EPUser user = EPUserUtils.getUserSession(request); + List<OnboardingWidget> onboardingWidgets = null; + + if (user == null || user.isGuest()) { + EcompPortalUtils.setBadPermissions(user, response, "getOnboardingWidgets"); + } else { + String getType = request.getHeader("X-Widgets-Type"); + if (!StringUtils.isEmpty(getType) && (getType.equals("managed") || getType.equals("all"))) { + onboardingWidgets = widgetService.getOnboardingWidgets(user, getType.equals("managed")); + } else { + logger.debug(EELFLoggerDelegate.debugLogger, "WidgetsController.getOnboardingApps - request must contain header 'X-Widgets-Type' with 'all' or 'managed'"); + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + } + } + + EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/widgets", "GET result =", response.getStatus()); + return onboardingWidgets; + } + + private boolean userHasPermissions(EPUser user, HttpServletResponse response, String invocator) { + if (!adminRolesService.isSuperAdmin(user) && !adminRolesService.isAccountAdmin(user)) { + EcompPortalUtils.setBadPermissions(user, response, invocator); + return false; + } + return true; + } + + // Attention: real json has all OnboardingWidget fields except "id", we use OnboardingWidget for not to create new class for parsing + @RequestMapping(value = { "/portalApi/widgets/{widgetId}" }, method = { RequestMethod.PUT }, produces = "application/json") + public FieldsValidator putOnboardingWidget(HttpServletRequest request, @PathVariable("widgetId") Long widgetId, + @RequestBody OnboardingWidget onboardingWidget, HttpServletResponse response) { + EPUser user = EPUserUtils.getUserSession(request); + FieldsValidator fieldsValidator = null; + if (userHasPermissions(user, response, "putOnboardingWidget")) { + onboardingWidget.id = widgetId; // ! + onboardingWidget.normalize(); + fieldsValidator = widgetService.setOnboardingWidget(user, onboardingWidget); + response.setStatus(fieldsValidator.httpStatusCode.intValue()); + } + EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/widgets/" + widgetId, "GET result =", response.getStatus()); + + return fieldsValidator; + } + + // Attention: real json has all OnboardingWidget fields except "id", we use OnboardingWidget for not to create new class for parsing + @RequestMapping(value = { "/portalApi/widgets" }, method = { RequestMethod.POST }, produces = "application/json") + public FieldsValidator postOnboardingWidget(HttpServletRequest request, @RequestBody OnboardingWidget onboardingWidget, HttpServletResponse response) { + EPUser user = EPUserUtils.getUserSession(request); + FieldsValidator fieldsValidator = null; ; + + if (userHasPermissions(user, response, "postOnboardingWidget")) { + onboardingWidget.id = null; // ! + onboardingWidget.normalize(); + fieldsValidator = widgetService.setOnboardingWidget(user, onboardingWidget); + response.setStatus(fieldsValidator.httpStatusCode.intValue()); + } + + EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/widgets", "POST result =", response.getStatus()); + return fieldsValidator; + } + + @RequestMapping(value = { "/portalApi/widgets/{widgetId}" }, method = { RequestMethod.DELETE }, produces = "application/json") + public FieldsValidator deleteOnboardingWidget(HttpServletRequest request, @PathVariable("widgetId") Long widgetId, HttpServletResponse response) { + EPUser user = EPUserUtils.getUserSession(request); + FieldsValidator fieldsValidator = null; ; + + if (userHasPermissions(user, response, "deleteOnboardingWidget")) { + fieldsValidator = widgetService.deleteOnboardingWidget(user, widgetId); + response.setStatus(fieldsValidator.httpStatusCode.intValue()); + } + + EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/widgets/" + widgetId, "DELETE result =", response.getStatus()); + return fieldsValidator; + } + + /** + * service to accept a user's action made on the application + * catalog. + * + * @param request + * @param selectRequest + * JSON with data including application ID + * @param response + * @return FieldsValidator + * @throws IOException + */ + @RequestMapping(value = { "portalApi/widgetCatalogSelection" }, method = RequestMethod.PUT, produces = "application/json") + public FieldsValidator putWidgetCatalogSelection(HttpServletRequest request, + @RequestBody org.onap.portalapp.portal.transport.WidgetCatalogPersonalization persRequest, HttpServletResponse response) throws IOException { + FieldsValidator result = new FieldsValidator(); + EPUser user = EPUserUtils.getUserSession(request); + try { + if (persRequest.getWidgetId() == null || user == null) { + EcompPortalUtils.setBadPermissions(user, response, "putWidgetCatalogSelection"); + } else { + persUserWidgetService.setPersUserAppValue(user, persRequest.getWidgetId(), persRequest.getSelect()); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Failed in putAppCatalogSelection", e); + response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString()); + } + result.httpStatusCode = new Long(HttpServletResponse.SC_OK); + return result; + } +}
\ No newline at end of file diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AdminUserApp.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/AdminUserApp.java index ed172f6c..72bd798d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AdminUserApp.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/AdminUserApp.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AdminUserApplications.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/AdminUserApplications.java index de0d406a..ca54d236 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AdminUserApplications.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/AdminUserApplications.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.util.ArrayList; import java.util.List; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/App.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/App.java index 8e4bf490..aa5a4b8d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/App.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/App.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppContactUs.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/AppContactUs.java index b816ff98..f3117622 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppContactUs.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/AppContactUs.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,18 +35,17 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; + +import com.fasterxml.jackson.annotation.JsonBackReference; -/** - * Models rows in the fn_app_contact_us table added for 1610.1. - */ public class AppContactUs extends DomainVo { private static final long serialVersionUID = -2742197830465055134L; - private EPApp app; + @JsonBackReference private EPApp app; private String description; private String contactEmail; private String contactName; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppIdAndNameTransportModel.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/AppIdAndNameTransportModel.java index 00463f72..d57e2828 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppIdAndNameTransportModel.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/AppIdAndNameTransportModel.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppsResponse.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/AppsResponse.java index d3a940ea..a7835fd5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppsResponse.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/AppsResponse.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; public class AppsResponse { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/BEProperty.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/BEProperty.java index 8147903e..737f4ab3 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/BEProperty.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/BEProperty.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; public class BEProperty { private String key; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/BasicAuthCredentials.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/BasicAuthCredentials.java index 83cf21d8..30dad848 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/BasicAuthCredentials.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/BasicAuthCredentials.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,11 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.util.List; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; public class BasicAuthCredentials extends DomainVo { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/CentralRoleFunction.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/CentralV2RoleFunction.java index 49e4228c..05c87ba6 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/CentralRoleFunction.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/CentralV2RoleFunction.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,41 +35,60 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import java.io.Serializable; -import com.fasterxml.jackson.annotation.JsonIgnore; +import org.onap.portalsdk.core.domain.support.DomainVo; +import com.fasterxml.jackson.annotation.JsonIgnore; + @SuppressWarnings("rawtypes") -public class CentralRoleFunction extends DomainVo implements java.io.Serializable, Comparable { - - /** - * - */ +public class CentralV2RoleFunction extends DomainVo implements Serializable, Comparable{ + + /** + * + */ private static final long serialVersionUID = -4018975640065252688L; - private String code; - private String name; - @JsonIgnore - private Long appId; - @JsonIgnore - private Long roleId; - private String editUrl; - - public CentralRoleFunction() { - + private String code; + private String name; + @JsonIgnore + private Long appId; + @JsonIgnore + private Long roleId; + private String type; + private String action; + private String editUrl; + + + public CentralV2RoleFunction() { + } - - public CentralRoleFunction(Long id, String code, String name, Long appId, String editUrl) { + + + public CentralV2RoleFunction(Long id, String code, String name, Long appId, String type, String action,String editUrl) { super(); this.id = id; this.code = code; this.name = name; this.appId = appId; + this.type = type; + this.action = action; this.editUrl = editUrl; } + + public CentralV2RoleFunction(Long id, String code, String name, Long appId,String editUrl) { + super(); + this.id = id; + this.code = code; + this.name = name; + this.appId = appId; + this.editUrl = editUrl; + } + + - public CentralRoleFunction(String code, String name) { + public CentralV2RoleFunction(String code, String name) { super(); this.code = code; this.name = name; @@ -81,65 +100,89 @@ public class CentralRoleFunction extends DomainVo implements java.io.Serializabl public String getCode() { return code; } - /** - * @param code - * the code to set + * @param code the code to set */ public void setCode(String code) { this.code = code; } - /** * @return the name */ public String getName() { return name; } - /** - * @param name - * the name to set + * @param name the name to set */ public void setName(String name) { this.name = name; } - /** * @return the appId */ public Long getAppId() { return appId; } - /** - * @param appId - * the appId to set + * @param appId the appId to set */ public void setAppId(Long appId) { this.appId = appId; } - /** * @return the editUrl */ public String getEditUrl() { return editUrl; } - /** - * @param editUrl - * the editUrl to set + * @param editUrl the editUrl to set */ public void setEditUrl(String editUrl) { this.editUrl = editUrl; } + + + /** + * @return the type + */ + public String getType() { + return type; + } - public int compareTo(Object obj) { - String c1 = getName(); - String c2 = ((CentralRoleFunction) obj).getName(); - return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); + /** + * @param type the type to set + */ + public void setType(String type) { + this.type = type; } + + /** + * @return the action + */ + public String getAction() { + return action; + } + + + /** + * @param action the action to set + */ + public void setAction(String action) { + this.action = action; + } + + + public int compareTo(Object obj){ + String c1 = getName(); + String c2 = ((CentralV2RoleFunction)obj).getName(); + + return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); + } + + + } diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/lm/FusionLicenseManagerImplTest.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/CentralizedApp.java index ecdf415c..2e902b83 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/lm/FusionLicenseManagerImplTest.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/CentralizedApp.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,32 +35,47 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.lm; +package org.onap.portalapp.portal.domain; -import static org.junit.Assert.assertEquals; +import java.io.Serializable; -import java.util.Date; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; -import org.junit.Test; -import org.openecomp.portalapp.lm.FusionLicenseManagerImpl; +import com.fasterxml.jackson.annotation.JsonInclude; -public class FusionLicenseManagerImplTest { +@Entity +@JsonInclude(JsonInclude.Include.NON_NULL) +public class CentralizedApp implements Serializable{ - - @Test - public void FusionLicenseManagerImplTest(){ - FusionLicenseManagerImpl fusionLicenseManagerImpl = new FusionLicenseManagerImpl(); - - String nvlReturn = null; - - int installLicenseInt = fusionLicenseManagerImpl.installLicense(); - nvlReturn = fusionLicenseManagerImpl.nvl("test"); - Date expiredDateReturn = fusionLicenseManagerImpl.getExpiredDate(); - - assertEquals(installLicenseInt, 0); - assertEquals(nvlReturn, null); - assertEquals(expiredDateReturn, null); - + /** + * + */ + private static final long serialVersionUID = -3773410386555027935L; + + @Id + @Column(name="app_id") + private int appId; + + @Id + @Column(name="app_name") + private String appName; + + public int getAppId() { + return appId; } - + + public void setAppId(int appId) { + this.appId = appId; + } + + public String getAppName() { + return appName; + } + + public void setAppName(String appName) { + this.appName = appName; + } + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPApp.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPApp.java index c27a9ad1..6f593df3 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPApp.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPApp.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,14 +35,14 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.util.Arrays; import javax.persistence.Lob; import org.apache.commons.lang.StringUtils; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; /** * Model for all columns in the fn_app table. diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPAppRoleFunction.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPAppRoleFunction.java index 1c621c7f..559050b9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPAppRoleFunction.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPAppRoleFunction.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,9 +35,9 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; public class EPAppRoleFunction extends DomainVo implements java.io.Serializable{ @@ -46,6 +46,7 @@ public class EPAppRoleFunction extends DomainVo implements java.io.Serializable private Long roleId; private Long appId; private String code; + private String roleAppId; /** * @return the roleId @@ -83,5 +84,18 @@ public class EPAppRoleFunction extends DomainVo implements java.io.Serializable public void setCode(String code) { this.code = code; } - + /** + * + * @return the roles app Id + */ + public String getRoleAppId() { + return roleAppId; + } + /** + * + * @param roleAppId + */ + public void setRoleAppId(String roleAppId) { + this.roleAppId = roleAppId; + } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPEndpoint.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPEndpoint.java index 0abcfa8f..c967919d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPEndpoint.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPEndpoint.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,9 +35,9 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; public class EPEndpoint extends DomainVo { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPEndpointAccount.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPEndpointAccount.java index b4f66f3b..3184be41 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPEndpointAccount.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPEndpointAccount.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,9 +35,9 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; public class EPEndpointAccount extends DomainVo { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPRole.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPRole.java index fdc70ee1..601c7633 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPRole.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,14 +35,14 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.util.Iterator; import java.util.SortedSet; import java.util.TreeSet; -import org.openecomp.portalsdk.core.domain.RoleFunction; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.RoleFunction; +import org.onap.portalsdk.core.domain.support.DomainVo; import com.fasterxml.jackson.annotation.JsonIgnore; public class EPRole extends DomainVo { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUser.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUser.java index e5e09ac5..e7435203 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUser.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUser.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,16 +35,16 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.util.Date; import java.util.Iterator; import java.util.SortedSet; import java.util.TreeSet; -import org.openecomp.portalapp.portal.utils.PortalConstants; -import org.openecomp.portalsdk.core.domain.User; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalsdk.core.domain.User; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import com.fasterxml.jackson.annotation.JsonIgnore; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserApp.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserApp.java index 80189ddd..1449af76 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserApp.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserApp.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; @SuppressWarnings("rawtypes") diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppCatalogRoles.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserAppCatalogRoles.java index 2074beb8..f6d42b70 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppCatalogRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserAppCatalogRoles.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,13 +35,13 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRoles.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserAppRoles.java index fe6d1975..3e681081 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserAppRoles.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,14 +35,14 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequest.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequest.java index 651ef5e6..923d2444 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequest.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.util.Date; import java.util.Set; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; public class EPUserAppRolesRequest extends DomainVo { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequestDetail.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequestDetail.java index 8bf83a31..42373853 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequestDetail.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequestDetail.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,9 +35,9 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; public class EPUserAppRolesRequestDetail extends DomainVo { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppsManualSortPreference.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserAppsManualSortPreference.java index 0d7ee8f0..4d943f62 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppsManualSortPreference.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserAppsManualSortPreference.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,9 +35,9 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; public class EPUserAppsManualSortPreference extends DomainVo { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppsSortPreference.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserAppsSortPreference.java index 7d0a8603..1fc7b8e9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppsSortPreference.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserAppsSortPreference.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,9 +35,9 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; public class EPUserAppsSortPreference extends DomainVo{ diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserNotification.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserNotification.java index 993c7dba..1cb85a55 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserNotification.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUserNotification.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,11 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.util.Date; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; public class EPUserNotification extends DomainVo { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPWidgetsManualSortPreference.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPWidgetsManualSortPreference.java index 1c515d6e..552e2e0f 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPWidgetsManualSortPreference.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPWidgetsManualSortPreference.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,9 +35,9 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; public class EPWidgetsManualSortPreference extends DomainVo{ diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompApp.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EcompApp.java index 30be6889..6fafbba4 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompApp.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EcompApp.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; /** * Model for a subset of the columns in the fn_app table. diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAppRole.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EcompAppRole.java index e60b220a..e6176ebb 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAppRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EcompAppRole.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import javax.persistence.Column; import javax.persistence.Entity; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAppRoleId.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EcompAppRoleId.java index c61052d8..063714ee 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAppRoleId.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EcompAppRoleId.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAuditLog.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EcompAuditLog.java index 517b9173..72307eb6 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAuditLog.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EcompAuditLog.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,11 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.util.Date; -import org.openecomp.portalsdk.core.domain.AuditLog; +import org.onap.portalsdk.core.domain.AuditLog; public class EcompAuditLog extends AuditLog { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/ExternalRoleDetails.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/ExternalRoleDetails.java index 2ba6a573..6c8a548a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/ExternalRoleDetails.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/ExternalRoleDetails.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.util.List; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/ExternalSystemAccess.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/ExternalSystemAccess.java index b4c08954..29b4fe35 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/ExternalSystemAccess.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/ExternalSystemAccess.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; public class ExternalSystemAccess { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/FunctionalMenuItemWithAppID.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/FunctionalMenuItemWithAppID.java index 5087d029..a9455d61 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/FunctionalMenuItemWithAppID.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/FunctionalMenuItemWithAppID.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.util.List; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/GetAccessResult.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/GetAccessResult.java index 5c43de24..f64810d7 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/GetAccessResult.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/GetAccessResult.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/GetAccessResultId.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/GetAccessResultId.java index df7faac3..a9cd69a2 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/GetAccessResultId.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/GetAccessResultId.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/MicroserviceData.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/MicroserviceData.java index d99523a6..a7129d58 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/MicroserviceData.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/MicroserviceData.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.util.List; @@ -44,7 +44,7 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; public class MicroserviceData extends DomainVo { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/MicroserviceParameter.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/MicroserviceParameter.java index 8ed012ef..a761f754 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/MicroserviceParameter.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/MicroserviceParameter.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,9 +35,9 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; public class MicroserviceParameter extends DomainVo { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/PersUserAppSelection.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/PersUserAppSelection.java index 6dbc5d30..13e58dc0 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/PersUserAppSelection.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/PersUserAppSelection.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,9 +35,9 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; /** * Models a row in the table with personalization of user app selections. diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/PersUserWidgetSelection.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/PersUserWidgetSelection.java index f049a520..833934db 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/PersUserWidgetSelection.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/PersUserWidgetSelection.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,9 +35,9 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; /** * Models a row in the table with personalization of user widget selections. diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/RoleApp.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/RoleApp.java index 8b3f2a8c..1b52b8b1 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/RoleApp.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/RoleApp.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.io.Serializable; import java.util.Set; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/SharedContext.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/SharedContext.java index 710e910a..ebfb2855 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/SharedContext.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/SharedContext.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.util.Date; @@ -45,7 +45,7 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; /** * A shared context is a key-value pair in a session. All shared-context objects diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserIdRoleId.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/UserIdRoleId.java index 9d59bf34..e267e925 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserIdRoleId.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/UserIdRoleId.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserRole.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/UserRole.java index 38b74a54..eda4eeef 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/UserRole.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserRoles.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/UserRoles.java index 578292a4..0efaaea2 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/UserRoles.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,15 +35,15 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalsdk.core.util.SystemProperties; public class UserRoles implements Serializable { private static final long serialVersionUID = 1L; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/Widget.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/Widget.java index 33f2df88..98cfd155 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/Widget.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/Widget.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,11 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import org.apache.commons.lang.StringUtils; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; public class Widget extends DomainVo { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetCatalog.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/WidgetCatalog.java index edf6eb85..7ddb5a4a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetCatalog.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/WidgetCatalog.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.io.Serializable; import java.util.Set; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetCatalogParameter.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/WidgetCatalogParameter.java index 18833f6d..2e5940ff 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetCatalogParameter.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/WidgetCatalogParameter.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,9 +35,9 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; public class WidgetCatalogParameter extends DomainVo{ diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetParameterResult.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/WidgetParameterResult.java index 81d703f4..0251c326 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetParameterResult.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/WidgetParameterResult.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; public class WidgetParameterResult { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetServiceHeaders.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/WidgetServiceHeaders.java index 14c7799a..e6360e5b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetServiceHeaders.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/WidgetServiceHeaders.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,15 +35,14 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.nio.charset.Charset; import org.apache.commons.codec.binary.Base64; import org.springframework.http.HttpHeaders; - -import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalsdk.core.onboarding.util.CipherUtil; public class WidgetServiceHeaders { @@ -56,7 +55,7 @@ public class WidgetServiceHeaders { return new HttpHeaders(){{ String username = EcompPortalUtils.getPropertyOrDefault("microservices.widget.username", "widget_user"); - String password = CipherUtil.decrypt(EcompPortalUtils.getPropertyOrDefault("microservices.widget.password", "widget_password")); + String password = CipherUtil.decryptPKC(EcompPortalUtils.getPropertyOrDefault("microservices.widget.password", "widget_password")); String auth = username + ":" + password; byte[] encodedAuth = Base64.encodeBase64( auth.getBytes(Charset.forName("US-ASCII")) ); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppCatalogItem.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/AppCatalogItem.java index 1279004f..9701dd5d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppCatalogItem.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/AppCatalogItem.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.ecomp.model; +package org.onap.portalapp.portal.ecomp.model; import javax.persistence.Entity; import javax.persistence.Id; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; import com.fasterxml.jackson.annotation.JsonInclude; /** diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppCategoryFunctionsItem.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/AppCategoryFunctionsItem.java index e09b8627..d22c26d7 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppCategoryFunctionsItem.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/AppCategoryFunctionsItem.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.ecomp.model; +package org.onap.portalapp.portal.ecomp.model; import javax.persistence.Entity; import javax.persistence.Id; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; import com.fasterxml.jackson.annotation.JsonInclude; /** diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppContactUsItem.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/AppContactUsItem.java index 74adc8be..9afde2b9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppContactUsItem.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/AppContactUsItem.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.ecomp.model; +package org.onap.portalapp.portal.ecomp.model; import javax.persistence.Entity; import javax.persistence.Id; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; import com.fasterxml.jackson.annotation.JsonInclude; /** diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/CommonWidgetsEnum.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/CommonWidgetsEnum.java index 784cf3d5..43079a77 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/CommonWidgetsEnum.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/CommonWidgetsEnum.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.ecomp.model; +package org.onap.portalapp.portal.ecomp.model; public enum CommonWidgetsEnum{ NEWS("news"), diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/PortalRestResponse.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/PortalRestResponse.java index 05dadca8..7d1f432e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/PortalRestResponse.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/PortalRestResponse.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.ecomp.model; +package org.onap.portalapp.portal.ecomp.model; public class PortalRestResponse<T> { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/PortalRestStatusEnum.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/PortalRestStatusEnum.java index 1f70da72..5989ff8c 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/PortalRestStatusEnum.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/PortalRestStatusEnum.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.ecomp.model; +package org.onap.portalapp.portal.ecomp.model; public enum PortalRestStatusEnum{ OK("ok"), diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/SearchResultItem.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/SearchResultItem.java index dbd70b94..6a62543e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/SearchResultItem.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ecomp/model/SearchResultItem.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.ecomp.model; +package org.onap.portalapp.portal.ecomp.model; import javax.persistence.Entity; import javax.persistence.Id; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/DeleteDomainObjectFailedException.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/DeleteDomainObjectFailedException.java new file mode 100644 index 00000000..420184f0 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/DeleteDomainObjectFailedException.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.exceptions; + +public class DeleteDomainObjectFailedException extends Exception{ + + private static final long serialVersionUID = -4591508985449251121L; + + public DeleteDomainObjectFailedException(String msg) { + super(msg); + } +} diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/DuplicateRecordException.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/DuplicateRecordException.java new file mode 100644 index 00000000..1f279f40 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/DuplicateRecordException.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.exceptions; + +public class DuplicateRecordException extends Exception{ + + private static final long serialVersionUID = 2759542750310357001L; + + public DuplicateRecordException(String msg) { + super(msg); + } +} diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/ExternalAuthSystemException.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/ExternalAuthSystemException.java new file mode 100644 index 00000000..1c17c2c0 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/ExternalAuthSystemException.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.exceptions; + +public class ExternalAuthSystemException extends Exception { + + private static final long serialVersionUID = -4576754924998287267L; + + public ExternalAuthSystemException(String msg) { + super(msg); + } +} diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/InactiveApplicationException.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/InactiveApplicationException.java new file mode 100644 index 00000000..8a7d70c5 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/InactiveApplicationException.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.exceptions; + +public class InactiveApplicationException extends Exception{ + + private static final long serialVersionUID = -4641226040102977745L; + + public InactiveApplicationException(String msg) { + super(msg); + } +} diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/InvalidApplicationException.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/InvalidApplicationException.java new file mode 100644 index 00000000..d48e60f6 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/InvalidApplicationException.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.exceptions; + +public class InvalidApplicationException extends Exception{ + + private static final long serialVersionUID = -5454293609563606255L; + + public InvalidApplicationException(String msg) { + super(msg); + } +} diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterfaceFactory.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/InvalidRoleException.java index 26726547..bf19f4a5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterfaceFactory.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/InvalidRoleException.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,15 +35,13 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler.policy; +package org.onap.portalapp.portal.exceptions; -public class PolicyRestInterfaceFactory { +public class InvalidRoleException extends Exception{ - public static PolicyRestInterfaceIfc getInstance() { - PolicyRestInterfaceIfc obj = null; + private static final long serialVersionUID = -7453145846850741282L; - obj = new PolicyRestInterface(); - - return (obj); + public InvalidRoleException(String message){ + super(message); } -}
\ No newline at end of file +} diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/InvalidUserException.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/InvalidUserException.java new file mode 100644 index 00000000..00650108 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/InvalidUserException.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.exceptions; + +public class InvalidUserException extends Exception{ + + private static final long serialVersionUID = 273572212076653743L; + + public InvalidUserException(String msg) { + super(msg); + } +} diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/exceptions/NoHealthyServiceException.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/NoHealthyServiceException.java index b4764d81..d210b415 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/exceptions/NoHealthyServiceException.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/NoHealthyServiceException.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.exceptions; +package org.onap.portalapp.portal.exceptions; import com.ecwid.consul.ConsulException; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/NonCentralizedAppException.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/NonCentralizedAppException.java new file mode 100644 index 00000000..4bfde355 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/NonCentralizedAppException.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ + +package org.onap.portalapp.portal.exceptions; + +public class NonCentralizedAppException extends Exception { + + String appName; + + private static final long serialVersionUID = 1L; + + public NonCentralizedAppException(String name) { + this.appName= name; + } + + @Override + public String toString() { + return appName + " is not Centralized Application"; + } + +} diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/RoleFunctionException.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/RoleFunctionException.java new file mode 100644 index 00000000..b189ca47 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/RoleFunctionException.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ + +package org.onap.portalapp.portal.exceptions; + +import org.apache.commons.codec.DecoderException; + +public class RoleFunctionException extends Exception{ + + /** + * + */ + private static final long serialVersionUID = -3280548136475923423L; + + public RoleFunctionException(String msg, DecoderException e) { + super(msg,e); + } +} diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/SecurityVulnerabilitiesException.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/SecurityVulnerabilitiesException.java new file mode 100644 index 00000000..8fffbc39 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/exceptions/SecurityVulnerabilitiesException.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.exceptions; + +@SuppressWarnings("serial") +public class SecurityVulnerabilitiesException extends Exception { + SecurityVulnerabilitiesException(String msg) { + super(msg); + } + }
\ No newline at end of file diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/interceptor/PortalResourceInterceptor.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/interceptor/PortalResourceInterceptor.java index 4514126a..5d2f399b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/interceptor/PortalResourceInterceptor.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/interceptor/PortalResourceInterceptor.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,39 +35,46 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.interceptor; +package org.onap.portalapp.portal.interceptor; import java.nio.charset.Charset; +import java.util.ArrayList; import java.util.Base64; +import java.util.List; import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalapp.controller.sessionmgt.SessionCommunicationController; -import org.openecomp.portalapp.portal.controller.BasicAuthenticationController; -import org.openecomp.portalapp.portal.controller.ExternalAppsRestfulController; -import org.openecomp.portalapp.portal.controller.SharedContextRestController; -import org.openecomp.portalapp.portal.controller.WebAnalyticsExtAppController; -import org.openecomp.portalapp.portal.domain.BasicAuthCredentials; -import org.openecomp.portalapp.portal.domain.EPEndpoint; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.logging.aop.EPEELFLoggerAdvice; -import org.openecomp.portalapp.portal.logging.format.EPAppMessagesEnum; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.portal.service.BasicAuthenticationCredentialService; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.service.RemoteWebServiceCallService; -import org.openecomp.portalapp.service.sessionmgt.ManageService; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.controller.FusionBaseController; -import org.openecomp.portalsdk.core.exception.UrlAccessRestrictedException; -import org.openecomp.portalsdk.core.interceptor.ResourceInterceptor; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.listener.PortalTimeoutHandler; -import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.portalsdk.core.util.SystemProperties.SecurityEventTypeEnum; +import org.apache.commons.codec.binary.Hex; +import org.onap.portalapp.controller.sessionmgt.SessionCommunicationController; +import org.onap.portalapp.portal.controller.BasicAuthenticationController; +import org.onap.portalapp.portal.controller.ExternalAppsRestfulController; +import org.onap.portalapp.portal.controller.SharedContextRestController; +import org.onap.portalapp.portal.controller.WebAnalyticsExtAppController; +import org.onap.portalapp.portal.domain.BasicAuthCredentials; +import org.onap.portalapp.portal.domain.EPEndpoint; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.logging.aop.EPEELFLoggerAdvice; +import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.service.BasicAuthenticationCredentialService; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.service.RemoteWebServiceCallService; +import org.onap.portalapp.service.sessionmgt.ManageService; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.controller.FusionBaseController; +import org.onap.portalsdk.core.exception.UrlAccessRestrictedException; +import org.onap.portalsdk.core.interceptor.ResourceInterceptor; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.onboarding.listener.PortalTimeoutHandler; +import org.onap.portalsdk.core.onboarding.util.CipherUtil; +import org.onap.portalsdk.core.util.SystemProperties; +import org.onap.portalsdk.core.util.SystemProperties.SecurityEventTypeEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.method.HandlerMethod; @@ -241,7 +248,7 @@ public class PortalResourceInterceptor extends ResourceInterceptor { encrypted(accountNamePassword[1])); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "checkBasicAuth failed to get credentials", e); - final String msg = "Failed while getting basic authentication credential: " + e.toString(); + final String msg = "Failed while getting basic authentication credential: "; sendErrorResponse(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg); throw e; } @@ -294,11 +301,12 @@ public class PortalResourceInterceptor extends ResourceInterceptor { return values; } + @SuppressWarnings("unused") private String decrypted(String encrypted) throws Exception { String result = ""; if (encrypted != null & encrypted.length() > 0) { try { - result = CipherUtil.decrypt(encrypted, SystemProperties.getProperty(SystemProperties.Decryption_Key)); + result = CipherUtil.decryptPKC(encrypted, SystemProperties.getProperty(SystemProperties.Decryption_Key)); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "decryptedPassword failed", e); throw e; @@ -311,7 +319,7 @@ public class PortalResourceInterceptor extends ResourceInterceptor { String result = ""; if (decryptedPwd != null & decryptedPwd.length() > 0) { try { - result = CipherUtil.encrypt(decryptedPwd, + result = CipherUtil.encryptPKC(decryptedPwd, SystemProperties.getProperty(SystemProperties.Decryption_Key)); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "encryptedPassword() failed", e); @@ -322,12 +330,37 @@ public class PortalResourceInterceptor extends ResourceInterceptor { } private Boolean matchRoleFunctions(String portalApiPath, Set<? extends String> roleFunctions) { - for (String roleFunction : roleFunctions) { - if (portalApiPath.matches(roleFunction)) - return true; + String[] path = portalApiPath.split("/"); + List<String> roleFunList = new ArrayList<>(); + if (path.length > 1) { + roleFunList = roleFunctions.stream().filter(item -> item.startsWith(path[0])).collect(Collectors.toList()); + if (roleFunList.size() >= 1) { + for (String roleFunction : roleFunList) { + String[] roleFunctionArray = roleFunction.split("/"); + boolean b = true; + if (roleFunctionArray.length == path.length) { + for (int i = 0; i < roleFunctionArray.length; i++) { + if (b) { + if (!roleFunctionArray[i].equals("*")) { + Pattern p = Pattern.compile(Pattern.quote(path[i]), Pattern.CASE_INSENSITIVE); + Matcher m = p.matcher(roleFunctionArray[i]); + b = m.matches(); + + } + } + } + if (b) + return b; + } + } + } + } else { + for (String roleFunction : roleFunctions) { + if (portalApiPath.matches(roleFunction)) + return true; + } } return false; - } protected void handleSessionUpdates(HttpServletRequest request) { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/HealthMonitor.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/listener/HealthMonitor.java index 881952cf..0bc5c4c8 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/HealthMonitor.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/listener/HealthMonitor.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.listener; +package org.onap.portalapp.portal.listener; import java.util.List; @@ -45,13 +45,13 @@ import javax.annotation.PreDestroy; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.logging.format.EPAppMessagesEnum; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.portal.ueb.EPUebHelper; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.ueb.EPUebHelper; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.transaction.annotation.Transactional; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/UserContextListener.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/listener/UserContextListener.java index 686bef2d..2d0570f8 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/UserContextListener.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/listener/UserContextListener.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.listener; +package org.onap.portalapp.portal.listener; import java.util.HashMap; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/UserSessionListener.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/listener/UserSessionListener.java index a0093569..8633a415 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/UserSessionListener.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/listener/UserSessionListener.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -36,7 +36,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.listener; +package org.onap.portalapp.portal.listener; import java.util.HashMap; @@ -47,11 +47,11 @@ import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.service.SharedContextService; -import org.openecomp.portalsdk.core.domain.support.CollaborateList; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.service.SharedContextService; +import org.onap.portalsdk.core.domain.support.CollaborateList; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.util.StringUtils; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPAuditLog.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/aop/EPAuditLog.java index 7d761254..8c72ed73 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPAuditLog.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/aop/EPAuditLog.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.logging.aop; +package org.onap.portalapp.portal.logging.aop; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java index d095bbdb..11fb2fb5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.logging.aop; +package org.onap.portalapp.portal.logging.aop; import java.net.InetAddress; import java.text.SimpleDateFormat; @@ -44,16 +44,16 @@ import java.util.UUID; import javax.servlet.http.HttpServletRequest; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.exception.SessionExpiredException; -import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum; -import org.openecomp.portalsdk.core.logging.format.AuditLogFormatter; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.portalsdk.core.util.SystemProperties.SecurityEventTypeEnum; -import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.exception.SessionExpiredException; +import org.onap.portalsdk.core.logging.format.AlarmSeverityEnum; +import org.onap.portalsdk.core.logging.format.AuditLogFormatter; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.util.SystemProperties; +import org.onap.portalsdk.core.util.SystemProperties.SecurityEventTypeEnum; +import org.onap.portalsdk.core.web.support.UserUtils; import org.slf4j.MDC; import com.att.eelf.configuration.Configuration; @@ -66,13 +66,13 @@ public class EPEELFLoggerAdvice { /** * DateTime Format according to the ECOMP Application Logging Guidelines. */ - private static final SimpleDateFormat ecompLogDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); /** * @return Current date and time in the format specified by the ECOMP * Application Logging Guidelines. */ public static String getCurrentDateTimeUTC() { + SimpleDateFormat ecompLogDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); String currentDateTime = ecompLogDateFormat.format(new Date()); return currentDateTime; } @@ -112,6 +112,13 @@ public class EPEELFLoggerAdvice { MDC.put(className + methodName + EPCommonSystemProperties.METRICSLOG_BEGIN_TIMESTAMP, getCurrentDateTimeUTC()); MDC.put(EPCommonSystemProperties.TARGET_ENTITY, EPCommonSystemProperties.ECOMP_PORTAL_BE); MDC.put(EPCommonSystemProperties.TARGET_SERVICE_NAME, methodName); + if (MDC.get(Configuration.MDC_KEY_REQUEST_ID) == null){ + String requestId = UUID.randomUUID().toString(); + MDC.put(Configuration.MDC_KEY_REQUEST_ID, requestId); + } + MDC.put(EPCommonSystemProperties.PARTNER_NAME, "Unknown"); + MDC.put(Configuration.MDC_SERVICE_NAME, EPCommonSystemProperties.ECOMP_PORTAL_BE); + if (securityEventType != null) { MDC.put(className + methodName + EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, getCurrentDateTimeUTC()); @@ -208,6 +215,10 @@ public class EPEELFLoggerAdvice { MDC.remove(Configuration.MDC_SERVICE_NAME); MDC.remove(EPCommonSystemProperties.MDC_LOGIN_ID); MDC.remove(EPCommonSystemProperties.EXTERNAL_API_RESPONSE_CODE); + }else{ + MDC.remove(Configuration.MDC_KEY_REQUEST_ID); + MDC.remove(EPCommonSystemProperties.PARTNER_NAME); + MDC.remove(Configuration.MDC_SERVICE_NAME); } // clear when finishes audit logging @@ -225,6 +236,7 @@ public class EPEELFLoggerAdvice { MDC.remove(EPCommonSystemProperties.MDC_TIMER); MDC.remove(EPCommonSystemProperties.TARGET_ENTITY); MDC.remove(EPCommonSystemProperties.TARGET_SERVICE_NAME); + } /** @@ -290,7 +302,7 @@ public class EPEELFLoggerAdvice { && securityEventType != SecurityEventTypeEnum.INCOMING_UEB_MESSAGE) { // Load the RequestID (aka TrasactionId) into MDC context. String requestId = UserUtils.getRequestId(req); - if (requestId == "" || requestId == null) { + if (requestId == null||requestId.trim().length()==0) { requestId = UUID.randomUUID().toString(); } MDC.put(Configuration.MDC_KEY_REQUEST_ID, requestId); @@ -298,7 +310,7 @@ public class EPEELFLoggerAdvice { // Load user agent into MDC context, if available. String accessingClient = "Unknown"; accessingClient = req.getHeader(SystemProperties.USERAGENT_NAME); - if (accessingClient != null && accessingClient != "" && (accessingClient.contains("Mozilla") + if (accessingClient != null && accessingClient.trim().length()==0 && (accessingClient.contains("Mozilla") || accessingClient.contains("Chrome") || accessingClient.contains("Safari"))) { accessingClient = EPCommonSystemProperties.ECOMP_PORTAL_FE; } @@ -352,9 +364,9 @@ public class EPEELFLoggerAdvice { } MDC.put(Configuration.MDC_SERVICE_INSTANCE_ID, ""); - MDC.put(Configuration.MDC_ALERT_SEVERITY, AlarmSeverityEnum.INFORMATIONAL.toString()); + MDC.put(Configuration.MDC_ALERT_SEVERITY, AlarmSeverityEnum.INFORMATIONAL.severity()); try { - MDC.put(Configuration.MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName()); + MDC.put(Configuration.MDC_SERVER_FQDN, InetAddress.getLocalHost().getCanonicalHostName()); MDC.put(Configuration.MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress()); MDC.put(Configuration.MDC_INSTANCE_UUID, SystemProperties.getProperty(SystemProperties.INSTANCE_UUID)); } catch (Exception e) { @@ -369,8 +381,9 @@ public class EPEELFLoggerAdvice { * @param endDateTime */ private void calculateDateTimeDifference(String beginDateTime, String endDateTime) { - if (beginDateTime != null && endDateTime != null) { + if (beginDateTime != null && endDateTime != null && !beginDateTime.isEmpty()&&!endDateTime.isEmpty()) { try { + SimpleDateFormat ecompLogDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); Date beginDate = ecompLogDateFormat.parse(beginDateTime); Date endDate = ecompLogDateFormat.parse(endDateTime); String timeDifference = String.format("%d", endDate.getTime() - beginDate.getTime()); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPMetricsLog.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/aop/EPMetricsLog.java index 4cd5971f..ee52dd81 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPMetricsLog.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/aop/EPMetricsLog.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.logging.aop; +package org.onap.portalapp.portal.logging.aop; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/ApplicationCodes.properties b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/format/ApplicationCodes.properties index 09d73085..cd686ce2 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/ApplicationCodes.properties +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/format/ApplicationCodes.properties @@ -1,39 +1,21 @@ ### -# ============LICENSE_START========================================== -# ONAP Portal -# =================================================================== -# Copyright © 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. +# ================================================================================ +# ECOMP Portal +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# +# +# http://www.apache.org/licenses/LICENSE-2.0 +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# ================================================================================ ### ######################################################################## #Resource key=Error Code|Message text|Resolution text |Description text diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPAppMessagesEnum.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/format/EPAppMessagesEnum.java index 4a99eeeb..d7536bf7 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPAppMessagesEnum.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/format/EPAppMessagesEnum.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,11 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.logging.format; +package org.onap.portalapp.portal.logging.format; -import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum; -import org.openecomp.portalsdk.core.logging.format.ErrorSeverityEnum; -import org.openecomp.portalsdk.core.logging.format.ErrorTypeEnum; +import org.onap.portalsdk.core.logging.format.AlarmSeverityEnum; +import org.onap.portalsdk.core.logging.format.ErrorSeverityEnum; +import org.onap.portalsdk.core.logging.format.ErrorTypeEnum; /** * @@ -213,6 +213,18 @@ public enum EPAppMessagesEnum { ExternalAuthAccessGeneralError(EPErrorCodesEnum.EXTERNALAUTHACCESS_GENERALERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, "ERR520E", "Unexpected error", "Details: {0}.", "Please check logs for more information."), + + SchedulerAccessConnectionError(EPErrorCodesEnum.SCHEDULER_ACCESS_CONNECTIONERROR, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR240E", "Scheduler Connection problem", "Details: {0}.", "Please check logs for more information."), + + SchedulerAuxAccessAuthenticationError(EPErrorCodesEnum.SCHEDULERAUX_ACCESS_AUTHENTICATIONERROR, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR140E", "SchedulerAux authentication problem", "Details: {0}.", "Please check logs for more information."), + + SchedulerAccessGeneralError(EPErrorCodesEnum.SCHEDULER_ACCESS_GENERALERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR540E", "Unexpected Scheduler error", "Details: {0}.", "Please check logs for more information."), + + SchedulerInvalidAttributeError(EPErrorCodesEnum.SCHEDULER_INVALID_ATTRIBUTEERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR505E", "Unable to create Scheduler", "Details: {0}.", "Please check logs for more information."), ; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPErrorCodesEnum.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/format/EPErrorCodesEnum.java index cdcc0643..e4cd38e7 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPErrorCodesEnum.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/format/EPErrorCodesEnum.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.logging.format; +package org.onap.portalapp.portal.logging.format; import com.att.eelf.i18n.EELFResolvableErrorEnum; import com.att.eelf.i18n.EELFResourceManager; @@ -104,6 +104,11 @@ public enum EPErrorCodesEnum implements EELFResolvableErrorEnum { EXTERNALAUTHACCESS_CONNECTIONERROR, EXTERNALAUTHACCESS_AUTHENTICATIONERROR, EXTERNALAUTHACCESS_GENERALERROR, + + SCHEDULER_ACCESS_CONNECTIONERROR, + SCHEDULERAUX_ACCESS_AUTHENTICATIONERROR, + SCHEDULER_ACCESS_GENERALERROR, + SCHEDULER_INVALID_ATTRIBUTEERROR, ; /** diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/logic/EPLogUtil.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/logic/EPLogUtil.java index 9c9137fc..c47fb9da 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/logic/EPLogUtil.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/logic/EPLogUtil.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,16 +35,16 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.logging.logic; +package org.onap.portalapp.portal.logging.logic; import static com.att.eelf.configuration.Configuration.MDC_ALERT_SEVERITY; import java.text.MessageFormat; -import org.openecomp.portalapp.portal.logging.format.EPAppMessagesEnum; -import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum; -import org.openecomp.portalsdk.core.logging.format.ErrorSeverityEnum; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum; +import org.onap.portalsdk.core.logging.format.AlarmSeverityEnum; +import org.onap.portalsdk.core.logging.format.ErrorSeverityEnum; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.slf4j.MDC; import org.springframework.http.HttpStatus; @@ -88,7 +88,7 @@ public class EPLogUtil { AlarmSeverityEnum alarmSeverityEnum = epMessageEnum.getAlarmSeverity(); ErrorSeverityEnum errorSeverityEnum = epMessageEnum.getErrorSeverity(); - MDC.put(MDC_ALERT_SEVERITY, alarmSeverityEnum.name()); + MDC.put(MDC_ALERT_SEVERITY, alarmSeverityEnum.severity()); MDC.put("ErrorCode", epMessageEnum.getErrorCode()); MDC.put("ErrorDescription", epMessageEnum.getErrorDescription()); MDC.put("ClassName", EPLogUtil.class.getName()); @@ -134,7 +134,7 @@ public class EPLogUtil { AlarmSeverityEnum alarmSeverityEnum = epMessageEnum.getAlarmSeverity(); ErrorSeverityEnum errorSeverityEnum = epMessageEnum.getErrorSeverity(); - MDC.put(MDC_ALERT_SEVERITY, alarmSeverityEnum.name()); + MDC.put(MDC_ALERT_SEVERITY, alarmSeverityEnum.severity()); MDC.put("ErrorCode", epMessageEnum.getErrorCode()); MDC.put("ErrorDescription", epMessageEnum.getErrorDescription()); @@ -308,4 +308,21 @@ public class EPLogUtil { } } + public static void schedulerAccessAlarm(EELFLoggerDelegate logger, int res) { + if (res == HttpStatus.UNAUTHORIZED.value() || res == HttpStatus.FORBIDDEN.value()) { + EPLogUtil.logEcompError(logger, EPAppMessagesEnum.SchedulerAuxAccessAuthenticationError); + } else if (res == HttpStatus.NOT_FOUND.value() || res == HttpStatus.NOT_ACCEPTABLE.value() + || res == HttpStatus.CONFLICT.value() || res == HttpStatus.BAD_REQUEST.value() + || res == HttpStatus.REQUEST_TIMEOUT.value()||res==HttpStatus.INTERNAL_SERVER_ERROR.value()) { + EPLogUtil.logEcompError(logger, EPAppMessagesEnum.SchedulerAccessConnectionError); + } else if (res == HttpStatus.PRECONDITION_FAILED.value() || res == HttpStatus.EXPECTATION_FAILED.value()) { + EPLogUtil.logEcompError(logger, EPAppMessagesEnum.SchedulerInvalidAttributeError); + } else if (res != HttpStatus.ACCEPTED.value() && res != HttpStatus.OK.value() + && res != HttpStatus.NO_CONTENT.value()) { + EPLogUtil.logEcompError(logger, EPAppMessagesEnum.SchedulerAccessGeneralError); + } else { + logger.error(EELFLoggerDelegate.errorLogger, "Other SchedulerErrors failed", res); + } + } + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/RestObject.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/RestObject.java index 354b9ef6..327354c6 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/RestObject.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/RestObject.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -36,7 +36,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler; +package org.onap.portalapp.portal.scheduler; public class RestObject<T> { diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerProperties.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerProperties.java new file mode 100644 index 00000000..4fcdc4d7 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerProperties.java @@ -0,0 +1,164 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.scheduler; + +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.env.Environment; + +@Configuration +@PropertySource(value = { "${container.classpath:}/WEB-INF/conf/scheduler.properties" }) + +public class SchedulerProperties { + + private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SchedulerProperties.class); + + private static Environment environment; + + + public SchedulerProperties() { + } + + protected Environment getEnvironment() { + return environment; + } + + @Autowired + public void setEnvironment(Environment environment) { + SchedulerProperties.environment = environment; + } + + /** + * Tests whether a property value is available for the specified key. + * + * @param key + * Property key + * @return True if the key is known, otherwise false. + */ + public static boolean containsProperty(String key) { + return environment.containsProperty(key); + } + + /** + * Returns the property value associated with the given key (never + * {@code null}), after trimming any trailing space. + * + * @param key + * Property key + * @return Property value; the empty string if the environment was not + * autowired, which should never happen. + * @throws IllegalStateException + * if the key cannot be resolved + */ + public static String getProperty(String key) { + String value = ""; + if (environment == null) { + logger.error(EELFLoggerDelegate.errorLogger, "getProperty: environment is null, should never happen!"); + } else { + value = environment.getRequiredProperty(key); + // java.util.Properties preserves trailing space + if (value != null) + value = value.trim(); + } + return value; + } + + public static final String SCHEDULER_USER_NAME_VAL = "scheduler.user.name"; + + public static final String SCHEDULER_PASSWORD_VAL = "scheduler.password"; + + public static final String SCHEDULER_SERVER_URL_VAL = "scheduler.server.url"; + + public static final String SCHEDULER_CREATE_NEW_VNF_CHANGE_INSTANCE_VAL = "scheduler.create.new.vnf.change.instance"; + + public static final String SCHEDULER_GET_TIME_SLOTS = "scheduler.get.time.slots"; + + public static final String SCHEDULER_SUBMIT_NEW_VNF_CHANGE = "scheduler.submit.new.vnf.change"; + + public static final String SCHEDULERAUX_CLIENTAUTH_VAL = "scheduleraux.ClientAuth"; + + public static final String SCHEDULERAUX_CLIENT_MECHID_VAL = "scheduleraux.client.mechId"; + + public static final String SCHEDULERAUX_CLIENT_PASSWORD_VAL = "scheduleraux.client.password"; + + public static final String SCHEDULERAUX_USERNAME_VAL = "scheduleraux.username"; + + public static final String SCHEDULERAUX_PASSWORD_VAL = "scheduleraux.password"; + + public static final String SCHEDULERAUX_AUTHORIZATION_VAL = "scheduleraux.Authorization"; + + public static final String SCHEDULERAUX_SERVER_URL_VAL = "scheduleraux.server.url"; + + public static final String SCHEDULERAUX_ENVIRONMENT_VAL = "scheduleraux.environment"; + + public static final String SCHEDULERAUX_GET_CONFIG_VAL = "scheduleraux.get.config"; + + + /** The Constant VID_TRUSTSTORE_FILENAME. */ + public static final String VID_TRUSTSTORE_FILENAME = "vid.truststore.filename"; + + /** The Constant VID_TRUSTSTORE_PASSWD_X. */ + public static final String VID_TRUSTSTORE_PASSWD_X = "vid.truststore.passwd.x"; + + /** The Constant FILESEPARATOR. */ + public static final String FILESEPARATOR = (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator"); + + /** Scheduler UI constant **/ + public static final String SCHEDULER_DOMAIN_NAME = "scheduler.domain.name"; + + public static final String SCHEDULER_SCHEDULE_NAME = "scheduler.schedule.name"; + + public static final String SCHEDULER_WORKFLOW_NAME = "scheduler.workflow.name"; + + public static final String SCHEDULER_CALLBACK_URL = "scheduler.callback.url"; + + public static final String SCHEDULER_APPROVAL_TYPE = "scheduler.approval.type"; + + public static final String SCHEDULER_APPROVAL_SUBMIT_STATUS = "scheduler.approval.submit.status"; + + public static final String SCHEDULER_APPROVAL_REJECT_STATUS = "scheduler.approval.reject.status"; + + public static final String SCHEDULER_INTERVAL_GET_TIMESLOT_RATE = "scheduler.interval.get.timeslot.rate"; + + public static final String SCHEDULER_POLICY_NAME = "scheduler.policy.name"; + + public static final String SCHEDULER_GROUP_ID = "scheduler.group.id"; + +} diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerResponseWrapper.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerResponseWrapper.java index 731eef85..510c7cd9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerResponseWrapper.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerResponseWrapper.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,18 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler; +package org.onap.portalapp.portal.scheduler; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + import org.apache.commons.lang.builder.ToStringBuilder; /** @@ -98,11 +105,14 @@ public class SchedulerResponseWrapper { return ToStringBuilder.reflectionToString(this); } - public String getResponse () { - - StringBuilder b = new StringBuilder ("{ \"status\": "); - b.append(getStatus()).append(", \"entity\": \" " ).append(this.getEntity()).append("\" ,\"uuid\": \"" ).append(this.getUuid()).append("\"}"); - return (b.toString()); + public String getResponse () throws JsonProcessingException,IOException { + Map<String, Object> map = new LinkedHashMap<>(); + map.put("status", getStatus()); + map.put("entity", getEntity()); + map.put("uuid", getUuid()); + ObjectMapper objectMapper = new ObjectMapper(); + String jsonResponse = objectMapper.writeValueAsString(map); + return jsonResponse; } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInt.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInt.java index 78a0b108..7ada83bf 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInt.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInt.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -36,14 +36,12 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler; +package org.onap.portalapp.portal.scheduler; import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.util.Date; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import com.fasterxml.jackson.databind.ObjectMapper; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; public class SchedulerRestInt { diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInterface.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInterface.java new file mode 100644 index 00000000..26e40c9a --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInterface.java @@ -0,0 +1,270 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.scheduler; + +import java.util.Collections; + +import javax.security.auth.login.CredentialException; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.Entity; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.Response; + +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang.StringUtils; +import org.drools.compiler.lang.DRL5Expressions.neg_operator_key_return; +import org.eclipse.jetty.util.security.Password; +import org.json.simple.JSONObject; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.scheduler.client.HttpBasicClient; +import org.onap.portalapp.portal.scheduler.client.HttpsBasicClient; +import org.onap.portalapp.portal.scheduler.restobjects.RestObject; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Service; +import org.springframework.web.client.HttpClientErrorException; + +@Service +public class SchedulerRestInterface implements SchedulerRestInterfaceIfc { + + private static final String PASSWORD_IS_EMPTY = "Password is Empty"; + + private static Client client = null; + + private MultivaluedHashMap<String, Object> commonHeaders; + + /** The logger. */ + static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SchedulerRestInterface.class); + + public SchedulerRestInterface() { + super(); + } + + public void initRestClient() { + logger.debug(EELFLoggerDelegate.debugLogger, "Starting to initialize rest client"); + + final String username; + final String password; + + String methodName = "initRestClient"; + /* Setting user name based on properties */ + String retrievedUsername = SchedulerProperties.getProperty(SchedulerProperties.SCHEDULER_USER_NAME_VAL); + if (retrievedUsername.isEmpty()) { + username = ""; + } else { + username = retrievedUsername; + } + + /* Setting password based on properties */ + String retrievedPassword = SchedulerProperties.getProperty(SchedulerProperties.SCHEDULER_PASSWORD_VAL); + if (retrievedPassword.isEmpty()) { + password = StringUtils.EMPTY; + } else { + if (retrievedPassword.contains("OBF:")) { + password = Password.deobfuscate(retrievedPassword); + } else { + password = retrievedPassword; + } + } + try { + if (StringUtils.isBlank(password)) { + throw new CredentialException(PASSWORD_IS_EMPTY); + } + } catch (Exception ex) { + logger.error(EELFLoggerDelegate.errorLogger, "Unable to initialize rest client", ex); + } + String authString = username + ":" + password; + byte[] authEncBytes = Base64.encodeBase64(authString.getBytes()); + String authStringEnc = new String(authEncBytes); + + commonHeaders = new MultivaluedHashMap<String, Object>(); + commonHeaders.put("Authorization", Collections.singletonList((Object) ("Basic " + authStringEnc))); + + try { + if (!username.isEmpty()) { + + client = HttpBasicClient.getClient(); + } else { + + client = HttpsBasicClient.getClient(); + } + } catch (Exception e) { + logger.debug(EELFLoggerDelegate.debugLogger, "Unable to initialize rest client"); + + } + logger.debug(EELFLoggerDelegate.debugLogger, "Client Initialized"); + + } + + @SuppressWarnings("unchecked") + public <T> void Get(T t, String sourceId, String path, + org.onap.portalapp.portal.scheduler.restobjects.RestObject<T> restObject) throws Exception { + + String methodName = "Get"; + String url = SchedulerProperties.getProperty(SchedulerProperties.SCHEDULER_SERVER_URL_VAL) + path; + + logger.debug(EELFLoggerDelegate.debugLogger, "URL FOR GET : ", url); + try { + initRestClient(); + + final Response cres = client.target(url).request().accept("application/json").headers(commonHeaders).get(); + + int status = cres.getStatus(); + restObject.setStatusCode(status); + + t = (T) cres.readEntity(t.getClass()); + if (t.equals("")) { + restObject.set(null); + } else { + restObject.set(t); + } + } catch (HttpClientErrorException e) { + String message = String.format( + " HttpClientErrorException: Exception For the POST . MethodName: %s, Url: %s", methodName,url); + logger.error(EELFLoggerDelegate.errorLogger, message, e); + EPLogUtil.schedulerAccessAlarm(logger, e.getStatusCode().value()); + } catch (Exception e) { + String message = String.format( + "Exception For the POST . MethodName: %s, Url: %s", methodName,url); + + logger.error(EELFLoggerDelegate.errorLogger, message, e); + EPLogUtil.schedulerAccessAlarm(logger, HttpStatus.INTERNAL_SERVER_ERROR.value()); + + throw e; + + } + + } + + @SuppressWarnings("unchecked") + public <T> void Post(T t, JSONObject requestDetails, String path, RestObject<T> restObject) throws Exception { + + String methodName = "Post"; + String url = SchedulerProperties.getProperty(SchedulerProperties.SCHEDULER_SERVER_URL_VAL) + path; + logger.debug(EELFLoggerDelegate.debugLogger, "URL FOR POST : "+ url); + + try { + + initRestClient(); + + // Change the content length + final Response cres = client.target(url).request().accept("application/json").headers(commonHeaders) + .post(Entity.entity(requestDetails, MediaType.APPLICATION_JSON)); + + if (cres.getEntity() != null) { + t = (T) cres.readEntity(t.getClass()); + restObject.set(t); + } else { + t = null; + restObject.set(t); + } + + int status = cres.getStatus(); + restObject.setStatusCode(status); + + if (status >= 200 && status <= 299) { + String message = String.format( + " REST api POST was successful!", methodName); + logger.debug(EELFLoggerDelegate.debugLogger, message); + + } else { + String message = String.format( + " FAILED with http status . MethodName: %s, Status: %s, Url: %s", methodName,status,url); + logger.debug(EELFLoggerDelegate.debugLogger, message); + } + + } catch (HttpClientErrorException e) { + String message = String.format( + " HttpClientErrorException: Exception For the POST . MethodName: %s, Url: %s", methodName,url); + logger.error(EELFLoggerDelegate.errorLogger, message, e); + EPLogUtil.schedulerAccessAlarm(logger, e.getStatusCode().value()); + } catch (Exception e) { + String message = String.format( + " HttpClientErrorException: Exception For the POST . MethodName: %s, Url: %s", methodName,url); + logger.error(EELFLoggerDelegate.errorLogger, message, e); + EPLogUtil.schedulerAccessAlarm(logger, HttpStatus.INTERNAL_SERVER_ERROR.value()); + throw e; + } + } + + @Override + public void logRequest(JSONObject requestDetails) { + } + + @SuppressWarnings("unchecked") + public <T> void Delete(T t, JSONObject requestDetails, String sourceID, String path, RestObject<T> restObject) { + + String methodName = "Delete"; + String url = ""; + Response cres = null; + + try { + initRestClient(); + + url = SchedulerProperties.getProperty(SchedulerProperties.SCHEDULER_SERVER_URL_VAL) + path; + + cres = client.target(url).request().accept("application/json").headers(commonHeaders) + // .entity(r) + .build("DELETE", Entity.entity(requestDetails, MediaType.APPLICATION_JSON)).invoke(); + // .method("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON)); + // .delete(Entity.entity(r, MediaType.APPLICATION_JSON)); + + int status = cres.getStatus(); + restObject.setStatusCode(status); + if (cres.getEntity() != null) { + t = (T) cres.readEntity(t.getClass()); + restObject.set(t); + } + + } catch (HttpClientErrorException e) { + logger.error(EELFLoggerDelegate.errorLogger, " HttpClientErrorException:Exception For the Delete", + methodName, url, e); + EPLogUtil.schedulerAccessAlarm(logger, e.getStatusCode().value()); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Exception For the Delete", methodName, url, e); + EPLogUtil.schedulerAccessAlarm(logger, HttpStatus.INTERNAL_SERVER_ERROR.value()); + throw e; + } + } + + public <T> T getInstance(Class<T> clazz) throws IllegalAccessException, InstantiationException { + return clazz.newInstance(); + } + +} diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterfaceFactory.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInterfaceFactory.java index 8aaf8819..75ae6d3a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterfaceFactory.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInterfaceFactory.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,16 +35,17 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler; +package org.onap.portalapp.portal.scheduler; public class SchedulerRestInterfaceFactory { - public static SchedulerRestInterfaceIfc getInstance() { + + public static SchedulerRestInterfaceIfc getInstance () { SchedulerRestInterfaceIfc obj = null; obj = new SchedulerRestInterface(); - - return (obj); + + return ( obj ); } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterfaceIfc.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInterfaceIfc.java index 738f9baa..5d1da5e3 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterfaceIfc.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInterfaceIfc.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,19 +35,19 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler; +package org.onap.portalapp.portal.scheduler; import org.json.simple.JSONObject; +import org.onap.portalapp.portal.scheduler.restobjects.RestObject; import org.springframework.stereotype.Service; -import org.openecomp.portalapp.portal.scheduler.restobjects.RestObject; + @Service public interface SchedulerRestInterfaceIfc { public void initRestClient(); - public <T> void Get(T t, String sourceId, String path, - org.openecomp.portalapp.portal.scheduler.restobjects.RestObject<T> restObject) throws Exception; + public <T> void Get(T t, String sourceId, String path, org.onap.portalapp.portal.scheduler.restobjects.RestObject<T> restObject ) throws Exception; public <T> void Delete(T t, JSONObject requestDetails, String sourceID, String path, RestObject<T> restObject) throws Exception; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerUtil.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerUtil.java index 39de6b3e..2da5f696 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerUtil.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerUtil.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,103 +35,102 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler; +package org.onap.portalapp.portal.scheduler; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; -import org.openecomp.portalapp.portal.scheduler.restobjects.GetTimeSlotsRestObject; -import org.openecomp.portalapp.portal.scheduler.restobjects.PostCreateNewVnfRestObject; -import org.openecomp.portalapp.portal.scheduler.restobjects.PostSubmitVnfChangeRestObject; -import org.openecomp.portalapp.portal.scheduler.wrapper.GetTimeSlotsWrapper; -import org.openecomp.portalapp.portal.scheduler.wrapper.PostCreateNewVnfWrapper; -import org.openecomp.portalapp.portal.scheduler.wrapper.PostSubmitVnfChangeTimeSlotsWrapper; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.portal.scheduler.restobjects.GetTimeSlotsRestObject; +import org.onap.portalapp.portal.scheduler.restobjects.PostCreateNewVnfRestObject; +import org.onap.portalapp.portal.scheduler.restobjects.PostSubmitVnfChangeRestObject; +import org.onap.portalapp.portal.scheduler.wrapper.GetTimeSlotsWrapper; +import org.onap.portalapp.portal.scheduler.wrapper.PostCreateNewVnfWrapper; +import org.onap.portalapp.portal.scheduler.wrapper.PostSubmitVnfChangeTimeSlotsWrapper; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import com.fasterxml.jackson.databind.ObjectMapper; public class SchedulerUtil { - + private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SchedulerUtil.class); - + final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS"); - public static GetTimeSlotsWrapper getTimeSlotsWrapResponse(GetTimeSlotsRestObject<String> rs) { - + public static GetTimeSlotsWrapper getTimeSlotsWrapResponse (GetTimeSlotsRestObject<String> rs) { + String resp_str = ""; int status = 0; - - if (rs != null) { + + if ( rs != null ) { resp_str = rs.get(); status = rs.getStatusCode(); } - + GetTimeSlotsWrapper w = new GetTimeSlotsWrapper(); - + w.setEntity(resp_str); - w.setStatus(status); - + w.setStatus (status); + return (w); } - - public static PostSubmitVnfChangeTimeSlotsWrapper postSubmitNewVnfWrapResponse( - PostSubmitVnfChangeRestObject<String> rs) { - + + public static PostSubmitVnfChangeTimeSlotsWrapper postSubmitNewVnfWrapResponse (PostSubmitVnfChangeRestObject<String> rs) { + String resp_str = ""; int status = 0; String uuid = ""; - - if (rs != null) { + + if ( rs != null ) { resp_str = rs.get(); status = rs.getStatusCode(); uuid = rs.getUUID(); } - + PostSubmitVnfChangeTimeSlotsWrapper w = new PostSubmitVnfChangeTimeSlotsWrapper(); - + w.setEntity(resp_str); - w.setStatus(status); + w.setStatus (status); w.setUuid(uuid); - + return (w); } - - public static PostCreateNewVnfWrapper postCreateNewVnfWrapResponse(PostCreateNewVnfRestObject<String> rs) { - + + public static PostCreateNewVnfWrapper postCreateNewVnfWrapResponse (PostCreateNewVnfRestObject<String> rs) { + String resp_str = ""; int status = 0; String uuid = ""; - - if (rs != null) { + + if ( rs != null ) { resp_str = rs.get(); status = rs.getStatusCode(); uuid = rs.getUUID(); } - + PostCreateNewVnfWrapper w = new PostCreateNewVnfWrapper(); - + w.setEntity(resp_str); - w.setStatus(status); + w.setStatus (status); w.setUuid(uuid); - + return (w); } - - public static <T> String convertPojoToString(T t) throws com.fasterxml.jackson.core.JsonProcessingException { - + + public static <T> String convertPojoToString ( T t ) throws com.fasterxml.jackson.core.JsonProcessingException { + String methodName = "convertPojoToString"; ObjectMapper mapper = new ObjectMapper(); String r_json_str = ""; - if (t != null) { - try { - r_json_str = mapper.writeValueAsString(t); - } catch (com.fasterxml.jackson.core.JsonProcessingException j) { - logger.debug(EELFLoggerDelegate.debugLogger, - dateFormat.format(new Date()) + "<== " + methodName + " Unable to parse object as json"); - } - } - return (r_json_str); + if ( t != null ) { + try { + r_json_str = mapper.writeValueAsString(t); + } + catch ( com.fasterxml.jackson.core.JsonProcessingException j ) { + logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " Unable to parse object as json"); + } + } + return (r_json_str); } - + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/client/HttpBasicClient.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/client/HttpBasicClient.java index 2059cae0..8d64b2e4 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/client/HttpBasicClient.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/client/HttpBasicClient.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -36,7 +36,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler.client; +package org.onap.portalapp.portal.scheduler.client; import java.text.DateFormat; @@ -48,8 +48,8 @@ import javax.ws.rs.client.ClientBuilder; import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.client.ClientProperties; -import org.openecomp.portalapp.portal.scheduler.util.CustomJacksonJaxBJsonProvider; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.portal.scheduler.util.CustomJacksonJaxBJsonProvider; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; /** diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/client/HttpsBasicClient.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/client/HttpsBasicClient.java index 2eb3ac72..53848e02 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/client/HttpsBasicClient.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/client/HttpsBasicClient.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -36,7 +36,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler.client; +package org.onap.portalapp.portal.scheduler.client; import java.io.File; import java.text.DateFormat; @@ -53,10 +53,10 @@ import javax.ws.rs.client.ClientBuilder; import org.eclipse.jetty.util.security.Password; import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.client.ClientProperties; -import org.openecomp.portalapp.portal.scheduler.properties.VidProperties; -import org.openecomp.portalapp.portal.scheduler.util.CustomJacksonJaxBJsonProvider; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.scheduler.SchedulerProperties; +import org.onap.portalapp.portal.scheduler.util.CustomJacksonJaxBJsonProvider; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.util.SystemProperties; /** * General SSL client using the VID tomcat keystore. It doesn't use client certificates. @@ -88,9 +88,9 @@ public class HttpsBasicClient{ config.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); - String truststore_path = SystemProperties.getProperty(VidProperties.VID_TRUSTSTORE_FILENAME); + String truststore_path = SchedulerProperties.getProperty(SchedulerProperties.VID_TRUSTSTORE_FILENAME); logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + " " + methodName + " truststore_path=" + truststore_path); - String truststore_password = SystemProperties.getProperty(VidProperties.VID_TRUSTSTORE_PASSWD_X); + String truststore_password = SchedulerProperties.getProperty(SchedulerProperties.VID_TRUSTSTORE_PASSWD_X); String decrypted_truststore_password = Password.deobfuscate(truststore_password); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/rest/RequestDetails.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/policy/rest/RequestDetails.java index a7759cba..66b77faf 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/rest/RequestDetails.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/policy/rest/RequestDetails.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -36,7 +36,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler.policy.rest; +package org.onap.portalapp.portal.scheduler.policy.rest; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/GetTimeSlotsRestObject.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/restobjects/GetTimeSlotsRestObject.java index 9749c836..6adf59c7 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/GetTimeSlotsRestObject.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/restobjects/GetTimeSlotsRestObject.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler.restobjects; +package org.onap.portalapp.portal.scheduler.restobjects; public class GetTimeSlotsRestObject<T> extends RestObject<T> { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/PostCreateNewVnfRestObject.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/restobjects/PostCreateNewVnfRestObject.java index 94b66821..757b8188 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/PostCreateNewVnfRestObject.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/restobjects/PostCreateNewVnfRestObject.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler.restobjects; +package org.onap.portalapp.portal.scheduler.restobjects; public class PostCreateNewVnfRestObject<T> extends RestObject<T> { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/PostSubmitVnfChangeRestObject.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/restobjects/PostSubmitVnfChangeRestObject.java index 4f78fd75..3f75315e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/PostSubmitVnfChangeRestObject.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/restobjects/PostSubmitVnfChangeRestObject.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler.restobjects; +package org.onap.portalapp.portal.scheduler.restobjects; public class PostSubmitVnfChangeRestObject<T> extends RestObject<T> { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/RestObject.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/restobjects/RestObject.java index a8636ad9..b2f4d5c0 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/RestObject.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/restobjects/RestObject.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -36,7 +36,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler.restobjects; +package org.onap.portalapp.portal.scheduler.restobjects; public class RestObject<T> { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/util/CustomJacksonJaxBJsonProvider.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/util/CustomJacksonJaxBJsonProvider.java index d9792b3d..9f7b092c 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/util/CustomJacksonJaxBJsonProvider.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/util/CustomJacksonJaxBJsonProvider.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -36,7 +36,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler.util; +package org.onap.portalapp.portal.scheduler.util; import javax.ws.rs.ext.Provider; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/GetTimeSlotsWrapper.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/wrapper/GetTimeSlotsWrapper.java index 69b6b366..43f4e36a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/GetTimeSlotsWrapper.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/wrapper/GetTimeSlotsWrapper.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler.wrapper; +package org.onap.portalapp.portal.scheduler.wrapper; public class GetTimeSlotsWrapper extends SchedulerResponseWrapper { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/PostCreateNewVnfWrapper.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/wrapper/PostCreateNewVnfWrapper.java index 41f07f38..fce04d84 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/PostCreateNewVnfWrapper.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/wrapper/PostCreateNewVnfWrapper.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,42 +35,50 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler.wrapper; +package org.onap.portalapp.portal.scheduler.wrapper; + +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; import org.apache.commons.lang.builder.ToStringBuilder; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "uuid" -}) +@JsonPropertyOrder({ "uuid" }) public class PostCreateNewVnfWrapper extends SchedulerResponseWrapper { @JsonProperty("uuid") private String uuid; - + @JsonProperty("uuid") - public String getUuid() { - return uuid; - } - + public String getUuid() { + return uuid; + } + @JsonProperty("uuid") - public void setUuid(String v) { - this.uuid = v; - } - + public void setUuid(String v) { + this.uuid = v; + } + @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + public String getResponse() throws JsonProcessingException, IOException { - public String getResponse () { - - StringBuilder b = new StringBuilder ("{ \"status\": "); - b.append(getStatus()).append(", \"entity\": \" " ).append(this.getEntity()).append("\" ,\"uuid\": \"" ).append(this.getUuid()).append("\"}"); - return (b.toString()); - } + Map<String, Object> map = new LinkedHashMap<>(); + map.put("status", getStatus()); + map.put("entity", getEntity()); + map.put("uuid", getUuid()); + ObjectMapper objectMapper = new ObjectMapper(); + String jsonResponse = objectMapper.writeValueAsString(map); + return jsonResponse; + } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/PostSubmitVnfChangeTimeSlotsWrapper.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/wrapper/PostSubmitVnfChangeTimeSlotsWrapper.java index c0f2403d..bd588e0d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/PostSubmitVnfChangeTimeSlotsWrapper.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/wrapper/PostSubmitVnfChangeTimeSlotsWrapper.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,41 +35,50 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler.wrapper; +package org.onap.portalapp.portal.scheduler.wrapper; + +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; import org.apache.commons.lang.builder.ToStringBuilder; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "uuid" -}) -public class PostSubmitVnfChangeTimeSlotsWrapper extends SchedulerResponseWrapper { +@JsonPropertyOrder({ "uuid" }) +public class PostSubmitVnfChangeTimeSlotsWrapper extends SchedulerResponseWrapper { @JsonProperty("uuid") private String uuid; - + @JsonProperty("uuid") - public String getUuid() { - return uuid; - } - + public String getUuid() { + return uuid; + } + @JsonProperty("uuid") - public void setUuid(String v) { - this.uuid = v; - } - + public void setUuid(String v) { + this.uuid = v; + } + @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + public String getResponse() throws JsonProcessingException, IOException { + + Map<String, Object> map = new LinkedHashMap<>(); + map.put("status", getStatus()); + map.put("entity", getEntity()); + map.put("uuid", getUuid()); + ObjectMapper objectMapper = new ObjectMapper(); + String jsonResponse = objectMapper.writeValueAsString(map); + return jsonResponse; - public String getResponse () { - - StringBuilder b = new StringBuilder ("{ \"status\": "); - b.append(getStatus()).append(", \"entity\": \" " ).append(this.getEntity()).append("\" ,\"uuid\": \"" ).append(this.getUuid()).append("\"}"); - return (b.toString()); - } + } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/SchedulerResponseWrapper.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/wrapper/SchedulerResponseWrapper.java index 3a55b4fc..67ded99d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/SchedulerResponseWrapper.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/wrapper/SchedulerResponseWrapper.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,24 +35,28 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler.wrapper; +package org.onap.portalapp.portal.scheduler.wrapper; + +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +import org.apache.commons.lang.builder.ToStringBuilder; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import org.apache.commons.lang.builder.ToStringBuilder; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; /** * This wrapper encapsulates the Scheduler response */ @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "status", - "entity" -}) +@JsonPropertyOrder({ "status", "entity" }) public class SchedulerResponseWrapper { - + @JsonProperty("status") private int status; @@ -60,35 +64,44 @@ public class SchedulerResponseWrapper { private String entity; @JsonProperty("entity") - public String getEntity() { - return entity; - } - + public String getEntity() { + return entity; + } + @JsonProperty("status") - public int getStatus() { - return status; - } - + public int getStatus() { + return status; + } + @JsonProperty("status") - public void setStatus(int v) { - this.status = v; - } + public void setStatus(int v) { + this.status = v; + } @JsonProperty("entity") - public void setEntity(String v) { - this.entity = v; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } + public void setEntity(String v) { + this.entity = v; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + public String getResponse() throws JsonProcessingException, IOException { + /* + * StringBuilder b = new StringBuilder ("{ \"status\": "); + * + * b.append(getStatus()).append(", \"entity\": " + * ).append(this.getEntity()).append("}"); return (b.toString()); + */ + + Map<String, Object> map = new LinkedHashMap<>(); + map.put("status", getStatus()); + map.put("entity", getEntity()); + ObjectMapper objectMapper = new ObjectMapper(); + String jsonResponse = objectMapper.writeValueAsString(map); + return jsonResponse; - public String getResponse () { - - StringBuilder b = new StringBuilder ("{ \"status\": "); - - b.append(getStatus()).append(", \"entity\": " ).append(this.getEntity()).append("}"); - return (b.toString()); - } + } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/RestObject.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/RestObject.java index efe2de07..f9755a0f 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/RestObject.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/RestObject.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -36,7 +36,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler.policy; +package org.onap.portalapp.portal.scheduleraux; /** * The Class RestObject. diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyResponseWrapper.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxResponseWrapper.java index 276af521..35becb6b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyResponseWrapper.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxResponseWrapper.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler.policy; +package org.onap.portalapp.portal.scheduleraux; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -51,7 +51,7 @@ import org.apache.commons.lang.builder.ToStringBuilder; "entity" }) -public class PolicyResponseWrapper { +public class SchedulerAuxResponseWrapper { @JsonProperty("status") private int status; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInt.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxRestInt.java index 14c4db72..18f4ce88 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInt.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxRestInt.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -36,21 +36,21 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler.policy; +package org.onap.portalapp.portal.scheduleraux; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; -import org.openecomp.portalapp.portal.scheduler.policy.rest.RequestDetails; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.portal.scheduler.policy.rest.RequestDetails; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import com.fasterxml.jackson.databind.ObjectMapper; -public class PolicyRestInt { +public class SchedulerAuxRestInt { /** The logger. */ - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PolicyRestInterface.class); + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SchedulerAuxRestInterface.class); /** The Constant dateFormat. */ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS"); @@ -58,7 +58,7 @@ public class PolicyRestInt { /** The request date format. */ public DateFormat requestDateFormat = new SimpleDateFormat("EEE, dd MMM YYYY HH:mm:ss z"); - public PolicyRestInt() { + public SchedulerAuxRestInt() { requestDateFormat.setTimeZone(java.util.TimeZone.getTimeZone("GMT")); } diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxRestInterface.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxRestInterface.java new file mode 100644 index 00000000..bf0fa515 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxRestInterface.java @@ -0,0 +1,278 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.scheduleraux; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Collections; +import java.util.Date; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.Entity; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.Response; + +import org.apache.commons.codec.binary.Base64; +import org.eclipse.jetty.util.security.Password; +import org.json.simple.JSONObject; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.scheduler.SchedulerProperties; +import org.onap.portalapp.portal.scheduler.client.HttpBasicClient; +import org.onap.portalapp.portal.scheduler.policy.rest.RequestDetails; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.springframework.http.HttpStatus; +import org.springframework.web.client.HttpClientErrorException; + +public class SchedulerAuxRestInterface extends SchedulerAuxRestInt implements SchedulerAuxRestInterfaceIfc { + + /** The logger. */ + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SchedulerAuxRestInterface.class); + + /** The Constant dateFormat. */ + final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS"); + + /** The client. */ + private static Client client = null; + + /** The common headers. */ + private MultivaluedHashMap<String, Object> commonHeaders; + + public SchedulerAuxRestInterface() { + super(); + } + + public void initRestClient() { + final String methodname = "initRestClient()"; + final String mechId = SchedulerProperties.getProperty(SchedulerProperties.SCHEDULERAUX_CLIENT_MECHID_VAL); + final String clientPassword = SchedulerProperties + .getProperty(SchedulerProperties.SCHEDULERAUX_CLIENT_PASSWORD_VAL); + final String username = SchedulerProperties.getProperty(SchedulerProperties.SCHEDULERAUX_USERNAME_VAL); + final String password = SchedulerProperties.getProperty(SchedulerProperties.SCHEDULERAUX_PASSWORD_VAL); + final String environment = SchedulerProperties.getProperty(SchedulerProperties.SCHEDULERAUX_ENVIRONMENT_VAL); + final String clientAuth = SchedulerProperties.getProperty(SchedulerProperties.SCHEDULERAUX_CLIENTAUTH_VAL); + final String decrypted_client_password = Password.deobfuscate(clientPassword); + String mechAuthString = mechId + ":" + decrypted_client_password; + byte[] mechAuthEncBytes = Base64.encodeBase64(mechAuthString.getBytes()); + final String decrypted_password = Password.deobfuscate(password); + String authString = username + ":" + decrypted_password; + byte[] authEncBytes = Base64.encodeBase64(authString.getBytes()); + String authorization = new String(authEncBytes); + + commonHeaders = new MultivaluedHashMap<String, Object>(); + commonHeaders.put("ClientAuth", Collections.singletonList((Object) ("Basic " + clientAuth))); + commonHeaders.put("Authorization", Collections.singletonList((Object) ("Basic " + authorization))); + commonHeaders.put("Environment", Collections.singletonList((Object) (environment))); + + if (client == null) { + + try { + client = HttpBasicClient.getClient(); + } catch (Exception e) { + logger.debug(EELFLoggerDelegate.debugLogger, " Unable to get the SSL client", methodname); + + } + } + } + + @SuppressWarnings("unchecked") + public <T> void Get(T t, String sourceId, String path, RestObject<T> restObject) throws Exception { + String methodName = "Get"; + + logger.debug(EELFLoggerDelegate.debugLogger, " start", methodName); + + String url = ""; + restObject.set(t); + + url = SchedulerProperties.getProperty(SchedulerProperties.SCHEDULERAUX_SERVER_URL_VAL) + path; + logger.debug(EELFLoggerDelegate.debugLogger, " sending request to url: ", dateFormat.format(new Date()), + methodName, url); + + initRestClient(); + + final Response cres = client.target(url).request().accept("application/json").headers(commonHeaders).get(); + + int status = cres.getStatus(); + restObject.setStatusCode(status); + + if (status == 200) { + t = (T) cres.readEntity(t.getClass()); + restObject.set(t); + logger.debug(EELFLoggerDelegate.debugLogger, " REST api was successfull!", dateFormat.format(new Date()), + methodName); + + } else { + throw new Exception(methodName + " with status=" + status + ", url= " + url); + } + + logger.debug(EELFLoggerDelegate.debugLogger, " received status", methodName, status); + + return; + } + + @SuppressWarnings("unchecked") + public <T> void Delete(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) { + + String methodName = "Delete"; + String url = ""; + Response cres = null; + + logRequest(r); + + try { + initRestClient(); + + url = SchedulerProperties.getProperty(SchedulerProperties.SCHEDULERAUX_SERVER_URL_VAL) + path; + logger.debug(EELFLoggerDelegate.debugLogger, " methodName sending request to: ", + dateFormat.format(new Date()), url, methodName); + + cres = client.target(url).request().accept("application/json").headers(commonHeaders) + // .entity(r) + .build("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON)).invoke(); + // .method("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON)); + // .delete(Entity.entity(r, MediaType.APPLICATION_JSON)); + + int status = cres.getStatus(); + restObject.setStatusCode(status); + + if (status == 404) { // resource not found + String msg = "Resource does not exist...: " + cres.getStatus(); + logger.debug(EELFLoggerDelegate.debugLogger, "msg", dateFormat.format(new Date()), msg); + } else if (status == 200 || status == 204) { + logger.debug(EELFLoggerDelegate.debugLogger, "Resource--deleted:url", dateFormat.format(new Date()), + url); + } else if (status == 202) { + String msg = "Delete in progress: " + status; + logger.debug(EELFLoggerDelegate.debugLogger, "msg ", dateFormat.format(new Date()), msg); + } else { + String msg = "Deleting Resource failed: " + status; + logger.debug(EELFLoggerDelegate.debugLogger, "msg", dateFormat.format(new Date()), msg); + } + + try { + t = (T) cres.readEntity(t.getClass()); + restObject.set(t); + } catch (HttpClientErrorException e) { + logger.error(EELFLoggerDelegate.errorLogger, + " HttpClientErrorException:No response entity, this is probably ok, e=", methodName, e); + EPLogUtil.schedulerAccessAlarm(logger, e.getStatusCode().value()); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "No response entity, this is probably ok, e=", methodName, + e); + EPLogUtil.schedulerAccessAlarm(logger, HttpStatus.INTERNAL_SERVER_ERROR.value()); + + } + + } catch (HttpClientErrorException e) { + logger.error(EELFLoggerDelegate.errorLogger, " HttpClientErrorException:Exception with the URL", methodName, + url, e); + EPLogUtil.schedulerAccessAlarm(logger, e.getStatusCode().value()); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Exception with the URL ", dateFormat.format(new Date()), + methodName, url, e); + EPLogUtil.schedulerAccessAlarm(logger, HttpStatus.INTERNAL_SERVER_ERROR.value()); + + throw e; + + } + } + + @SuppressWarnings("unchecked") + public <T> void Post(T t, JSONObject requestDetails, String uuid, String path, RestObject<T> restObject) + throws HttpClientErrorException, Exception { + + String methodName = "Post"; + String url = ""; + Response cres = null; + logger.debug(EELFLoggerDelegate.debugLogger, "POST policy rest interface"); + // logRequest (requestDetails); + try { + + initRestClient(); + + url = SchedulerProperties.getProperty(SchedulerProperties.SCHEDULERAUX_SERVER_URL_VAL) + path; + logger.debug(EELFLoggerDelegate.debugLogger, " sending request to url= ", methodName, url); + // Change the content length + + cres = client.target(url).request().accept("application/json").headers(commonHeaders) + // .header("content-length", 201) + // .header("X-FromAppId", sourceID) + .post(Entity.entity(requestDetails, MediaType.APPLICATION_JSON)); + + t = (T) cres.readEntity(t.getClass()); + if (t.equals("")) { + restObject.set(null); + } else { + restObject.set(t); + } + + int status = cres.getStatus(); + + restObject.setStatusCode(status); + + if (status >= 200 && status <= 299) { + logger.debug(EELFLoggerDelegate.debugLogger, " REST api POST was successful!", methodName); + + } else { + logger.debug(EELFLoggerDelegate.debugLogger, "methodname with Status and URL", methodName, status, url); + } + + } catch (HttpClientErrorException e) { + String message = String.format( + " HttpClientErrorException:Exception with the URL . MethodName: %s, Url: %s", methodName,url); + logger.error(EELFLoggerDelegate.errorLogger, message, e); + EPLogUtil.schedulerAccessAlarm(logger, e.getStatusCode().value()); + } catch (Exception e) { + String message = String.format( + " Exception with the URL . MethodName: %s, Url: %s", methodName,url); + logger.error(EELFLoggerDelegate.errorLogger, message, e); + EPLogUtil.schedulerAccessAlarm(logger, HttpStatus.BAD_REQUEST.value()); + throw e; + + } + } + + public <T> T getInstance(Class<T> clazz) throws IllegalAccessException, InstantiationException { + return clazz.newInstance(); + } + + @Override + public void logRequest(RequestDetails r) { + // TODO Auto-generated method stub + } +}
\ No newline at end of file diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxRestInterfaceFactory.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxRestInterfaceFactory.java new file mode 100644 index 00000000..55ab036c --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxRestInterfaceFactory.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.scheduleraux; + +public class SchedulerAuxRestInterfaceFactory { + + + public static SchedulerAuxRestInterfaceIfc getInstance () { + SchedulerAuxRestInterfaceIfc obj = null; + + obj = new SchedulerAuxRestInterface(); + + return ( obj ); + } +}
\ No newline at end of file diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterfaceIfc.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxRestInterfaceIfc.java index 4e3d08e0..4c0d64ef 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterfaceIfc.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxRestInterfaceIfc.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,82 +35,60 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler.policy; +package org.onap.portalapp.portal.scheduleraux; import org.json.simple.JSONObject; -import org.openecomp.portalapp.portal.scheduler.policy.rest.RequestDetails; +import org.onap.portalapp.portal.scheduler.policy.rest.RequestDetails; -public interface PolicyRestInterfaceIfc { +public interface SchedulerAuxRestInterfaceIfc { /** * Inits the rest client. */ public void initRestClient(); - + /** * Gets the. * - * @param <T> - * the generic type - * @param t - * the t - * @param sourceId - * the source id - * @param path - * the path - * @param restObject - * the rest object - * @throws Exception - * the exception + * @param <T> the generic type + * @param t the t + * @param sourceId the source id + * @param path the path + * @param restObject the rest object + * @throws Exception the exception */ - public <T> void Get(T t, String sourceId, String path, RestObject<T> restObject) throws Exception; - + public <T> void Get (T t, String sourceId, String path, RestObject<T> restObject ) throws Exception; + /** * Delete. * - * @param <T> - * the generic type - * @param t - * the t - * @param r - * the r - * @param sourceID - * the source ID - * @param path - * the path - * @param restObject - * the rest object - * @throws Exception - * the exception + * @param <T> the generic type + * @param t the t + * @param r the r + * @param sourceID the source ID + * @param path the path + * @param restObject the rest object + * @throws Exception the exception */ - public <T> void Delete(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) - throws Exception; - + public <T> void Delete(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) throws Exception; + /** * Post. * - * @param <T> - * the generic type - * @param t - * the t - * @param r - * the r - * @param sourceID - * the source ID - * @param path - * the path - * @param restObject - * the rest object - * @throws Exception - * the exception + * @param <T> the generic type + * @param t the t + * @param r the r + * @param sourceID the source ID + * @param path the path + * @param restObject the rest object + * @throws Exception the exception */ public <T> void Post(T t, JSONObject r, String sourceID, String path, RestObject<T> restObject) throws Exception; - + /*** * Log request. * - * @param r - * the r + * @param r the r */ - public void logRequest(RequestDetails r); - + public void logRequest ( RequestDetails r ); + }
\ No newline at end of file diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyUtil.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxUtil.java index 3e1c9415..678073c8 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyUtil.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxUtil.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,56 +35,53 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.scheduler.policy; +package org.onap.portalapp.portal.scheduleraux; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import org.glassfish.jersey.client.ClientResponse; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; /*import org.openecomp.vid.policy.PolicyResponseWrapper; import org.openecomp.vid.policy.PolicyUtil; import org.openecomp.vid.policy.RestObject;*/ import com.fasterxml.jackson.databind.ObjectMapper; -public class PolicyUtil { +public class SchedulerAuxUtil { - private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PolicyUtil.class); + private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SchedulerAuxUtil.class); final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS"); - public static PolicyResponseWrapper wrapResponse ( String body, int statusCode ) { + public static SchedulerAuxResponseWrapper wrapResponse ( String body, int statusCode ) { - PolicyResponseWrapper w = new PolicyResponseWrapper(); + SchedulerAuxResponseWrapper w = new SchedulerAuxResponseWrapper(); w.setStatus (statusCode); w.setEntity(body); return w; } - public static PolicyResponseWrapper wrapResponse (ClientResponse cres) { + public static SchedulerAuxResponseWrapper wrapResponse (ClientResponse cres) { String resp_str = ""; - int statuscode = 0; if ( cres != null ) { resp_str = cres.readEntity(String.class); - statuscode = cres.getStatus(); } - - - PolicyResponseWrapper w = PolicyUtil.wrapResponse ( resp_str, statuscode ); + int statuscode = cres.getStatus(); + SchedulerAuxResponseWrapper w = SchedulerAuxUtil.wrapResponse ( resp_str, statuscode ); return (w); } - public static PolicyResponseWrapper wrapResponse (RestObject<String> rs) { + public static SchedulerAuxResponseWrapper wrapResponse (RestObject<String> rs) { String resp_str = ""; int status = 0; if ( rs != null ) { resp_str = rs.get(); status = rs.getStatusCode(); } - PolicyResponseWrapper w = PolicyUtil.wrapResponse ( resp_str, status ); + SchedulerAuxResponseWrapper w = SchedulerAuxUtil.wrapResponse ( resp_str, status ); return (w); } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AdminRolesService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AdminRolesService.java index 020ed6f4..49ab1a06 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AdminRolesService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AdminRolesService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,13 +35,14 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.transport.AppsListWithAdminRole; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.transport.AppsListWithAdminRole; public interface AdminRolesService { @@ -71,4 +72,6 @@ public interface AdminRolesService { public boolean isUser(EPUser user); List<EPRole> getRolesByApp(EPUser user, Long appId); + + public boolean isAccountAdminOfApplication(EPUser user, EPApp app); } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AdminRolesServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AdminRolesServiceImpl.java index e9ca4e9b..653e974b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AdminRolesServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AdminRolesServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,13 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.SortedSet; import javax.annotation.PostConstruct; @@ -50,24 +51,24 @@ import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.json.JSONArray; import org.json.JSONObject; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EPUserApp; -import org.openecomp.portalapp.portal.domain.UserIdRoleId; -import org.openecomp.portalapp.portal.domain.UserRole; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.logging.format.EPAppMessagesEnum; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.portal.transport.AppNameIdIsAdmin; -import org.openecomp.portalapp.portal.transport.AppsListWithAdminRole; -import org.openecomp.portalapp.portal.transport.ExternalAccessUser; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.portal.utils.PortalConstants; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPUserApp; +import org.onap.portalapp.portal.domain.UserIdRoleId; +import org.onap.portalapp.portal.domain.UserRole; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.transport.AppNameIdIsAdmin; +import org.onap.portalapp.portal.transport.AppsListWithAdminRole; +import org.onap.portalapp.portal.transport.ExternalAccessUser; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.http.HttpEntity; @@ -123,10 +124,17 @@ public class AdminRolesServiceImpl implements AdminRolesService { AppsListWithAdminRole appsListWithAdminRole = null; try { - List<EPUser> userList = dataAccessService.getList(EPUser.class, " where orgUserId = '" + orgUserId + "'", - null, null); + List<EPUser> userList = null; + Map<String, String> userParams = new HashMap<>(); + userParams.put("org_user_id", orgUserId); + try { + userList = dataAccessService.executeNamedQuery("getEPUserByOrgUserId", userParams, null); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getEPUserByOrgUserId failed", e); + } + HashMap<Long, Long> appsUserAdmin = new HashMap<Long, Long>(); - if (userList.size() > 0) { + if (userList!= null && userList.size() > 0) { EPUser user = userList.get(0); List<EPUserApp> userAppList = null; try { @@ -240,9 +248,10 @@ public class AdminRolesServiceImpl implements AdminRolesService { localSession.save(EPUserApp.class.getName(), newUserApp); } transaction.commit(); - - // Add user admin role for list of centralized applications in external system - result = addAdminRoleInExternalSystem(user, localSession, newAppsWhereUserIsAdmin); + if (EcompPortalUtils.checkIfRemoteCentralAccessAllowed()) { + // Add user admin role for list of centralized applications in external system + addAdminRoleInExternalSystem(user, localSession, newAppsWhereUserIsAdmin); + } } catch (Exception e) { EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e); logger.error(EELFLoggerDelegate.errorLogger, @@ -494,4 +503,27 @@ public class AdminRolesServiceImpl implements AdminRolesService { } return list; } + + @Override + public boolean isAccountAdminOfApplication(EPUser user, EPApp app) { + try { + EPUser currentUser = user != null + ? (EPUser) dataAccessService.getDomainObject(EPUser.class, user.getId(), null) : null; + if (currentUser != null && currentUser.getId() != null) { + SortedSet<EPUserApp> userApps = currentUser.getEPUserApps(); + EPUserApp userApp = userApps.stream() + .filter(x -> x.getRole().getId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID) + && x.getApp().getId().equals(app.getId())) + .findAny().orElse(null); + if (userApp != null) { + return true; + } + } + } catch (Exception e) { + EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e); + logger.error(EELFLoggerDelegate.errorLogger, + "Exception occurred while executing isAccountAdminOfApplication operation", e); + } + return false; + } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppContactUsService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AppContactUsService.java index da33293c..874f7d04 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppContactUsService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AppContactUsService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; -import org.openecomp.portalapp.portal.ecomp.model.AppCategoryFunctionsItem; -import org.openecomp.portalapp.portal.ecomp.model.AppContactUsItem; +import org.onap.portalapp.portal.ecomp.model.AppCategoryFunctionsItem; +import org.onap.portalapp.portal.ecomp.model.AppContactUsItem; public interface AppContactUsService { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppContactUsServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AppContactUsServiceImpl.java index 2f987075..edffafc3 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppContactUsServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AppContactUsServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.Collections; import java.util.Comparator; @@ -44,13 +44,12 @@ import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalapp.portal.domain.AppContactUs; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.ecomp.model.AppCategoryFunctionsItem; -import org.openecomp.portalapp.portal.ecomp.model.AppContactUsItem; +import org.onap.portalapp.portal.domain.AppContactUs; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.ecomp.model.AppCategoryFunctionsItem; +import org.onap.portalapp.portal.ecomp.model.AppContactUsItem; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.service.DataAccessService; /** * Provides database access for the contact-us page controllers. diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ApplicationsRestClientService.java index a8d79aed..b3f376a7 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ApplicationsRestClientService.java @@ -1,12 +1,12 @@ /*- * ============LICENSE_START========================================== - * ONAP Portal SDK + * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,10 +35,10 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import org.apache.cxf.transport.http.HTTPException; -import org.openecomp.portalapp.util.SystemType; +import org.onap.portalapp.util.SystemType; public interface ApplicationsRestClientService { public <T> T get(Class<T> clazz, long app, String restPath) throws HTTPException; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ApplicationsRestClientServiceImpl.java index ae11a91e..18717204 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ApplicationsRestClientServiceImpl.java @@ -1,12 +1,12 @@ /*- * ============LICENSE_START========================================== - * ONAP Portal SDK + * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID; @@ -50,19 +50,21 @@ import javax.servlet.http.HttpServletResponse; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import org.apache.commons.lang.StringUtils; import org.apache.cxf.jaxrs.client.WebClient; import org.apache.cxf.transport.http.HTTPException; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.logging.format.EPAppMessagesEnum; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.util.SystemType; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.service.AppsCacheService; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.util.SystemType; +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.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; @@ -172,7 +174,7 @@ public class ApplicationsRestClientServiceImpl implements ApplicationsRestClient String username = (type == SystemType.APPLICATION) ? externalApp.getUsername(): ""; String encriptedPwd = (type == SystemType.APPLICATION) ? externalApp.getAppPassword(): ""; String appName = (type == SystemType.APPLICATION) ? externalApp.getName(): ""; - String decreptedAppPwd = ""; + String decreptedAppPwd = StringUtils.EMPTY; // Set local context MDC.put(EPCommonSystemProperties.PROTOCOL, EPCommonSystemProperties.HTTP); @@ -184,7 +186,7 @@ public class ApplicationsRestClientServiceImpl implements ApplicationsRestClient MDC.put(EPCommonSystemProperties.TARGET_SERVICE_NAME, restPath); try { - decreptedAppPwd = CipherUtil.decrypt(encriptedPwd, + decreptedAppPwd = CipherUtil.decryptPKC(encriptedPwd, SystemProperties.getProperty(SystemProperties.Decryption_Key)); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "createClientFor failed to decrypt", e); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AppsCacheService.java index 4ffccd1e..edaf1137 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AppsCacheService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -36,9 +36,9 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; -import org.openecomp.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPApp; public interface AppsCacheService { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheServiceImple.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AppsCacheServiceImple.java index f56cdef9..c318f196 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheServiceImple.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AppsCacheServiceImple.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.HashMap; import java.util.List; @@ -46,10 +46,11 @@ import javax.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.portal.service.AppsCacheService; +import org.onap.portalapp.portal.service.AppsCacheServiceImple; @Service("appsCacheService") @org.springframework.context.annotation.Configuration diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthAccountService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthAccountService.java index 0f18b6f3..2b3c3f38 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthAccountService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthAccountService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; -import org.openecomp.portalapp.portal.domain.BasicAuthCredentials; -import org.openecomp.portalapp.portal.domain.EPEndpoint; +import org.onap.portalapp.portal.domain.BasicAuthCredentials; +import org.onap.portalapp.portal.domain.EPEndpoint; public interface BasicAuthAccountService { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthAccountServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthAccountServiceImpl.java index 1c353d07..e6b7c6ea 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthAccountServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthAccountServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.ArrayList; import java.util.HashMap; @@ -44,14 +44,14 @@ import java.util.Map; import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Restrictions; -import org.openecomp.portalapp.portal.domain.BasicAuthCredentials; -import org.openecomp.portalapp.portal.domain.EPEndpoint; -import org.openecomp.portalapp.portal.domain.EPEndpointAccount; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.domain.BasicAuthCredentials; +import org.onap.portalapp.portal.domain.EPEndpoint; +import org.onap.portalapp.portal.domain.EPEndpointAccount; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.onboarding.util.CipherUtil; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; @@ -183,9 +183,16 @@ public class BasicAuthAccountServiceImpl implements BasicAuthAccountService{ @SuppressWarnings("unchecked") private List<EPEndpoint> getEPEndpoints(long accountId) { List<EPEndpoint> result = new ArrayList<>(); - List<EPEndpointAccount> list = (List<EPEndpointAccount>) dataAccessService - .getList(EPEndpointAccount.class, " where account_id = '" + accountId + "'", null, null); - for(int i = 0; i < list.size(); i++){ + List<EPEndpointAccount> list = null; + Map<String, Long> params = new HashMap<>(); + params.put("account_id", accountId); + try { + list = this.getDataAccessService().executeNamedQuery("getEPEndpointAccountByAccountId", params, null); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getEPEndpointAccountByAccountId failed", e); + } + + for(int i = 0; list != null && i < list.size(); i++){ result.add((EPEndpoint) dataAccessService.getDomainObject(EPEndpoint.class, list.get(i).getEp_id(), null)); } return result; @@ -210,7 +217,7 @@ public class BasicAuthAccountServiceImpl implements BasicAuthAccountService{ String result = ""; if (encryptedPwd != null & encryptedPwd.length() > 0) { try { - result = CipherUtil.decrypt(encryptedPwd, + result = CipherUtil.decryptPKC(encryptedPwd, SystemProperties.getProperty(SystemProperties.Decryption_Key)); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "decryptedPassword() failed", e); @@ -224,7 +231,7 @@ public class BasicAuthAccountServiceImpl implements BasicAuthAccountService{ String result = ""; if (decryptedPwd != null & decryptedPwd.length() > 0) { try { - result = CipherUtil.encrypt(decryptedPwd, + result = CipherUtil.encryptPKC(decryptedPwd, SystemProperties.getProperty(SystemProperties.Decryption_Key)); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "encryptedPassword() failed", e); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthenticationCredentialService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthenticationCredentialService.java index c16ae40d..b95b7254 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthenticationCredentialService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthenticationCredentialService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,9 +35,9 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; -import org.openecomp.portalapp.portal.domain.BasicAuthCredentials; +import org.onap.portalapp.portal.domain.BasicAuthCredentials; public interface BasicAuthenticationCredentialService { /** diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthenticationCredentialServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthenticationCredentialServiceImpl.java index 49f6f58c..b50eb391 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthenticationCredentialServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthenticationCredentialServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,19 +35,19 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.ArrayList; import java.util.List; import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Restrictions; -import org.openecomp.portalapp.portal.domain.BasicAuthCredentials; -import org.openecomp.portalapp.portal.domain.EPEndpoint; -import org.openecomp.portalapp.portal.domain.EPEndpointAccount; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.DataAccessService; +import org.onap.portalapp.portal.domain.BasicAuthCredentials; +import org.onap.portalapp.portal.domain.EPEndpoint; +import org.onap.portalapp.portal.domain.EPEndpointAccount; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.service.DataAccessService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ConsulHealthService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ConsulHealthService.java index 6742a4c9..87d20712 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ConsulHealthService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ConsulHealthService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; -import org.openecomp.portalapp.portal.exceptions.NoHealthyServiceException; +import org.onap.portalapp.portal.exceptions.NoHealthyServiceException; + import com.ecwid.consul.ConsulException; import com.orbitz.consul.model.health.ServiceHealth; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ConsulHealthServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ConsulHealthServiceImpl.java index d3ca7452..ebb43767 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ConsulHealthServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ConsulHealthServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.stereotype.Component; import com.ecwid.consul.ConsulException; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/DashboardSearchService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/DashboardSearchService.java index 87d557c3..82a40b7d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/DashboardSearchService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/DashboardSearchService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,14 +35,14 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; import java.util.Map; -import org.openecomp.portalapp.portal.transport.CommonWidget; -import org.openecomp.portalapp.portal.transport.CommonWidgetMeta; -import org.openecomp.portalapp.portal.ecomp.model.SearchResultItem; +import org.onap.portalapp.portal.ecomp.model.SearchResultItem; +import org.onap.portalapp.portal.transport.CommonWidget; +import org.onap.portalapp.portal.transport.CommonWidgetMeta; public interface DashboardSearchService { public Map<String, List<SearchResultItem>> searchResults(String userId, String searchString); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/DashboardSearchServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/DashboardSearchServiceImpl.java index f08011f2..776bd619 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/DashboardSearchServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/DashboardSearchServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.ArrayList; import java.util.HashMap; @@ -44,11 +44,10 @@ import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; - -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalapp.portal.transport.CommonWidget; -import org.openecomp.portalapp.portal.transport.CommonWidgetMeta; -import org.openecomp.portalapp.portal.ecomp.model.SearchResultItem; +import org.onap.portalapp.portal.ecomp.model.SearchResultItem; +import org.onap.portalapp.portal.transport.CommonWidget; +import org.onap.portalapp.portal.transport.CommonWidgetMeta; +import org.onap.portalsdk.core.service.DataAccessService; @Component public class DashboardSearchServiceImpl implements DashboardSearchService { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAppCommonServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAppCommonServiceImpl.java index 2fc0f505..8c055b2d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAppCommonServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAppCommonServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.io.IOException; import java.security.GeneralSecurityException; @@ -52,46 +52,47 @@ import javax.annotation.PostConstruct; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; -import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; -import org.openecomp.portalapp.portal.domain.AdminUserApp; -import org.openecomp.portalapp.portal.domain.AdminUserApplications; -import org.openecomp.portalapp.portal.domain.AppIdAndNameTransportModel; -import org.openecomp.portalapp.portal.domain.AppsResponse; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EPUserAppRolesRequest; -import org.openecomp.portalapp.portal.domain.EPUserAppRolesRequestDetail; -import org.openecomp.portalapp.portal.domain.EPUserAppsManualSortPreference; -import org.openecomp.portalapp.portal.domain.EPUserAppsSortPreference; -import org.openecomp.portalapp.portal.domain.EPWidgetsManualSortPreference; -import org.openecomp.portalapp.portal.domain.EcompApp; -import org.openecomp.portalapp.portal.domain.UserRole; -import org.openecomp.portalapp.portal.domain.UserRoles; -import org.openecomp.portalapp.portal.ecomp.model.AppCatalogItem; -import org.openecomp.portalapp.portal.logging.format.EPAppMessagesEnum; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.portal.transport.EPAppsManualPreference; -import org.openecomp.portalapp.portal.transport.EPAppsSortPreference; -import org.openecomp.portalapp.portal.transport.EPDeleteAppsManualSortPref; -import org.openecomp.portalapp.portal.transport.EPWidgetsSortPreference; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.FunctionalMenuItem; -import org.openecomp.portalapp.portal.transport.LocalRole; -import org.openecomp.portalapp.portal.transport.OnboardingApp; -import org.openecomp.portalapp.portal.ueb.EPUebHelper; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.ueb.Helper; -import org.openecomp.portalsdk.core.onboarding.ueb.TopicManager; -import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; -import org.openecomp.portalsdk.core.onboarding.util.PortalApiConstants; -import org.openecomp.portalsdk.core.onboarding.util.PortalApiProperties; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Restrictions; +import org.onap.portalapp.portal.domain.AdminUserApp; +import org.onap.portalapp.portal.domain.AdminUserApplications; +import org.onap.portalapp.portal.domain.AppIdAndNameTransportModel; +import org.onap.portalapp.portal.domain.AppsResponse; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPUserAppRolesRequest; +import org.onap.portalapp.portal.domain.EPUserAppRolesRequestDetail; +import org.onap.portalapp.portal.domain.EPUserAppsManualSortPreference; +import org.onap.portalapp.portal.domain.EPUserAppsSortPreference; +import org.onap.portalapp.portal.domain.EPWidgetsManualSortPreference; +import org.onap.portalapp.portal.domain.EcompApp; +import org.onap.portalapp.portal.domain.UserRole; +import org.onap.portalapp.portal.domain.UserRoles; +import org.onap.portalapp.portal.ecomp.model.AppCatalogItem; +import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.transport.EPAppsManualPreference; +import org.onap.portalapp.portal.transport.EPAppsSortPreference; +import org.onap.portalapp.portal.transport.EPDeleteAppsManualSortPref; +import org.onap.portalapp.portal.transport.EPWidgetsSortPreference; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.FunctionalMenuItem; +import org.onap.portalapp.portal.transport.LocalRole; +import org.onap.portalapp.portal.transport.OnboardingApp; +import org.onap.portalapp.portal.ueb.EPUebHelper; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.onboarding.ueb.Helper; +import org.onap.portalsdk.core.onboarding.ueb.TopicManager; +import org.onap.portalsdk.core.onboarding.util.CipherUtil; +import org.onap.portalsdk.core.onboarding.util.PortalApiConstants; +import org.onap.portalsdk.core.onboarding.util.PortalApiProperties; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import com.att.nsa.apiClient.http.HttpException; @@ -120,7 +121,7 @@ public class EPAppCommonServiceImpl implements EPAppService { @Autowired private DataAccessService dataAccessService; @Autowired - private EPUebHelper epUebHelper; + private EPUebHelper epUebHelper; @PostConstruct private void init() { @@ -211,9 +212,7 @@ public class EPAppCommonServiceImpl implements EPAppService { @Override public EPApp getApp(Long appId) { try { - @SuppressWarnings("unchecked") - List<EPApp> apps = dataAccessService.getList(EPApp.class, " where id = " + appId, null, null); - return (apps.size() > 0) ? apps.get(0) : null; + return (EPApp) dataAccessService.getDomainObject(EPApp.class, appId, null); } catch (Exception e) { EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e); return null; @@ -250,6 +249,28 @@ public class EPAppCommonServiceImpl implements EPAppService { @SuppressWarnings("unchecked") List<EPApp> apps = (List<EPApp>) dataAccessService.executeNamedQuery("getMyloginAppDetails", params, null); return (apps.size() > 0) ? apps.get(0) : null; + } catch(Exception e) { + EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e); + return null; + } + } + + @Override + public EPApp getAppDetailByAppName(String appName) { + final Map<String, String> params = new HashMap<String, String>(); + try { + params.put("appName", appName); + @SuppressWarnings("unchecked") + List<EPApp> apps = (List<EPApp>) dataAccessService.executeNamedQuery("getAppDetailsByAppName", params, null); + if (apps.size() > 0) { + EPApp app = apps.get(0); + if (!EcompPortalUtils.checkIfRemoteCentralAccessAllowed()) { + app.setCentralAuth(false); + } + return app; + } else{ + return null; + } } catch (Exception e) { EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e); return null; @@ -672,11 +693,25 @@ public class EPAppCommonServiceImpl implements EPAppService { boolean duplicatedName = false; List<EPApp> apps; if (onboardingApp.id == null) { - apps = dataAccessService.getList(EPApp.class, - " where url = '" + onboardingApp.url + "' or name = '" + onboardingApp.name + "'", null, null); + List<Criterion> restrictionsList = new ArrayList<Criterion>(); + Criterion urlCrit =Restrictions.eq("url", onboardingApp.url); + Criterion nameCrit = Restrictions.eq("name",onboardingApp.name); + Criterion orCrit = Restrictions.or(urlCrit, nameCrit); + + restrictionsList.add(orCrit); + apps = (List<EPApp>) dataAccessService.getList(EPApp.class, null, restrictionsList, null); + + } else { - apps = dataAccessService.getList(EPApp.class, " where id = " + onboardingApp.id + " or url = '" - + onboardingApp.url + "' or name = '" + onboardingApp.name + "'", null, null); + List<Criterion> restrictionsList = new ArrayList<Criterion>(); + Criterion idCrit =Restrictions.eq("id", onboardingApp.id); + Criterion urlCrit =Restrictions.eq("url", onboardingApp.url); + Criterion nameCrit = Restrictions.eq("name",onboardingApp.name); + Criterion orCrit = Restrictions.or(idCrit, urlCrit, nameCrit); + + restrictionsList.add(orCrit); + apps = (List<EPApp>) dataAccessService.getList(EPApp.class, null, restrictionsList, null); + } for (EPApp app : apps) { if (onboardingApp.id != null && onboardingApp.id.equals(app.getId())) { @@ -757,14 +792,95 @@ public class EPAppCommonServiceImpl implements EPAppService { dataAccessService.deleteDomainObjects(EPUserAppRolesRequestDetail.class , "req_id=" + EPUserAppRolesRequestList.get(i).getId(),null); } - - Boolean result = false; - Session localSession = null; + Session localSession = null; Transaction transaction = null; + Boolean result = false; try { localSession = sessionFactory.openSession(); transaction = localSession.beginTransaction(); + + // 1) Remove the URL for any functional menu item associated with + // this app + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleting URL for any functional menu item associated with app"); + // Named query is stored in EP.hbm.xml, mapped to EPApp + dataAccessService.executeNamedQuery("updateMenuFunctionalAndRoles", params, null); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleted URL for any functional menu item associated with app"); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleting favorites associated with a menu item that is associated with this app"); + // 2)Remove any favorites associated with a menu item that is + // associated with this app + dataAccessService.executeNamedQuery("removeAppFromMenuFavorites", params, null); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleted favorites associated with a menu item that is associated with this app"); + + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleting role, appid records from fn_menu_functional_role that are associated with this app"); + // 3)Remove all role, appid records from fn_menu_functional_role + // that are associated with this app + dataAccessService.executeNamedQuery("removeAppFromMenuFunctionalRoles", params, null); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleted role, appid records from fn_menu_functional_role that are associated with this app"); + + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleting all roles, rolefunctions, appid records from ep_app_role_function that are associated with this app"); + // 4)Remove all roles, rolefunctions, appid records from ep_app_role_function + // that are associated with this app + dataAccessService.executeNamedQuery("removeAppFromEpAppRoleFunction", params, null); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleted all roles, rolefunctions, appid records from ep_app_role_function that are associated with this app"); + + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleting all rolefunctions, appid records from ep_app_function that are associated with this app"); + // 5)Remove all rolefunctions, appid records from ep_app_function + // that are associated with this app + dataAccessService.executeNamedQuery("removeAppFromEpAppFunction", params, null); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleted all rolefunctions, appid records from ep_app_function that are associated with this app"); + + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleting all records from fn_user_role associated with this app"); + // 6)Remove all records from fn_user_role associated with this app + dataAccessService.executeNamedQuery("removeAppFromFnUserRole", params, null); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleted all records from fn_user_role associated with this app"); + + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleting any widgets associated with this app"); + // 7)Remove any widgets associated with this app + dataAccessService.executeNamedQuery("removeAppFromEpWidgetCatalogRole", params, null); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleted widgets associated with this app"); + + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleting any roles associated with this app"); + // 8)Remove any roles associated with this app + dataAccessService.executeNamedQuery("removeAppFromEpRoleNotification", params, null); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleted roles associated with this app"); + + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleting all records from fn_role associated with this app"); + // 9)Remove all records from fn_role associated with this app + dataAccessService.executeNamedQuery("removeAppFromFnRole", params, null); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleted all records from fn_role associated with this app"); + + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleting in table fn_app_contact_us entries associated with this app"); + // 10)Remove app contact us entries + dataAccessService.executeNamedQuery("removeAppFromAppContactUs", params, null); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleted in table fn_app_contact_us entries associated with this app"); + + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleting rows in the fn_pers_user_app_sel table"); + // 11)Remove rows in the app personalization selection table + dataAccessService.executeNamedQuery("removeAppFromEpPersUserAppSel", params, null); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleted rows in the fn_pers_user_app_sel table"); + + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleting rows in the ep_pers_user_app_man_sort table"); + // 12)Remove rows in the app personalization sort table + dataAccessService.executeNamedQuery("removeAppFromEpPersUserAppManSort", params, null); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleted rows in the ep_pers_user_app_man_sort table"); + + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleting rows in the ep_user_roles_request table"); + // 13)Remove rows in the app personalization sort table + dataAccessService.executeNamedQuery("removeAppFromEpUserRolesRequest", params, null); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleted rows in the ep_user_roles_request table"); + + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleting rows in the ep_web_analytics_source"); + // 14)Remove rows in the ep_web_analytics_source + dataAccessService.executeNamedQuery("removeAppFromEpWebAnalytics", params, null); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleted rows in the ep_web_analytics_source"); + + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleting the app "); + // 15)Delete the app + dataAccessService.executeNamedQuery("removeAppFromFnApp", params, null); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp: Deleted the app"); + + /* // 1) Remove the URL for any functional menu item associated with // this app String sql = "UPDATE fn_menu_functional m, fn_menu_functional_roles mr SET m.url='' " @@ -866,7 +982,9 @@ public class EPAppCommonServiceImpl implements EPAppService { query.executeUpdate(); transaction.commit(); + */ result = true; + logger.debug(EELFLoggerDelegate.debugLogger, "deleteOnboardingApp success"); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "deleteOnboardingApp failed", e); EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError); @@ -982,7 +1100,7 @@ public class EPAppCommonServiceImpl implements EPAppService { String topicDescription) throws HttpException, CambriaApiException, IOException { init(EPAppCommonServiceImpl.this); - final LinkedList<String> urlList = Helper.uebUrlList(); + final LinkedList<String> urlList = (LinkedList<String>) Helper.uebUrlList(); if (logger.isInfoEnabled()) { logger.info("==> createTopic"); logger.info("topicName: " + topicName); @@ -1001,7 +1119,7 @@ public class EPAppCommonServiceImpl implements EPAppService { public void addPublisher(String topicOwnerKey, String topicOwnerSecret, String publisherKey, String topicName) throws HttpException, CambriaApiException, IOException { logger.info("==> addPublisher to topic " + topicName); - final LinkedList<String> urlList = Helper.uebUrlList(); + final LinkedList<String> urlList = (LinkedList<String>) Helper.uebUrlList(); CambriaTopicManager tm = null; try { tm = service.getTopicManager(urlList, topicOwnerKey, topicOwnerSecret); @@ -1241,7 +1359,7 @@ public class EPAppCommonServiceImpl implements EPAppService { String result = ""; if (encryptedAppPwd != null & encryptedAppPwd.length() > 0) { try { - result = CipherUtil.decrypt(encryptedAppPwd, + result = CipherUtil.decryptPKC(encryptedAppPwd, SystemProperties.getProperty(SystemProperties.Decryption_Key)); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "decryptedPassword failed for app " + app.getName(), e); @@ -1254,7 +1372,7 @@ public class EPAppCommonServiceImpl implements EPAppService { String result = ""; if (decryptedAppPwd != null & decryptedAppPwd.length() > 0) { try { - result = CipherUtil.encrypt(decryptedAppPwd, + result = CipherUtil.encryptPKC(decryptedAppPwd, SystemProperties.getProperty(SystemProperties.Decryption_Key)); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "encryptedPassword failed for app " + app.getName(), e); @@ -1326,8 +1444,8 @@ public class EPAppCommonServiceImpl implements EPAppService { if (delEpWidgetsManPref.getWidgetid() != null) { Long widgetId = delEpWidgetsManPref.getWidgetid(); if (existingWidgetIds.containsKey(widgetId)) { - dataAccessService.deleteDomainObjects(EPWidgetsManualSortPreference.class, - "widget_id=" + widgetId + " AND user_id=" + user.getId(), null); + params.put("widgetId",widgetId); + dataAccessService.executeNamedQuery("deleteUserWidgetPlacement", params, null); } fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_OK); } @@ -1490,6 +1608,19 @@ public class EPAppCommonServiceImpl implements EPAppService { @Override + public UserRoles getUserProfileForRolesLeftMenu(String loginId) { + final Map<String, String> params = new HashMap<>(); + params.put("org_user_id", loginId); + @SuppressWarnings("unchecked") + List<UserRole> userRoleList = dataAccessService.executeNamedQuery( "getRolesForLeftMenu", params, null); + ArrayList<UserRoles> usersRolesList = aggregateUserProfileRowsResultsByRole(userRoleList); + if (usersRolesList == null || usersRolesList.size() < 1) + return null; + + return usersRolesList.get(0); + } + + @Override public UserRoles getUserProfileNormalizedForLeftMenu(EPUser user) { // Check database. UserRoles userAndRoles = getUserProfileForLeftMenu(user.getLoginId()); @@ -1497,19 +1628,39 @@ public class EPAppCommonServiceImpl implements EPAppService { if (user.isGuest() || userAndRoles == null) { logger.debug(EELFLoggerDelegate.debugLogger, "getUserProfileForLeftMenu: treating user {} as guest", user.getLoginId()); - UserRole userRole = new UserRole(); - userRole.setUser_Id(user.getId()); - userRole.setOrgUserId(user.getLoginId()); - userRole.setFirstName(user.getFirstName()); - userRole.setLastName(user.getLastName()); - userRole.setRoleId(-1L); - userRole.setRoleName("Guest"); - userRole.setUser_Id(-1L); - userAndRoles = new UserRoles(userRole); + userAndRoles = createUserRoles(user); } return userAndRoles; } + @Override + public UserRoles getUserProfileNormalizedForRolesLeftMenu(EPUser user) { + // Check database. + UserRoles userAndRoles = getUserProfileForRolesLeftMenu(user.getLoginId()); + // If no roles are defined, treat this user as a guest. + if (user.isGuest() || userAndRoles == null) { + logger.debug(EELFLoggerDelegate.debugLogger, "getUserProfileForLeftMenu: treating user {} as guest", + user.getLoginId()); + userAndRoles = createUserRoles(user); + } + + return userAndRoles; + } + + public UserRoles createUserRoles(EPUser user) + { + UserRole userRole = new UserRole(); + userRole.setUser_Id(user.getId()); + userRole.setOrgUserId(user.getLoginId()); + userRole.setFirstName(user.getFirstName()); + userRole.setLastName(user.getLastName()); + userRole.setRoleId(-1L); + userRole.setRoleName("Guest"); + userRole.setUser_Id(-1L); + UserRoles userAndRoles = new UserRoles(userRole); + return userAndRoles; + + } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAppService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAppService.java index c4a31907..3dd18a6f 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAppService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAppService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,25 +35,25 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; -import org.openecomp.portalapp.portal.domain.AdminUserApplications; -import org.openecomp.portalapp.portal.domain.AppIdAndNameTransportModel; -import org.openecomp.portalapp.portal.domain.AppsResponse; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EcompApp; -import org.openecomp.portalapp.portal.domain.UserRoles; -import org.openecomp.portalapp.portal.ecomp.model.AppCatalogItem; -import org.openecomp.portalapp.portal.transport.EPAppsManualPreference; -import org.openecomp.portalapp.portal.transport.EPAppsSortPreference; -import org.openecomp.portalapp.portal.transport.EPDeleteAppsManualSortPref; -import org.openecomp.portalapp.portal.transport.EPWidgetsSortPreference; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.LocalRole; -import org.openecomp.portalapp.portal.transport.OnboardingApp; +import org.onap.portalapp.portal.domain.AdminUserApplications; +import org.onap.portalapp.portal.domain.AppIdAndNameTransportModel; +import org.onap.portalapp.portal.domain.AppsResponse; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EcompApp; +import org.onap.portalapp.portal.domain.UserRoles; +import org.onap.portalapp.portal.ecomp.model.AppCatalogItem; +import org.onap.portalapp.portal.transport.EPAppsManualPreference; +import org.onap.portalapp.portal.transport.EPAppsSortPreference; +import org.onap.portalapp.portal.transport.EPDeleteAppsManualSortPref; +import org.onap.portalapp.portal.transport.EPWidgetsSortPreference; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.LocalRole; +import org.onap.portalapp.portal.transport.OnboardingApp; public interface EPAppService { @@ -194,6 +194,15 @@ public interface EPAppService { EPApp getApp(Long appId); EPApp getAppDetail(String appName); + + /** + * + * It return app information + * + * @param appName it contains application name + * @return EPApp + */ + EPApp getAppDetailByAppName(String appName); List<EPApp> getAppsOrderByName(EPUser user); @@ -232,4 +241,8 @@ public interface EPAppService { UserRoles getUserProfileForLeftMenu(String loginId); + UserRoles getUserProfileForRolesLeftMenu(String loginId); + + UserRoles getUserProfileNormalizedForRolesLeftMenu(EPUser user); + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAuditService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAuditService.java index 321b441f..d1479176 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAuditService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAuditService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.Date; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAuditServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAuditServiceImpl.java index 5e86c3c9..1b3dfade 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAuditServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAuditServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.time.LocalDate; import java.util.Date; @@ -47,12 +47,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; - -import org.openecomp.portalsdk.core.domain.AuditLog; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalsdk.core.domain.AuditLog; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.service.DataAccessService; @Service("epAuditService") @Transactional diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLdapService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPLdapService.java index e06f3987..7721cbc9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLdapService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPLdapService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,10 +35,10 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; -import org.openecomp.portalsdk.core.command.support.SearchResult; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.command.support.SearchResult; +import org.onap.portalsdk.core.domain.support.DomainVo; public interface EPLdapService { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLdapServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPLdapServiceImpl.java index 82e44fd8..941acaf6 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLdapServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPLdapServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.ArrayList; import java.util.Collections; @@ -48,16 +48,17 @@ import javax.naming.directory.Attributes; import javax.naming.directory.DirContext; import javax.naming.directory.SearchControls; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalsdk.core.command.support.SearchResult; -import org.openecomp.portalsdk.core.domain.support.DomainVo; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.support.FusionService; -import org.openecomp.portalsdk.core.service.support.ServiceLocator; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalsdk.core.command.support.SearchResult; +import org.onap.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.service.support.FusionService; +import org.onap.portalsdk.core.service.support.ServiceLocator; +import org.onap.portalsdk.core.util.SystemProperties; +import org.owasp.esapi.ESAPI; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; @@ -138,7 +139,7 @@ public class EPLdapServiceImpl extends FusionService implements EPLdapService { NamingEnumeration e = dirContext.search( SystemProperties.getProperty(SystemProperties.POST_PROVIDER_URL) + "/" + SystemProperties.getProperty(SystemProperties.POST_SECURITY_PRINCIPAL), - filterClause.toString(), searchControls); + ESAPI.encoder().encodeForDN(filterClause.toString()), searchControls); list = processResults(e); } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLeftMenuService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPLeftMenuService.java index 145d4df2..822776fd 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLeftMenuService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPLeftMenuService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.Set; -import org.openecomp.portalsdk.core.domain.MenuData; -import org.openecomp.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalsdk.core.domain.MenuData; public interface EPLeftMenuService { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLeftMenuServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPLeftMenuServiceImpl.java index fe661b3d..98d31b16 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLeftMenuServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPLeftMenuServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.Collection; import java.util.Comparator; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.SortedSet; @@ -47,18 +48,16 @@ import java.util.TreeSet; import org.json.JSONArray; import org.json.JSONObject; +import org.onap.portalapp.portal.domain.CentralizedApp; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalsdk.core.domain.MenuData; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.openecomp.portalsdk.core.domain.MenuData; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.UserRoles; -//import org.openecomp.portalapp.portal.domain.Menu; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; - @Service("leftMenuService") @Transactional @org.springframework.context.annotation.Configuration @@ -69,9 +68,9 @@ public class EPLeftMenuServiceImpl implements EPLeftMenuService { private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EPLeftMenuServiceImpl.class); + @Autowired - private EPAppService appService; - + private ExternalAccessRolesService externalAccessRolesService; /* * (non-Javadoc) * @@ -82,26 +81,9 @@ public class EPLeftMenuServiceImpl implements EPLeftMenuService { @Override public String getLeftMenuItems(EPUser user, Set<MenuData> fullMenuSet, Set<String> roleFunctionSet) { final Map<String, JSONObject> defaultNavMap = new LinkedHashMap<String, JSONObject>(); - resetNavMap(defaultNavMap); - loadDefaultNavMap(defaultNavMap); - - // Handle Account Administrator in a special way; soon this will - // be revised as Account Administrator may become obsolete - try { - if (user != null) { - UserRoles uRoles = appService.getUserProfileNormalizedForLeftMenu(user); - if (uRoles.getRoles().contains("Account Administrator")) - loadAccAdminNavMap(defaultNavMap); - } - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "getLeftMenuItems: failed to get roles for user " + user.getOrgUserId(), e); - } - - loadNavMapByRole(defaultNavMap, fullMenuSet); - + loadNavMapByRole(defaultNavMap, fullMenuSet , user); return convertToSideBarModel(defaultNavMap); } @@ -119,7 +101,7 @@ public class EPLeftMenuServiceImpl implements EPLeftMenuService { * @param defaultNavMap * @param fullMenuSet */ - private void loadNavMapByRole(Map<String, JSONObject> defaultNavMap, Set<MenuData> fullMenuSet) { + private void loadNavMapByRole(Map<String, JSONObject> defaultNavMap, Set<MenuData> fullMenuSet , EPUser user) { class SortOrderComparator implements Comparator<MenuData> { @Override @@ -132,6 +114,13 @@ public class EPLeftMenuServiceImpl implements EPLeftMenuService { for (MenuData mn : fullMenuSet) { sortMenuSet.add(mn); } + + // Remove Roles from left menu if user doesnt have admin access on + // centralized application + List<CentralizedApp> applicationsList = null; + applicationsList = externalAccessRolesService.getCentralizedAppsOfUser(user.getOrgUserId()); + if (applicationsList.size() == 0) + sortMenuSet.removeIf(x -> x.getLabel().contains("Roles")); for (MenuData mn : sortMenuSet) { JSONObject navItemsDetails = new JSONObject(); @@ -187,27 +176,4 @@ public class EPLeftMenuServiceImpl implements EPLeftMenuService { } - /** - * Loads default entries for application administrator. - * - * @param defaultNavMap - */ - private void loadAccAdminNavMap(Map<String, JSONObject> defaultNavMap) { - - JSONObject navItemsDetails1 = new JSONObject(); - navItemsDetails1.put("name", "Users"); - navItemsDetails1.put("state", "root.users"); - navItemsDetails1.put("imageSrc", "icon-user"); - defaultNavMap.put("root.users", navItemsDetails1); - - // No more widget onboarding like this: - // - // JSONObject navItemsDetails2 = new JSONObject(); - // navItemsDetails2.put("name", "Widget Onboarding"); - // navItemsDetails2.put("state", "root.widgetOnboarding"); - // navItemsDetails2.put("imageSrc", "icon-add-widget"); - // defaultNavMap.put("root.widgetOnboarding", navItemsDetails2); - - } - } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLoginService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPLoginService.java index d3224944..4fd9baa4 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLoginService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPLoginService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.HashMap; -import org.openecomp.portalapp.command.EPLoginBean; -import org.openecomp.portalapp.portal.domain.EPUser; +import org.onap.portalapp.command.EPLoginBean; +import org.onap.portalapp.portal.domain.EPUser; public interface EPLoginService { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLoginServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPLoginServiceImpl.java index a06d89ac..eff297f5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLoginServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPLoginServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.Date; import java.util.HashMap; @@ -44,18 +44,18 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.openecomp.portalapp.command.EPLoginBean; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.logging.format.EPAppMessagesEnum; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.menu.MenuBuilder; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.service.support.FusionService; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.portalsdk.core.web.support.AppUtils; +import org.onap.portalapp.command.EPLoginBean; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.menu.MenuBuilder; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.service.support.FusionService; +import org.onap.portalsdk.core.util.SystemProperties; +import org.onap.portalsdk.core.web.support.AppUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; @@ -221,7 +221,7 @@ public class EPLoginServiceImpl extends FusionService implements EPLoginService params.put("org_user_id", bean.getOrgUserId()); List list = null; try { - list = dataAccessService.executeNamedQuery("getUserByOrgUserId", params, new HashMap()); + list = dataAccessService.executeNamedQuery("getEPUserByOrgUserId", params, new HashMap()); } catch (Exception e) { EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e); logger.error(EELFLoggerDelegate.errorLogger, "findUser(EPLoginBean) failed", e); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleFunctionService.java index 5c5b15cf..044225a3 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleFunctionService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,15 +35,17 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; import java.util.Set; import javax.servlet.http.HttpServletRequest; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalsdk.core.domain.RoleFunction; +import org.apache.commons.codec.DecoderException; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.exceptions.RoleFunctionException; +import org.onap.portalsdk.core.domain.RoleFunction; public interface EPRoleFunctionService { @@ -62,7 +64,8 @@ public interface EPRoleFunctionService { * @param user * EPUser * @return Set of role functions that was built. + * @throws RoleFunctionException */ - public Set getRoleFunctions(HttpServletRequest request, EPUser user); + public Set getRoleFunctions(HttpServletRequest request, EPUser user) throws RoleFunctionException; } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceCentralizedImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleFunctionServiceCentralizedImpl.java index 814dbaf5..c2028056 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceCentralizedImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleFunctionServiceCentralizedImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.ArrayList; import java.util.HashMap; @@ -43,16 +43,26 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.regex.Pattern; +import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; +import org.apache.commons.codec.DecoderException; +import org.apache.commons.codec.binary.Hex; import org.hibernate.SessionFactory; -import org.openecomp.portalapp.portal.domain.CentralRoleFunction; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalsdk.core.domain.RoleFunction; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.controller.RoleManageController; +import org.onap.portalapp.portal.domain.CentralV2RoleFunction; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.exceptions.RoleFunctionException; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.domain.RoleFunction; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +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; @@ -60,48 +70,63 @@ import org.springframework.transaction.annotation.Transactional; @Transactional public class EPRoleFunctionServiceCentralizedImpl implements EPRoleFunctionService{ - + private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EPRoleFunctionServiceCentralizedImpl.class); + @Autowired private DataAccessService dataAccessService; @Autowired private SessionFactory sessionFactory; - @SuppressWarnings({ "unchecked"}) + @Autowired + private ExternalAccessRolesService externalAccessRolesService; + + @SuppressWarnings("unchecked") @Override public List<RoleFunction> getRoleFunctions() { - List<CentralRoleFunction> getRoleFuncList = null; + List<CentralV2RoleFunction> getRoleFuncList = null; List<RoleFunction> getRoleFuncListOfPortal = new ArrayList<>(); final Map<String, Long> params = new HashMap<>(); params.put("appId", (long) 1); //Sync all functions from external system into Ecomp portal DB getRoleFuncList = dataAccessService.executeNamedQuery("getAllRoleFunctions", params, null); - for(CentralRoleFunction roleFunction : getRoleFuncList) + for(CentralV2RoleFunction roleFunction : getRoleFuncList) { RoleFunction roleFun = new RoleFunction(); - roleFun.setCode(roleFunction.getCode()); + String code = EcompPortalUtils.getFunctionCode(roleFunction.getCode()); + roleFun.setCode(code); roleFun.setName(roleFunction.getName()); getRoleFuncListOfPortal.add(roleFun); } return getRoleFuncListOfPortal; } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public Set getRoleFunctions(HttpServletRequest request, EPUser user) { + public Set getRoleFunctions(HttpServletRequest request, EPUser user) throws RoleFunctionException { HttpSession session = request.getSession(); String userId = user.getId().toString(); final Map<String, String> params = new HashMap<>(); params.put("userId", userId); - @SuppressWarnings("unchecked") - List getRoleFuncListOfPortal = dataAccessService.executeNamedQuery("getRoleFunctionsOfUser", params, null); - Set<String> getRoleFuncListOfPortalSet = new HashSet<>(getRoleFuncListOfPortal); + List getRoleFuncListOfPortal = dataAccessService.executeNamedQuery("getRoleFunctionsOfUser", params, null); + Set<String> getRoleFuncListOfPortalSet = new HashSet<>(getRoleFuncListOfPortal); + Set<String> roleFunSet = new HashSet<>(); + roleFunSet = getRoleFuncListOfPortalSet.stream().filter(x -> x.contains("|")).collect(Collectors.toSet()); + if (roleFunSet.size() > 0) + for (String roleFunction : roleFunSet) { + String roleFun = EcompPortalUtils.getFunctionCode(roleFunction); + getRoleFuncListOfPortalSet.remove(roleFunction); + getRoleFuncListOfPortalSet.add(roleFun); + } + + Set<String> finalRoleFunctionSet = new HashSet<>(); + for (String roleFn : getRoleFuncListOfPortalSet) { + finalRoleFunctionSet.add(EPUserUtils.decodeFunctionCode(roleFn)); + } session.setAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME), - getRoleFuncListOfPortalSet); - return getRoleFuncListOfPortalSet; - + finalRoleFunctionSet); + logger.debug(EELFLoggerDelegate.debugLogger, + "getRoleFunctions: RoleFunctions Of User" + finalRoleFunctionSet); + return finalRoleFunctionSet; } - - - } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleFunctionServiceImpl.java index 2049700c..130d9caa 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleFunctionServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.HashMap; import java.util.HashSet; @@ -46,12 +46,12 @@ import java.util.Set; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.domain.RoleFunction; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.util.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; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleService.java index 85b523db..d29e6494 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; -import org.openecomp.portalsdk.core.domain.RoleFunction; -import org.openecomp.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalsdk.core.domain.RoleFunction; public interface EPRoleService { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleServiceImpl.java index e4c67140..3e73d8d2 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.HashMap; import java.util.Iterator; @@ -48,13 +48,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; - -import org.openecomp.portalsdk.core.domain.RoleFunction; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.utils.PortalConstants; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalsdk.core.domain.RoleFunction; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.service.DataAccessService; @Service("epRoleService") @Transactional diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesService.java index 643e2285..d65f1152 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,19 +35,33 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; +import java.io.IOException; import java.util.List; +import java.util.Map; import org.hibernate.Session; -import org.openecomp.portalapp.portal.domain.CentralRoleFunction; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.transport.CentralRole; -import org.openecomp.portalsdk.core.domain.Role; -import org.openecomp.portalsdk.core.domain.RoleFunction; -import org.openecomp.portalsdk.core.restful.domain.EcompUser; +import org.json.JSONArray; +import org.onap.portalapp.portal.domain.CentralV2RoleFunction; +import org.onap.portalapp.portal.domain.CentralizedApp; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.ExternalRoleDetails; +import org.onap.portalapp.portal.transport.CentralRole; +import org.onap.portalapp.portal.transport.CentralUser; +import org.onap.portalapp.portal.transport.CentralV2Role; +import org.onap.portalapp.portal.transport.ExternalRequestFieldsValidator; +import org.onap.portalsdk.core.domain.Role; +import org.onap.portalsdk.core.domain.RoleFunction; +import org.onap.portalsdk.core.restful.domain.EcompUser; +import org.springframework.http.ResponseEntity; +import org.springframework.web.client.HttpClientErrorException; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; public interface ExternalAccessRolesService { @@ -96,7 +110,7 @@ public interface ExternalAccessRolesService { * @return String * @throws Exception */ - String getUserWithRoles(String loginId, String uebkey) throws Exception; + String getV2UserWithRoles(String loginId, String uebkey) throws Exception; /** * It returns list of all role functions @@ -104,7 +118,7 @@ public interface ExternalAccessRolesService { * @return List * @throws Exception */ - List<CentralRoleFunction> getRoleFuncList(String string) throws Exception; + List<CentralV2RoleFunction> getRoleFuncList(String string) throws Exception; /** * It return list of role provided by the app uebkey and roleId @@ -114,7 +128,7 @@ public interface ExternalAccessRolesService { * @return CentralRole * @throws Exception */ - CentralRole getRoleInfo(Long roleId, String uebkey) throws Exception; + CentralV2Role getRoleInfo(Long roleId, String uebkey) throws Exception; /** * It returns the CentralRoleFunction object @@ -124,7 +138,7 @@ public interface ExternalAccessRolesService { * @return CentralRoleFunction * @throws Exception */ - public CentralRoleFunction getRoleFunction(String functionCode, String uebkey) throws Exception; + public CentralV2RoleFunction getRoleFunction(String functionCode, String uebkey) throws Exception; /** * It saves role function in the DB @@ -134,7 +148,7 @@ public interface ExternalAccessRolesService { * @return true else false * @throws Exception */ - public boolean saveCentralRoleFunction(CentralRoleFunction domainCentralRoleFunction, EPApp requestedApp) throws Exception; + public boolean saveCentralRoleFunction(CentralV2RoleFunction domainCentralRoleFunction, EPApp requestedApp) throws Exception; /** * It deletes role function in the DB @@ -151,16 +165,18 @@ public interface ExternalAccessRolesService { * @return List * @throws Exception */ - public List<CentralRole> getRolesForApp(String uebkey) throws Exception; + public List<CentralV2Role> getRolesForApp(String uebkey) throws Exception; /** + * * It saves role function in the DB * * @param saveRole * @param uebkey - * @throws Exception + * @return message and true or false + * @throws Exception */ - boolean saveRoleForApplication(Role saveRole, String uebkey) throws Exception; + ExternalRequestFieldsValidator saveRoleForApplication(Role saveRole, String uebkey) throws Exception; /** * It deletes role in the DB @@ -171,7 +187,7 @@ public interface ExternalAccessRolesService { * @throws Exception */ boolean deleteRoleForApplication(String code, String uebkey) throws Exception; - + /** * It gets all active roles for single application * @@ -179,7 +195,7 @@ public interface ExternalAccessRolesService { * @return List * @throws Exception */ - List<CentralRole> getActiveRoles(String uebkey) throws Exception; + List<CentralV2Role> getActiveRoles(String uebkey) throws Exception; /** * It deletes user related roles for an application in the table @@ -189,7 +205,7 @@ public interface ExternalAccessRolesService { * @return true else false * @throws Exception */ - public boolean deleteDependencyRoleRecord(Long roleId, String uebkey, String LoginId) throws Exception; + public ExternalRequestFieldsValidator deleteDependencyRoleRecord(Long roleId, String uebkey, String LoginId) throws Exception; /** * It sync new functions codes and names from and updates role functions from external access system @@ -272,9 +288,10 @@ public interface ExternalAccessRolesService { * @param localSession * @param roleId * @param appId + * @param isPortalRequest * @throws Exception */ - public void deleteRoleDependencyRecords(Session localSession, Long roleId, Long appId) throws Exception; + public void deleteRoleDependencyRecords(Session localSession, Long roleId, Long appId, boolean isPortalRequest) throws Exception; /** * It returns list of applications functions along with functions associated with global role @@ -293,5 +310,127 @@ public interface ExternalAccessRolesService { * Method getAllUsers returns all the active users of application */ List<EcompUser> getAllAppUsers(String uebkey) throws Exception; + + /** + * + * @param result + * @return returns Role Object + * Method ConvertCentralRoleToRole converts the CentralRole String to Role Object + */ + public Role ConvertCentralRoleToRole(String result); + + /** + * It returns the list of centralized applications + * + * @param userId + * @return List + */ + public List<CentralizedApp> getCentralizedAppsOfUser(String userId); + + /** + * It returns the list of globalRoles of Portal + * @return + */ + public List<EPRole> getGlobalRolesOfPortal(); + + /** + * It converts list of CentralRoleFunction objects to RoleFunction objects + * @param answer contains list of CentralRoleFunction objects + * @return List of RoleFunction objects + */ + public List<RoleFunction> convertCentralRoleFunctionToRoleFunctionObject(List<CentralV2RoleFunction> answer); + + /** + * + * It returns user roles for older version + * + * @param loginId + * @param uebkey + * @return EPUser + * @throws Exception + */ + public CentralUser getUserRoles(String loginId, String uebkey) throws Exception; + + /** + * It converts list of V2 CentralRole objects to old version CentralRole objects + * + * @param v2CenRole + * @return List of CentralRole objects + */ + public List<CentralRole> convertV2CentralRoleListToOldVerisonCentralRoleList(List<CentralV2Role> v2CenRole); + + /** + * + * It finds namespace in external auth system if found returns namespace information + * + * @param epApp + * @return Http response + */ + public ResponseEntity<String> getNameSpaceIfExists(EPApp epApp) throws Exception, HttpClientErrorException; + + /** + * + * It converts V2 CentralRole objects to old version CentralRole objects + * + * @param answer + * @return + */ + public CentralRole convertV2CentralRoleToOldVerisonCentralRole(CentralV2Role answer); + + /** + * + * Returns list of EPRole Objects if exists + * + * @param app + * @return List of EPRole objects + */ + Map<String, EPRole> getCurrentRolesInDB(EPApp app); + + + /** + * + * It uploads list of users for single role when role name is re-named + * + * @param header + * @param roleId + * @param roleName + * @return number of user roles added in External Auth System + * @throws Exception + */ + public Integer bulkUploadUsersSingleRole(String uebkey, Long roleId, String roleName) throws Exception; + + /** + * + * It returns JSON array of external auth roles and its corresponding functions + * + * @param app + * @return JSON Array + * @throws Exception + */ + public JSONArray getAppRolesJSONFromExtAuthSystem(EPApp app) throws Exception; + + /** + * It encodes the function code based on Hex encoding + * @param funCode + * + */ + public String encodeFunctionCode(String funCode); + + /** + * + * It returns list of ExternalRoleDetails which is converted from JSON array of roles + * + * @param app + * @param mapper + * @param extRole contains external auth application roles JSON array + * @return List of ExternalRoleDetails objects + * @throws IOException + * @throws JsonParseException + * @throws JsonMappingException + */ + public List<ExternalRoleDetails> getExternalRoleDetailsList(EPApp app, + ObjectMapper mapper, JSONArray extRole) throws IOException, JsonParseException, JsonMappingException; + + public JSONArray getAllUsersByRole(String roleName) throws Exception; } diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java new file mode 100644 index 00000000..e867c3d6 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java @@ -0,0 +1,3497 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.service; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import org.apache.commons.codec.DecoderException; +import org.apache.commons.codec.binary.Hex; +import org.apache.commons.lang.StringUtils; +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.Transaction; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Restrictions; +import org.json.JSONArray; +import org.json.JSONObject; +import org.onap.portalapp.portal.domain.CentralV2RoleFunction; +import org.onap.portalapp.portal.domain.CentralizedApp; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPAppRoleFunction; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPUserApp; +import org.onap.portalapp.portal.domain.ExternalRoleDetails; +import org.onap.portalapp.portal.exceptions.DeleteDomainObjectFailedException; +import org.onap.portalapp.portal.exceptions.ExternalAuthSystemException; +import org.onap.portalapp.portal.exceptions.InactiveApplicationException; +import org.onap.portalapp.portal.exceptions.InvalidApplicationException; +import org.onap.portalapp.portal.exceptions.InvalidUserException; +import org.onap.portalapp.portal.exceptions.RoleFunctionException; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.transport.BulkUploadRoleFunction; +import org.onap.portalapp.portal.transport.BulkUploadUserRoles; +import org.onap.portalapp.portal.transport.CentralApp; +import org.onap.portalapp.portal.transport.CentralRole; +import org.onap.portalapp.portal.transport.CentralRoleFunction; +import org.onap.portalapp.portal.transport.CentralUser; +import org.onap.portalapp.portal.transport.CentralUserApp; +import org.onap.portalapp.portal.transport.CentralV2Role; +import org.onap.portalapp.portal.transport.CentralV2User; +import org.onap.portalapp.portal.transport.CentralV2UserApp; +import org.onap.portalapp.portal.transport.EcompUserRoles; +import org.onap.portalapp.portal.transport.ExternalAccessPerms; +import org.onap.portalapp.portal.transport.ExternalAccessPermsDetail; +import org.onap.portalapp.portal.transport.ExternalAccessRole; +import org.onap.portalapp.portal.transport.ExternalAccessRolePerms; +import org.onap.portalapp.portal.transport.ExternalAccessUser; +import org.onap.portalapp.portal.transport.ExternalRequestFieldsValidator; +import org.onap.portalapp.portal.transport.ExternalRoleDescription; +import org.onap.portalapp.portal.transport.GlobalRoleWithApplicationRoleFunction; +import org.onap.portalapp.portal.transport.LocalRole; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.domain.Role; +import org.onap.portalsdk.core.domain.RoleFunction; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.restful.domain.EcompRole; +import org.onap.portalsdk.core.restful.domain.EcompUser; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.SystemProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.RestTemplate; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.type.TypeFactory; + +@Service("externalAccessRolesService") +@EnableAspectJAutoProxy +@EPMetricsLog +@EPAuditLog +public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesService { + + private static final String APP_ROLE_NAME_PARAM = "appRoleName"; + + private static final String GET_ROLE_TO_UPDATE_IN_EXTERNAL_AUTH_SYSTEM = "getRoletoUpdateInExternalAuthSystem"; + + private static final String GET_PORTAL_APP_ROLES_QUERY = "getPortalAppRoles"; + + private static final String GET_ROLE_FUNCTION_QUERY = "getRoleFunction"; + + private static final String FUNCTION_CODE_PARAMS = "functionCode"; + + private static final String AND_FUNCTION_CD_EQUALS = " and function_cd = '"; + + private static final String OWNER = ".owner"; + + private static final String ADMIN = ".admin"; + + private static final String ACCOUNT_ADMINISTRATOR = ".Account_Administrator"; + + private static final String FUNCTION_PIPE = "|"; + + private static final String IS_NULL_STRING = "null"; + + private static final String EXTERNAL_AUTH_PERMS = "perms"; + + private static final String EXTERNAL_AUTH_ROLE_DESCRIPTION = "description"; + + private static final String IS_EMPTY_JSON_STRING = "{}"; + + private static final String CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE = "Connecting to External Auth system"; + + private static final String APP_ROLE_ID = "appRoleId"; + + private static final String APP_ID = "appId"; + + private static final String PRIORITY = "priority"; + + private static final String ACTIVE = "active"; + + private static final String ROLE_NAME = "name"; + + private static final String ID = "id"; + + private static final String APP_ID_EQUALS = " app_id = "; + + private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ExternalAccessRolesServiceImpl.class); + + @Autowired + private DataAccessService dataAccessService; + + @Autowired + private EPAppService epAppService; + + @Autowired + private SessionFactory sessionFactory; + + @Autowired + EPRoleService ePRoleService; + + RestTemplate template = new RestTemplate(); + + + // These decode values are based on HexDecoder + static final String decodeValueOfForwardSlash = "2f"; + static final String decodeValueOfHiphen = "2d"; + static final String decodeValueOfStar = "2a"; + + @SuppressWarnings("unchecked") + public List<EPRole> getAppRoles(Long appId) throws Exception { + List<EPRole> applicationRoles = null; + final Map<String, Long> appParams = new HashMap<>(); + try { + if (appId == 1) { + applicationRoles = dataAccessService.executeNamedQuery("getPortalAppRolesList", null, null); + } else { + appParams.put("appId", appId); + applicationRoles = dataAccessService.executeNamedQuery("getPartnerAppRolesList", appParams, null); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getAppRoles: failed", e); + throw e; + } + return applicationRoles; + } + + @SuppressWarnings("unchecked") + @Override + public List<EPApp> getApp(String uebkey) throws Exception { + List<EPApp> app = null; + try { + final Map<String, String> appUebkeyParams = new HashMap<>(); + appUebkeyParams.put("appKey", uebkey); + app = dataAccessService.executeNamedQuery("getMyAppDetailsByUebKey", appUebkeyParams, null); + if(!app.isEmpty() && !app.get(0).getEnabled() && !app.get(0).getId().equals(PortalConstants.PORTAL_APP_ID)){ + throw new InactiveApplicationException("Application:"+app.get(0).getName()+" is Unavailable"); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getApp: failed", e); + throw e; + } + return app; + } + + /** + * It returns single application role from external auth system + * @param addRole + * @param app + * @return JSON string which contains application role details + * @throws Exception + */ + private String getSingleAppRole(String addRole, EPApp app) throws Exception { + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + HttpEntity<String> entity = new HttpEntity<>(headers); + ResponseEntity<String> response = null; + logger.debug(EELFLoggerDelegate.debugLogger, "getSingleAppRole: Connecting to External Auth system"); + response = template.exchange( + SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "roles/" + + app.getNameSpace() + + "." + addRole + .replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"), + HttpMethod.GET, entity, String.class); + logger.debug(EELFLoggerDelegate.debugLogger, + "getSingleAppRole: Finished GET app role from External Auth system and status code: {} ", + response.getStatusCode().value()); + return response.getBody(); + } + + @Override + public boolean addRole(Role addRole, String uebkey) throws Exception { + boolean response = false; + ResponseEntity<String> addResponse = null; + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + EPApp app = getApp(uebkey).get(0); + String newRole = updateExistingRoleInExternalSystem(addRole, app); + HttpEntity<String> entity = new HttpEntity<>(newRole, headers); + logger.debug(EELFLoggerDelegate.debugLogger, "addRole: Connecting to External Auth system"); + addResponse = template.exchange( + SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role", + HttpMethod.POST, entity, String.class); + if (addResponse.getStatusCode().value() == 201) { + response = true; + logger.debug(EELFLoggerDelegate.debugLogger, "addRole: Finished adding role in the External Auth system and response code: {} ", addResponse.getStatusCode().value()); + } + if (addResponse.getStatusCode().value() == 406) { + logger.error(EELFLoggerDelegate.errorLogger, + "addRole: Failed to add in the External Auth system due to {} and status code: {}", addResponse.getBody(), addResponse.getStatusCode().value()); + } + return response; + } + + /** + * + * It deletes record in external auth system + * + * @param delRole + * @return JSON String which has status code and response body + * @throws Exception + */ + private ResponseEntity<String> deleteRoleInExternalSystem(String delRole) throws Exception { + ResponseEntity<String> delResponse = null; + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + HttpEntity<String> entity = new HttpEntity<>(delRole, headers); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteRoleInExternalSystem: {} for DELETE: {}" , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE, delRole); + delResponse = template.exchange( + SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role?force=true", + HttpMethod.DELETE, entity, String.class); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteRoleInExternalSystem: Finished DELETE operation in the External Auth system {} and status code: {} ", delRole, delResponse.getStatusCode().value()); + return delResponse; + } + + /** + * It updates role in external auth system + * + * @param updateExtRole + * @param app + * @return true if success else false + * @throws Exception + * If updateRoleInExternalSystem fails we catch it in logger for detail message + */ + @SuppressWarnings("unchecked") + private boolean updateRoleInExternalSystem(Role updateExtRole, EPApp app, boolean isGlobalRole) throws Exception { + boolean response = false; + ObjectMapper mapper = new ObjectMapper(); + ResponseEntity<String> deleteResponse = null; + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + List<EPRole> epRoleList = null; + if (app.getId().equals(PortalConstants.PORTAL_APP_ID) + || (isGlobalRole && !app.getId().equals(PortalConstants.PORTAL_APP_ID))) { + epRoleList = getPortalAppRoleInfo(updateExtRole.getId()); + } else { + epRoleList = getPartnerAppRoleInfo(updateExtRole.getId(), app); + } + + // Assigning functions to global role + if ((isGlobalRole && !app.getId().equals(PortalConstants.PORTAL_APP_ID))) { + List<RoleFunction> globalRoleFunctionListNew = convertSetToListOfRoleFunctions(updateExtRole); + EPApp portalAppInfo = epAppService.getApp(PortalConstants.PORTAL_APP_ID); + addFunctionsTOGlobalRole(epRoleList, updateExtRole, globalRoleFunctionListNew, mapper, app, portalAppInfo); + response = true; + } else { + String appRole = getSingleAppRole(epRoleList.get(0).getName(), app); + List<RoleFunction> roleFunctionListNew = convertSetToListOfRoleFunctions(updateExtRole); + if (!appRole.equals(IS_EMPTY_JSON_STRING)) { + JSONObject jsonObj = new JSONObject(appRole); + JSONArray extRole = jsonObj.getJSONArray("role"); + if (!extRole.getJSONObject(0).has(EXTERNAL_AUTH_ROLE_DESCRIPTION)) { + String roleName = extRole.getJSONObject(0).getString(ROLE_NAME); + Map<String, String> delRoleKeyMapper = new HashMap<>(); + delRoleKeyMapper.put(ROLE_NAME, roleName); + String delRoleKeyValue = mapper.writeValueAsString(delRoleKeyMapper); + deleteResponse = deleteRoleInExternalSystem(delRoleKeyValue); + if (deleteResponse.getStatusCode().value() != 200) { + throw new ExternalAuthSystemException(deleteResponse.getBody()); + } + addRole(updateExtRole, app.getUebKey()); + } else { + String desc = extRole.getJSONObject(0).getString(EXTERNAL_AUTH_ROLE_DESCRIPTION); + String name = extRole.getJSONObject(0).getString(ROLE_NAME); + List<ExternalAccessPerms> list = new ArrayList<>(); + if (extRole.getJSONObject(0).has(EXTERNAL_AUTH_PERMS)) { + JSONArray perms = extRole.getJSONObject(0).getJSONArray(EXTERNAL_AUTH_PERMS); + list = mapper.readValue(perms.toString(), TypeFactory.defaultInstance() + .constructCollectionType(List.class, ExternalAccessPerms.class)); + } + ExternalRoleDescription sysRoleList = mapper.readValue(desc, ExternalRoleDescription.class); + // If role name or role functions are updated then delete + // record in External System and add new record to avoid + // conflicts + Boolean existingRoleActive; + boolean isActiveValueChanged; + // check role active status + existingRoleActive = new Boolean(sysRoleList.getActive()); + isActiveValueChanged = existingRoleActive.equals(updateExtRole.getActive()); + boolean isRoleNameChanged = false; + if (!sysRoleList.getName().equals(updateExtRole.getName())) { + isRoleNameChanged = true; + Map<String, String> delRoleKeyMapper = new HashMap<>(); + delRoleKeyMapper.put(ROLE_NAME, name); + String delRoleKeyValue = mapper.writeValueAsString(delRoleKeyMapper); + deleteResponse = deleteRoleInExternalSystem(delRoleKeyValue); + if (deleteResponse.getStatusCode().value() != 200) { + logger.error(EELFLoggerDelegate.errorLogger, + "updateRoleInExternalSystem: Failed to delete role in external system due to {} ", + deleteResponse.getBody()); + throw new ExternalAuthSystemException(deleteResponse.getBody()); + } + addRole(updateExtRole, app.getUebKey()); + // add partner functions to the global role in External Auth System + if(!list.isEmpty() && isGlobalRole){ + addPartnerHasRoleFunctionsToGlobalRole(list, mapper, app, updateExtRole); + } + list.removeIf(perm -> EcompPortalUtils.checkNameSpaceMatching(perm.getType(), app.getNameSpace())); + // if role name is changes please ignore the previous functions in External Auth and update with user requested functions + addRemoveFunctionsToRole(updateExtRole, app, mapper, roleFunctionListNew, name, + list); + } + boolean checkPriorityStatus = StringUtils.equals(String.valueOf(sysRoleList.getPriority()), + String.valueOf(updateExtRole.getPriority())); + ExternalAccessRole updateRole = new ExternalAccessRole(); + if (!isActiveValueChanged || !checkPriorityStatus || sysRoleList.getId().equals(IS_NULL_STRING) + || !sysRoleList.getId().equals(String.valueOf(epRoleList.get(0).getId()))) { + String updateDesc = ""; + List<EPRole> getRole; + final Map<String, String> getAppRoleByName = new HashMap<>(); + getAppRoleByName.put(APP_ROLE_NAME_PARAM, updateExtRole.getName()); + if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) { + getRole = dataAccessService.executeNamedQuery(GET_PORTAL_APP_ROLES_QUERY, getAppRoleByName, + null); + } else { + getAppRoleByName.put("appId", String.valueOf(app.getId())); + getRole = dataAccessService.executeNamedQuery(GET_ROLE_TO_UPDATE_IN_EXTERNAL_AUTH_SYSTEM, + getAppRoleByName, null); + } + Map<String, String> extSystemUpdateRoleJsonMapper = new LinkedHashMap<>(); + extSystemUpdateRoleJsonMapper.put(ID, String.valueOf(getRole.get(0).getId())); + extSystemUpdateRoleJsonMapper.put(ROLE_NAME, String.valueOf(updateExtRole.getName())); + extSystemUpdateRoleJsonMapper.put(ACTIVE, String.valueOf(updateExtRole.getActive())); + extSystemUpdateRoleJsonMapper.put(PRIORITY, String.valueOf(updateExtRole.getPriority())); + if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) { + extSystemUpdateRoleJsonMapper.put(APP_ID, "null"); + extSystemUpdateRoleJsonMapper.put(APP_ROLE_ID, "null"); + } else { + extSystemUpdateRoleJsonMapper.put(APP_ID, String.valueOf(app.getId())); + extSystemUpdateRoleJsonMapper.put(APP_ROLE_ID, + String.valueOf(getRole.get(0).getAppRoleId())); + + } + updateDesc = mapper.writeValueAsString(extSystemUpdateRoleJsonMapper); + updateRole.setName(app.getNameSpace() + "." + updateExtRole.getName().replaceAll( + EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_")); + updateRole.setDescription(updateDesc); + String updateRoleDesc = mapper.writeValueAsString(updateRole); + HttpEntity<String> entity = new HttpEntity<>(updateRoleDesc, headers); + logger.debug(EELFLoggerDelegate.debugLogger, "updateRoleInExternalSystem: {} for PUT: {}", + CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE, updateRoleDesc); + ResponseEntity<String> updatePermsResponse = template.exchange( + SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + + "role", + HttpMethod.PUT, entity, String.class); + logger.debug(EELFLoggerDelegate.debugLogger, + "updateRoleInExternalSystem: Finished updating in External Auth system {} and status code: {} ", + updateRoleDesc, updatePermsResponse.getStatusCode().value()); + } + if(!isRoleNameChanged) { + response = addRemoveFunctionsToRole(updateExtRole, app, mapper, roleFunctionListNew, name, + list); + } + } + } else { + // It seems like role exists in local DB but not in External + // Access system + addRole(updateExtRole, app.getUebKey()); + List<RoleFunction> roleFunctionListUpdate = convertSetToListOfRoleFunctions(updateExtRole); + response = true; + if (!roleFunctionListUpdate.isEmpty()) { + addRoleFunctionsInExternalSystem(updateExtRole, mapper, app); + } + } + } + return response; + } + + private boolean addRemoveFunctionsToRole(Role updateExtRole, EPApp app, ObjectMapper mapper, + List<RoleFunction> roleFunctionListNew, String name, List<ExternalAccessPerms> list) throws Exception { + boolean response; + Map<String, RoleFunction> updateRoleFunc = new HashMap<>(); + for (RoleFunction addPerm : roleFunctionListNew) { + updateRoleFunc.put(addPerm.getCode(), addPerm); + } + final Map<String, ExternalAccessPerms> extRolePermMap = new HashMap<>(); + final Map<String, ExternalAccessPerms> extRolePermMapPipes = new HashMap<>(); + list.removeIf(perm -> !EcompPortalUtils.checkNameSpaceMatching(perm.getType(), app.getNameSpace())); + // Update permissions in the ExternalAccess System + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + if (!list.isEmpty()) { + for (ExternalAccessPerms perm : list) { + RoleFunction roleFunc = updateRoleFunc.get(perm.getType().substring(app.getNameSpace().length()+1) + FUNCTION_PIPE + perm.getInstance() + FUNCTION_PIPE + perm.getAction()); + if (roleFunc==null) { + RoleFunction roleFuncPipeFilter = updateRoleFunc.get(perm.getInstance()); + if(roleFuncPipeFilter == null) + removePermForRole(perm, mapper, name, headers); + } + extRolePermMap.put(perm.getInstance(), perm); + extRolePermMapPipes.put( + perm.getType().substring(app.getNameSpace().length()+1) + FUNCTION_PIPE + perm.getInstance() + FUNCTION_PIPE + perm.getAction(), perm); + } + } + response = true; + if (!roleFunctionListNew.isEmpty()) { + for (RoleFunction roleFunc : roleFunctionListNew) { + if(roleFunc.getCode().contains(FUNCTION_PIPE)) { + ExternalAccessPerms perm = extRolePermMapPipes.get(roleFunc.getCode()); + if (perm == null) { + response = addFunctionsToRoleInExternalAuthSystem(updateExtRole, app, mapper, headers, + roleFunc); + } + } else { + if (!extRolePermMap.containsKey(EcompPortalUtils.getFunctionCode(roleFunc.getCode()))) { + response = addFunctionsToRoleInExternalAuthSystem(updateExtRole, app, mapper, headers, + roleFunc); + } + } + } + } + return response; + } + + /* + * Adds function to the role in the external auth system while editing a role or updating new functions to a role + * + */ + private boolean addFunctionsToRoleInExternalAuthSystem(Role updateExtRole, EPApp app, ObjectMapper mapper, + HttpHeaders headers, RoleFunction roleFunc) throws JsonProcessingException { + boolean response; + ExternalAccessRolePerms extRolePerms; + ExternalAccessPerms extPerms; + String code = ""; + String type = ""; + String action = ""; + if (roleFunc.getCode().contains(FUNCTION_PIPE)) { + code = EcompPortalUtils.getFunctionCode(roleFunc.getCode()); + type = getFunctionType(roleFunc.getCode()); + action = getFunctionAction(roleFunc.getCode()); + } else { + code = roleFunc.getCode(); + type = roleFunc.getCode().contains("menu") ? "menu" : "url"; + action = "*"; + } + extPerms = new ExternalAccessPerms(app.getNameSpace() + "." + type, code, action); + extRolePerms = new ExternalAccessRolePerms(extPerms, + app.getNameSpace() + "." + + updateExtRole.getName().replaceAll( + EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, + "_")); + String updateRolePerms = mapper.writeValueAsString(extRolePerms); + HttpEntity<String> entity = new HttpEntity<>(updateRolePerms, headers); + logger.debug(EELFLoggerDelegate.debugLogger, "updateRoleInExternalSystem: {} for POST: {}", + CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE, updateRolePerms); + ResponseEntity<String> addResponse = template.exchange( + SystemProperties.getProperty( + EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role/perm", + HttpMethod.POST, entity, String.class); + if (addResponse.getStatusCode().value() != 201 && addResponse.getStatusCode().value()!= 409) { + response = false; + logger.debug(EELFLoggerDelegate.debugLogger, + "updateRoleInExternalSystem: Connected to External Auth system but something went wrong! due to {} and statuscode: {}", + addResponse.getStatusCode().getReasonPhrase(), + addResponse.getStatusCode().value()); + } else { + response = true; + logger.debug(EELFLoggerDelegate.debugLogger, + "updateRoleInExternalSystem: Finished adding permissions to roles in External Auth system {} and status code: {} ", + updateRolePerms, addResponse.getStatusCode().value()); + } + return response; + } + + private void addPartnerHasRoleFunctionsToGlobalRole(List<ExternalAccessPerms> permslist, ObjectMapper mapper, + EPApp app, Role updateExtRole) throws Exception { + for (ExternalAccessPerms perm : permslist) { + if (!EcompPortalUtils.checkNameSpaceMatching(perm.getType(), app.getNameSpace())) { + ExternalAccessRolePerms extAddGlobalRolePerms = null; + ExternalAccessPerms extAddPerms = null; + extAddPerms = new ExternalAccessPerms(perm.getType(), perm.getInstance(), perm.getAction()); + extAddGlobalRolePerms = new ExternalAccessRolePerms(extAddPerms, + app.getNameSpace() + "." + updateExtRole.getName().replaceAll( + EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_")); + String addPerms = mapper.writeValueAsString(extAddGlobalRolePerms); + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + HttpEntity<String> entity = new HttpEntity<>(addPerms, headers); + logger.debug(EELFLoggerDelegate.debugLogger, "addPartnerHasRoleFunctionsToGlobalRole: {} ", + CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); + try { + ResponseEntity<String> addResponse = template + .exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + + "role/perm", HttpMethod.POST, entity, String.class); + if (addResponse.getStatusCode().value() != 201) { + logger.debug(EELFLoggerDelegate.debugLogger, + "addPartnerHasRoleFunctionsToGlobalRole: While adding permission to the role in External Auth system something went wrong! due to {} and statuscode: {}", + addResponse.getStatusCode().getReasonPhrase(), addResponse.getStatusCode().value()); + } else { + logger.debug(EELFLoggerDelegate.debugLogger, + "addPartnerHasRoleFunctionsToGlobalRole: Finished adding permissions to roles in External Auth system and status code: {} ", + addResponse.getStatusCode().value()); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "addPartnerHasRoleFunctionsToGlobalRole: Failed for POST request: {} due to ", + addPerms, e); + } + } + } + } + + @SuppressWarnings("unchecked") + private void addFunctionsTOGlobalRole(List<EPRole> epRoleList, Role updateExtRole, List<RoleFunction> roleFunctionListNew, ObjectMapper mapper, EPApp app, EPApp portalAppInfo) + throws Exception { + try { + logger.debug(EELFLoggerDelegate.debugLogger, "Entering into addFunctionsTOGlobalRole"); + //GET Permissions from External Auth System + JSONArray extPerms = getExtAuthPermissions(app); + List<ExternalAccessPermsDetail> permsDetailList = getExtAuthPerrmissonList(app, extPerms); + final Map<String, ExternalAccessPermsDetail> existingPermsWithRoles = new HashMap<>(); + final Map<String, ExternalAccessPermsDetail> existingPermsWithRolesWithPipes = new HashMap<>(); + final Map<String, RoleFunction> userRquestedFunctionsMap = new HashMap<>(); + final Map<String, RoleFunction> userRquestedFunctionsMapPipesFilter = new HashMap<>(); + for (ExternalAccessPermsDetail permDetail : permsDetailList) { + existingPermsWithRoles.put(EcompPortalUtils.getFunctionCode(permDetail.getInstance()), permDetail); + existingPermsWithRolesWithPipes.put(permDetail.getInstance(), permDetail); + + } + // Add If function does not exists for role in External Auth System + for (RoleFunction roleFunc : roleFunctionListNew) { + String roleFuncCode = ""; + ExternalAccessPermsDetail permsDetail; + if(roleFunc.getCode().contains(FUNCTION_PIPE)) { + roleFuncCode = roleFunc.getCode(); + permsDetail = existingPermsWithRolesWithPipes.get(roleFunc.getCode()); + } else { + roleFuncCode = EcompPortalUtils.getFunctionCode(roleFunc.getCode()); + permsDetail = existingPermsWithRoles.get(roleFuncCode); + } + if (null == permsDetail.getRoles() || !permsDetail.getRoles() + .contains(portalAppInfo.getNameSpace() + FUNCTION_PIPE + epRoleList.get(0).getName().replaceAll( + EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"))) { + addRoleFunctionsToGlobalRoleInExternalSystem(roleFunc, updateExtRole, mapper, app, portalAppInfo); + } + userRquestedFunctionsMap.put(roleFuncCode, roleFunc); + userRquestedFunctionsMapPipesFilter.put(EcompPortalUtils.getFunctionCode(roleFuncCode), roleFunc); + } + // Delete functions if exists in External Auth System but not in incoming request + final Map<String, Long> epAppRoleFuncParams = new HashMap<>(); + epAppRoleFuncParams.put("requestedAppId", app.getId()); + epAppRoleFuncParams.put("roleId",updateExtRole.getId()); + List<GlobalRoleWithApplicationRoleFunction> globalRoleFunctionList = dataAccessService.executeNamedQuery("getGlobalRoleForRequestedApp", epAppRoleFuncParams, null); + for(GlobalRoleWithApplicationRoleFunction globalRoleFunc: globalRoleFunctionList){ + String globalRoleFuncWithoutPipes = ""; + RoleFunction roleFunc = null; + if(globalRoleFunc.getFunctionCd().contains(FUNCTION_PIPE)) { + globalRoleFuncWithoutPipes = globalRoleFunc.getFunctionCd(); + roleFunc = userRquestedFunctionsMap.get(globalRoleFuncWithoutPipes); + }else { + globalRoleFuncWithoutPipes = EcompPortalUtils.getFunctionCode(globalRoleFunc.getFunctionCd()); + roleFunc = userRquestedFunctionsMapPipesFilter.get(globalRoleFuncWithoutPipes); + } + if(roleFunc == null){ + ExternalAccessPermsDetail permDetailFromMap = globalRoleFunc.getFunctionCd().contains(FUNCTION_PIPE) ? existingPermsWithRolesWithPipes.get(globalRoleFuncWithoutPipes) : existingPermsWithRoles.get(globalRoleFuncWithoutPipes); + ExternalAccessPerms perm = new ExternalAccessPerms(permDetailFromMap.getType(), EcompPortalUtils.getFunctionCode(permDetailFromMap.getInstance()), permDetailFromMap.getAction()); + String roleName = portalAppInfo.getNameSpace()+"."+globalRoleFunc.getRoleName().replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"); + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + removePermForRole(perm, mapper, roleName, headers); + } + } + logger.debug(EELFLoggerDelegate.debugLogger, "Finished addFunctionsTOGlobalRole"); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "addFunctionsTOGlobalRole: Failed",e); + throw e; + } + } + + private void addRoleFunctionsToGlobalRoleInExternalSystem(RoleFunction addFunction, Role globalRole, ObjectMapper mapper, EPApp app, + EPApp portalAppInfo) throws Exception { + try { + logger.debug(EELFLoggerDelegate.debugLogger, "Entering into addRoleFunctionsToGlobalRoleInExternalSystem"); + ExternalAccessRolePerms extAddRolePerms = null; + ExternalAccessPerms extAddPerms = null; + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + String code = ""; + String type = ""; + String action = ""; + if (addFunction.getCode().contains(FUNCTION_PIPE)) { + code = EcompPortalUtils.getFunctionCode(addFunction.getCode()); + type = getFunctionType(addFunction.getCode()); + action = getFunctionAction(addFunction.getCode()); + } else { + code = addFunction.getCode(); + type = addFunction.getCode().contains("menu") ? "menu" : "url"; + action = "*"; + } + extAddPerms = new ExternalAccessPerms(app.getNameSpace() + "." + type, code, action); + extAddRolePerms = new ExternalAccessRolePerms(extAddPerms, + portalAppInfo.getNameSpace() + "." + globalRole.getName().replaceAll( + EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_")); + String updateRolePerms = mapper.writeValueAsString(extAddRolePerms); + HttpEntity<String> entity = new HttpEntity<>(updateRolePerms, headers); + logger.debug(EELFLoggerDelegate.debugLogger, "addRoleFunctionsInExternalSystem: {} ", + CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); + ResponseEntity<String> addResponse = template + .exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + + "role/perm", HttpMethod.POST, entity, String.class); + if (addResponse.getStatusCode().value() != 201) { + logger.debug(EELFLoggerDelegate.debugLogger, + "addRoleFunctionsInExternalSystem: While adding permission to the role in External Auth system something went wrong! due to {} and statuscode: {}", + addResponse.getStatusCode().getReasonPhrase(), addResponse.getStatusCode().value()); + } else { + logger.debug(EELFLoggerDelegate.debugLogger, + "addRoleFunctionsInExternalSystem: Finished adding permissions to roles in External Auth system and status code: {} ", + addResponse.getStatusCode().value()); + } + logger.debug(EELFLoggerDelegate.debugLogger, "Finished addRoleFunctionsToGlobalRoleInExternalSystem"); + }catch(Exception e){ + logger.error(EELFLoggerDelegate.errorLogger, "addRoleFunctionsToGlobalRoleInExternalSystem: Failed",e); + throw e; + } + } + + /** + * + * It adds functions to the role in external auth system + * + * @param updateExtRole + * @param addPermsMapper + * @param app + * @return true if success else false + * @throws Exception + */ + private boolean addRoleFunctionsInExternalSystem(Role updateExtRole, ObjectMapper addPermsMapper, EPApp app) + throws Exception { + boolean response = false; + ExternalAccessRolePerms extAddRolePerms = null; + ExternalAccessPerms extAddPerms = null; + List<RoleFunction> roleFunctionListAdd = convertSetToListOfRoleFunctions(updateExtRole); + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + for (RoleFunction roleFunc : roleFunctionListAdd) { + String code = ""; + String type= ""; + String action = ""; + if (roleFunc.getCode().contains(FUNCTION_PIPE)) { + code = EcompPortalUtils.getFunctionCode(roleFunc.getCode()); + type = getFunctionType(roleFunc.getCode()); + action = getFunctionAction(roleFunc.getCode()); + } else { + code = roleFunc.getCode(); + type = roleFunc.getCode().contains("menu") ? "menu" : "url"; + action = "*"; + } + extAddPerms = new ExternalAccessPerms(app.getNameSpace() + "." + type, code, action); + extAddRolePerms = new ExternalAccessRolePerms(extAddPerms, + app.getNameSpace() + "." + updateExtRole.getName().replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_")); + String updateRolePerms = addPermsMapper.writeValueAsString(extAddRolePerms); + HttpEntity<String> entity = new HttpEntity<>(updateRolePerms, headers); + logger.debug(EELFLoggerDelegate.debugLogger, "addRoleFunctionsInExternalSystem: {} for POST: {} " , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE, updateRolePerms); + ResponseEntity<String> addResponse = template.exchange( + SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role/perm", + HttpMethod.POST, entity, String.class); + if (addResponse.getStatusCode().value() != 201) { + response = false; + logger.debug(EELFLoggerDelegate.debugLogger, + "addRoleFunctionsInExternalSystem: While adding permission to the role in External Auth system something went wrong! due to {} and statuscode: {}", + addResponse.getStatusCode().getReasonPhrase(), addResponse.getStatusCode().value()); + } else { + response = true; + logger.debug(EELFLoggerDelegate.debugLogger, "addRoleFunctionsInExternalSystem: Finished adding permissions to roles in External Auth system {} and status code: {} ", updateRolePerms, addResponse.getStatusCode().value()); + } + } + return response; + } + + /** + * + * It converts list of functions in updateExtRole parameter to the RoleFunction object + * + * @param updateExtRole + * @return list of functions + */ + @SuppressWarnings("unchecked") + private List<RoleFunction> convertSetToListOfRoleFunctions(Role updateExtRole) { + Set<RoleFunction> roleFunctionSetList = updateExtRole.getRoleFunctions(); + List<RoleFunction> roleFunctionList = new ArrayList<>(); + ObjectMapper roleFuncMapper = new ObjectMapper(); + Iterator<RoleFunction> itetaror = roleFunctionSetList.iterator(); + while (itetaror.hasNext()) { + Object nextValue = itetaror.next(); + RoleFunction roleFunction = roleFuncMapper.convertValue(nextValue, RoleFunction.class); + roleFunctionList.add(roleFunction); + } + return roleFunctionList.stream().distinct().collect(Collectors.toList()); + } + + /** + * It delete permissions/functions in the external auth system + * + * @param perm + * @param permMapper + * @param name + * @param headers + * @throws JsonProcessingException + * @throws Exception + */ + private void removePermForRole(ExternalAccessPerms perm, ObjectMapper permMapper, String name, HttpHeaders headers) + throws ExternalAuthSystemException, JsonProcessingException { + ExternalAccessRolePerms extAccessRolePerms = new ExternalAccessRolePerms(perm, name); + String permDetails = permMapper.writeValueAsString(extAccessRolePerms); + try{ + HttpEntity<String> deleteEntity = new HttpEntity<>(permDetails, headers); + logger.debug(EELFLoggerDelegate.debugLogger, "removePermForRole: {} for DELETE: {} " , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE, permDetails); + ResponseEntity<String> deletePermResponse = template + .exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role/" + + name + "/perm", HttpMethod.DELETE, deleteEntity, String.class); + if (deletePermResponse.getStatusCode().value() != 200) { + throw new ExternalAuthSystemException(deletePermResponse.getBody()); + } + logger.debug(EELFLoggerDelegate.debugLogger, "removePermForRole: Finished deleting permission to role in External Auth system: {} and status code: {}", + permDetails, deletePermResponse.getStatusCode().value()); + } catch(Exception e){ + if(e.getMessage().contains("404")){ + logger.error(EELFLoggerDelegate.errorLogger, "Failed to add role for DELETE request: {} due to {}", permDetails, e.getMessage()); + } else{ + throw e; + } + } + } + + /** + * It will create new role in the External Auth System + * + * @param newRole + * @param app + * @return true if successfully added in the system else false + * @throws Exception + * If fails to add role in the system + */ + private void addNewRoleInExternalSystem(List<EPRole> newRole, EPApp app) throws Exception, HttpClientErrorException { + try{ + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + ObjectMapper mapper = new ObjectMapper(); + String addNewRole = ""; + ExternalAccessRole extRole = new ExternalAccessRole(); + String addDesc = null; + Map<String, String> extSystemJsonMapper = new LinkedHashMap<>(); + extSystemJsonMapper.put(ID, String.valueOf(newRole.get(0).getId())); + extSystemJsonMapper.put(ROLE_NAME, String.valueOf(newRole.get(0).getName())); + extSystemJsonMapper.put(ACTIVE, String.valueOf(newRole.get(0).getActive())); + extSystemJsonMapper.put(PRIORITY, String.valueOf(newRole.get(0).getPriority())); + extSystemJsonMapper.put(APP_ID, String.valueOf(newRole.get(0).getAppId())); + extSystemJsonMapper.put(APP_ROLE_ID, String.valueOf(newRole.get(0).getAppRoleId())); + addDesc = mapper.writeValueAsString(extSystemJsonMapper); + extRole.setName(app.getNameSpace() + "." + newRole.get(0).getName().replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_")); + extRole.setDescription(addDesc); + addNewRole = mapper.writeValueAsString(extRole); + HttpEntity<String> postEntity = new HttpEntity<>(addNewRole, headers); + logger.debug(EELFLoggerDelegate.debugLogger, "addNewRoleInExternalSystem: {} for POST: {} " , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE, addNewRole); + ResponseEntity<String> addNewRoleInExternalSystem = template.exchange( + SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role", + HttpMethod.POST, postEntity, String.class); + if (addNewRoleInExternalSystem.getStatusCode().value() == 201) { + logger.debug(EELFLoggerDelegate.debugLogger, + "addNewRoleInExternalSystem: Finished adding into External Auth system for POST: {} and status code: {}", + addNewRole, addNewRoleInExternalSystem.getStatusCode().value()); + } + }catch(HttpClientErrorException ht){ + dataAccessService.deleteDomainObjects(EPRole.class, " role_id = "+ newRole.get(0).getId(), null); + logger.error(EELFLoggerDelegate.debugLogger, "addNewRoleInExternalSystem: Failed to add in External Auth system and status code: {}", + ht); + throw new HttpClientErrorException(ht.getStatusCode()); + } + } + + /** + * + * It updates existing role in the External Auth System + * + * @param addRole + * It Contains role information + * @param app + * @return string which is formatted to match with the external auth system + * @throws JsonProcessingException + */ + private String updateExistingRoleInExternalSystem(Role addRole, EPApp app) throws JsonProcessingException { + ObjectMapper mapper = new ObjectMapper(); + String addNewRole = ""; + ExternalAccessRole extRole = new ExternalAccessRole(); + List<EPRole> role = null; + String addDesc = null; + Map<String, String> extSystemUpdateRole = new LinkedHashMap<>(); + if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) { + role = getPortalAppRoleInfo(addRole.getId()); + } else { + role = getPartnerAppRoleInfo(addRole.getId(), app); + } + extSystemUpdateRole.put(ID, String.valueOf(role.get(0).getId())); + extSystemUpdateRole.put(ROLE_NAME, String.valueOf(addRole.getName())); + extSystemUpdateRole.put(ACTIVE, String.valueOf(role.get(0).getActive())); + extSystemUpdateRole.put(PRIORITY, String.valueOf(role.get(0).getPriority())); + extSystemUpdateRole.put(APP_ID, String.valueOf(role.get(0).getAppId())); + extSystemUpdateRole.put(APP_ROLE_ID, String.valueOf(role.get(0).getAppRoleId())); + addDesc = mapper.writeValueAsString(extSystemUpdateRole); + extRole.setName(app.getNameSpace() + "." + addRole.getName().replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_")); + extRole.setDescription(addDesc); + addNewRole = mapper.writeValueAsString(extRole); + return addNewRole; + } + + /** + * It create a role in the external auth system and then in our local + * + * @param addRoleInDB + * @param app + * @return true else false + * @throws Exception + */ + @SuppressWarnings("unchecked") + @Transactional(rollbackFor = Exception.class) + private boolean addRoleInEcompDB(Role addRoleInDB, EPApp app) throws Exception { + boolean result = false; + EPRole epRole = null; + Set<RoleFunction> roleFunctionList = addRoleInDB.getRoleFunctions(); + List<RoleFunction> roleFunctionListNew = new ArrayList<>(); + ObjectMapper mapper = new ObjectMapper(); + Iterator<RoleFunction> itetaror = roleFunctionList.iterator(); + while (itetaror.hasNext()) { + Object nextValue = itetaror.next(); + RoleFunction roleFunction = mapper.convertValue(nextValue, RoleFunction.class); + roleFunctionListNew.add(roleFunction); + } + List<RoleFunction> listWithoutDuplicates = roleFunctionListNew.stream().distinct().collect(Collectors.toList()); + try { + if (addRoleInDB.getId() == null) { // check if it is new role + if (EcompPortalUtils.checkIfRemoteCentralAccessAllowed()) { + checkIfRoleExitsInExternalSystem(addRoleInDB, app); + } + EPRole epRoleNew = new EPRole(); + epRoleNew.setActive(addRoleInDB.getActive()); + epRoleNew.setName(addRoleInDB.getName()); + epRoleNew.setPriority(addRoleInDB.getPriority()); + if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) { + epRoleNew.setAppId(null); + } else { + epRoleNew.setAppId(app.getId()); + } + dataAccessService.saveDomainObject(epRoleNew, null); + List<EPRole> getRoleCreated = null; + final Map<String, String> epAppRoleParams = new HashMap<>(); + final Map<String, String> epAppPortalRoleParams = new HashMap<>(); + if (!app.getId().equals(PortalConstants.PORTAL_APP_ID)) { + epAppRoleParams.put("appId", String.valueOf(app.getId())); + epAppRoleParams.put(APP_ROLE_NAME_PARAM, addRoleInDB.getName()); + List<EPRole> roleCreated = dataAccessService.executeNamedQuery(GET_ROLE_TO_UPDATE_IN_EXTERNAL_AUTH_SYSTEM, epAppRoleParams, null); + EPRole epUpdateRole = roleCreated.get(0); + epUpdateRole.setAppRoleId(epUpdateRole.getId()); + dataAccessService.saveDomainObject(epUpdateRole, null); + getRoleCreated = dataAccessService.executeNamedQuery(GET_ROLE_TO_UPDATE_IN_EXTERNAL_AUTH_SYSTEM, epAppRoleParams, null); + } else { + epAppPortalRoleParams.put(APP_ROLE_NAME_PARAM, addRoleInDB.getName()); + getRoleCreated = dataAccessService.executeNamedQuery(GET_PORTAL_APP_ROLES_QUERY, epAppPortalRoleParams, null); + } + // Add role in External Auth system + if (EcompPortalUtils.checkIfRemoteCentralAccessAllowed()) { + addNewRoleInExternalSystem(getRoleCreated, app); + } + } else { // if role already exists then update it + EPRole globalRole = null; + List<EPRole> applicationRoles; + List<EPRole> globalRoleList = getGlobalRolesOfPortal(); + boolean isGlobalRole = false; + if (!globalRoleList.isEmpty()) { + EPRole role = globalRoleList.stream().filter(x -> addRoleInDB.getId().equals(x.getId())).findAny() + .orElse(null); + if (role != null) { + globalRole = role; + isGlobalRole = true; + } + } + if (app.getId().equals(PortalConstants.PORTAL_APP_ID) + || (globalRole != null && app.getId() != globalRole.getAppId())) { + applicationRoles = getPortalAppRoleInfo(addRoleInDB.getId()); + } else { + applicationRoles = getPartnerAppRoleInfo(addRoleInDB.getId(), app); + } + if (EcompPortalUtils.checkIfRemoteCentralAccessAllowed()) { + updateRoleInExternalSystem(addRoleInDB, app, isGlobalRole); + // Add all user to the re-named role in external auth system + if (!applicationRoles.isEmpty() + && !addRoleInDB.getName().equals(applicationRoles.get(0).getName())) { + bulkUploadUsersSingleRole(app.getUebKey(), applicationRoles.get(0).getId(), + addRoleInDB.getName()); + } + } + deleteRoleFunction(app, applicationRoles); + if (!applicationRoles.isEmpty()) { + epRole = applicationRoles.get(0); + epRole.setName(addRoleInDB.getName()); + epRole.setPriority(addRoleInDB.getPriority()); + epRole.setActive(addRoleInDB.getActive()); + if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) { + epRole.setAppId(null); + epRole.setAppRoleId(null); + } else if (!app.getId().equals(PortalConstants.PORTAL_APP_ID) + && applicationRoles.get(0).getAppRoleId() == null) { + epRole.setAppRoleId(epRole.getId()); + } + dataAccessService.saveDomainObject(epRole, null); + } + Long roleAppId = null; + if (globalRole != null && !app.getId().equals(globalRole.getAppId())) + roleAppId = PortalConstants.PORTAL_APP_ID; + saveRoleFunction(listWithoutDuplicates, app, applicationRoles, roleAppId); + result = true; + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "addRoleInEcompDB is failed", e); + throw e; + } + return result; + } + + /** + * + * It validates whether role exists in external auth system + * + * @param checkRole + * @param app + * @throws Exception + * If role exits + */ + private void checkIfRoleExitsInExternalSystem(Role checkRole, EPApp app) throws Exception { + getNameSpaceIfExists(app); + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + String roleName = app.getNameSpace() + "." + checkRole.getName().replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"); + HttpEntity<String> checkRoleEntity = new HttpEntity<>(headers); + logger.debug(EELFLoggerDelegate.debugLogger, "checkIfRoleExitsInExternalSystem: {} " , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); + ResponseEntity<String> checkRoleInExternalSystem = template + .exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "roles/" + + roleName, HttpMethod.GET, checkRoleEntity, String.class); + if (!checkRoleInExternalSystem.getBody().equals(IS_EMPTY_JSON_STRING)) { + logger.debug("checkIfRoleExitsInExternalSystem: Role already exists in external system {} and status code: {} ", checkRoleInExternalSystem.getBody(), checkRoleInExternalSystem.getStatusCode().value()); + throw new ExternalAuthSystemException(" Role already exists in external system"); + } + } + + /** + * It saves list of functions to the role in portal + * + * @param roleFunctionListNew + * @param app + * @param applicationRoles + * @throws Exception + */ + @SuppressWarnings("unchecked") + private void saveRoleFunction(List<RoleFunction> roleFunctionListNew, EPApp app, List<EPRole> applicationRoles ,Long roleAppId) + throws Exception { + final Map<String, String> getAppFunctionParams = new HashMap<>(); + + for (RoleFunction roleFunc : roleFunctionListNew) { + String code = EcompPortalUtils.getFunctionCode(roleFunc.getCode()); + EPAppRoleFunction appRoleFunc = new EPAppRoleFunction(); + appRoleFunc.setAppId(app.getId()); + appRoleFunc.setRoleId(applicationRoles.get(0).getId()); + appRoleFunc.setRoleAppId(String.valueOf(roleAppId)); + getAppFunctionParams.put("appId", String.valueOf(app.getId())); + getAppFunctionParams.put(FUNCTION_CODE_PARAMS, roleFunc.getCode()); + // query to check if function code has pipes + List<CentralV2RoleFunction> roleFunction = dataAccessService.executeNamedQuery(GET_ROLE_FUNCTION_QUERY, getAppFunctionParams, null); + if(roleFunction.isEmpty()){ + getAppFunctionParams.put(FUNCTION_CODE_PARAMS, code); + roleFunction = dataAccessService.executeNamedQuery(GET_ROLE_FUNCTION_QUERY, getAppFunctionParams, null); + } + if(roleFunction.size() > 1){ + CentralV2RoleFunction getExactFunctionCode = appFunctionListFilter(code, roleFunction); + appRoleFunc.setCode(getExactFunctionCode.getCode()); + } else{ + appRoleFunc.setCode(roleFunction.get(0).getCode()); + } + + dataAccessService.saveDomainObject(appRoleFunc, null); + } + } + + /** + * + * It filters the app functions which starts with similar name in the result set + * + * @param roleFunc + * @param roleFunction + * @return CentralRoleFunction + */ + private CentralV2RoleFunction appFunctionListFilter(String roleFuncCode, List<CentralV2RoleFunction> roleFunction) { + final Map<String, CentralV2RoleFunction> appFunctionsFilter = new HashMap<>(); + final Map<String, CentralV2RoleFunction> appFunctionsFilterPipes = new HashMap<>(); + CentralV2RoleFunction getExactFunctionCode = null; + for(CentralV2RoleFunction cenRoleFunction : roleFunction){ + appFunctionsFilter.put(cenRoleFunction.getCode(), cenRoleFunction); + appFunctionsFilterPipes.put(EcompPortalUtils.getFunctionCode(cenRoleFunction.getCode()), cenRoleFunction); + } + getExactFunctionCode = appFunctionsFilter.get(roleFuncCode); + if(getExactFunctionCode == null){ + getExactFunctionCode = appFunctionsFilterPipes.get(roleFuncCode); + } + return getExactFunctionCode; + } + + /** + * It deletes all EPAppRoleFunction records in the portal + * + * @param app + * @param role + */ + @SuppressWarnings("unchecked") + private void deleteRoleFunction(EPApp app, List<EPRole> role) { + final Map<String, Long> appRoleFuncsParams = new HashMap<>(); + appRoleFuncsParams.put("appId", app.getId()); + appRoleFuncsParams.put("roleId", role.get(0).getId()); + List<EPAppRoleFunction> appRoleFunctionList = dataAccessService.executeNamedQuery("getAppRoleFunctionOnRoleIdandAppId", appRoleFuncsParams, null); + if (!appRoleFunctionList.isEmpty()) { + for (EPAppRoleFunction approleFunction : appRoleFunctionList) { + dataAccessService.deleteDomainObject(approleFunction, null); + } + } + } + + @Override + @SuppressWarnings("unchecked") + public List<EPUser> getUser(String loginId){ + final Map<String, String> userParams = new HashMap<>(); + userParams.put("org_user_id", loginId); + return (List<EPUser>) dataAccessService.executeNamedQuery("getEPUserByOrgUserId", userParams, null); + } + + @Override + public String getV2UserWithRoles(String loginId, String uebkey) throws Exception { + final Map<String, String> params = new HashMap<>(); + List<EPUser> userList = null; + CentralV2User cenV2User = null; + String result = null; + try { + params.put("orgUserIdValue", loginId); + List<EPApp> appList = getApp(uebkey); + if (!appList.isEmpty()) { + userList = getUser(loginId); + if (!userList.isEmpty()) { + ObjectMapper mapper = new ObjectMapper(); + cenV2User = getV2UserAppRoles(loginId, uebkey); + result = mapper.writeValueAsString(cenV2User); + } else if (userList.isEmpty()) { + throw new InvalidUserException("User not found"); + } + } else { + throw new InactiveApplicationException("Application not found"); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getUser: failed", e); + throw e; + } + return result; + } + + @Override + public List<CentralV2Role> getRolesForApp(String uebkey) throws Exception { + logger.debug(EELFLoggerDelegate.debugLogger, "getRolesForApp: Entering into getRolesForApp"); + List<CentralV2Role> roleList = new ArrayList<>(); + final Map<String, Long> params = new HashMap<>(); + try { + List<EPApp> app = getApp(uebkey); + List<EPRole> appRolesList = getAppRoles(app.get(0).getId()); + roleList = createCentralRoleObject(app, appRolesList, roleList, params); + if(app.get(0).getId() != PortalConstants.PORTAL_APP_ID){ + List<CentralV2Role> globalRoleList = getGlobalRolesOfApplication(app.get(0).getId()); + List<EPRole> globalRolesList = getGlobalRolesOfPortal(); + List<CentralV2Role> portalsGlobalRolesFinlaList = new ArrayList<>(); + if (!globalRolesList.isEmpty()) { + for (EPRole eprole : globalRolesList) { + CentralV2Role cenRole = convertRoleToCentralV2Role(eprole); + portalsGlobalRolesFinlaList.add(cenRole); + } + roleList.addAll(globalRoleList); + for (CentralV2Role role : portalsGlobalRolesFinlaList) { + CentralV2Role result = roleList.stream() + .filter(x -> role.getId().equals(x.getId())).findAny().orElse(null); + if (result == null) + roleList.add(role); + } + } else { + for (EPRole role : globalRolesList) { + CentralV2Role cenRole = convertRoleToCentralV2Role(role); + roleList.add(cenRole); + } + } + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getRolesForApp: Failed!", e); + throw e; + } + logger.debug(EELFLoggerDelegate.debugLogger, "getRolesForApp: Finished!"); + return roleList.stream().distinct().collect(Collectors.toList()); + } + + @SuppressWarnings("unchecked") + @Override + public List<CentralV2RoleFunction> getRoleFuncList(String uebkey) throws Exception { + EPApp app = getApp(uebkey).get(0); + List<CentralV2RoleFunction> finalRoleList = new ArrayList<>(); + final Map<String, Long> params = new HashMap<>(); + params.put(APP_ID, app.getId()); + List<CentralV2RoleFunction> getRoleFuncList = dataAccessService.executeNamedQuery("getAllRoleFunctions", params, null); + for (CentralV2RoleFunction roleFuncItem : getRoleFuncList) { + String code = EcompPortalUtils.getFunctionCode(roleFuncItem.getCode()); + String type = getFunctionType(roleFuncItem.getCode()); + String action = getFunctionAction(roleFuncItem.getCode()); + roleFuncItem.setCode(EPUserUtils.decodeFunctionCode(code)); + roleFuncItem.setType(type); + roleFuncItem.setAction(action); + finalRoleList.add(roleFuncItem); + } + return finalRoleList; + } + + + /** + * It return function action + * + * @param roleFuncItem + * @return String action + */ + private String getFunctionAction(String roleFuncItem) { + return (!roleFuncItem.contains(FUNCTION_PIPE)) ? "*" + : EcompPortalUtils.getFunctionAction(roleFuncItem); + } + + /** + * + * It check function code has any pipes, if found return function type + * + * @param roleFuncItem + * @param type + * @return function type + */ + private String getFunctionType(String roleFuncItem) { + String type = null; + if ((roleFuncItem.contains(FUNCTION_PIPE) && roleFuncItem.contains("menu")) + || (!roleFuncItem.contains(FUNCTION_PIPE) && roleFuncItem.contains("menu"))) { + type = "menu"; + } else if (checkIfCodeHasNoPipesAndHasTypeUrl(roleFuncItem) + ||checkIfCodeHasPipesAndHasTypeUrl(roleFuncItem) + ||checkIfCodeHasNoPipesAndHasNoTypeUrl(roleFuncItem)) { + type = "url"; + } else if (roleFuncItem.contains(FUNCTION_PIPE) + && (!roleFuncItem.contains("menu") || roleFuncItem.contains("url"))) { + type = EcompPortalUtils.getFunctionType(roleFuncItem); + } + return type; + } + + /** + * + * It check whether function code has no pipes and no url string in it + * + * @param roleFuncItem + * @return true or false + */ + private boolean checkIfCodeHasNoPipesAndHasNoTypeUrl(String roleFuncItem) { + return !roleFuncItem.contains(FUNCTION_PIPE) && !roleFuncItem.contains("url"); + } + + /** + * + * It check whether function code has pipes and url string in it + * + * @param roleFuncItem + * @return true or false + */ + private boolean checkIfCodeHasPipesAndHasTypeUrl(String roleFuncItem) { + return roleFuncItem.contains(FUNCTION_PIPE) && roleFuncItem.contains("url"); + } + + /** + * + * It check whether function code has no pipes and has url string in it + * + * @param roleFuncItem + * @return true or false + */ + private boolean checkIfCodeHasNoPipesAndHasTypeUrl(String roleFuncItem) { + return !roleFuncItem.contains(FUNCTION_PIPE) && roleFuncItem.contains("url"); + } + + /** + * It returns user detail information which is deep copy of EPUser.class object + * + * @param userInfo + * @param userAppSet + * @param app + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + private CentralV2User createEPUser(EPUser userInfo, Set<EPUserApp> userAppSet, EPApp app) throws Exception { + + final Map<String, Long> params = new HashMap<>(); + CentralV2User userAppList = new CentralV2User(); + CentralV2User user1 = null; + try { + userAppList.setUserApps(new TreeSet<CentralV2UserApp>()); + for (EPUserApp userApp : userAppSet) { + if (userApp.getRole().getActive()) { + EPApp epApp = userApp.getApp(); + String globalRole = userApp.getRole().getName().toLowerCase(); + if (((epApp.getId().equals(app.getId())) + && (!userApp.getRole().getId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID))) + || ((epApp.getId().equals(PortalConstants.PORTAL_APP_ID)) + && (globalRole.toLowerCase().startsWith("global_")))) { + CentralV2UserApp cua = new CentralV2UserApp(); + cua.setUserId(null); + CentralApp cenApp = new CentralApp(1L, epApp.getCreated(), epApp.getModified(), + epApp.getCreatedId(), epApp.getModifiedId(), epApp.getRowNum(), epApp.getName(), + epApp.getImageUrl(), epApp.getDescription(), epApp.getNotes(), epApp.getUrl(), + epApp.getAlternateUrl(), epApp.getAppRestEndpoint(), epApp.getMlAppName(), + epApp.getMlAppAdminId(), String.valueOf(epApp.getMotsId()), epApp.getAppPassword(), + String.valueOf(epApp.getOpen()), String.valueOf(epApp.getEnabled()), + epApp.getThumbnail(), epApp.getUsername(), epApp.getUebKey(), epApp.getUebSecret(), + epApp.getUebTopicName()); + cua.setApp(cenApp); + params.put("roleId", userApp.getRole().getId()); + params.put(APP_ID, userApp.getApp().getId()); + CentralV2Role centralRole; + List<EPRole> globalRoleList; + globalRoleList = getGlobalRolesOfPortal(); + EPRole result = globalRoleList.stream().filter(x -> userApp.getRole().getId().equals(x.getId())) + .findAny().orElse(null); + if (result != null && userApp.getApp().getId() != app.getId()) { + userApp.getRole().setId(result.getId()); + centralRole = getGlobalRoleForRequestedApp(app.getId(), userApp.getRole().getId()); + cua.setRole(centralRole); + } else { + List<CentralV2RoleFunction> appRoleFunctionList = dataAccessService + .executeNamedQuery("getAppRoleFunctionList", params, null); + SortedSet<CentralV2RoleFunction> roleFunctionSet = new TreeSet<>(); + for (CentralV2RoleFunction roleFunc : appRoleFunctionList) { + String functionCode = EcompPortalUtils.getFunctionCode(roleFunc.getCode()); + CentralV2RoleFunction cenRoleFunc = new CentralV2RoleFunction(roleFunc.getId(), + functionCode, roleFunc.getName(), null, null); + roleFunctionSet.add(cenRoleFunc); + } + Long userRoleId = null; + if (globalRole.toLowerCase().startsWith("global_") + && epApp.getId().equals(PortalConstants.PORTAL_APP_ID)) { + userRoleId = userApp.getRole().getId(); + } else { + userRoleId = userApp.getRole().getAppRoleId(); + } + CentralV2Role cenRole = new CentralV2Role(userRoleId, userApp.getRole().getCreated(), + userApp.getRole().getModified(), userApp.getRole().getCreatedId(), + userApp.getRole().getModifiedId(), userApp.getRole().getRowNum(), + userApp.getRole().getName(), userApp.getRole().getActive(), + userApp.getRole().getPriority(), roleFunctionSet, null, null); + cua.setRole(cenRole); + } + userAppList.getUserApps().add(cua); + } + } + } + + user1 = new CentralV2User(null, userInfo.getCreated(), userInfo.getModified(), userInfo.getCreatedId(), + userInfo.getModifiedId(), userInfo.getRowNum(), userInfo.getOrgId(), userInfo.getManagerId(), + userInfo.getFirstName(), userInfo.getMiddleInitial(), userInfo.getLastName(), userInfo.getPhone(), + userInfo.getFax(), userInfo.getCellular(), userInfo.getEmail(), userInfo.getAddressId(), + userInfo.getAlertMethodCd(), userInfo.getHrid(), userInfo.getOrgUserId(), userInfo.getOrgCode(), + userInfo.getAddress1(), userInfo.getAddress2(), userInfo.getCity(), userInfo.getState(), + userInfo.getZipCode(), userInfo.getCountry(), userInfo.getOrgManagerUserId(), + userInfo.getLocationClli(), userInfo.getBusinessCountryCode(), userInfo.getBusinessCountryName(), + userInfo.getBusinessUnit(), userInfo.getBusinessUnitName(), userInfo.getDepartment(), + userInfo.getDepartmentName(), userInfo.getCompanyCode(), userInfo.getCompany(), + userInfo.getZipCodeSuffix(), userInfo.getJobTitle(), userInfo.getCommandChain(), + userInfo.getSiloStatus(), userInfo.getCostCenter(), userInfo.getFinancialLocCode(), + userInfo.getLoginId(), userInfo.getLoginPwd(), userInfo.getLastLoginDate(), userInfo.getActive(), + userInfo.getInternal(), userInfo.getSelectedProfileId(), userInfo.getTimeZoneId(), + userInfo.isOnline(), userInfo.getChatId(), userAppList.getUserApps(), null); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "createEPUser: createEPUser failed", e); + throw e; + } + return user1; + } + + @Override + public CentralV2Role getRoleInfo(Long roleId, String uebkey) throws Exception { + final Map<String, Long> params = new HashMap<>(); + List<CentralV2Role> roleList = new ArrayList<>(); + CentralV2Role cenRole = new CentralV2Role(); + List<EPRole> roleInfo = null; + List<EPApp> app = null; + try { + app = getApp(uebkey); + if (app.isEmpty()) { + throw new InactiveApplicationException("Application not found"); + } + if (app.get(0).getId() != PortalConstants.PORTAL_APP_ID) { + List<EPRole> globalRoleList = new ArrayList<>(); + globalRoleList = getGlobalRolesOfPortal(); + if (globalRoleList.size() > 0) { + EPRole result = globalRoleList.stream().filter(x -> roleId.equals(x.getId())).findAny() + .orElse(null); + if (result != null) + return getGlobalRoleForRequestedApp(app.get(0).getId(), roleId); + } + } + if (app.get(0).getId().equals(PortalConstants.PORTAL_APP_ID)) { + roleInfo = getPortalAppRoleInfo(roleId); + } else { + roleInfo = getPartnerAppRoleInfo(roleId, app.get(0)); + } + roleList = createCentralRoleObject(app, roleInfo, roleList, params); + if (roleList.isEmpty()) { + return cenRole; + } + + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getRoleInfo: failed", e); + throw e; + + } + return roleList.get(0); + } + + @SuppressWarnings("unchecked") + private List<EPRole> getPartnerAppRoleInfo(Long roleId, EPApp app) { + List<EPRole> roleInfo; + final Map<String, Long> getPartnerAppRoleParams = new HashMap<>(); + getPartnerAppRoleParams.put("appRoleId", roleId); + getPartnerAppRoleParams.put("appId", app.getId()); + roleInfo = dataAccessService.executeNamedQuery("getPartnerAppRoleByRoleId", getPartnerAppRoleParams, null); + if(roleInfo.isEmpty()) { + getPartnerAppRoleParams.put("appRoleId", roleId); + roleInfo = dataAccessService.executeNamedQuery("getPartnerAppRoleById", getPartnerAppRoleParams, null); + } + return roleInfo; + } + + @SuppressWarnings("unchecked") + private List<EPRole> getPortalAppRoleInfo(Long roleId) { + List<EPRole> roleInfo; + final Map<String, Long> getPortalAppRoleParams = new HashMap<>(); + getPortalAppRoleParams.put("roleId", roleId); + roleInfo = dataAccessService.executeNamedQuery("getPortalAppRoleByRoleId", getPortalAppRoleParams, null); + return roleInfo; + } + + /** + * + * It returns list of app roles along with role functions and which went through deep copy + * + * @param app + * @param roleInfo + * @param roleList + * @param params + * @return + * @throws DecoderException + */ + @SuppressWarnings("unchecked") + private List<CentralV2Role> createCentralRoleObject(List<EPApp> app, List<EPRole> roleInfo, + List<CentralV2Role> roleList, Map<String, Long> params) throws RoleFunctionException { + for (EPRole role : roleInfo) { + params.put("roleId", role.getId()); + params.put(APP_ID, app.get(0).getId()); + List<CentralV2RoleFunction> cenRoleFuncList = dataAccessService.executeNamedQuery("getAppRoleFunctionList", + params, null); + SortedSet<CentralV2RoleFunction> roleFunctionSet = new TreeSet<>(); + for (CentralV2RoleFunction roleFunc : cenRoleFuncList) { + String functionCode = EcompPortalUtils.getFunctionCode(roleFunc.getCode()); + functionCode = EPUserUtils.decodeFunctionCode(functionCode); + String type = getFunctionType(roleFunc.getCode()); + String action = getFunctionAction(roleFunc.getCode()); + CentralV2RoleFunction cenRoleFunc = new CentralV2RoleFunction(role.getId(), functionCode, + roleFunc.getName(), null, type, action, null); + roleFunctionSet.add(cenRoleFunc); + } + SortedSet<CentralV2Role> childRoles = new TreeSet<>(); + SortedSet<CentralV2Role> parentRoles = new TreeSet<>(); + CentralV2Role cenRole = null; + if (role.getAppRoleId() == null) { + cenRole = new CentralV2Role(role.getId(), role.getCreated(), role.getModified(), role.getCreatedId(), + role.getModifiedId(), role.getRowNum(), role.getName(), role.getActive(), role.getPriority(), + roleFunctionSet, childRoles, parentRoles); + } else { + cenRole = new CentralV2Role(role.getAppRoleId(), role.getCreated(), role.getModified(), + role.getCreatedId(), role.getModifiedId(), role.getRowNum(), role.getName(), role.getActive(), + role.getPriority(), roleFunctionSet, childRoles, parentRoles); + } + roleList.add(cenRole); + } + return roleList; + } + + @SuppressWarnings("unchecked") + @Override + public CentralV2RoleFunction getRoleFunction(String functionCode, String uebkey) throws Exception { + if (functionCode.contains("|")) + functionCode = EcompPortalUtils.getFunctionCode(functionCode); + functionCode = encodeFunctionCode(functionCode); + CentralV2RoleFunction roleFunc = null; + EPApp app = getApp(uebkey).get(0); + List<CentralV2RoleFunction> getRoleFuncList = null; + final Map<String, String> params = new HashMap<>(); + try { + params.put(FUNCTION_CODE_PARAMS, functionCode); + params.put(APP_ID, String.valueOf(app.getId())); + getRoleFuncList = dataAccessService.executeNamedQuery(GET_ROLE_FUNCTION_QUERY, params, null); + if (getRoleFuncList.isEmpty()) { + return roleFunc; + } else { + if (getRoleFuncList.size() > 1) { + CentralV2RoleFunction cenV2RoleFunction = appFunctionListFilter(functionCode, getRoleFuncList); + if(cenV2RoleFunction == null) + return roleFunc; + roleFunc = checkIfPipesExitsInFunctionCode(cenV2RoleFunction); + } else { + roleFunc = checkIfPipesExitsInFunctionCode(getRoleFuncList.get(0)); + } + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getRoleFunction: failed", e); + throw e; + } + return roleFunc; + } + + private CentralV2RoleFunction checkIfPipesExitsInFunctionCode(CentralV2RoleFunction getRoleFuncList) { + CentralV2RoleFunction roleFunc; + String functionCodeFormat = getRoleFuncList.getCode(); + if (functionCodeFormat.contains(FUNCTION_PIPE)) { + String newfunctionCodeFormat = EcompPortalUtils.getFunctionCode(functionCodeFormat); + String newfunctionTypeFormat = EcompPortalUtils.getFunctionType(functionCodeFormat); + String newfunctionActionFormat = EcompPortalUtils.getFunctionAction(functionCodeFormat); + roleFunc = new CentralV2RoleFunction(getRoleFuncList.getId(), newfunctionCodeFormat, + getRoleFuncList.getName(), getRoleFuncList.getAppId(), newfunctionTypeFormat, newfunctionActionFormat, + getRoleFuncList.getEditUrl()); + } else { + roleFunc = new CentralV2RoleFunction(getRoleFuncList.getId(), functionCodeFormat, + getRoleFuncList.getName(), getRoleFuncList.getAppId(), + getRoleFuncList.getEditUrl()); + } + return roleFunc; + } + + @SuppressWarnings("unchecked") + @Override + public boolean saveCentralRoleFunction(CentralV2RoleFunction domainCentralRoleFunction, EPApp app) throws Exception { + boolean saveOrUpdateFunction = false; + try { + domainCentralRoleFunction.setCode(encodeFunctionCode(domainCentralRoleFunction.getCode())); + final Map<String, String> functionParams = new HashMap<>(); + functionParams.put("appId", String.valueOf(app.getId())); + List<CentralV2RoleFunction> appRoleFuncWithPipe = new ArrayList<>(); + // If request coming from portal application we use type, instance/code and action to fetch record + if(domainCentralRoleFunction.getType()!=null && domainCentralRoleFunction.getAction()!=null){ + functionParams.put(FUNCTION_CODE_PARAMS, domainCentralRoleFunction.getType()+FUNCTION_PIPE + +domainCentralRoleFunction.getCode()+FUNCTION_PIPE+domainCentralRoleFunction.getAction()); + appRoleFuncWithPipe = dataAccessService.executeNamedQuery(GET_ROLE_FUNCTION_QUERY, functionParams, null); + if(appRoleFuncWithPipe.isEmpty()){ + functionParams.put(FUNCTION_CODE_PARAMS, domainCentralRoleFunction.getCode()); + appRoleFuncWithPipe = dataAccessService.executeNamedQuery(GET_ROLE_FUNCTION_QUERY, functionParams, null); + } + } + // If request coming from SDK applications we use just function code to fetch record + else{ + functionParams.put(FUNCTION_CODE_PARAMS, domainCentralRoleFunction.getCode()); + } + CentralV2RoleFunction appFunctionCode = null; + if(!appRoleFuncWithPipe.isEmpty()){ + // Make sure we extract correct record if similar records are found as query uses like condition + appFunctionCode = appFunctionListFilter(domainCentralRoleFunction.getCode(), appRoleFuncWithPipe); + if(appFunctionCode == null){ + appFunctionCode = domainCentralRoleFunction; + } + } else{ + appFunctionCode = domainCentralRoleFunction; + } + appFunctionCode.setName(domainCentralRoleFunction.getName()); + if(EcompPortalUtils.checkIfRemoteCentralAccessAllowed()) { + addRoleFunctionInExternalSystem(appFunctionCode, app); + } + if(domainCentralRoleFunction.getType() != null && domainCentralRoleFunction.getAction() != null){ + appFunctionCode.setCode(domainCentralRoleFunction.getType()+ + FUNCTION_PIPE+domainCentralRoleFunction.getCode()+FUNCTION_PIPE+domainCentralRoleFunction.getAction()); + } + appFunctionCode.setAppId(app.getId()); + dataAccessService.saveDomainObject(appFunctionCode, null); + saveOrUpdateFunction = true; + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "saveCentralRoleFunction: failed", e); + throw e; + } + return saveOrUpdateFunction; + } + + /** + * It creates application permission in external auth system + * + * @param domainCentralRoleFunction + * @param app + * @throws Exception + */ + private void addRoleFunctionInExternalSystem(CentralV2RoleFunction domainCentralRoleFunction, EPApp app) + throws Exception { + ObjectMapper mapper = new ObjectMapper(); + ExternalAccessPerms extPerms = new ExternalAccessPerms(); + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + String type = ""; + String instance = ""; + String action = ""; + if((domainCentralRoleFunction.getType()!=null && domainCentralRoleFunction.getAction()!=null) || domainCentralRoleFunction.getCode().contains(FUNCTION_PIPE)){ + type = domainCentralRoleFunction.getCode().contains(FUNCTION_PIPE) ? EcompPortalUtils.getFunctionType(domainCentralRoleFunction.getCode()) : domainCentralRoleFunction.getType(); + instance = domainCentralRoleFunction.getCode().contains(FUNCTION_PIPE) ? EcompPortalUtils.getFunctionCode(domainCentralRoleFunction.getCode()) : domainCentralRoleFunction.getCode(); + action = domainCentralRoleFunction.getCode().contains(FUNCTION_PIPE) ? EcompPortalUtils.getFunctionAction(domainCentralRoleFunction.getCode()) : domainCentralRoleFunction.getAction(); + } else{ + type = domainCentralRoleFunction.getCode().contains("menu") ? "menu" : "url"; + instance = domainCentralRoleFunction.getCode(); + action = "*"; + } + // get Permissions from External Auth System + JSONArray extPermsList = getExtAuthPermissions(app); + List<ExternalAccessPermsDetail> permsDetailList = getExtAuthPerrmissonList(app, extPermsList); + String requestedPerm = type+FUNCTION_PIPE+instance+FUNCTION_PIPE+action; + boolean checkIfFunctionsExits = permsDetailList.stream().anyMatch(permsDetail -> permsDetail.getInstance().equals(requestedPerm)); + if (!checkIfFunctionsExits) { + try { + extPerms.setAction(action); + extPerms.setInstance(instance); + extPerms.setType(app.getNameSpace() + "." + type); + extPerms.setDescription(domainCentralRoleFunction.getName()); + String addFunction = mapper.writeValueAsString(extPerms); + HttpEntity<String> entity = new HttpEntity<>(addFunction, headers); + logger.debug(EELFLoggerDelegate.debugLogger, "addRoleFunctionInExternalSystem: {} for POST: {}" , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE, addFunction); + ResponseEntity<String> addPermResponse= template.exchange( + SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "perm", + HttpMethod.POST, entity, String.class); + logger.debug(EELFLoggerDelegate.debugLogger, "addRoleFunctionInExternalSystem: Finished adding permission for POST: {} and status code: {} ", addPermResponse.getStatusCode().value(), addFunction); + } catch(HttpClientErrorException e){ + logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to add function in external central auth system", e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); + throw e; + }catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "addRoleFunctionInExternalSystem: Failed to add fucntion in external central auth system", + e); + throw e; + } + } else { + try { + extPerms.setAction(action); + extPerms.setInstance(instance); + extPerms.setType(app.getNameSpace() + "." + type); + extPerms.setDescription(domainCentralRoleFunction.getName()); + String updateRoleFunction = mapper.writeValueAsString(extPerms); + HttpEntity<String> entity = new HttpEntity<>(updateRoleFunction, headers); + logger.debug(EELFLoggerDelegate.debugLogger, "addRoleFunctionInExternalSystem: {} for PUT: {}" , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE, updateRoleFunction); + ResponseEntity<String> updatePermResponse = template.exchange( + SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "perm", + HttpMethod.PUT, entity, String.class); + logger.debug(EELFLoggerDelegate.debugLogger, "addRoleFunctionInExternalSystem: Finished updating permission in External Auth system {} and response: {} ", updateRoleFunction, updatePermResponse.getStatusCode().value()); + } catch(HttpClientErrorException e){ + logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to add function in external central auth system", e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); + throw e; + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "addRoleFunctionInExternalSystem: Failed to update function in external central auth system",e); + throw e; + } + } + } + + @SuppressWarnings("unchecked") + @Override + @Transactional(rollbackFor = Exception.class) + public boolean deleteCentralRoleFunction(String code, EPApp app) { + boolean deleteFunctionResponse = false; + try { + final Map<String, String> params = new HashMap<>(); + params.put(FUNCTION_CODE_PARAMS, code); + params.put(APP_ID, String.valueOf(app.getId())); + List<CentralV2RoleFunction> domainCentralRoleFunction = dataAccessService + .executeNamedQuery(GET_ROLE_FUNCTION_QUERY, params, null); + CentralV2RoleFunction appFunctionCode = appFunctionListFilter(code, domainCentralRoleFunction); + if (EcompPortalUtils.checkIfRemoteCentralAccessAllowed()) { + deleteRoleFunctionInExternalSystem(appFunctionCode, app); + // Delete role function dependency records + deleteAppRoleFunctions(appFunctionCode.getCode(), app); + } + dataAccessService.deleteDomainObject(appFunctionCode, null); + deleteFunctionResponse = true; + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "deleteCentralRoleFunction: failed", e); + } + return deleteFunctionResponse; + } + + /** + * It deletes app function record in portal + * + * @param code + * @param app + */ + private void deleteAppRoleFunctions(String code, EPApp app) { + dataAccessService.deleteDomainObjects(EPAppRoleFunction.class, + APP_ID_EQUALS + app.getId() + AND_FUNCTION_CD_EQUALS + code + "'", null); + } + + /** + * + * It deletes permission in the external auth system + * + * @param domainCentralRoleFunction + * @param app + * @throws Exception + */ + private void deleteRoleFunctionInExternalSystem(CentralV2RoleFunction domainCentralRoleFunction, EPApp app) + throws Exception { + try { + ObjectMapper mapper = new ObjectMapper(); + ExternalAccessPerms extPerms = new ExternalAccessPerms(); + String instanceValue = EcompPortalUtils.getFunctionCode(domainCentralRoleFunction.getCode()); + String checkType = getFunctionType(domainCentralRoleFunction.getCode()); + String actionValue = getFunctionAction(domainCentralRoleFunction.getCode()); + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + extPerms.setAction(actionValue); + extPerms.setInstance(instanceValue); + extPerms.setType(app.getNameSpace() + "." + checkType); + extPerms.setDescription(domainCentralRoleFunction.getName()); + String deleteRoleFunction = mapper.writeValueAsString(extPerms); + HttpEntity<String> entity = new HttpEntity<>(deleteRoleFunction, headers); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteRoleFunctionInExternalSystem: {} for DELETE: {} ", + CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE, deleteRoleFunction); + ResponseEntity<String> delPermResponse = template + .exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + + "perm?force=true", HttpMethod.DELETE, entity, String.class); + logger.debug(EELFLoggerDelegate.debugLogger, + "deleteRoleFunctionInExternalSystem: Finished deleting permission in External Auth system {} and status code: {} ", + deleteRoleFunction, delPermResponse.getStatusCode().value()); + } catch(HttpClientErrorException e){ + logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to delete functions in External System", e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); + } catch (Exception e) { + if (e.getMessage().equalsIgnoreCase("404 Not Found")) { + logger.debug(EELFLoggerDelegate.debugLogger, + " deleteRoleFunctionInExternalSystem: It seems like function is already deleted in external central auth system but exists in local DB", + e.getMessage()); + } else { + logger.error(EELFLoggerDelegate.errorLogger, "deleteRoleFunctionInExternalSystem: Failed to delete functions in External System", e); + } + } + } + + @Override + public ExternalRequestFieldsValidator saveRoleForApplication(Role saveRole, String uebkey) throws Exception { + boolean response = false; + String message = ""; + try { + EPApp app = getApp(uebkey).get(0); + addRoleInEcompDB(saveRole, app); + response = true; + } catch (Exception e) { + message = e.getMessage(); + logger.error(EELFLoggerDelegate.errorLogger, "saveRoleForApplication failed", e); + } + return new ExternalRequestFieldsValidator(response,message); + } + + @SuppressWarnings("unchecked") + @Override + public boolean deleteRoleForApplication(String deleteRole, String uebkey) throws Exception { + Session localSession = sessionFactory.openSession(); + Transaction transaction = null; + boolean result = false; + try { + List<EPRole> epRoleList = null; + EPApp app = getApp(uebkey).get(0); + final Map<String, String> deleteRoleParams = new HashMap<>(); + deleteRoleParams.put(APP_ROLE_NAME_PARAM, deleteRole); + if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) { + epRoleList = dataAccessService.executeNamedQuery(GET_PORTAL_APP_ROLES_QUERY, deleteRoleParams, null); + } else { + deleteRoleParams.put(APP_ID, String.valueOf(app.getId())); + epRoleList = dataAccessService.executeNamedQuery(GET_ROLE_TO_UPDATE_IN_EXTERNAL_AUTH_SYSTEM, deleteRoleParams, null); + } + if (!epRoleList.isEmpty()) { + transaction = localSession.beginTransaction(); + // Delete app role functions before deleting role + deleteRoleFunction(app, epRoleList); + if (app.getId() == 1) { + // Delete fn_user_ role + dataAccessService.deleteDomainObjects(EPUserApp.class, + APP_ID_EQUALS + app.getId() + " and role_id = " + epRoleList.get(0).getId(), null); + boolean isPortalRequest = false; + deleteRoleDependencyRecords(localSession, epRoleList.get(0).getId(), app.getId(), isPortalRequest); + } + deleteRoleInExternalAuthSystem(epRoleList, app); + transaction.commit(); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteRoleForApplication: committed the transaction"); + dataAccessService.deleteDomainObject(epRoleList.get(0), null); + } + result = true; + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "deleteRoleForApplication: failed", e); + result = false; + } finally { + localSession.close(); + } + return result; + } + + /** + * + * It deletes role for application in external auth system + * + * @param epRoleList contains role information + * @param app contains application information + * @throws Exception + */ + private void deleteRoleInExternalAuthSystem(List<EPRole> epRoleList, EPApp app) throws Exception { + ResponseEntity<String> deleteResponse; + ResponseEntity<String> res = getNameSpaceIfExists(app); + if (res.getStatusCode() == HttpStatus.OK) { + // Delete Role in External System + String deleteRoleKey = "{\"name\":\"" + app.getNameSpace() + "." + epRoleList.get(0).getName() + .replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_") + "\"}"; + deleteResponse = deleteRoleInExternalSystem(deleteRoleKey); + if (deleteResponse.getStatusCode().value() != 200 || deleteResponse.getStatusCode().value() != 404) { + EPLogUtil.logExternalAuthAccessAlarm(logger, deleteResponse.getStatusCode()); + logger.error(EELFLoggerDelegate.errorLogger, + "deleteRoleForApplication: Failed to delete role in external auth system! due to {} ", + deleteResponse.getBody()); + } + logger.debug(EELFLoggerDelegate.debugLogger, + "deleteRoleForApplication: about to commit the transaction"); + } + } + + /** + * + * It deletes application user role in external auth system + * + * @param role + * @param app + * @param LoginId + * @throws Exception + */ + private void deleteUserRoleInExternalSystem(EPRole role, EPApp app, String LoginId) throws Exception { + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + HttpEntity<String> entity = new HttpEntity<>(headers); + getNameSpaceIfExists(app); + logger.debug(EELFLoggerDelegate.debugLogger,"deleteUserRoleInExternalSystem: {} " , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); + ResponseEntity<String> getResponse = template + .exchange( + SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "userRole/" + + LoginId + + SystemProperties + .getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN) + + "/" + app.getNameSpace() + "." + role.getName().replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"), + HttpMethod.GET, entity, String.class); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteUserRoleInExternalSystem: Finished GET user roles from External Auth system and response: {} ", getResponse.getBody()); + if (getResponse.getStatusCode().value() != 200) { + throw new ExternalAuthSystemException(getResponse.getBody()); + } + String res = getResponse.getBody(); + if (!res.equals(IS_EMPTY_JSON_STRING)) { + HttpEntity<String> userRoleentity = new HttpEntity<>(headers); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteUserRoleInExternalSystem: {} " , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); + ResponseEntity<String> deleteResponse = template + .exchange( + SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + + "userRole/" + LoginId + + SystemProperties + .getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN) + + "/" + app.getNameSpace() + "." + role.getName().replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"), + HttpMethod.DELETE, userRoleentity, String.class); + if (deleteResponse.getStatusCode().value() != 200) { + throw new ExternalAuthSystemException("Failed to delete user role"); + } + logger.debug(EELFLoggerDelegate.debugLogger, "deleteUserRoleInExternalSystem: Finished deleting user role in External Auth system and status code: {} ", deleteResponse.getStatusCode().value()); + } + } + + @SuppressWarnings("unchecked") + @Override + public List<CentralV2Role> getActiveRoles(String uebkey) throws Exception { + List<CentralV2Role> roleList = new ArrayList<>(); + try { + List<EPApp> app = getApp(uebkey); + final Map<String, Long> params = new HashMap<>(); + // check if portal + Long appId = null; + if (!app.get(0).getId().equals(PortalConstants.PORTAL_APP_ID)) { + appId = app.get(0).getId(); + } + List<Criterion> restrictionsList = new ArrayList<Criterion>(); + Criterion active_ynCrt = Restrictions.eq("active", Boolean.TRUE); + Criterion appIdCrt; + if (appId == null) + appIdCrt = Restrictions.isNull("appId"); + else + appIdCrt = Restrictions.eq("appId", appId); + Criterion andCrit = Restrictions.and(active_ynCrt, appIdCrt); + restrictionsList.add(andCrit); + List<EPRole> epRole = (List<EPRole>) dataAccessService.getList(EPRole.class, null, restrictionsList, null); + roleList = createCentralRoleObject(app, epRole, roleList, params); + List<CentralV2Role> globalRoleList = getGlobalRolesOfApplication(app.get(0).getId()); + if (globalRoleList.size() > 0) + roleList.addAll(globalRoleList); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getActiveRoles: failed", e); + throw e; + } + return roleList; + + } + + @Override + @Transactional(rollbackFor = Exception.class) + public ExternalRequestFieldsValidator deleteDependencyRoleRecord(Long roleId, String uebkey, String LoginId) throws Exception { + Session localSession = sessionFactory.openSession(); + String message = ""; + Transaction transaction = null; + boolean response = false; + EPApp app = null; + try { + transaction = localSession.beginTransaction(); + List<EPRole> epRoleList = null; + app = getApp(uebkey).get(0); + if(app.getId().equals(PortalConstants.PORTAL_APP_ID)){ + epRoleList = getPortalAppRoleInfo(roleId); + } else{ + epRoleList = getPartnerAppRoleInfo(roleId, app); + } + if(EcompPortalUtils.checkIfRemoteCentralAccessAllowed()) { + // Delete User Role in External System before deleting role + deleteUserRoleInExternalSystem(epRoleList.get(0), app, LoginId); + } + // Delete user app roles + dataAccessService.deleteDomainObjects(EPUserApp.class, + APP_ID_EQUALS + app.getId() + " and role_id = " + epRoleList.get(0).getId(), null); + boolean isPortalRequest = false; + deleteRoleDependencyRecords(localSession, epRoleList.get(0).getId(), app.getId(), isPortalRequest); + transaction.commit(); + if (EcompPortalUtils.checkIfRemoteCentralAccessAllowed()) { + // Final call to delete role once all dependencies has been deleted + deleteRoleInExternalAuthSystem(epRoleList, app); + } + dataAccessService.deleteDomainObjects(EPRole.class, " role_id = "+ epRoleList.get(0).getId(), null); + logger.debug(EELFLoggerDelegate.debugLogger, "deleteDependencyRoleRecord: committed the transaction"); + response = true; + } catch(HttpClientErrorException e){ + logger.error(EELFLoggerDelegate.errorLogger, "deleteDependencyRoleRecord: HttpClientErrorException", e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); + message = e.getMessage(); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "deleteDependencyRoleRecord failed", e); + EcompPortalUtils.rollbackTransaction(transaction, + "deleteDependencyRoleRecord rollback, exception = " + e.toString()); + message = e.getMessage(); + } finally { + localSession.close(); + } + return new ExternalRequestFieldsValidator(response,message); + } + + @Override + @SuppressWarnings("unchecked") + @Transactional + public void syncRoleFunctionFromExternalAccessSystem(EPApp app) { + try { + + // get Permissions from External Auth System + JSONArray extPerms = getExtAuthPermissions(app); + List<ExternalAccessPermsDetail> permsDetailList = getExtAuthPerrmissonList(app, extPerms); + + // get functions in DB + final Map<String, Long> params = new HashMap<>(); + final Map<String, CentralV2RoleFunction> roleFuncMap = new HashMap<>(); + params.put(APP_ID, app.getId()); + List<CentralV2RoleFunction> appFunctions = dataAccessService.executeNamedQuery("getAllRoleFunctions", params, + null); + if (!appFunctions.isEmpty()) { + for (CentralV2RoleFunction roleFunc : appFunctions) { + roleFuncMap.put(roleFunc.getCode(), roleFunc); + } + } + + // get Roles for portal in DB + List<EPRole> portalRoleList = getGlobalRolesOfPortal(); + final Map<String, EPRole> existingPortalRolesMap = new HashMap<>(); + for(EPRole epRole : portalRoleList){ + existingPortalRolesMap.put(epRole.getName().replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"), epRole); + } + + // get Roles in DB + final Map<String, EPRole> currentRolesInDB = getCurrentRolesInDB(app); + + // store External Permissions with Pipe and without Pipe (just instance) + final Map<String, ExternalAccessPermsDetail> extAccessPermsContainsPipeMap = new HashMap<>(); + final Map<String, ExternalAccessPermsDetail> extAccessPermsMap = new HashMap<>(); + for (ExternalAccessPermsDetail permsDetailInfoWithPipe : permsDetailList) { + extAccessPermsContainsPipeMap.put(permsDetailInfoWithPipe.getInstance(), permsDetailInfoWithPipe); + String finalFunctionCodeVal = EcompPortalUtils.getFunctionCode(permsDetailInfoWithPipe.getInstance()); + extAccessPermsMap.put(finalFunctionCodeVal, permsDetailInfoWithPipe); + } + + // Add if new functions and app role functions were added in + // external auth system + for (ExternalAccessPermsDetail permsDetail : permsDetailList) { + String code = permsDetail.getInstance(); + CentralV2RoleFunction getFunctionCodeKey = roleFuncMap.get(permsDetail.getInstance()); + List<CentralV2RoleFunction> roleFunctionList = addGetLocalFunction(app, roleFuncMap, permsDetail, code, + getFunctionCodeKey); + List<String> roles = permsDetail.getRoles(); + if (roles != null) { + // Check if function has any roles and which does not exist + // in External Auth System. If exists delete in local + addRemoveIfFunctionsRolesIsSyncWithExternalAuth(app, currentRolesInDB, roleFunctionList, roles, existingPortalRolesMap); + } + } + + // Check if function does exits in External Auth System but exits in + // local then delete function and its dependencies + for (CentralV2RoleFunction roleFunc : appFunctions) { + try { + ExternalAccessPermsDetail getFunctionCodeContainsPipeKey = extAccessPermsContainsPipeMap + .get(roleFunc.getCode()); + if (null == getFunctionCodeContainsPipeKey) { + ExternalAccessPermsDetail getFunctionCodeKey = extAccessPermsMap.get(roleFunc.getCode()); + if (null == getFunctionCodeKey) { + deleteAppRoleFuncDoesNotExitsInExtSystem(app, roleFunc); + } + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, + "syncRoleFunctionFromExternalAccessSystem: Failed to delete function", e); + + } + } + + logger.debug(EELFLoggerDelegate.debugLogger, + "syncRoleFunctionFromExternalAccessSystem: Finished syncRoleFunctionFromExternalAccessSystem"); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, + "syncRoleFunctionFromExternalAccessSystem: Failed syncRoleFunctionFromExternalAccessSystem", e); + + } + } + + @SuppressWarnings("unchecked") + private void addRemoveIfFunctionsRolesIsSyncWithExternalAuth(EPApp app, final Map<String, EPRole> currentRolesInDB, + List<CentralV2RoleFunction> roleFunctionList, List<String> roles, Map<String, EPRole> existingPortalRolesMap) + throws Exception { + if (!roleFunctionList.isEmpty()) { + final Map<String, String> appRoleFuncParams = new HashMap<>(); + final Map<String, LocalRole> currentAppRoleFunctionsMap = new HashMap<>(); + final Map<String, String> currentRolesInExtSystem = new HashMap<>(); + appRoleFuncParams.put("functionCd", roleFunctionList.get(0).getCode()); + appRoleFuncParams.put("appId", String.valueOf(app.getId())); + List<LocalRole> localRoleList = dataAccessService.executeNamedQuery("getCurrentAppRoleFunctions", + appRoleFuncParams, null); + for (LocalRole localRole : localRoleList) { + currentAppRoleFunctionsMap.put(localRole.getRolename().replaceAll( + EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"), localRole); + } + for (String addRole : roles) { + currentRolesInExtSystem.put(addRole.substring(addRole.indexOf(FUNCTION_PIPE)+1), addRole); + } + for (String extAuthrole : roles) { + String roleNameSpace = extAuthrole.substring(0, extAuthrole.indexOf(FUNCTION_PIPE)); + boolean isNameSpaceMatching = EcompPortalUtils.checkNameSpaceMatching(roleNameSpace, app.getNameSpace()); + if (isNameSpaceMatching) { + if (!currentAppRoleFunctionsMap + .containsKey(extAuthrole.substring(app.getNameSpace().length() + 1))) { + EPRole localAddFuntionRole = currentRolesInDB + .get(extAuthrole.substring(app.getNameSpace().length() + 1)); + if (localAddFuntionRole == null) { + checkAndAddRoleInDB(app, currentRolesInDB, roleFunctionList, extAuthrole); + } else { + EPAppRoleFunction addAppRoleFunc = new EPAppRoleFunction(); + addAppRoleFunc.setAppId(app.getId()); + addAppRoleFunc.setCode(roleFunctionList.get(0).getCode()); + addAppRoleFunc.setRoleId(localAddFuntionRole.getId()); + dataAccessService.saveDomainObject(addAppRoleFunc, null); + } + } + // This block is to save global role function if exists + } else { + String extAuthAppRoleName = extAuthrole.substring(extAuthrole.indexOf(FUNCTION_PIPE) + 1); + boolean checkIfGlobalRoleExists = existingPortalRolesMap.containsKey(extAuthAppRoleName); + if (checkIfGlobalRoleExists) { + final Map<String, Long> params = new HashMap<>(); + EPRole role = existingPortalRolesMap.get(extAuthAppRoleName); + EPAppRoleFunction addGlobalRoleFunctions = new EPAppRoleFunction(); + params.put("appId", app.getId()); + params.put("roleId", role.getId()); + List<EPAppRoleFunction> currentGlobalRoleFunctionsList = dataAccessService.executeNamedQuery("getAppRoleFunctionOnRoleIdandAppId", params, null); + boolean checkIfRoleFunctionExists = currentGlobalRoleFunctionsList.stream().anyMatch(currentGlobalRoleFunction -> currentGlobalRoleFunction.getCode().equals(roleFunctionList.get(0).getCode())); + if (role != null && !checkIfRoleFunctionExists) { + addGlobalRoleFunctions.setAppId(app.getId()); + addGlobalRoleFunctions.setRoleId(role.getId()); + if (!app.getId().equals(role.getAppRoleId())) { + addGlobalRoleFunctions.setRoleAppId((PortalConstants.PORTAL_APP_ID).toString()); + } else { + addGlobalRoleFunctions.setRoleAppId(null); + } + addGlobalRoleFunctions.setCode(roleFunctionList.get(0).getCode()); + dataAccessService.saveDomainObject(addGlobalRoleFunctions, null); + } + } + } + } + for (LocalRole localRoleDelete : localRoleList) { + if (!currentRolesInExtSystem.containsKey(localRoleDelete.getRolename() + .replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"))) { + dataAccessService.deleteDomainObjects(EPAppRoleFunction.class, + APP_ID_EQUALS + app.getId() + AND_FUNCTION_CD_EQUALS + roleFunctionList.get(0).getCode() + + "'" + " and role_id = " + localRoleDelete.getRoleId().longValue(), + null); + } + } + } + } + + private void deleteAppRoleFuncDoesNotExitsInExtSystem(EPApp app, CentralV2RoleFunction roleFunc) { + logger.debug(EELFLoggerDelegate.debugLogger, + "syncRoleFunctionFromExternalAccessSystem: Deleting app role function {}", + roleFunc.getCode()); + dataAccessService.deleteDomainObjects(EPAppRoleFunction.class, + APP_ID_EQUALS + app.getId() + AND_FUNCTION_CD_EQUALS + roleFunc.getCode() +"'", null); + logger.debug(EELFLoggerDelegate.debugLogger, + "syncRoleFunctionFromExternalAccessSystem: Deleted app role function {}", + roleFunc.getCode()); + + logger.debug(EELFLoggerDelegate.debugLogger, + "syncRoleFunctionFromExternalAccessSystem: Deleting app function {}", + roleFunc.getCode()); + dataAccessService.deleteDomainObjects(CentralV2RoleFunction.class, + APP_ID_EQUALS + app.getId() + AND_FUNCTION_CD_EQUALS + roleFunc.getCode() +"'", null); + logger.debug(EELFLoggerDelegate.debugLogger, + "syncRoleFunctionFromExternalAccessSystem: Deleted app function {}", + roleFunc.getCode()); + } + + private void checkAndAddRoleInDB(EPApp app, final Map<String, EPRole> currentRolesInDB, + List<CentralV2RoleFunction> roleFunctionList, String roleList) throws Exception { + if (!currentRolesInDB.containsKey( + roleList.substring(app.getNameSpace().length() + 1))) { + Role role = addRoleInDBIfDoesNotExists(app, + roleList.substring(app.getNameSpace().length() + 1)); + addIfRoleDescriptionNotExitsInExtSystem(role, app); + if (!roleFunctionList.isEmpty()) { + try { + if (!roleFunctionList.isEmpty()) { + EPAppRoleFunction addAppRoleFunc = new EPAppRoleFunction(); + addAppRoleFunc.setAppId(app.getId()); + addAppRoleFunc.setCode(roleFunctionList.get(0).getCode()); + addAppRoleFunc.setRoleId(role.getId()); + dataAccessService.saveDomainObject(addAppRoleFunc, null); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, + "syncRoleFunctionFromExternalAccessSystem: Failed to save app role function ", + e); + } + } + } + } + + @SuppressWarnings("unchecked") + private List<CentralV2RoleFunction> addGetLocalFunction(EPApp app, final Map<String, CentralV2RoleFunction> roleFuncMap, + ExternalAccessPermsDetail permsDetail, String code, CentralV2RoleFunction getFunctionCodeKey) { + String finalFunctionCodeVal = addToLocalIfFunctionNotExists(app, roleFuncMap, permsDetail, code, + getFunctionCodeKey); + final Map<String, String> appSyncFuncsParams = new HashMap<>(); + appSyncFuncsParams.put("appId", String.valueOf(app.getId())); + appSyncFuncsParams.put("functionCd", finalFunctionCodeVal); + List<CentralV2RoleFunction> roleFunctionList = null; + roleFunctionList = dataAccessService.executeNamedQuery("getAppFunctionOnCodeAndAppId", appSyncFuncsParams, + null); + if (roleFunctionList.isEmpty()) { + appSyncFuncsParams.put("functionCd", code); + roleFunctionList = dataAccessService.executeNamedQuery("getAppFunctionOnCodeAndAppId", appSyncFuncsParams, + null); + } + return roleFunctionList; + } + + private String addToLocalIfFunctionNotExists(EPApp app, final Map<String, CentralV2RoleFunction> roleFuncMap, + ExternalAccessPermsDetail permsDetail, String code, CentralV2RoleFunction getFunctionCodeKey + ) { + String finalFunctionCodeVal = ""; + if (null == getFunctionCodeKey) { + finalFunctionCodeVal = EcompPortalUtils.getFunctionCode(permsDetail.getInstance()); + CentralV2RoleFunction checkIfCodeStillExits = roleFuncMap.get(finalFunctionCodeVal); + // If function does not exist in local then add! + if (null == checkIfCodeStillExits) { + logger.debug(EELFLoggerDelegate.debugLogger, + "syncRoleFunctionFromExternalAccessSystem: Adding function: {} ", code); + addFunctionInEcompDB(app, permsDetail, code); + logger.debug(EELFLoggerDelegate.debugLogger, + "syncRoleFunctionFromExternalAccessSystem: Finished adding function: {} ", code); + } + } + return finalFunctionCodeVal; + } + + @SuppressWarnings("unchecked") + @Override + public Map<String, EPRole> getCurrentRolesInDB(EPApp app) { + final Map<String, EPRole> currentRolesInDB = new HashMap<>(); + List<EPRole> getCurrentRoleList = null; + final Map<String, Long> appParams = new HashMap<>(); + if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) { + getCurrentRoleList = dataAccessService.executeNamedQuery("getPortalAppRolesList", null, null); + } else { + appParams.put("appId", app.getId()); + getCurrentRoleList = dataAccessService.executeNamedQuery("getPartnerAppRolesList", appParams, null); + } + for (EPRole role : getCurrentRoleList) { + currentRolesInDB.put(role.getName() + .replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"), role); + } + return currentRolesInDB; + } + + private List<ExternalAccessPermsDetail> getExtAuthPerrmissonList(EPApp app, JSONArray extPerms) + throws IOException{ + ExternalAccessPermsDetail permDetails = null; + List<ExternalAccessPermsDetail> permsDetailList = new ArrayList<>(); + for (int i = 0; i < extPerms.length(); i++) { + String description = null; + if (extPerms.getJSONObject(i).has("description")) { + description = extPerms.getJSONObject(i).getString(EXTERNAL_AUTH_ROLE_DESCRIPTION); + } else { + description = extPerms.getJSONObject(i).getString("instance"); + } + if (extPerms.getJSONObject(i).has("roles")) { + ObjectMapper rolesListMapper = new ObjectMapper(); + JSONArray resRoles = extPerms.getJSONObject(i).getJSONArray("roles"); + List<String> list = rolesListMapper.readValue(resRoles.toString(), + TypeFactory.defaultInstance().constructCollectionType(List.class, String.class)); + permDetails = new ExternalAccessPermsDetail(extPerms.getJSONObject(i).getString("type"), + extPerms.getJSONObject(i).getString("type").substring(app.getNameSpace().length() + 1) + + FUNCTION_PIPE + extPerms.getJSONObject(i).getString("instance") + FUNCTION_PIPE + + extPerms.getJSONObject(i).getString("action"), + extPerms.getJSONObject(i).getString("action"), list, description); + permsDetailList.add(permDetails); + } else { + permDetails = new ExternalAccessPermsDetail(extPerms.getJSONObject(i).getString("type"), + extPerms.getJSONObject(i).getString("type").substring(app.getNameSpace().length() + 1) + + FUNCTION_PIPE + extPerms.getJSONObject(i).getString("instance") + FUNCTION_PIPE + + extPerms.getJSONObject(i).getString("action"), + extPerms.getJSONObject(i).getString("action"), description); + permsDetailList.add(permDetails); + } + } + return permsDetailList; + } + + private JSONArray getExtAuthPermissions(EPApp app) throws Exception { + ResponseEntity<String> response = null; + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + HttpEntity<String> entity = new HttpEntity<>(headers); + logger.debug(EELFLoggerDelegate.debugLogger, "syncRoleFunctionFromExternalAccessSystem: {} ", + CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); + response = template + .exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + + "perms/ns/" + app.getNameSpace(), HttpMethod.GET, entity, String.class); + + String res = response.getBody(); + logger.debug(EELFLoggerDelegate.debugLogger, + "syncRoleFunctionFromExternalAccessSystem: Finished GET permissions from External Auth system and response: {} ", + response.getBody()); + JSONObject jsonObj = new JSONObject(res); + JSONArray extPerms = jsonObj.getJSONArray("perm"); + for (int i = 0; i < extPerms.length(); i++) { + if (extPerms.getJSONObject(i).getString("type").equals(app.getNameSpace() + ".access")) { + extPerms.remove(i); + i--; + } + } + return extPerms; + } + + /** + * + * Add function into local DB + * + * @param app + * @param permsDetail + * @param code + */ + private void addFunctionInEcompDB(EPApp app, ExternalAccessPermsDetail permsDetail, String code) { + try{ + CentralV2RoleFunction addFunction = new CentralV2RoleFunction(); + addFunction.setAppId(app.getId()); + addFunction.setCode(code); + addFunction.setName(permsDetail.getDescription()); + dataAccessService.saveDomainObject(addFunction, null); + } catch(Exception e){ + logger.error(EELFLoggerDelegate.errorLogger, "addFunctionInEcompDB: Failed to add function", e); + } + } + + /** + * + * It updates description of a role in external auth system + * + * @param role + * @param app + * @throws Exception + */ + private void addIfRoleDescriptionNotExitsInExtSystem(Role role, EPApp app) throws Exception { + String addRoleNew = updateExistingRoleInExternalSystem(role, app); + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + try { + HttpEntity<String> entity = new HttpEntity<>(addRoleNew, headers); + template.exchange( + SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role", + HttpMethod.PUT, entity, String.class); + } catch (HttpClientErrorException e) { + logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to addIfRoleDescriptionNotExitsInExtSystem", + e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "addIfRoleDescriptionNotExitsInExtSystem: Failed", + e); + } + } + + /** + * + * While sync functions form external auth system if new role found we should add in local and return Role.class object + * + * @param app + * @param role + * @return + */ + @SuppressWarnings("unchecked") + private Role addRoleInDBIfDoesNotExists(EPApp app, String role) { + Role setNewRole = new Role(); + try { + // functions can have new role created in External Auth System prevent + // duplication here + boolean isCreated = checkIfRoleExitsElseCreateInSyncFunctions(role, app); + final Map<String, String> getRoleByNameParams = new HashMap<>(); + List<EPRole> getRoleCreated = null; + getRoleByNameParams.put(APP_ROLE_NAME_PARAM, role); + if (!app.getId().equals(PortalConstants.PORTAL_APP_ID)) { + getRoleByNameParams.put("appId", String.valueOf(app.getId())); + List<EPRole> roleCreated = dataAccessService + .executeNamedQuery(GET_ROLE_TO_UPDATE_IN_EXTERNAL_AUTH_SYSTEM, getRoleByNameParams, null); + if (!isCreated) { + EPRole epUpdateRole = roleCreated.get(0); + epUpdateRole.setAppRoleId(epUpdateRole.getId()); + dataAccessService.saveDomainObject(epUpdateRole, null); + getRoleCreated = dataAccessService.executeNamedQuery(GET_ROLE_TO_UPDATE_IN_EXTERNAL_AUTH_SYSTEM, + getRoleByNameParams, null); + } else { + getRoleCreated = roleCreated; + } + } else { + getRoleCreated = dataAccessService.executeNamedQuery(GET_PORTAL_APP_ROLES_QUERY, getRoleByNameParams, + null); + } + if (getRoleCreated != null && !getRoleCreated.isEmpty()) { + EPRole roleObject = getRoleCreated.get(0); + setNewRole.setId(roleObject.getId()); + setNewRole.setName(roleObject.getName()); + setNewRole.setActive(roleObject.getActive()); + setNewRole.setPriority(roleObject.getPriority()); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "addRoleInDBIfDoesNotExists: Failed", e); + } + return setNewRole; + } + + @SuppressWarnings("unchecked") + private boolean checkIfRoleExitsElseCreateInSyncFunctions(String role, EPApp app) { + boolean isCreated = false; + final Map<String, String> roleParams = new HashMap<>(); + roleParams.put(APP_ROLE_NAME_PARAM, role); + List<EPRole> roleCreated = null; + if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) { + roleCreated = dataAccessService.executeNamedQuery(GET_ROLE_TO_UPDATE_IN_EXTERNAL_AUTH_SYSTEM, roleParams, + null); + } else { + roleParams.put("appId", String.valueOf(app.getId())); + roleCreated = dataAccessService.executeNamedQuery(GET_ROLE_TO_UPDATE_IN_EXTERNAL_AUTH_SYSTEM, roleParams, + null); + } + if (roleCreated == null || roleCreated.isEmpty()) { + roleParams.put("appId", String.valueOf(app.getId())); + EPRole epRoleNew = new EPRole(); + epRoleNew.setActive(true); + epRoleNew.setName(role); + if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) { + epRoleNew.setAppId(null); + } else { + epRoleNew.setAppId(app.getId()); + } + dataAccessService.saveDomainObject(epRoleNew, null); + isCreated = false; + } else { + isCreated = true; + } + return isCreated; + } + + @Override + @SuppressWarnings("unchecked") + public Integer bulkUploadFunctions(String uebkey) throws Exception { + EPApp app = getApp(uebkey).get(0); + List<RoleFunction> roleFuncList = dataAccessService.executeNamedQuery("getAllFunctions", null, null); + CentralV2RoleFunction cenRoleFunc = null; + Integer functionsAdded = 0; + try { + for (RoleFunction roleFunc : roleFuncList) { + cenRoleFunc = new CentralV2RoleFunction(roleFunc.getCode(), roleFunc.getName()); + addRoleFunctionInExternalSystem(cenRoleFunc, app); + functionsAdded++; + } + } catch(HttpClientErrorException e){ + logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - bulkUploadFunctions failed", e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadFunctions: failed", e.getMessage(), e); + } + return functionsAdded; + } + + @Override + public Integer bulkUploadRoles(String uebkey) throws Exception { + List<EPApp> app = getApp(uebkey); + List<EPRole> roles = getAppRoles(app.get(0).getId()); + List<CentralV2Role> cenRoleList = new ArrayList<>(); + final Map<String, Long> params = new HashMap<>(); + Integer rolesListAdded = 0; + try { + cenRoleList = createCentralRoleObject(app, roles, cenRoleList, params); + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false); + String roleList = mapper.writeValueAsString(cenRoleList); + List<Role> roleObjectList = mapper.readValue(roleList, + TypeFactory.defaultInstance().constructCollectionType(List.class, Role.class)); + for (Role role : roleObjectList) { + addRoleInExternalSystem(role, app.get(0)); + rolesListAdded++; + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRoles: failed", e); + throw e; + } + return rolesListAdded; + } + + /** + * It creating new role in external auth system while doing bulk upload + * + * @param role + * @param app + * @throws Exception + */ + private void addRoleInExternalSystem(Role role, EPApp app) throws Exception { + String addRoleNew = updateExistingRoleInExternalSystem(role, app); + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + try { + HttpEntity<String> entity = new HttpEntity<>(addRoleNew, headers); + template.exchange( + SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role", + HttpMethod.POST, entity, String.class); + } catch(HttpClientErrorException e){ + logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to addRoleInExternalSystem", e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); + } catch (Exception e) { + if (e.getMessage().equalsIgnoreCase("409 Conflict")) { + logger.error(EELFLoggerDelegate.errorLogger, "addRoleInExternalSystem: Role already exits but does not break functionality", e); + } else { + logger.error(EELFLoggerDelegate.errorLogger, "addRoleInExternalSystem: Failed to addRoleInExternalSystem", e.getMessage()); + } + } + } + + @Override + @SuppressWarnings("unchecked") + public Integer bulkUploadRolesFunctions(String uebkey) throws Exception { + EPApp app = getApp(uebkey).get(0); + List<EPRole> roles = getAppRoles(app.getId()); + final Map<String, Long> params = new HashMap<>(); + Integer roleFunctions = 0; + try { + for (EPRole role : roles) { + params.put("roleId", role.getId()); + List<BulkUploadRoleFunction> appRoleFunc = dataAccessService.executeNamedQuery("uploadAllRoleFunctions", + params, null); + if (!appRoleFunc.isEmpty()) { + for (BulkUploadRoleFunction addRoleFunc : appRoleFunc) { + addRoleFunctionsInExternalSystem(addRoleFunc, role, app); + roleFunctions++; + } + } + } + } catch(HttpClientErrorException e){ + logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to bulkUploadRolesFunctions", e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRolesFunctions: failed", e); + } + return roleFunctions; + } + + /** + * Its adding a role function while doing bulk upload + * + * @param addRoleFunc + * @param role + * @param app + */ + private void addRoleFunctionsInExternalSystem(BulkUploadRoleFunction addRoleFunc, EPRole role, EPApp app) { + String checkType = addRoleFunc.getFunctionCd().contains("menu") ? "menu" : "url"; + ExternalAccessRolePerms extRolePerms = null; + ExternalAccessPerms extPerms = null; + ObjectMapper mapper = new ObjectMapper(); + try { + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + + extPerms = new ExternalAccessPerms(app.getNameSpace() + "." + checkType, addRoleFunc.getFunctionCd(), "*", + addRoleFunc.getFunctionName()); + extRolePerms = new ExternalAccessRolePerms(extPerms, + app.getNameSpace() + "." + role.getName().replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_")); + String updateRolePerms = mapper.writeValueAsString(extRolePerms); + HttpEntity<String> entity = new HttpEntity<>(updateRolePerms, headers); + template.exchange( + SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role/perm", + HttpMethod.POST, entity, String.class); + } catch (Exception e) { + if (e.getMessage().equalsIgnoreCase("409 Conflict")) { + logger.error(EELFLoggerDelegate.errorLogger, + "addRoleFunctionsInExternalSystem: RoleFunction already exits but does not break functionality", e); + } else { + logger.error(EELFLoggerDelegate.errorLogger, "addRoleFunctionsInExternalSystem: Failed to addRoleFunctionsInExternalSystem", + e.getMessage()); + } + } + } + + @Override + public void bulkUploadPartnerFunctions(String uebkey, List<RoleFunction> roleFunctionsList) throws Exception { + EPApp app = getApp(uebkey).get(0); + CentralV2RoleFunction cenRoleFunc = null; + for (RoleFunction roleFunction : roleFunctionsList) { + cenRoleFunc = new CentralV2RoleFunction(roleFunction.getCode(), roleFunction.getName()); + addRoleFunctionInExternalSystem(cenRoleFunc, app); + } + } + + @Override + public void bulkUploadPartnerRoles(String uebkey, List<Role> roleList) throws Exception { + EPApp app = getApp(uebkey).get(0); + for (Role role : roleList) { + addRoleInExternalSystem(role, app); + } + } + + @SuppressWarnings("unchecked") + @Override + public void bulkUploadPartnerRoleFunctions(String uebkey, List<Role> roleList) throws Exception { + EPApp app = getApp(uebkey).get(0); + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + for (Role role : roleList) { + try { + Set<RoleFunction> roleFunctionList = role.getRoleFunctions(); + List<RoleFunction> roleFunctionListNew = new ArrayList<>(); + ObjectMapper roleFunctionsMapper = new ObjectMapper(); + Iterator<RoleFunction> itetaror = roleFunctionList.iterator(); + while (itetaror.hasNext()) { + Object nextValue = itetaror.next(); + RoleFunction roleFunction = roleFunctionsMapper.convertValue(nextValue, RoleFunction.class); + roleFunctionListNew.add(roleFunction); + } + List<RoleFunction> listWithoutDuplicates = roleFunctionListNew.stream().distinct() + .collect(Collectors.toList()); + for (RoleFunction roleFunction : listWithoutDuplicates) { + String checkType = roleFunction.getCode().contains("menu") ? "menu" : "url"; + ExternalAccessRolePerms extRolePerms = null; + ExternalAccessPerms extPerms = null; + ObjectMapper mapper = new ObjectMapper(); + extPerms = new ExternalAccessPerms(app.getNameSpace() + "." + checkType, roleFunction.getCode(), + "*"); + extRolePerms = new ExternalAccessRolePerms(extPerms, + app.getNameSpace() + "." + role.getName().replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_")); + String updateRolePerms = mapper.writeValueAsString(extRolePerms); + HttpEntity<String> entity = new HttpEntity<>(updateRolePerms, headers); + template.exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + + "role/perm", HttpMethod.PUT, entity, String.class); + } + } catch (Exception e) { + if (e.getMessage().equalsIgnoreCase("409 Conflict")) { + logger.error(EELFLoggerDelegate.errorLogger, + "bulkUploadPartnerRoleFunctions: RoleFunction already exits but does not break functionality"); + } else { + logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadPartnerRoleFunctions: Failed to addRoleFunctionsInExternalSystem", + e); + } + } + + } + } + + @Override + @Transactional + public void syncApplicationRolesWithEcompDB(EPApp app) { + try { + logger.debug(EELFLoggerDelegate.debugLogger, "syncRoleFunctionFromExternalAccessSystem: Started"); + //Sync functions and roles assigned to it which also creates new roles if does not exits in portal + syncRoleFunctionFromExternalAccessSystem(app); + logger.debug(EELFLoggerDelegate.debugLogger, "syncRoleFunctionFromExternalAccessSystem: Finished"); + + ObjectMapper mapper = new ObjectMapper(); + logger.debug(EELFLoggerDelegate.debugLogger, "Entering to getAppRolesJSONFromExtAuthSystem"); + // Get Permissions from External Auth System + JSONArray extRole = getAppRolesJSONFromExtAuthSystem(app); + + logger.debug(EELFLoggerDelegate.debugLogger, "Entering into getExternalRoleDetailsList"); + List<ExternalRoleDetails> externalRoleDetailsList = getExternalRoleDetailsList(app, + mapper, extRole); + + List<EPRole> finalRoleList = new ArrayList<>(); + for (ExternalRoleDetails externalRole : externalRoleDetailsList) { + EPRole ecompRole = convertExternalRoleDetailstoEpRole(externalRole); + finalRoleList.add(ecompRole); + } + + List<EPRole> applicationRolesList; + applicationRolesList = getAppRoles(app.getId()); + List<String> applicationRoleIdList = new ArrayList<>(); + for (EPRole applicationRole : applicationRolesList) { + applicationRoleIdList.add(applicationRole.getName()); + } + + List<EPRole> roleListToBeAddInEcompDB = new ArrayList<>(); + for (EPRole aafRole : finalRoleList) { + if (!applicationRoleIdList.contains(aafRole.getName())) { + roleListToBeAddInEcompDB.add(aafRole); + } + } + + logger.debug(EELFLoggerDelegate.debugLogger, "Entering into inactiveRolesNotInExternalAuthSystem"); + // Check if roles exits in external Access system and if not make inactive in DB + inactiveRolesNotInExternalAuthSystem(app, finalRoleList, applicationRolesList); + + logger.debug(EELFLoggerDelegate.debugLogger, "Entering into checkAndUpdateRoleInDB"); + // It checks properties in the external auth system app role description and updates role in local + checkAndUpdateRoleInDB(app, finalRoleList); + + logger.debug(EELFLoggerDelegate.debugLogger, "Entering into addNewRoleInEcompDBUpdateDescInExtAuthSystem"); + // Add new roles in DB and updates role description in External Auth System + addNewRoleInEcompDBUpdateDescInExtAuthSystem(app, roleListToBeAddInEcompDB); + logger.debug(EELFLoggerDelegate.debugLogger, "syncApplicationRolesWithEcompDB: Finished"); + } catch (HttpClientErrorException e) { + logger.error(EELFLoggerDelegate.errorLogger, "syncApplicationRolesWithEcompDB: Failed due to the External Auth System", e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "syncApplicationRolesWithEcompDB: Failed ", e); + } + } + + /** + * + * It adds new roles in DB and updates description in External Auth System + * + * @param app + * @param roleListToBeAddInEcompDB + */ + @SuppressWarnings("unchecked") + private void addNewRoleInEcompDBUpdateDescInExtAuthSystem(EPApp app, List<EPRole> roleListToBeAddInEcompDB) { + EPRole roleToBeAddedInEcompDB; + for (int i = 0; i < roleListToBeAddInEcompDB.size(); i++) { + try { + roleToBeAddedInEcompDB = roleListToBeAddInEcompDB.get(i); + if (app.getId() == 1) { + roleToBeAddedInEcompDB.setAppRoleId(null); + } + dataAccessService.saveDomainObject(roleToBeAddedInEcompDB, null); + List<EPRole> getRoleCreatedInSync = null; + if (!app.getId().equals(PortalConstants.PORTAL_APP_ID)) { + final Map<String, String> globalRoleParams = new HashMap<>(); + globalRoleParams.put("appId", String.valueOf(app.getId())); + globalRoleParams.put("appRoleName", roleToBeAddedInEcompDB.getName()); + getRoleCreatedInSync = dataAccessService.executeNamedQuery(GET_ROLE_TO_UPDATE_IN_EXTERNAL_AUTH_SYSTEM, globalRoleParams, null); + EPRole epUpdateRole = getRoleCreatedInSync.get(0); + epUpdateRole.setAppRoleId(epUpdateRole.getId()); + dataAccessService.saveDomainObject(epUpdateRole, null); + } + List<EPRole> roleList = new ArrayList<>(); + final Map<String, String> params = new HashMap<>(); + + params.put(APP_ROLE_NAME_PARAM, roleToBeAddedInEcompDB.getName()); + boolean isPortalRole = false; + if (app.getId() == 1) { + isPortalRole = true; + roleList = dataAccessService.executeNamedQuery(GET_PORTAL_APP_ROLES_QUERY, params, null); + } else { + isPortalRole = false; + params.put(APP_ID, app.getId().toString()); + roleList = dataAccessService.executeNamedQuery(GET_ROLE_TO_UPDATE_IN_EXTERNAL_AUTH_SYSTEM, params, null); + } + EPRole role = roleList.get(0); + Role aaFrole = new Role(); + aaFrole.setId(role.getId()); + aaFrole.setActive(role.getActive()); + aaFrole.setPriority(role.getPriority()); + aaFrole.setName(role.getName()); + updateRoleInExternalSystem(aaFrole, app, isPortalRole); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, + "SyncApplicationRolesWithEcompDB: Failed to add or update role in external auth system", e); + } + } + } + + /** + * + * It checks description in External Auth System if found any changes updates in DB + * + * @param app + * @param finalRoleList contains list of External Auth System roles list which is converted to EPRole + */ + @SuppressWarnings("unchecked") + private void checkAndUpdateRoleInDB(EPApp app, List<EPRole> finalRoleList) { + for (EPRole roleItem : finalRoleList) { + final Map<String, String> roleParams = new HashMap<>(); + List<EPRole> currentList = null; + roleParams.put(APP_ROLE_NAME_PARAM, roleItem.getName()); + if (app.getId() == 1) { + currentList = dataAccessService.executeNamedQuery(GET_PORTAL_APP_ROLES_QUERY, roleParams, null); + } else { + roleParams.put(APP_ID, app.getId().toString()); + currentList = dataAccessService.executeNamedQuery(GET_ROLE_TO_UPDATE_IN_EXTERNAL_AUTH_SYSTEM, roleParams, null); + } + + if (!currentList.isEmpty()) { + try { + Boolean aafRoleActive; + Boolean localRoleActive; + boolean result; + aafRoleActive = Boolean.valueOf(roleItem.getActive()); + localRoleActive = Boolean.valueOf(currentList.get(0).getActive()); + result = aafRoleActive.equals(localRoleActive); + EPRole updateRole = currentList.get(0); + + if (!result) { + updateRole.setActive(roleItem.getActive()); + dataAccessService.saveDomainObject(updateRole, null); + } + if (roleItem.getPriority() != null + && !currentList.get(0).getPriority().equals(roleItem.getPriority())) { + updateRole.setPriority(roleItem.getPriority()); + dataAccessService.saveDomainObject(updateRole, null); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, + "syncApplicationRolesWithEcompDB: Failed to update role ", e); + } + } + } + } + /** + * + * It de-activates application roles in DB if not present in External Auth system + * + * @param app + * @param finalRoleList contains list of current roles present in External Auth System + * @param applicationRolesList contains list of current roles present in DB + */ + @SuppressWarnings("unchecked") + private void inactiveRolesNotInExternalAuthSystem(EPApp app, List<EPRole> finalRoleList, + List<EPRole> applicationRolesList) { + final Map<String, EPRole> checkRolesInactive = new HashMap<>(); + for (EPRole extrole : finalRoleList) { + checkRolesInactive.put(extrole.getName(), extrole); + } + for (EPRole role : applicationRolesList) { + try { + final Map<String, String> extRoleParams = new HashMap<>(); + List<EPRole> roleList = null; + extRoleParams.put(APP_ROLE_NAME_PARAM, role.getName()); + if (!checkRolesInactive.containsKey(role.getName())) { + if (app.getId() == 1) { + roleList = dataAccessService.executeNamedQuery(GET_PORTAL_APP_ROLES_QUERY, extRoleParams, null); + } else { + extRoleParams.put(APP_ID, app.getId().toString()); + roleList = dataAccessService.executeNamedQuery(GET_ROLE_TO_UPDATE_IN_EXTERNAL_AUTH_SYSTEM, extRoleParams, null); + } + EPRole updateRoleInactive = roleList.get(0); + updateRoleInactive.setActive(false); + dataAccessService.saveDomainObject(updateRoleInactive, null); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, + "syncApplicationRolesWithEcompDB: Failed to de-activate role ", e); + } + } + } + + @Override + @SuppressWarnings("unchecked") + public List<ExternalRoleDetails> getExternalRoleDetailsList(EPApp app, + ObjectMapper mapper, JSONArray extRole) + throws IOException { + List<ExternalRoleDetails> externalRoleDetailsList = new ArrayList<>(); + ExternalRoleDescription ApplicationRole = new ExternalRoleDescription(); + ExternalAccessPerms externalAccessPerms = new ExternalAccessPerms(); + List<String> functionCodelist = new ArrayList<>(); + for (int i = 0; i < extRole.length(); i++) { + ExternalRoleDetails externalRoleDetail = new ExternalRoleDetails(); + EPAppRoleFunction ePAppRoleFunction = new EPAppRoleFunction(); + JSONObject Role = (JSONObject) extRole.get(i); + if (!extRole.getJSONObject(i).has(EXTERNAL_AUTH_ROLE_DESCRIPTION)) { + ApplicationRole.setActive("true"); + ApplicationRole.setAppId(IS_NULL_STRING); + ApplicationRole.setPriority(IS_NULL_STRING); + ApplicationRole.setAppRoleId(IS_NULL_STRING); + String roleName = extRole.getJSONObject(i).getString(ROLE_NAME); + ApplicationRole.setName(roleName.substring(app.getNameSpace().length() + 1)); + } else { + String desc = extRole.getJSONObject(i).getString(EXTERNAL_AUTH_ROLE_DESCRIPTION); + ApplicationRole = mapper.readValue(desc, ExternalRoleDescription.class); + } + + SortedSet<ExternalAccessPerms> externalAccessPermsOfRole = new TreeSet<>(); + if (extRole.getJSONObject(i).has(EXTERNAL_AUTH_PERMS)) { + JSONArray extPerm = (JSONArray) Role.get(EXTERNAL_AUTH_PERMS); + for (int j = 0; j < extPerm.length(); j++) { + JSONObject perms = extPerm.getJSONObject(j); + boolean isNamespaceMatching = EcompPortalUtils.checkNameSpaceMatching(perms.getString("type"), app.getNameSpace()); + if (isNamespaceMatching) { + externalAccessPerms = new ExternalAccessPerms(perms.getString("type"), + perms.getString("instance"), perms.getString("action")); + ePAppRoleFunction.setCode(externalAccessPerms.getInstance()); + functionCodelist.add(ePAppRoleFunction.getCode()); + externalAccessPermsOfRole.add(externalAccessPerms); + } + + } + } + + if (ApplicationRole.getActive().equals(IS_NULL_STRING)) { + externalRoleDetail.setActive(false); + } else { + externalRoleDetail.setActive(Boolean.parseBoolean(ApplicationRole.getActive())); + } + externalRoleDetail.setName(ApplicationRole.getName()); + + if (ApplicationRole.getAppId().equals(IS_NULL_STRING) && app.getId() == 1) { + externalRoleDetail.setAppId(null); + } else if (ApplicationRole.getAppId().equals(IS_NULL_STRING)) { + externalRoleDetail.setAppId(app.getId()); + } else { + externalRoleDetail.setAppId(Long.parseLong(ApplicationRole.getAppId())); + } + + if (ApplicationRole.getPriority().equals(IS_NULL_STRING)) { + externalRoleDetail.setPriority(null); + } else { + externalRoleDetail.setPriority(Integer.parseInt(ApplicationRole.getPriority())); + } + + if (ApplicationRole.getAppRoleId().equals(IS_NULL_STRING) && app.getId() == 1) { + externalRoleDetail.setAppRoleId(null); + } + + // get role functions from DB + final Map<String, EPAppRoleFunction> roleFunctionsMap = new HashMap<>(); + if (!ApplicationRole.getId().equals(IS_NULL_STRING)) { + final Map<String, Long> appRoleFuncsParams = new HashMap<>(); + appRoleFuncsParams.put("appId", app.getId()); + appRoleFuncsParams.put("roleId", Long.valueOf(ApplicationRole.getId())); + List<EPAppRoleFunction> appRoleFunctions = dataAccessService.executeNamedQuery("getAppRoleFunctionOnRoleIdandAppId", appRoleFuncsParams, null); + if (!appRoleFunctions.isEmpty()) { + for (EPAppRoleFunction roleFunc : appRoleFunctions) { + roleFunctionsMap.put(roleFunc.getCode(), roleFunc); + } + } + } + + if (!externalAccessPermsOfRole.isEmpty()) { + // Adding functions to role + for (ExternalAccessPerms externalpermission : externalAccessPermsOfRole) { + EPAppRoleFunction checkRoleFunctionExits = roleFunctionsMap.get(externalpermission.getInstance()); + if (checkRoleFunctionExits == null) { + String funcCode = externalpermission.getType().substring(app.getNameSpace().length() + 1) + + FUNCTION_PIPE + externalAccessPerms.getInstance() + FUNCTION_PIPE + + externalAccessPerms.getAction(); + EPAppRoleFunction checkRoleFunctionPipeExits = roleFunctionsMap.get(funcCode); + if (checkRoleFunctionPipeExits == null) { + try { + final Map<String, String> appFuncsParams = new HashMap<>(); + appFuncsParams.put("appId", String.valueOf(app.getId())); + appFuncsParams.put("functionCd", externalpermission.getInstance()); + logger.debug(EELFLoggerDelegate.debugLogger, + "SyncApplicationRolesWithEcompDB: Adding function to the role: {}", + externalpermission.getInstance()); + List<CentralV2RoleFunction> roleFunction = null; + roleFunction = dataAccessService.executeNamedQuery("getAppFunctionOnCodeAndAppId", appFuncsParams, null); + if (roleFunction.isEmpty()) { + appFuncsParams.put("functionCd", funcCode); + roleFunction = dataAccessService.executeNamedQuery("getAppFunctionOnCodeAndAppId", appFuncsParams, null); + } + if (!roleFunction.isEmpty()) { + EPAppRoleFunction apRoleFunction = new EPAppRoleFunction(); + apRoleFunction.setAppId(app.getId()); + apRoleFunction.setRoleId(Long.parseLong(ApplicationRole.getId())); + apRoleFunction.setCode(roleFunction.get(0).getCode()); + dataAccessService.saveDomainObject(apRoleFunction, null); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, + "SyncApplicationRolesWithEcompDB: Failed to add role function", e); + } + } + } + } + } + externalRoleDetailsList.add(externalRoleDetail); + } + return externalRoleDetailsList; + } + + @Override + public JSONArray getAppRolesJSONFromExtAuthSystem(EPApp app) throws Exception { + ResponseEntity<String> response = null; + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + HttpEntity<String> entity = new HttpEntity<>(headers); + logger.debug(EELFLoggerDelegate.debugLogger, "syncApplicationRolesWithEcompDB: {} ", + CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); + response = template + .exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + + "roles/ns/" + app.getNameSpace(), HttpMethod.GET, entity, String.class); + String res = response.getBody(); + logger.debug(EELFLoggerDelegate.debugLogger, + "syncApplicationRolesWithEcompDB: Finished GET roles from External Auth system and the result is :", + res); + JSONObject jsonObj = new JSONObject(res); + JSONArray extRole = jsonObj.getJSONArray("role"); + for (int i = 0; i < extRole.length(); i++) { + if (extRole.getJSONObject(i).getString(ROLE_NAME).equals(app.getNameSpace() + ADMIN) + || extRole.getJSONObject(i).getString(ROLE_NAME).equals(app.getNameSpace() + OWNER) + || (extRole.getJSONObject(i).getString(ROLE_NAME).equals(app.getNameSpace() + ACCOUNT_ADMINISTRATOR) + && !app.getId().equals(PortalConstants.PORTAL_APP_ID))) { + extRole.remove(i); + i--; + } + } + return extRole; + } + + @Override + public JSONArray getAllUsersByRole(String roleName) throws Exception{ + ResponseEntity<String> response = null; + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + HttpEntity<String> entity = new HttpEntity<>(headers); + logger.debug(EELFLoggerDelegate.debugLogger, "getAllUsersByRole: {} ", + CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); + response = template + .exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + + "userRoles/role/" + roleName, HttpMethod.GET, entity, String.class); + String res = response.getBody(); + logger.debug(EELFLoggerDelegate.debugLogger, + "syncApplicationRolesWithEcompDB: Finished GET roles from External Auth system and the result is :", + res); + JSONObject jsonObj = new JSONObject(res); + JSONArray extRole = jsonObj.getJSONArray("userRole"); + + return extRole; + } + + /** + * + * It converts from ExternalRoleDetails.class object to EPRole.class object + * + * @param externalRoleDetails + * @return EPRole object + */ + private EPRole convertExternalRoleDetailstoEpRole(ExternalRoleDetails externalRoleDetails) { + EPRole role = new EPRole(); + role.setActive(externalRoleDetails.isActive()); + role.setAppId(externalRoleDetails.getAppId()); + role.setAppRoleId(externalRoleDetails.getAppRoleId()); + role.setName(externalRoleDetails.getName()); + role.setPriority(externalRoleDetails.getPriority()); + return role; + } + + @SuppressWarnings("unchecked") + @Override + public Integer bulkUploadUserRoles(String uebkey) throws Exception { + EPApp app = getApp(uebkey).get(0); + final Map<String, String> params = new HashMap<>(); + params.put("uebKey", app.getUebKey()); + List<BulkUploadUserRoles> userRolesList = null; + Integer userRolesAdded = 0; + if (app.getCentralAuth()) { + userRolesList = dataAccessService.executeNamedQuery("getBulkUserRoles", params, null); + for (BulkUploadUserRoles userRolesUpload : userRolesList) { + if(!userRolesUpload.getOrgUserId().equals("su1234")){ + addUserRoleInExternalSystem(userRolesUpload); + userRolesAdded++; + } + } + } + return userRolesAdded; + } + + /** + * Its adding a user role in external auth system while doing bulk upload + * + * @param userRolesUpload + */ + private void addUserRoleInExternalSystem(BulkUploadUserRoles userRolesUpload) { + try { + String name = ""; + ObjectMapper mapper = new ObjectMapper(); + if (EPCommonSystemProperties + .containsProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN)) { + name = userRolesUpload.getOrgUserId() + + SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN); + } + ExternalAccessUser extUser = new ExternalAccessUser(name, + userRolesUpload.getAppNameSpace() + "." + userRolesUpload.getRoleName().replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_")); + String userRole = mapper.writeValueAsString(extUser); + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + HttpEntity<String> entity = new HttpEntity<>(userRole, headers); + template.exchange( + SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "userRole", + HttpMethod.POST, entity, String.class); + } catch(HttpClientErrorException e){ + logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to addUserRoleInExternalSystem", e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); + } catch (Exception e) { + if (e.getMessage().equalsIgnoreCase("409 Conflict")) { + logger.error(EELFLoggerDelegate.errorLogger, "addUserRoleInExternalSystem: UserRole already exits but does not break functionality"); + } else { + logger.error(EELFLoggerDelegate.errorLogger, "addUserRoleInExternalSystem: Failed to addUserRoleInExternalSystem", e); + } + } + } + + @Override + public void deleteRoleDependencyRecords(Session localSession, Long roleId, Long appId, boolean isPortalRequest) throws Exception { + try { + String sql = ""; + Query query = null; + + //It should delete only when it portal's roleId + if(appId.equals(PortalConstants.PORTAL_APP_ID)){ + // Delete from fn_role_function + sql = "DELETE FROM fn_role_function WHERE role_id=" + roleId; + logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql); + query = localSession.createSQLQuery(sql); + query.executeUpdate(); + + // Delete from fn_role_composite + sql = "DELETE FROM fn_role_composite WHERE parent_role_id=" + roleId + " OR child_role_id=" + roleId; + logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql); + query = localSession.createSQLQuery(sql); + query.executeUpdate(); + } + + // Delete from ep_app_role_function + sql = "DELETE FROM ep_app_role_function WHERE role_id=" + roleId; + logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql); + query = localSession.createSQLQuery(sql); + query.executeUpdate(); + + // Delete from ep_role_notification + sql = "DELETE FROM ep_role_notification WHERE role_id=" + roleId; + logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql); + query = localSession.createSQLQuery(sql); + query.executeUpdate(); + + // Delete from fn_user_pseudo_role + sql = "DELETE FROM fn_user_pseudo_role WHERE pseudo_role_id=" + roleId; + logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql); + query = localSession.createSQLQuery(sql); + query.executeUpdate(); + + // Delete form EP_WIDGET_CATALOG_ROLE + sql = "DELETE FROM EP_WIDGET_CATALOG_ROLE WHERE role_id=" + roleId; + logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql); + query = localSession.createSQLQuery(sql); + query.executeUpdate(); + + // Delete form EP_WIDGET_CATALOG_ROLE + sql = "DELETE FROM ep_user_roles_request_det WHERE requested_role_id=" + roleId; + logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql); + query = localSession.createSQLQuery(sql); + query.executeUpdate(); + + if(!isPortalRequest) { + // Delete form fn_menu_functional_roles + sql = "DELETE FROM fn_menu_functional_roles WHERE role_id=" + roleId; + logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql); + query = localSession.createSQLQuery(sql); + query.executeUpdate(); + } + } catch (Exception e) { + logger.debug(EELFLoggerDelegate.debugLogger, "deleteRoleDependeciesRecord: failed ", e); + throw new DeleteDomainObjectFailedException("delete Failed" + e.getMessage()); + } + + } + + @SuppressWarnings("unchecked") + @Override + public List<String> getMenuFunctionsList(String uebkey) throws Exception { + List<String> appMenuFunctionsList = null; + try { + EPApp app = getApp(uebkey).get(0); + final Map<String, Long> appParams = new HashMap<>(); + appParams.put(APP_ID, app.getId()); + appMenuFunctionsList = dataAccessService.executeNamedQuery("getMenuFunctions", appParams, null); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getMenuFunctionsList: Failed", e); + return appMenuFunctionsList; + } + return appMenuFunctionsList; + } + + @SuppressWarnings({ "unchecked"}) + @Override + public List<EcompUser> getAllAppUsers(String uebkey) throws Exception { + List<String> usersList = new ArrayList<>(); + List<EcompUser> usersfinalList = new ArrayList<>(); + try { + EPApp app = getApp(uebkey).get(0); + final Map<String, Long> appParams = new HashMap<>(); + appParams.put("appId", app.getId()); + List<EcompUserRoles> userList = (List<EcompUserRoles>) dataAccessService + .executeNamedQuery("ApplicationUserRoles", appParams, null); + for (EcompUserRoles ecompUserRole : userList) { + boolean found = false; + Set<EcompRole> roles = null; + for (EcompUser user : usersfinalList) { + if (user.getOrgUserId().equals(ecompUserRole.getOrgUserId())) { + EcompRole ecompRole = new EcompRole(); + ecompRole.setId(ecompUserRole.getRoleId()); + ecompRole.setName(ecompUserRole.getRoleName()); + roles = user.getRoles(); + roles.add(ecompRole); + user.setRoles(roles); + found = true; + break; + } + } + + if (!found) { + EcompUser epUser = new EcompUser(); + epUser.setOrgId(ecompUserRole.getOrgId()); + epUser.setManagerId(ecompUserRole.getManagerId()); + epUser.setFirstName(ecompUserRole.getFirstName()); + epUser.setLastName(ecompUserRole.getLastName()); + epUser.setPhone(ecompUserRole.getPhone()); + epUser.setEmail(ecompUserRole.getEmail()); + epUser.setOrgUserId(ecompUserRole.getOrgUserId()); + epUser.setOrgCode(ecompUserRole.getOrgCode()); + epUser.setOrgManagerUserId(ecompUserRole.getOrgManagerUserId()); + epUser.setJobTitle(ecompUserRole.getJobTitle()); + epUser.setLoginId(ecompUserRole.getLoginId()); + epUser.setActive(true); + roles = new HashSet<>(); + EcompRole ecompRole = new EcompRole(); + ecompRole.setId(ecompUserRole.getRoleId()); + ecompRole.setName(ecompUserRole.getRoleName()); + roles.add(ecompRole); + epUser.setRoles(roles); + usersfinalList.add(epUser); + } + } + ObjectMapper mapper = new ObjectMapper(); + + for (EcompUser u1 : usersfinalList) { + String str = mapper.writeValueAsString(u1); + usersList.add(str); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getAllUsers failed", e); + throw e; + } + return usersfinalList; + } + + + @Override + public Role ConvertCentralRoleToRole(String result) { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + Role newRole = new Role(); + try { + newRole = mapper.readValue(result, Role.class); + } catch (IOException e) { + logger.error(EELFLoggerDelegate.errorLogger, "Failed to convert the result to Role Object", e); + } + if (newRole.getRoleFunctions() != null) { + @SuppressWarnings("unchecked") + Set<RoleFunction> roleFunctionList = newRole.getRoleFunctions(); + Set<RoleFunction> roleFunctionListNew = new HashSet<>(); + Iterator<RoleFunction> itetaror = roleFunctionList.iterator(); + while (itetaror.hasNext()) { + Object nextValue = itetaror.next(); + RoleFunction roleFun = mapper.convertValue(nextValue, RoleFunction.class); + roleFunctionListNew.add(roleFun); + } + newRole.setRoleFunctions(roleFunctionListNew); + } + return newRole; + } + + @Override + @SuppressWarnings("unchecked") + public List<CentralizedApp> getCentralizedAppsOfUser(String userId) { + Map<String, String> params = new HashMap<>(); + params.put("userId", userId); + List<CentralizedApp> centralizedAppsList = new ArrayList<>(); + try{ + centralizedAppsList = dataAccessService + .executeNamedQuery("getCentralizedAppsOfUser", params, null); + }catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getCentralizedAppsOfUser failed", e); + } + return centralizedAppsList; + } + + @SuppressWarnings("unchecked") + public List<CentralV2Role> getGlobalRolesOfApplication(Long appId) { + Map<String, Long> params = new HashMap<>(); + params.put("appId", appId); + List<GlobalRoleWithApplicationRoleFunction> globalRoles = new ArrayList<>(); + try { + globalRoles = dataAccessService.executeNamedQuery("getGlobalRoleWithApplicationRoleFunctions", params, + null); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getCentralizedAppsOfUser failed", e); + } + List<CentralV2Role> rolesfinalList = new ArrayList<>(); + if (globalRoles.size() > 0) + rolesfinalList = finalListOfCentralRoles(globalRoles); + return rolesfinalList; + } + + @SuppressWarnings("unchecked") + private CentralV2Role getGlobalRoleForRequestedApp(long requestedAppId, long roleId) { + CentralV2Role finalGlobalrole = null; + List<GlobalRoleWithApplicationRoleFunction> roleWithApplicationRoleFucntions = new ArrayList<>(); + Map<String, Long> params = new HashMap<>(); + params.put("roleId", roleId); + params.put("requestedAppId", requestedAppId); + try { + roleWithApplicationRoleFucntions = dataAccessService.executeNamedQuery("getGlobalRoleForRequestedApp", + params, null); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getGlobalRoleForRequestedApp failed", e); + } + if (roleWithApplicationRoleFucntions.size() > 0) { + List<CentralV2Role> rolesfinalList = finalListOfCentralRoles(roleWithApplicationRoleFucntions); + finalGlobalrole = rolesfinalList.get(0); + } else { + List<EPRole> roleList = getPortalAppRoleInfo(roleId); + finalGlobalrole = convertRoleToCentralV2Role(roleList.get(0)); + } + return finalGlobalrole; + } + + private List<CentralV2Role> finalListOfCentralRoles(List<GlobalRoleWithApplicationRoleFunction> globalRoles) { + List<CentralV2Role> rolesfinalList = new ArrayList<>(); + for (GlobalRoleWithApplicationRoleFunction role : globalRoles) { + boolean found = false; + for (CentralV2Role cenRole : rolesfinalList) { + if (role.getRoleId().equals(cenRole.getId())) { + SortedSet<CentralV2RoleFunction> roleFunctions = cenRole.getRoleFunctions(); + CentralV2RoleFunction cenRoleFun = createCentralRoleFunctionForGlobalRole(role); + roleFunctions.add(cenRoleFun); + cenRole.setRoleFunctions(roleFunctions); + found = true; + break; + } + } + if (!found) { + CentralV2Role cenrole = new CentralV2Role(); + cenrole.setName(role.getRoleName()); + cenrole.setId(role.getRoleId()); + cenrole.setActive(role.isActive()); + cenrole.setPriority(role.getPriority()); + SortedSet<CentralV2RoleFunction> roleFunctions = new TreeSet<>(); + CentralV2RoleFunction cenRoleFun = createCentralRoleFunctionForGlobalRole(role); + roleFunctions.add(cenRoleFun); + cenrole.setRoleFunctions(roleFunctions); + rolesfinalList.add(cenrole); + } + } + return rolesfinalList; + } + + private CentralV2RoleFunction createCentralRoleFunctionForGlobalRole(GlobalRoleWithApplicationRoleFunction role) { + String instance; + String type; + String action; + CentralV2RoleFunction cenRoleFun; + if(role.getFunctionCd().contains(FUNCTION_PIPE)){ + instance = EcompPortalUtils.getFunctionCode(role.getFunctionCd()); + type = EcompPortalUtils.getFunctionType(role.getFunctionCd()); + action = EcompPortalUtils.getFunctionAction(role.getFunctionCd()); + cenRoleFun = new CentralV2RoleFunction(null, instance, role.getFunctionName(), null, type, action, null); + } else{ + type = getFunctionType(role.getFunctionCd()); + action = getFunctionAction(role.getFunctionCd()); + cenRoleFun = new CentralV2RoleFunction(null, role.getFunctionCd(), role.getFunctionName(), null, type, action, null); + } + return cenRoleFun; + } + + @SuppressWarnings("unchecked") + @Override + public List<EPRole> getGlobalRolesOfPortal() { + List<EPRole> globalRoles = new ArrayList<>(); + try { + globalRoles = dataAccessService.executeNamedQuery("getGlobalRolesOfPortal", null, null); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getGlobalRolesOfPortal failed", e); + } + return globalRoles; + } + + private CentralV2Role convertRoleToCentralV2Role(EPRole role) { + return new CentralV2Role(role.getId(), role.getCreated(), role.getModified(), role.getCreatedId(), + role.getModifiedId(), role.getRowNum(), role.getName(), role.getActive(), role.getPriority(), + new TreeSet<>(), new TreeSet<>(), new TreeSet<>()); + + } + + @Override + public List<RoleFunction> convertCentralRoleFunctionToRoleFunctionObject(List<CentralV2RoleFunction> answer) { + List<RoleFunction> addRoleFuncList = new ArrayList<>(); + for(CentralV2RoleFunction cenRoleFunc : answer){ + RoleFunction setRoleFunc = new RoleFunction(); + setRoleFunc.setCode(cenRoleFunc.getCode()); + setRoleFunc.setName(cenRoleFunc.getName()); + addRoleFuncList.add(setRoleFunc); + } + return addRoleFuncList; + } + + @Override + public CentralUser getUserRoles(String loginId, String uebkey) throws Exception { + CentralUser sendUserRoles = null; + + try { + CentralV2User cenV2User = getV2UserAppRoles(loginId, uebkey); + sendUserRoles = convertV2UserRolesToOlderVersion(cenV2User); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getUserRoles: failed", e); + } + return sendUserRoles; + } + + /** + * + * It returns V2 CentralUser object if user has any roles and permissions + * + * @param loginId + * @param uebkey + * @return CentralUser object + * @throws Exception + */ + private CentralV2User getV2UserAppRoles(String loginId, String uebkey) throws Exception { + EPApp app; + List<EPUser> epUserList; + List<EPApp> appList = getApp(uebkey); + app = appList.get(0); + epUserList = getUser(loginId); + EPUser user = epUserList.get(0); + Set<EPUserApp> userAppSet = user.getEPUserApps(); + return createEPUser(user, userAppSet, app); + } + + /** + * It converts V2 CentralUser object to old version CentralUser object + * + * @param cenV2User + * @return EPUser object + */ + private CentralUser convertV2UserRolesToOlderVersion(CentralV2User cenV2User) { + Set<CentralV2UserApp> userV2Apps = cenV2User.getUserApps(); + Set<CentralUserApp> userApps = new TreeSet<>(); + for(CentralV2UserApp userApp : userV2Apps){ + CentralApp app = userApp.getApp(); + CentralUserApp cua = new CentralUserApp(); + cua.setUserId(null); + cua.setApp(app); + SortedSet<CentralRoleFunction> cenRoleFunction = new TreeSet<>(); + for(CentralV2RoleFunction cenV2RoleFunc : userApp.getRole().getRoleFunctions() ){ + CentralRoleFunction cenRoleFunc = new CentralRoleFunction(cenV2RoleFunc.getCode(), cenV2RoleFunc.getName()); + cenRoleFunction.add(cenRoleFunc); + } + CentralRole role = new CentralRole(userApp.getRole().getId(), userApp.getRole().getName(), userApp.getRole().isActive(), userApp.getRole().getPriority(), + cenRoleFunction); + cua.setRole(role); + userApps.add(cua); + } + return new CentralUser(cenV2User.getId(), cenV2User.getCreated(), cenV2User.getModified(), + cenV2User.getCreatedId(),cenV2User.getModifiedId(), + cenV2User.getRowNum(), cenV2User.getOrgId(), cenV2User.getManagerId(), cenV2User.getFirstName(), + cenV2User.getMiddleInitial(), cenV2User.getLastName(), cenV2User.getPhone(), cenV2User.getFax(), + cenV2User.getCellular(),cenV2User.getEmail(),cenV2User.getAddressId(),cenV2User.getAlertMethodCd(), + cenV2User.getHrid(),cenV2User.getOrgUserId(),cenV2User.getOrgCode(),cenV2User.getAddress1(), + cenV2User.getAddress2(),cenV2User.getCity(),cenV2User.getState(),cenV2User.getZipCode(),cenV2User.getCountry(), + cenV2User.getOrgManagerUserId(),cenV2User.getLocationClli(),cenV2User.getBusinessCountryCode(), + cenV2User.getBusinessCountryName(),cenV2User.getBusinessUnit(),cenV2User.getBusinessUnitName(), + cenV2User.getDepartment(),cenV2User.getDepartmentName(),cenV2User.getCompanyCode(), + cenV2User.getCompany(),cenV2User.getZipCodeSuffix(),cenV2User.getJobTitle(), + cenV2User.getCommandChain(),cenV2User.getSiloStatus(),cenV2User.getCostCenter(), + cenV2User.getFinancialLocCode(),cenV2User.getLoginId(),cenV2User.getLoginPwd(), + cenV2User.getLastLoginDate(),cenV2User.isActive(),cenV2User.isInternal(),cenV2User.getSelectedProfileId(),cenV2User.getTimeZoneId(), + cenV2User.isOnline(),cenV2User.getChatId(), + userApps); + } + + @Override + public List<CentralRole> convertV2CentralRoleListToOldVerisonCentralRoleList(List<CentralV2Role> v2CenRoleList) { + List<CentralRole> cenRoleList = new ArrayList<>(); + SortedSet<CentralRoleFunction> cenRoleFuncList = new TreeSet<>(); + for(CentralV2Role v2CenRole : v2CenRoleList){ + for(CentralV2RoleFunction v2CenRoleFunc: v2CenRole.getRoleFunctions()){ + CentralRoleFunction roleFunc = new CentralRoleFunction(v2CenRoleFunc.getCode(), v2CenRoleFunc.getName()); + cenRoleFuncList.add(roleFunc); + } + CentralRole role = new CentralRole(v2CenRole.getId(), v2CenRole.getName(), v2CenRole.isActive(), v2CenRole.getPriority(), cenRoleFuncList); + cenRoleList.add(role); + } + return cenRoleList; + } + + @Override + public ResponseEntity<String> getNameSpaceIfExists(EPApp app) throws Exception { + HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); + HttpEntity<String> entity = new HttpEntity<>(headers); + logger.debug(EELFLoggerDelegate.debugLogger, "checkIfNameSpaceExists: Connecting to External Auth system"); + ResponseEntity<String> response = null; + try { + response = template + .exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + + "nss/" + app.getNameSpace(), HttpMethod.GET, entity, String.class); + logger.debug(EELFLoggerDelegate.debugLogger, "checkIfNameSpaceExists: Finished ", + response.getStatusCode().value()); + } catch (HttpClientErrorException e) { + logger.error(EELFLoggerDelegate.errorLogger, "checkIfNameSpaceExists failed", e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); + if (e.getStatusCode() == HttpStatus.NOT_FOUND) + throw new InvalidApplicationException("Invalid NameSpace"); + else + throw e; + } + return response; + } + + @Override + public CentralRole convertV2CentralRoleToOldVerisonCentralRole(CentralV2Role v2CenRole) { + SortedSet<CentralRoleFunction> cenRoleFuncList = new TreeSet<>(); + for (CentralV2RoleFunction v2CenRoleFunc : v2CenRole.getRoleFunctions()) { + CentralRoleFunction roleFunc = new CentralRoleFunction(v2CenRoleFunc.getCode(), v2CenRoleFunc.getName()); + cenRoleFuncList.add(roleFunc); + } + return new CentralRole(v2CenRole.getId(), v2CenRole.getName(), v2CenRole.isActive(), v2CenRole.getPriority(), + cenRoleFuncList); + } + + @SuppressWarnings("unchecked") + @Override + public Integer bulkUploadUsersSingleRole(String uebkey, Long roleId, String modifiedRoleName) throws Exception { + EPApp app = getApp(uebkey).get(0); + final Map<String, String> params = new HashMap<>(); + params.put("uebKey", app.getUebKey()); + params.put("roleId", String.valueOf(roleId)); + List<BulkUploadUserRoles> userRolesList = null; + Integer userRolesAdded = 0; + if (app.getCentralAuth()) { + userRolesList = dataAccessService.executeNamedQuery("getBulkUsersForSingleRole", params, null); + for (BulkUploadUserRoles userRolesUpload : userRolesList) { + userRolesUpload.setRoleName(modifiedRoleName); + if(!userRolesUpload.getOrgUserId().equals("su1234")){ + addUserRoleInExternalSystem(userRolesUpload); + userRolesAdded++; + } + } + } + return userRolesAdded; + } + + @Override + public String encodeFunctionCode(String funCode){ + String encodedString = funCode; + List<Pattern> encodingList = new ArrayList<>(); + encodingList.add(Pattern.compile("/")); + encodingList.add(Pattern.compile("-")); + for (Pattern xssInputPattern : encodingList) { + encodedString = xssInputPattern.matcher(encodedString) + .replaceAll("%" + Hex.encodeHexString(xssInputPattern.toString().getBytes())); + } + encodedString = encodedString.replaceAll("\\*", "%"+ Hex.encodeHexString("*".getBytes())); + return encodedString; + } +} diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/FunctionalMenuService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/FunctionalMenuService.java index af049ffe..fa703bdf 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/FunctionalMenuService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/FunctionalMenuService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,19 +35,19 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.FunctionalMenuItemWithAppID; -import org.openecomp.portalapp.portal.transport.BusinessCardApplicationRole; -import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItem; -import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItemJson; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.FunctionalMenuItem; -import org.openecomp.portalapp.portal.transport.FunctionalMenuItemWithRoles; -import org.openecomp.portalapp.portal.transport.FunctionalMenuRole; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.FunctionalMenuItemWithAppID; +import org.onap.portalapp.portal.transport.BusinessCardApplicationRole; +import org.onap.portalapp.portal.transport.FavoritesFunctionalMenuItem; +import org.onap.portalapp.portal.transport.FavoritesFunctionalMenuItemJson; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.FunctionalMenuItem; +import org.onap.portalapp.portal.transport.FunctionalMenuItemWithRoles; +import org.onap.portalapp.portal.transport.FunctionalMenuRole; public interface FunctionalMenuService { List<FunctionalMenuItem> getFunctionalMenuItems (EPUser user); @@ -59,7 +59,7 @@ public interface FunctionalMenuService { List<FunctionalMenuItem> getFunctionalMenuItemsForNotificationTree(Boolean all); List<FunctionalMenuItem> getFunctionalMenuItemsForApp (Integer appId); List<FunctionalMenuItem> getFunctionalMenuItemsForUser (String orgUserId); - FunctionalMenuItem getFunctionalMenuItemDetails (Integer menuid); + FunctionalMenuItem getFunctionalMenuItemDetails (Long menuid); FieldsValidator createFunctionalMenuItem (FunctionalMenuItemWithRoles menuItemJson); FieldsValidator editFunctionalMenuItem (FunctionalMenuItemWithRoles menuItemJson); FieldsValidator deleteFunctionalMenuItem (Long menuId); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/FunctionalMenuServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/FunctionalMenuServiceImpl.java index 26f1431e..a6a4ca31 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/FunctionalMenuServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/FunctionalMenuServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.ArrayList; import java.util.HashMap; @@ -51,24 +51,25 @@ import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; +import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Projections; import org.hibernate.criterion.Restrictions; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.FunctionalMenuItemWithAppID; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.transport.BusinessCardApplicationRole; -import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItem; -import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItemJson; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.FunctionalMenuItem; -import org.openecomp.portalapp.portal.transport.FunctionalMenuItemWithRoles; -import org.openecomp.portalapp.portal.transport.FunctionalMenuRole; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.FunctionalMenuItemWithAppID; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.transport.BusinessCardApplicationRole; +import org.onap.portalapp.portal.transport.FavoritesFunctionalMenuItem; +import org.onap.portalapp.portal.transport.FavoritesFunctionalMenuItemJson; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.FunctionalMenuItem; +import org.onap.portalapp.portal.transport.FunctionalMenuItemWithRoles; +import org.onap.portalapp.portal.transport.FunctionalMenuRole; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; @@ -283,20 +284,14 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { return menuItems; } - public FunctionalMenuItem getFunctionalMenuItemDetails(Integer menuid) { + public FunctionalMenuItem getFunctionalMenuItemDetails(Long menuid) { // First, fill in the fields that apply to all menu items - - String sql = "SELECT * FROM fn_menu_functional WHERE menu_id = '" + menuid + "'"; - logQuery(sql); - @SuppressWarnings("unchecked") - List<FunctionalMenuItem> menuItems = dataAccessService.executeSQLQuery(sql, FunctionalMenuItem.class, null); + + List<FunctionalMenuItem> menuItems = getFunctionalMenuItem(menuid); FunctionalMenuItem menuItem = (menuItems == null || menuItems.isEmpty() ? null : menuItems.get(0)); // If it is a bottom-level menu item, must fill in the appid and the // roles - sql = "SELECT * FROM fn_menu_functional_roles WHERE menu_id = '" + menuid + "'"; - logQuery(sql); - @SuppressWarnings("unchecked") - List<FunctionalMenuRole> roleItems = dataAccessService.executeSQLQuery(sql, FunctionalMenuRole.class, null); + List<FunctionalMenuRole> roleItems = getFunctionalMenuRoleWithMenuId(menuid); if (roleItems.size() > 0 && menuItem != null) { Integer appid = roleItems.get(0).appId; menuItem.appid = appid; @@ -312,14 +307,27 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { return menuItem; } + @SuppressWarnings("unchecked") + private List<FunctionalMenuItem> getFunctionalMenuItem(Long menuid) { + List<Criterion> restrictionsList = new ArrayList<Criterion>(); + Criterion textCriterion = Restrictions.eq("menuId",menuid); + restrictionsList.add(textCriterion); + return (List<FunctionalMenuItem>) dataAccessService.getList(FunctionalMenuItem.class, null, restrictionsList, null); + } + + @SuppressWarnings("unchecked") + private List<FunctionalMenuRole> getFunctionalMenuRoleWithMenuId(Long menuid) { + List<Criterion> restrictionsList = new ArrayList<Criterion>(); + Criterion textCriterion = Restrictions.eq("menuId",menuid); + restrictionsList.add(textCriterion); + return (List<FunctionalMenuRole>) dataAccessService.getList(FunctionalMenuRole.class, null, restrictionsList, null); + } + private FieldsValidator menuItemFieldsChecker(FunctionalMenuItemWithRoles menuItemJson) { FieldsValidator fieldsValidator = new FieldsValidator(); try { // TODO: validate all the fields - @SuppressWarnings("unchecked") - List<FunctionalMenuItem> functionalMenuItems = dataAccessService.getList(FunctionalMenuItem.class, - " where text = '" + menuItemJson.text + "'", null, null); - + List<FunctionalMenuItem> functionalMenuItems = getFunctionalMenuItemWithText(menuItemJson); boolean dublicatedName = false; for (FunctionalMenuItem fnMenuItem : functionalMenuItems) { if (menuItemJson.menuId != null && menuItemJson.menuId.equals(fnMenuItem.menuId)) { @@ -372,6 +380,14 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { return fieldsValidator; } + @SuppressWarnings("unchecked") + private List<FunctionalMenuItem> getFunctionalMenuItemWithText(FunctionalMenuItemWithRoles menuItemJson) { + List<Criterion> restrictionsList = new ArrayList<Criterion>(); + Criterion textCriterion = Restrictions.eq("text",menuItemJson.text); + restrictionsList.add(textCriterion); + return (List<FunctionalMenuItem>) dataAccessService.getList(FunctionalMenuItem.class, null, restrictionsList, null); + } + // Turn foreign key checks on or off protected void setForeignKeys(Session localSession, Boolean on) { String keyCheck = "0"; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/GetAccessService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/GetAccessService.java index 5857658d..093fd258 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/GetAccessService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/GetAccessService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.GetAccessResult; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.GetAccessResult; public interface GetAccessService { /** diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/GetAccessServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/GetAccessServiceImpl.java index 317e838e..fb0bf7f7 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/GetAccessServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/GetAccessServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.HashMap; import java.util.List; @@ -45,11 +45,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; - -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.GetAccessResult; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.GetAccessResult; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalsdk.core.service.DataAccessService; @Service("getAccessService") @Transactional diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ManifestService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ManifestService.java index 5e4c96a7..ab15b189 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ManifestService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ManifestService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.io.IOException; import java.util.jar.Attributes; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ManifestServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ManifestServiceImpl.java index 0e5da802..6ea66fe1 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ManifestServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ManifestServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.io.IOException; import java.io.InputStream; @@ -47,9 +47,8 @@ import javax.servlet.ServletContext; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; @Service("manifestService") @EnableAspectJAutoProxy diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceProxyService.java index 85977ef1..594e5ef2 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceProxyService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,11 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import javax.servlet.http.HttpServletRequest; -import org.openecomp.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPUser; import org.springframework.web.client.RestClientException; public interface MicroserviceProxyService { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceProxyServiceImpl.java index acd8524a..d18ffbe9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceProxyServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,22 +35,22 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.apache.commons.codec.binary.Base64; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.MicroserviceData; -import org.openecomp.portalapp.portal.domain.MicroserviceParameter; -import org.openecomp.portalapp.portal.domain.WidgetCatalogParameter; -import org.openecomp.portalapp.portal.domain.WidgetServiceHeaders; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.MicroserviceData; +import org.onap.portalapp.portal.domain.MicroserviceParameter; +import org.onap.portalapp.portal.domain.WidgetCatalogParameter; +import org.onap.portalapp.portal.domain.WidgetServiceHeaders; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +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.context.annotation.EnableAspectJAutoProxy; import org.springframework.http.HttpEntity; @@ -176,7 +176,7 @@ public class MicroserviceProxyServiceImpl implements MicroserviceProxyService { String result = ""; if (encryptedPwd != null && encryptedPwd.length() > 0) { try { - result = CipherUtil.decrypt(encryptedPwd, + result = CipherUtil.decryptPKC(encryptedPwd, SystemProperties.getProperty(SystemProperties.Decryption_Key)); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "decryptedPassword failed", e); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceService.java index d2ef3647..60553b32 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; -import org.openecomp.portalapp.portal.domain.MicroserviceData; -import org.openecomp.portalapp.portal.domain.MicroserviceParameter; +import org.onap.portalapp.portal.domain.MicroserviceData; +import org.onap.portalapp.portal.domain.MicroserviceParameter; public interface MicroserviceService { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceServiceImpl.java index 23a8c504..d7f78d8c 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.ArrayList; import java.util.HashMap; @@ -46,13 +46,13 @@ import javax.crypto.BadPaddingException; import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Restrictions; -import org.openecomp.portalapp.portal.domain.MicroserviceData; -import org.openecomp.portalapp.portal.domain.MicroserviceParameter; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.domain.MicroserviceData; +import org.onap.portalapp.portal.domain.MicroserviceParameter; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.onboarding.util.CipherUtil; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; @@ -86,8 +86,11 @@ public class MicroserviceServiceImpl implements MicroserviceService { public MicroserviceData getMicroserviceDataById(long id) { MicroserviceData data = null; try { - data = (MicroserviceData) dataAccessService - .getList(MicroserviceData.class, " where id = '" + id + "'", null, null).get(0); + List<Criterion> restrictionsList = new ArrayList<Criterion>(); + Criterion idCriterion = Restrictions.eq("id", id); + restrictionsList.add(idCriterion); + data = (MicroserviceData) dataAccessService.getList(MicroserviceData.class, null, restrictionsList, null).get(0); + data.setParameterList(getServiceParameters(id)); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "getMicroserviceDataById failed", e); @@ -112,13 +115,19 @@ public class MicroserviceServiceImpl implements MicroserviceService { return list; } - @SuppressWarnings("unchecked") private List<MicroserviceParameter> getServiceParameters(long serviceId) { - List<MicroserviceParameter> list = (List<MicroserviceParameter>) dataAccessService - .getList(MicroserviceParameter.class, " where service_id = '" + serviceId + "'", null, null); + List<MicroserviceParameter> list = getMicroServiceParametersList(serviceId); return list; } + @SuppressWarnings("unchecked") + private List<MicroserviceParameter> getMicroServiceParametersList(long serviceId) { + List<Criterion> restrictionsList = new ArrayList<Criterion>(); + Criterion serviceIdCriterion = Restrictions.eq("serviceId", serviceId); + restrictionsList.add(serviceIdCriterion); + return (List<MicroserviceParameter>) dataAccessService.getList(MicroserviceParameter.class, null, restrictionsList, null); + } + @Override public void deleteMicroservice(long serviceId) throws Exception { @@ -136,7 +145,6 @@ public class MicroserviceServiceImpl implements MicroserviceService { } } - @SuppressWarnings("unchecked") @Override public void updateMicroservice(long serviceId, MicroserviceData newService) throws Exception { try { @@ -188,7 +196,7 @@ public class MicroserviceServiceImpl implements MicroserviceService { String result = ""; if (encryptedPwd != null & encryptedPwd.length() > 0) { try { - result = CipherUtil.decrypt(encryptedPwd, + result = CipherUtil.decryptPKC(encryptedPwd, SystemProperties.getProperty(SystemProperties.Decryption_Key)); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "decryptedPassword failed", e); @@ -202,7 +210,7 @@ public class MicroserviceServiceImpl implements MicroserviceService { String result = ""; if (decryptedPwd != null & decryptedPwd.length() > 0) { try { - result = CipherUtil.encrypt(decryptedPwd, + result = CipherUtil.encryptPKC(decryptedPwd, SystemProperties.getProperty(SystemProperties.Decryption_Key)); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "encryptedPassword failed", e); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserAppService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/PersUserAppService.java index af69f337..7838eb43 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserAppService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/PersUserAppService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,10 +35,10 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPUser; public interface PersUserAppService { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserAppServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/PersUserAppServiceImpl.java index c547a9de..39b88f63 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserAppServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/PersUserAppServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,22 +35,28 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EPUserApp; -import org.openecomp.portalapp.portal.domain.PersUserAppSelection; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Restrictions; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPUserApp; +import org.onap.portalapp.portal.domain.PersUserAppSelection; +import org.onap.portalapp.portal.domain.PersUserWidgetSelection; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.service.DataAccessService; @Service("persUserAppService") @Transactional @@ -59,6 +65,10 @@ import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; @EPMetricsLog public class PersUserAppServiceImpl implements PersUserAppService { + private static final String APP_ID = "appId"; + + private static final String USER_ID = "userId"; + private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PersUserAppServiceImpl.class); @Autowired @@ -81,10 +91,7 @@ public class PersUserAppServiceImpl implements PersUserAppService { throw new IllegalArgumentException("setPersUserAppValue: Null values"); // Find the record for this user-app combo, if any - String filter = " where user_id = " + Long.toString(user.getId()) + " and app_id = " - + Long.toString(app.getId()); - @SuppressWarnings("unchecked") - List<PersUserAppSelection> persList = dataAccessService.getList(PersUserAppSelection.class, filter, null, null); + List<PersUserAppSelection> persList = getUsersAppSelection(user, app); // Key constraint limits to 1 row PersUserAppSelection persRow = null; @@ -156,4 +163,13 @@ public class PersUserAppServiceImpl implements PersUserAppService { } } + @SuppressWarnings("unchecked") + private List<PersUserAppSelection> getUsersAppSelection(EPUser user, EPApp app) { + List<Criterion> restrictionsList = new ArrayList<Criterion>(); + Criterion userIdCriterion = Restrictions.eq("userId", user.getId()); + Criterion appIdCriterion = Restrictions.eq("appId", app.getId()); + restrictionsList.add(Restrictions.and(userIdCriterion, appIdCriterion)); + return (List<PersUserAppSelection>) dataAccessService.getList(PersUserAppSelection.class, null, restrictionsList, null); + } + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserWidgetService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/PersUserWidgetService.java index a59e43e5..5070e4b2 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserWidgetService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/PersUserWidgetService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,9 +35,9 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; -import org.openecomp.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPUser; public interface PersUserWidgetService { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserWidgetServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/PersUserWidgetServiceImpl.java index 5c38997f..94c934df 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserWidgetServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/PersUserWidgetServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,20 +35,22 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; +import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.PersUserWidgetSelection; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Restrictions; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.PersUserWidgetSelection; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.service.DataAccessService; @Service("persUserWidgetService") @Transactional @@ -66,12 +68,8 @@ public class PersUserWidgetServiceImpl implements PersUserWidgetService{ public void setPersUserAppValue(EPUser user, Long widgetId, boolean select) { if (user == null || widgetId == null) throw new IllegalArgumentException("setPersUserAppValue: Null values"); - - String filter = " where user_id = " + Long.toString(user.getId()) + " and widget_id = " - + Long.toString(widgetId); - @SuppressWarnings("unchecked") - List<PersUserWidgetSelection> persList = dataAccessService.getList(PersUserWidgetSelection.class, filter, null, null); - + + List<PersUserWidgetSelection> persList = getUserWidgetSelction(user, widgetId); // Key constraint limits to 1 row PersUserWidgetSelection persRow = null; if (persList.size() == 1){ @@ -96,4 +94,13 @@ public class PersUserWidgetServiceImpl implements PersUserWidgetService{ } + @SuppressWarnings("unchecked") + private List<PersUserWidgetSelection> getUserWidgetSelction(EPUser user, Long widgetId) { + List<Criterion> restrictionsList = new ArrayList<Criterion>(); + Criterion userIdCriterion = Restrictions.eq("userId", user.getId()); + Criterion widgetIdCriterion = Restrictions.eq("widgetId", widgetId); + restrictionsList.add(Restrictions.and(userIdCriterion, widgetIdCriterion)); + return (List<PersUserWidgetSelection>) dataAccessService.getList(PersUserWidgetSelection.class, null, restrictionsList, null); + } + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PortalAdminService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/PortalAdminService.java index 03257f97..a8817286 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PortalAdminService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/PortalAdminService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.PortalAdmin; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.PortalAdmin; public interface PortalAdminService { List<PortalAdmin> getPortalAdmins (); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PortalAdminServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/PortalAdminServiceImpl.java index bc4c3390..2704554e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PortalAdminServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/PortalAdminServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,8 +35,9 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -47,19 +48,22 @@ import javax.servlet.http.HttpServletResponse; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.transport.ExternalAccessUser; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.PortalAdmin; -import org.openecomp.portalapp.portal.transport.PortalAdminUserRole; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.portal.utils.PortalConstants; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Restrictions; +import org.onap.portalapp.portal.service.SearchService; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.transport.ExternalAccessUser; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.PortalAdmin; +import org.onap.portalapp.portal.transport.PortalAdminUserRole; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.http.HttpEntity; @@ -113,16 +117,13 @@ public class PortalAdminServiceImpl implements PortalAdminService { } } - @SuppressWarnings("unchecked") public FieldsValidator createPortalAdmin(String orgUserId) { FieldsValidator fieldsValidator = new FieldsValidator(); - logger.debug(EELFLoggerDelegate.debugLogger, "LR: createPortalAdmin: test 1"); - boolean result = false; + logger.debug(EELFLoggerDelegate.debugLogger, "LR: createPortalAdmin: orgUserId is {}", orgUserId); EPUser user = null; boolean createNewUser = false; - List<EPUser> localUserList = dataAccessService.getList(EPUser.class, " where orgUserId='" + orgUserId + "'", - null, null); - if (localUserList.size() > 0) { + List<EPUser> localUserList = getUserListWithOrguseId(orgUserId); + if (!localUserList.isEmpty()) { user = localUserList.get(0); } else { createNewUser = true; @@ -160,29 +161,29 @@ public class PortalAdminServiceImpl implements PortalAdminService { transaction.commit(); // Add role in the external central auth system - if(user != null) - result = addPortalAdminInExternalCentralAuth(user.getOrgUserId(), PortalConstants.PORTAL_ADMIN_ROLE); - else - logger.error(EELFLoggerDelegate.errorLogger, "PortalAdminServiceImpl createPortalAdmin: failed to Add role in the external central auth system since User obj is null" ); + if(user != null && EcompPortalUtils.checkIfRemoteCentralAccessAllowed()) { + addPortalAdminInExternalCentralAuth(user.getOrgUserId(), PortalConstants.PORTAL_ADMIN_ROLE); + } } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "createPortalAdmin failed", e); EcompPortalUtils.rollbackTransaction(transaction, "createPortalAdmin rollback, exception = " + e.toString()); + fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } finally { EcompPortalUtils.closeLocalSession(localSession, "createPortalAdmin"); } - if (!result) { - logger.debug(EELFLoggerDelegate.debugLogger, - "LR: createPortalAdmin: no result. setting httpStatusCode to " - + HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - logger.error(EELFLoggerDelegate.errorLogger, "PortalAdminServiceImpl.createPortalAdmin: bad request"); - } } return fieldsValidator; } + + @SuppressWarnings("unchecked") + private List<EPUser> getUserListWithOrguseId(String orgUserId) { + List<Criterion> restrictionsList = new ArrayList<Criterion>(); + Criterion orgUserIdCriterion = Restrictions.eq("orgUserId", orgUserId); + restrictionsList.add(orgUserIdCriterion); + return (List<EPUser>) dataAccessService.getList(EPUser.class, null, restrictionsList, null); + } - private boolean addPortalAdminInExternalCentralAuth(String loginId, String portalAdminRole){ - boolean result = false; + private void addPortalAdminInExternalCentralAuth(String loginId, String portalAdminRole) throws Exception{ try{ String name = ""; if (EPCommonSystemProperties.containsProperty( @@ -203,24 +204,20 @@ public class PortalAdminServiceImpl implements PortalAdminService { EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "userRole", HttpMethod.POST, addUserRole, String.class); - result = true; } catch (Exception e) { // This happens only if role already exists in external central access system but not in local DB thats where we logging here if (e.getMessage().equalsIgnoreCase("409 Conflict")) { - result = true; logger.debug(EELFLoggerDelegate.debugLogger, "Portal Admin role already exists", e.getMessage()); } else{ logger.error(EELFLoggerDelegate.errorLogger, "Failed to add Portal Admin role ", e); - result = false; + throw e; } } - return result; } public FieldsValidator deletePortalAdmin(Long userId) { FieldsValidator fieldsValidator = new FieldsValidator(); logger.debug(EELFLoggerDelegate.debugLogger, "deletePortalAdmin: test 1"); - boolean result = false; Session localSession = null; Transaction transaction = null; @@ -230,30 +227,24 @@ public class PortalAdminServiceImpl implements PortalAdminService { dataAccessService.deleteDomainObjects(PortalAdminUserRole.class, "user_id='" + userId + "' AND role_id='" + SYS_ADMIN_ROLE_ID + "'", null); transaction.commit(); - result = deletePortalAdminInExternalCentralAuth(userId, PortalConstants.PORTAL_ADMIN_ROLE); + if(EcompPortalUtils.checkIfRemoteCentralAccessAllowed()){ + deletePortalAdminInExternalCentralAuth(userId, PortalConstants.PORTAL_ADMIN_ROLE); + } } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "deletePortalAdmin failed", e); EcompPortalUtils.rollbackTransaction(transaction, "deletePortalAdmin rollback, exception = " + e.toString()); + fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } finally { EcompPortalUtils.closeLocalSession(localSession, "deletePortalAdmin"); } - if (result) { - } else { - logger.debug(EELFLoggerDelegate.debugLogger, "deletePortalAdmin: no result. setting httpStatusCode to " - + HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - } return fieldsValidator; } - @SuppressWarnings("unchecked") - private boolean deletePortalAdminInExternalCentralAuth(Long userId, String portalAdminRole){ - boolean result = false; + private void deletePortalAdminInExternalCentralAuth(Long userId, String portalAdminRole) throws Exception{ try{ String name = ""; - List<EPUser> localUserList = dataAccessService.getList(EPUser.class, " where user_id = " + userId, - null, null); + List<EPUser> localUserList = getUserListWithUserid(userId); if (EPCommonSystemProperties.containsProperty( EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN)) { name = localUserList.get(0).getOrgUserId() + SystemProperties @@ -268,16 +259,22 @@ public class PortalAdminServiceImpl implements PortalAdminService { EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "userRole/"+name+"/"+extRole, HttpMethod.DELETE, addUserRole, String.class); - result = true; } catch (Exception e) { if (e.getMessage().equalsIgnoreCase("404 Not Found")) { logger.debug(EELFLoggerDelegate.debugLogger, "Portal Admin role already deleted or may not be found", e.getMessage()); } else{ logger.error(EELFLoggerDelegate.errorLogger, "Failed to add Portal Admin role ", e); - result = false; + throw e; } } - return result; + } + + @SuppressWarnings("unchecked") + private List<EPUser> getUserListWithUserid(Long userId) { + List<Criterion> restrictionsList = new ArrayList<Criterion>(); + Criterion orgUserIdCriterion = Restrictions.eq("id", userId); + restrictionsList.add(orgUserIdCriterion); + return (List<EPUser>) dataAccessService.getList(EPUser.class, null, restrictionsList, null); } private void logQuery(String sql) { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SearchService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/SearchService.java index 56e64405..9cbc52ea 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SearchService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/SearchService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,9 +35,9 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; -import org.openecomp.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPUser; public interface SearchService { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SearchServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java index df0c3886..30ff5980 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SearchServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,16 +35,18 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.ArrayList; import java.util.List; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.transport.UserWithNameSurnameTitle; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.portal.service.SearchService; +import org.onap.portalapp.portal.service.SearchServiceImpl; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.transport.UserWithNameSurnameTitle; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; @@ -127,7 +129,7 @@ public class SearchServiceImpl implements SearchService { private List<UserWithNameSurnameTitle> searchUsersByAttrs(EPUser attrUser) { List<UserWithNameSurnameTitle> foundUsers = new ArrayList<UserWithNameSurnameTitle>(); try { - org.openecomp.portalsdk.core.command.support.SearchResult searchResult = this.ldapService.searchPost(attrUser, null, null, null, 0, 0, -1); + org.onap.portalsdk.core.command.support.SearchResult searchResult = this.ldapService.searchPost(attrUser, null, null, null, 0, 0, -1); for (Object obj : searchResult) { EPUser user = (EPUser) obj; UserWithNameSurnameTitle foundUser = new UserWithNameSurnameTitle(user.getOrgUserId(), user.getFirstName(), user.getLastName(), user.getJobTitle()); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SharedContextService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/SharedContextService.java index 24b164ed..37321e55 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SharedContextService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/SharedContextService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,11 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; -import org.openecomp.portalapp.portal.domain.SharedContext; +import org.onap.portalapp.portal.domain.SharedContext; /** * Defines the methods exposed by the service that manages shared context diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SharedContextServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/SharedContextServiceImpl.java index 37b38703..a950c5ff 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SharedContextServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/SharedContextServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -48,11 +48,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalapp.portal.domain.SharedContext; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.domain.SharedContext; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.service.DataAccessService; /** * Implementation of the shared-context service that talks to the database. diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/TicketEventService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/TicketEventService.java index 4219e035..ad0dbc55 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/TicketEventService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/TicketEventService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import com.fasterxml.jackson.databind.JsonNode; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserNotificationService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserNotificationService.java index 4aa6a180..f327c842 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserNotificationService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserNotificationService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,15 +35,15 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EcompAppRole; -import org.openecomp.portalapp.portal.transport.EpNotificationItem; -import org.openecomp.portalapp.portal.transport.EpNotificationItemVO; -import org.openecomp.portalapp.portal.transport.EpRoleNotificationItem; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EcompAppRole; +import org.onap.portalapp.portal.transport.EpNotificationItem; +import org.onap.portalapp.portal.transport.EpNotificationItemVO; +import org.onap.portalapp.portal.transport.EpRoleNotificationItem; public interface UserNotificationService { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserNotificationServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserNotificationServiceImpl.java index 329d4e8a..130c99e7 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserNotificationServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserNotificationServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.Date; import java.util.HashMap; @@ -45,15 +45,15 @@ import java.util.Map; import java.util.Set; import org.hibernate.SessionFactory; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EPUserNotification; -import org.openecomp.portalapp.portal.domain.EcompAppRole; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.transport.EpNotificationItem; -import org.openecomp.portalapp.portal.transport.EpNotificationItemVO; -import org.openecomp.portalapp.portal.transport.EpRoleNotificationItem; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.DataAccessService; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPUserNotification; +import org.onap.portalapp.portal.domain.EcompAppRole; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.transport.EpNotificationItem; +import org.onap.portalapp.portal.transport.EpNotificationItemVO; +import org.onap.portalapp.portal.transport.EpRoleNotificationItem; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.service.DataAccessService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; @@ -243,20 +243,20 @@ public class UserNotificationServiceImpl implements UserNotificationService { @Override public void deleteNotificationsFromEpNotificationTable() { Map<String, String> params = new HashMap<String, String>(); - dataAccessService.executeNamedUpdateQuery("deleteNotificationsFromEpNotificationTable", params, null); + dataAccessService.executeNamedQuery("deleteNotificationsFromEpNotificationTable", params, null); } @Override public void deleteNotificationsFromEpUserNotificationTable() { Map<String, String> params = new HashMap<String, String>(); - dataAccessService.executeNamedUpdateQuery("deleteNotificationsFromEpUserNotificationTable", params, null); + dataAccessService.executeNamedQuery("deleteNotificationsFromEpUserNotificationTable", params, null); } @Override public void deleteNotificationsFromEpRoleNotificationTable() { Map<String, String> params = new HashMap<String, String>(); - dataAccessService.executeNamedUpdateQuery("deleteNotificationsFromEpRoleNotificationTable", params, null); + dataAccessService.executeNamedQuery("deleteNotificationsFromEpRoleNotificationTable", params, null); } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserRolesCommonServiceImpl.java index f5bdca77..3535f753 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserRolesCommonServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -36,7 +36,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.io.IOException; import java.util.ArrayList; @@ -63,49 +63,51 @@ import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.json.JSONArray; import org.json.JSONObject; -import org.openecomp.portalapp.externalsystemapproval.model.ExternalSystemRoleApproval; -import org.openecomp.portalapp.externalsystemapproval.model.ExternalSystemUser; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EPUserApp; -import org.openecomp.portalapp.portal.domain.EPUserAppCatalogRoles; -import org.openecomp.portalapp.portal.domain.EPUserAppRoles; -import org.openecomp.portalapp.portal.domain.EPUserAppRolesRequest; -import org.openecomp.portalapp.portal.domain.EPUserAppRolesRequestDetail; -import org.openecomp.portalapp.portal.domain.ExternalSystemAccess; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.logging.format.EPAppMessagesEnum; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.portal.transport.AppWithRolesForUser; -import org.openecomp.portalapp.portal.transport.CentralRole; -import org.openecomp.portalapp.portal.transport.EPUserAppCurrentRoles; -import org.openecomp.portalapp.portal.transport.EcompUserAppRoles; -import org.openecomp.portalapp.portal.transport.ExternalAccessUser; -import org.openecomp.portalapp.portal.transport.ExternalAccessUserRoleDetail; -import org.openecomp.portalapp.portal.transport.ExternalRequestFieldsValidator; -import org.openecomp.portalapp.portal.transport.ExternalRoleDescription; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.FunctionalMenuItem; -import org.openecomp.portalapp.portal.transport.FunctionalMenuRole; -import org.openecomp.portalapp.portal.transport.RemoteRole; -import org.openecomp.portalapp.portal.transport.RemoteUserWithRoles; -import org.openecomp.portalapp.portal.transport.RoleInAppForUser; -import org.openecomp.portalapp.portal.transport.RolesInAppForUser; -import org.openecomp.portalapp.portal.transport.UserApplicationRoles; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.portal.utils.PortalConstants; -import org.openecomp.portalsdk.core.domain.Role; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.restful.domain.EcompRole; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.service.RoleService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.service.SearchService; +import org.onap.portalapp.externalsystemapproval.model.ExternalSystemRoleApproval; +import org.onap.portalapp.externalsystemapproval.model.ExternalSystemUser; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPUserApp; +import org.onap.portalapp.portal.domain.EPUserAppCatalogRoles; +import org.onap.portalapp.portal.domain.EPUserAppRoles; +import org.onap.portalapp.portal.domain.EPUserAppRolesRequest; +import org.onap.portalapp.portal.domain.EPUserAppRolesRequestDetail; +import org.onap.portalapp.portal.domain.ExternalSystemAccess; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.transport.AppWithRolesForUser; +import org.onap.portalapp.portal.transport.CentralV2Role; +import org.onap.portalapp.portal.transport.EPUserAppCurrentRoles; +import org.onap.portalapp.portal.transport.EcompUserAppRoles; +import org.onap.portalapp.portal.transport.ExternalAccessUser; +import org.onap.portalapp.portal.transport.ExternalAccessUserRoleDetail; +import org.onap.portalapp.portal.transport.ExternalRequestFieldsValidator; +import org.onap.portalapp.portal.transport.ExternalRoleDescription; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.FunctionalMenuItem; +import org.onap.portalapp.portal.transport.FunctionalMenuRole; +import org.onap.portalapp.portal.transport.RemoteRole; +import org.onap.portalapp.portal.transport.RemoteUserWithRoles; +import org.onap.portalapp.portal.transport.RoleInAppForUser; +import org.onap.portalapp.portal.transport.RolesInAppForUser; +import org.onap.portalapp.portal.transport.UserApplicationRoles; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.portal.utils.PortalConstants; +import org.onap.portalsdk.core.domain.Role; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.restful.domain.EcompRole; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.service.RoleService; +import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.client.RestTemplate; @@ -114,14 +116,14 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; @EPMetricsLog -public class UserRolesCommonServiceImpl { +public class UserRolesCommonServiceImpl { private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UserRolesCommonServiceImpl.class); private static final Object syncRests = new Object(); - + @Autowired - private DataAccessService dataAccessService; + private DataAccessService dataAccessService; @Autowired private SessionFactory sessionFactory; @Autowired @@ -133,17 +135,17 @@ public class UserRolesCommonServiceImpl { @Autowired private EPRoleService epRoleService; @Autowired - private RoleService roleService; - + private RoleService roleService; + @Autowired private ExternalAccessRolesService externalAccessRolesService; - + RestTemplate template = new RestTemplate(); - + /** * * @param ecompRoles - * @return HashMap<Long, EcompRole> + * @return HashMap<Long, EcompRole> */ private static HashMap<Long, EcompRole> hashMapFromEcompRoles(EcompRole[] ecompRoles) { HashMap<Long, EcompRole> result = new HashMap<Long, EcompRole>(); @@ -156,7 +158,7 @@ public class UserRolesCommonServiceImpl { } return result; } - + /** * * @param userId @@ -194,19 +196,16 @@ public class UserRolesCommonServiceImpl { EcompPortalUtils.closeLocalSession(localSession, "searchOrCreateUser"); } } - + /** - * This method return nothing and remove roles before adding any roles for an - * app - * + * This method return nothing and remove roles before adding any roles for an app * @param userRole * @param appId * @param localSession * @param userAppRoles * @param newUserAppRolesMap */ - private static void syncUserRolesExtension(EPUserApp userRole, Long appId, Session localSession, - EcompRole[] userAppRoles, HashMap<Long, EcompRole> newUserAppRolesMap) { + private static void syncUserRolesExtension(EPUserApp userRole, Long appId, Session localSession, EcompRole[] userAppRoles, HashMap<Long, EcompRole> newUserAppRolesMap) { Long userAppRoleId = 0L; if (appId == PortalConstants.PORTAL_APP_ID) { // local app @@ -221,32 +220,32 @@ public class UserRolesCommonServiceImpl { newUserAppRolesMap.remove(userAppRoleId); } } - + /** * Checks whether the role is inactive - * + * * @param epRole * @throws Exception - * if role is inactive, throws exception + * if role is inactive, throws exception */ - private void checkIfRoleInactive(EPRole epRole) throws Exception { - if (!epRole.getActive()) { - throw new Exception(epRole.getName() + " role is unavailable"); + private void checkIfRoleInactive(EPRole epRole) throws Exception{ + if(!epRole.getActive()){ + throw new Exception(epRole.getName()+ " role is unavailable"); } } - + /** * * @param sessionFactory * @param userId * @param appId * @param userAppRoles - * @param extRequestValue - * set to false if request is from users page otherwise true + * @param extRequestValue + * set to false if request is from users page otherwise true * @throws Exception */ - protected void syncUserRoles(SessionFactory sessionFactory, String userId, Long appId, EcompRole[] userAppRoles, - Boolean extRequestValue, String reqType) throws Exception { + protected void syncUserRoles(SessionFactory sessionFactory, String userId, Long appId, + EcompRole[] userAppRoles, Boolean extRequestValue, String reqType) throws Exception { boolean result = false; Session localSession = null; Transaction transaction = null; @@ -267,33 +266,28 @@ public class UserRolesCommonServiceImpl { @SuppressWarnings("unchecked") List<EPUserApp> userRoles = localSession.createQuery("from " + EPUserApp.class.getName() + " where app.id=" + appId + roleActive + " and userId=" + client.getId()).list(); - + if ("DELETE".equals(reqType)) { for (EPUserApp userAppRoleList : userRoles) { userAppParams.put("roleName", String.valueOf(userAppRoleList.getRole().getName())); - userAppParams.put("appId", String.valueOf(appId)); + userAppParams.put("appId", String.valueOf(appId)); appParams.put("appRoleName", userAppRoleList.getRole().getName()); @SuppressWarnings("unchecked") - List<EPRole> rolesList = (!userAppRoleList.getRole().getName() - .equals(PortalConstants.ADMIN_ROLE)) - ? (List<EPRole>) dataAccessService.executeNamedQuery("getAppRoles", - userAppParams, null) - : (List<EPRole>) dataAccessService.executeNamedQuery("getPortalAppRoles", - appParams, null); - if (rolesList.size() > 0 || !rolesList.isEmpty()) { - checkIfRoleInactive(rolesList.get(0)); + List<EPRole> rolesList = (!userAppRoleList.getRole().getName().equals(PortalConstants.ADMIN_ROLE)) ? (List<EPRole>) dataAccessService.executeNamedQuery("getAppRoles", userAppParams, null) : (List<EPRole>) dataAccessService.executeNamedQuery("getPortalAppRoles", appParams, null); + if(rolesList.size() > 0 || !rolesList.isEmpty()){ + checkIfRoleInactive(rolesList.get(0)); } } } for (EPUserApp userRole : userRoles) { - if (!userRole.getRoleId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID) - && userRole.getRoleId() != PortalConstants.SYS_ADMIN_ROLE_ID && !extRequestValue) { + if (!userRole.getRoleId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID) && userRole.getRoleId() != PortalConstants.SYS_ADMIN_ROLE_ID && !extRequestValue){ syncUserRolesExtension(userRole, appId, localSession, userAppRoles, newUserAppRolesMap); - } else if (extRequestValue - && ("PUT".equals(reqType) || "POST".equals(reqType) || "DELETE".equals(reqType))) { + } + else if (extRequestValue && ("PUT".equals(reqType) || "POST".equals(reqType) || "DELETE".equals(reqType))){ syncUserRolesExtension(userRole, appId, localSession, userAppRoles, newUserAppRolesMap); - } else if (extRequestValue && !userRole.getRoleId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID)) { + } + else if (extRequestValue && !userRole.getRoleId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID)){ syncUserRolesExtension(userRole, appId, localSession, userAppRoles, newUserAppRolesMap); } } @@ -304,13 +298,12 @@ public class UserRolesCommonServiceImpl { HashMap<Long, EPRole> rolesMap = new HashMap<Long, EPRole>(); if (appId.equals(PortalConstants.PORTAL_APP_ID)) { // local app String appIdValue = ""; - if (!extRequestValue) { - appIdValue = "and id != " + PortalConstants.SYS_ADMIN_ROLE_ID; + if(!extRequestValue){ + appIdValue = "and id != " + PortalConstants.SYS_ADMIN_ROLE_ID; } @SuppressWarnings("unchecked") List<EPRole> roles = localSession - .createQuery("from " + EPRole.class.getName() + " where appId is null " + appIdValue) - .list(); + .createQuery("from " + EPRole.class.getName() + " where appId is null " + appIdValue).list(); for (EPRole role : roles) { role.setAppId(1L); rolesMap.put(role.getId(), role); @@ -331,18 +324,15 @@ public class UserRolesCommonServiceImpl { EPRole role = null; for (EcompRole userRole : newRolesToAdd) { EPUserApp userApp = new EPUserApp(); - if (("PUT".equals(reqType) || "POST".equals(reqType)) - && userRole.getName().equals(PortalConstants.ADMIN_ROLE)) { - role = (EPRole) localSession.get(EPRole.class, - new Long(PortalConstants.ACCOUNT_ADMIN_ROLE_ID)); + if (("PUT".equals(reqType) || "POST".equals(reqType)) && userRole.getName().equals(PortalConstants.ADMIN_ROLE)) { + role = (EPRole) localSession.get(EPRole.class, new Long(PortalConstants.ACCOUNT_ADMIN_ROLE_ID)); userApp.setRole(role); - } else if ((userRole.getId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID)) - && !extRequestValue) { + } else if ((userRole.getId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID)) && !extRequestValue){ + continue; + }else if((userRole.getId().equals(PortalConstants.SYS_ADMIN_ROLE_ID)) && app.getId().equals(PortalConstants.PORTAL_APP_ID) && !extRequestValue){ continue; - } else if ((userRole.getId().equals(PortalConstants.SYS_ADMIN_ROLE_ID)) - && app.getId().equals(PortalConstants.PORTAL_APP_ID) && !extRequestValue) { - continue; - } else { + } + else { userApp.setRole(rolesMap.get(userRole.getId())); } @@ -354,17 +344,19 @@ public class UserRolesCommonServiceImpl { if (appId == PortalConstants.PORTAL_APP_ID) { /* - * for local app -- hack - always make sure fn_role table's app_id is null and - * not 1 for primary app in this case being ecomp portal app; reason: hibernate - * is rightly setting this to 1 while persisting to fn_role as per the mapping - * but SDK role management code expects the app_id to be null as there is no + * for local app -- hack - always make sure fn_role + * table's app_id is null and not 1 for primary app in + * this case being ecomp portal app; reason: hibernate + * is rightly setting this to 1 while persisting to + * fn_role as per the mapping but SDK role management + * code expects the app_id to be null as there is no * concept of App_id in SDK */ localSession.flush(); SQLQuery sqlQuery = localSession .createSQLQuery("update fn_role set app_id = null where app_id = 1 "); sqlQuery.executeUpdate(); - + } } } @@ -375,7 +367,7 @@ public class UserRolesCommonServiceImpl { EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e); EcompPortalUtils.rollbackTransaction(transaction, "Exception occurred in syncUserRoles, Details: " + e.toString()); - if ("DELETE".equals(reqType)) { + if("DELETE".equals(reqType)){ throw new Exception(e.getMessage()); } } finally { @@ -386,13 +378,13 @@ public class UserRolesCommonServiceImpl { } } } - + /** * Called when getting the list of roles for the user * * @param appRoles * @param userAppRoles - * @return List<RoleInAppForUser> + * @return List<RoleInAppForUser> */ protected List<RoleInAppForUser> constructRolesInAppForUserGet(EcompRole[] appRoles, EcompRole[] userAppRoles) { List<RoleInAppForUser> rolesInAppForUser = new ArrayList<RoleInAppForUser>(); @@ -424,12 +416,11 @@ public class UserRolesCommonServiceImpl { * * @param appRoles * @param userAppRoles - * @param extRequestValue - * set to false if request is from users page otherwise true + * @param extRequestValue + * set to false if request is from users page otherwise true * @return List<RoleInAppForUser> */ - protected List<RoleInAppForUser> constructRolesInAppForUserGet(List<Role> appRoles, EPRole[] userAppRoles, - Boolean extRequestValue) { + protected List<RoleInAppForUser> constructRolesInAppForUserGet(List<Role> appRoles, EPRole[] userAppRoles, Boolean extRequestValue) { List<RoleInAppForUser> rolesInAppForUser = new ArrayList<RoleInAppForUser>(); Set<Long> userAppRolesMap = new HashSet<Long>(); @@ -457,6 +448,7 @@ public class UserRolesCommonServiceImpl { return rolesInAppForUser; } + /** * copies of methods in GetAppsWithUserRoleState * @@ -518,8 +510,7 @@ public class UserRolesCommonServiceImpl { "from " + EPUserApp.class.getName() + " where app.id=" + appId + " and role_id=" + roleId) .list(); - logger.debug(EELFLoggerDelegate.debugLogger, - "syncAppRoles: number of userRoles to delete: " + userRoles.size()); + logger.debug(EELFLoggerDelegate.debugLogger, "syncAppRoles: number of userRoles to delete: " + userRoles.size()); for (EPUserApp userRole : userRoles) { logger.debug(EELFLoggerDelegate.debugLogger, "syncAppRoles: about to delete userRole: " + userRole.toString()); @@ -568,17 +559,15 @@ public class UserRolesCommonServiceImpl { } } } - externalAccessRolesService.deleteRoleDependencyRecords(localSession, roleId, appId); - logger.debug(EELFLoggerDelegate.debugLogger, - "syncAppRoles: about to delete the role: " + role.toString()); + boolean isPortalRequest = true; + externalAccessRolesService.deleteRoleDependencyRecords(localSession, roleId, appId, isPortalRequest); + logger.debug(EELFLoggerDelegate.debugLogger, "syncAppRoles: about to delete the role: " + role.toString()); localSession.delete(role); - localSession.flush(); logger.debug(EELFLoggerDelegate.debugLogger, "syncAppRoles: deleted the role"); } } for (EcompRole role : newRolesToAdd) { - logger.debug(EELFLoggerDelegate.debugLogger, - "syncAppRoles: about to add missing role: " + role.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, "syncAppRoles: about to add missing role: " + role.toString()); EPRole newRole = new EPRole(); // Attention! All roles from remote application supposed to be // active! @@ -601,7 +590,11 @@ public class UserRolesCommonServiceImpl { localSession.close(); } } - + + + + + /** * Called when updating the list of roles for the user * @@ -625,7 +618,7 @@ public class UserRolesCommonServiceImpl { } return result; } - + /** * * @param roleInAppForUserList @@ -639,7 +632,7 @@ public class UserRolesCommonServiceImpl { } return false; } - + /** * Builds JSON and posts it to a remote application to update user roles. * @@ -665,11 +658,11 @@ public class UserRolesCommonServiceImpl { // even when it fails! return updateUserRolesInEcomp; } - + /** * * @param roleInAppForUserList - * @return Set<EcompRole> + * @return Set<EcompRole> */ protected Set<EcompRole> constructUsersEcompRoles(List<RoleInAppForUser> roleInAppForUserList) { Set<EcompRole> existingUserRoles = new TreeSet<EcompRole>(); @@ -683,18 +676,18 @@ public class UserRolesCommonServiceImpl { } return existingUserRoles; } - + /** * Constructs user app roles excluding Account Administrator role * * @param roleInAppForUserList - * @return List of roles with Role name, Role Id + * @return + * List of roles with Role name, Role Id */ protected Set<EcompRole> constructUsersRemoteAppRoles(List<RoleInAppForUser> roleInAppForUserList) { Set<EcompRole> existingUserRoles = new TreeSet<EcompRole>(); for (RoleInAppForUser roleInAppForUser : roleInAppForUserList) { - if (roleInAppForUser.isApplied - && !roleInAppForUser.getRoleId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID)) { + if (roleInAppForUser.isApplied && !roleInAppForUser.getRoleId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID)) { EcompRole ecompRole = new EcompRole(); ecompRole.setId(roleInAppForUser.roleId); ecompRole.setName(roleInAppForUser.roleName); @@ -703,17 +696,16 @@ public class UserRolesCommonServiceImpl { } return existingUserRoles; } - + /** * This is for a single app * * @param rolesInAppForUser - * @param externalSystemRequest - * set to false if requests from Users page otherwise true + * @param externalSystemRequest + * set to false if requests from Users page otherwise true * @return true on success, false otherwise */ - protected boolean applyChangesInUserRolesForAppToEcompDB(RolesInAppForUser rolesInAppForUser, - boolean externalSystemRequest, String reqType) throws Exception { + protected boolean applyChangesInUserRolesForAppToEcompDB(RolesInAppForUser rolesInAppForUser, boolean externalSystemRequest, String reqType) throws Exception { boolean result = false; String userId = rolesInAppForUser.orgUserId; Long appId = rolesInAppForUser.appId; @@ -723,10 +715,8 @@ public class UserRolesCommonServiceImpl { } if (rolesInAppForUser != null) { - EcompRole[] userAppRoles = new EcompRole[rolesInAppForUser.roles.stream().distinct() - .collect(Collectors.toList()).size()]; - for (int i = 0; i < rolesInAppForUser.roles.stream().distinct().collect(Collectors.toList()) - .size(); i++) { + EcompRole[] userAppRoles = new EcompRole[rolesInAppForUser.roles.stream().distinct().collect(Collectors.toList()).size()]; + for (int i = 0; i < rolesInAppForUser.roles.stream().distinct().collect(Collectors.toList()).size(); i++) { RoleInAppForUser roleInAppForUser = rolesInAppForUser.roles.get(i); EcompRole role = new EcompRole(); role.setId(roleInAppForUser.roleId); @@ -738,9 +728,8 @@ public class UserRolesCommonServiceImpl { result = true; } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, - "applyChangesInUserRolesForAppToEcompDB: failed to syncUserRoles for orgUserId " + userId, - e); - if ("DELETE".equals(reqType)) { + "applyChangesInUserRolesForAppToEcompDB: failed to syncUserRoles for orgUserId " + userId, e); + if("DELETE".equals(reqType)){ throw new Exception(e.getMessage()); } } @@ -748,7 +737,7 @@ public class UserRolesCommonServiceImpl { } return result; } - + /** * * @param appId @@ -764,7 +753,7 @@ public class UserRolesCommonServiceImpl { userWithRemoteAppRoles.setRoles(remoteUser.getRoles()); return userWithRemoteAppRoles; } - + /* * (non-Javadoc) * @@ -793,7 +782,7 @@ public class UserRolesCommonServiceImpl { return rolesList; } - + /** * It adds new user for remote application * @@ -804,17 +793,14 @@ public class UserRolesCommonServiceImpl { * @param mapper * @param searchService * @param applicationsRestClientService - * @return + * @return * @throws Exception */ - private EPUser addRemoteUser(List<RoleInAppForUser> roleInAppForUserList, String userId, EPApp app, - ObjectMapper mapper, SearchService searchService, - ApplicationsRestClientService applicationsRestClientService) throws Exception { + private EPUser addRemoteUser(List<RoleInAppForUser> roleInAppForUserList, String userId, EPApp app, ObjectMapper mapper, SearchService searchService, ApplicationsRestClientService applicationsRestClientService) throws Exception{ EPUser addRemoteUser = null; if (remoteUserShouldBeCreated(roleInAppForUserList)) { - - createNewUserOnRemoteApp(userId, app, applicationsRestClientService, searchService, mapper, - isAppUpgradeVersion(app)); + + createNewUserOnRemoteApp(userId, app, applicationsRestClientService, searchService, mapper, isAppUpgradeVersion(app)); // If we succeed, we know that the new user was // persisted on remote app. addRemoteUser = getUserFromApp(userId, app, applicationsRestClientService); @@ -826,10 +812,10 @@ public class UserRolesCommonServiceImpl { } return addRemoteUser; } - + /** - * It checks whether the remote user exists or not if exits returns user object - * else null + * It checks whether the remote user exists or not + * if exits returns user object else null * * @param userId * @param app @@ -837,8 +823,7 @@ public class UserRolesCommonServiceImpl { * @return * @throws HTTPException */ - private EPUser checkIfRemoteUserExits(String userId, EPApp app, - ApplicationsRestClientService applicationsRestClientService) throws HTTPException { + private EPUser checkIfRemoteUserExits(String userId, EPApp app, ApplicationsRestClientService applicationsRestClientService) throws HTTPException{ EPUser checkRemoteUser = null; try { checkRemoteUser = getUserFromApp(userId, app, applicationsRestClientService); @@ -848,7 +833,7 @@ public class UserRolesCommonServiceImpl { logger.debug(EELFLoggerDelegate.debugLogger, "setAppWithUserRoleStateForUser: getuserFromApp threw exception with response code 400; continuing", e); - } else if (e.getResponseCode() == 404) { + } else if(e.getResponseCode() == 404) { logger.debug(EELFLoggerDelegate.debugLogger, "setAppWithUserRoleStateForUser: getuserFromApp threw exception with response code 404; continuing", e); @@ -859,13 +844,14 @@ public class UserRolesCommonServiceImpl { } return checkRemoteUser; } - + + /* * (non-Javadoc) * * @see org.openecomp.portalapp.portal.service.UserRolesService# - * setAppWithUserRoleStateForUser(org.openecomp.portalapp.portal.domain. EPUser, - * org.openecomp.portalapp.portal.transport.AppWithRolesForUser) + * setAppWithUserRoleStateForUser(org.openecomp.portalapp.portal.domain. + * EPUser, org.openecomp.portalapp.portal.transport.AppWithRolesForUser) */ public boolean setAppWithUserRoleStateForUser(EPUser user, AppWithRolesForUser newAppRolesForUser) { boolean result = false; @@ -896,36 +882,38 @@ public class UserRolesCommonServiceImpl { applicationsRestClientService); } } - + Set<EcompRole> userRolesInLocalApp = postUsersRolesToLocalApp(roleInAppForUserList, mapper, applicationsRestClientService, appId, userId); RolesInAppForUser rolesInAppForUser = constructRolesInAppForUserUpdate(userId, appId, userRolesInLocalApp); List<RoleInAppForUser> roleAppUserList = rolesInAppForUser.roles; - // Apply changes in external Access system - updateUserRolesInExternalSystem(app, rolesInAppForUser.orgUserId, roleAppUserList, epRequestValue); + if (EcompPortalUtils.checkIfRemoteCentralAccessAllowed()) { + // Apply changes in external Access system + updateUserRolesInExternalSystem(app, rolesInAppForUser.orgUserId, roleAppUserList, + epRequestValue); + } result = applyChangesInUserRolesForAppToEcompDB(rolesInAppForUser, epRequestValue, "Portal"); - } + } // In case if portal is not centralized then follow existing approach - else if (!app.getCentralAuth() && app.getId().equals(PortalConstants.PORTAL_APP_ID)) { + else if(!app.getCentralAuth() && app.getId().equals(PortalConstants.PORTAL_APP_ID)){ Set<EcompRole> userRolesInLocalApp = postUsersRolesToLocalApp(roleInAppForUserList, mapper, - applicationsRestClientService, appId, userId); + applicationsRestClientService, appId, userId); RolesInAppForUser rolesInAppForUser = constructRolesInAppForUserUpdate(userId, appId, userRolesInLocalApp); result = applyChangesInUserRolesForAppToEcompDB(rolesInAppForUser, epRequestValue, "Portal"); - } else {// remote app + } else{// remote app EPUser remoteAppUser = null; - if (!app.getCentralAuth() && !app.getId().equals(PortalConstants.PORTAL_APP_ID)) { - + if(!app.getCentralAuth() && !app.getId().equals(PortalConstants.PORTAL_APP_ID)){ + remoteAppUser = checkIfRemoteUserExits(userId, app, applicationsRestClientService); - + if (remoteAppUser == null) { - remoteAppUser = addRemoteUser(roleInAppForUserList, userId, app, mapper, searchService, - applicationsRestClientService); + remoteAppUser = addRemoteUser(roleInAppForUserList, userId, app, mapper, searchService, applicationsRestClientService); } if (remoteAppUser != null) { - Set<EcompRole> userRolesInRemoteApp = postUsersRolesToRemoteApp(roleInAppForUserList, - mapper, applicationsRestClientService, appId, userId); + Set<EcompRole> userRolesInRemoteApp = postUsersRolesToRemoteApp(roleInAppForUserList, mapper, + applicationsRestClientService, appId, userId); RolesInAppForUser rolesInAppForUser = constructRolesInAppForUserUpdate(userId, appId, userRolesInRemoteApp); result = applyChangesInUserRolesForAppToEcompDB(rolesInAppForUser, epRequestValue, null); @@ -933,8 +921,8 @@ public class UserRolesCommonServiceImpl { // If no roles remain, request app to set user inactive. if (userRolesInRemoteApp.size() == 0) { logger.debug(EELFLoggerDelegate.debugLogger, - "setAppWithUserRoleStateForUser: no roles in app {}, set user {} to inactive", - app, userId); + "setAppWithUserRoleStateForUser: no roles in app {}, set user {} to inactive", app, + userId); remoteAppUser.setActive(false); postUserToRemoteApp(userId, user, app, applicationsRestClientService); } @@ -942,7 +930,8 @@ public class UserRolesCommonServiceImpl { } } } catch (Exception e) { - String message = String.format("Failed to create user or update user roles for User %s, AppId %s", + String message = String.format( + "Failed to create user or update user roles for User %s, AppId %s", userId, Long.toString(appId)); logger.error(EELFLoggerDelegate.errorLogger, message, e); result = false; @@ -951,20 +940,16 @@ public class UserRolesCommonServiceImpl { } return result; } - /** - * It adds user roles in External system and also make data consistent in both - * local and in External System + * It adds user roles in External system and also make data consistent in both local and in External System * - * @param app - * details + * @param app details * @param orgUserId - * @param roleInAppUser - * Contains list of active roles + * @param roleInAppUser Contains list of active roles */ @SuppressWarnings("unchecked") - private void updateUserRolesInExternalSystem(EPApp app, String orgUserId, List<RoleInAppForUser> roleInAppUser, - boolean isPortalRequest) { + private void updateUserRolesInExternalSystem(EPApp app, String orgUserId, List<RoleInAppForUser> roleInAppUser, boolean isPortalRequest) throws Exception + { try { // check if user exists final Map<String, String> userParams = new HashMap<>(); @@ -987,10 +972,12 @@ public class UserRolesCommonServiceImpl { .exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "roles/user/" + name, HttpMethod.GET, getUserRolesEntity, String.class); if (getResponse.getStatusCode().value() == 200) { - logger.debug(EELFLoggerDelegate.debugLogger, - "updateUserRolesInExternalSystem: Finished GET user roles from external system and received user roles {}", + logger.debug(EELFLoggerDelegate.debugLogger, "updateUserRolesInExternalSystem: Finished GET user roles from external system and received user roles {}", getResponse.getBody()); + }else{ + logger.error(EELFLoggerDelegate.errorLogger, "updateUserRolesInExternalSystem: Failed GET user roles from external system and received user roles {}",getResponse.getBody() ); + EPLogUtil.logExternalAuthAccessAlarm(logger, getResponse.getStatusCode()); } List<ExternalAccessUserRoleDetail> userRoleDetailList = new ArrayList<>(); String res = getResponse.getBody(); @@ -1007,7 +994,7 @@ public class UserRolesCommonServiceImpl { && !extRoles.getJSONObject(i).getString("name").equals(app.getNameSpace() + ".admin") && !extRoles.getJSONObject(i).getString("name").equals(app.getNameSpace() + ".owner")) { ObjectMapper descMapper = new ObjectMapper(); - if (extRoles.getJSONObject(i).has("description")) { + if (extRoles.getJSONObject(i).has("description") && EcompPortalUtils.isJSONValid(extRoles.getJSONObject(i).getString("description"))) { ExternalRoleDescription desc = descMapper.readValue( extRoles.getJSONObject(i).getString("description"), ExternalRoleDescription.class); userRoleDetail = new ExternalAccessUserRoleDetail( @@ -1022,9 +1009,11 @@ public class UserRolesCommonServiceImpl { } } } - // If request coming from portal not from external role approval system then we - // have to check if user already - // have account admin or system admin as GUI will not send these roles + + List<ExternalAccessUserRoleDetail> userRoleListMatchingInExtAuthAndLocal = CheckIfRoleAreMatchingInUserRoleDetailList(userRoleDetailList,app); + + // If request coming from portal not from external role approval system then we have to check if user already + // have account admin or system admin as GUI will not send these roles if (!isPortalRequest) { final Map<String, String> loginIdParams = new HashMap<>(); loginIdParams.put("orgUserIdValue", orgUserId); @@ -1050,67 +1039,75 @@ public class UserRolesCommonServiceImpl { List<RoleInAppForUser> roleInAppUserNonDupls = roleInAppUser.stream().distinct() .collect(Collectors.toList()); final Map<String, RoleInAppForUser> currentUserRolesToUpdate = new HashMap<>(); - for (RoleInAppForUser roleInAppUserNew : roleInAppUser) { - currentUserRolesToUpdate.put(roleInAppUserNew.getRoleName(), roleInAppUserNew); + for (RoleInAppForUser roleInAppUserNew : roleInAppUserNonDupls) { + currentUserRolesToUpdate.put(roleInAppUserNew.getRoleName().replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"), roleInAppUserNew); } final Map<String, ExternalAccessUserRoleDetail> currentUserRolesInExternalSystem = new HashMap<>(); - for (ExternalAccessUserRoleDetail extAccessUserRole : userRoleDetailList) { + for (ExternalAccessUserRoleDetail extAccessUserRole : userRoleListMatchingInExtAuthAndLocal) { currentUserRolesInExternalSystem.put(extAccessUserRole.getName(), extAccessUserRole); } - // Check if roles does not exists in local but still there in External Central - // Auth System delete them all - for (ExternalAccessUserRoleDetail userRole : userRoleDetailList) { + // Check if user roles does not exists in local but still there in External Central Auth System delete them all + for (ExternalAccessUserRoleDetail userRole : userRoleListMatchingInExtAuthAndLocal) { if (!(currentUserRolesToUpdate - .containsKey(userRole.getName().substring(app.getNameSpace().length() + 1).replaceAll("_", " ")) - || currentUserRolesToUpdate - .containsKey(userRole.getName().substring(app.getNameSpace().length() + 1)))) { + .containsKey(userRole.getName().substring(app.getNameSpace().length() + 1)))) { HttpEntity<String> entity = new HttpEntity<>(headers); logger.debug(EELFLoggerDelegate.debugLogger, "updateUserRolesInExternalSystem: Connecting to external system to DELETE user role {}", - userRole); + userRole.getName()); ResponseEntity<String> deleteResponse = template.exchange( SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "userRole/" + name + "/" + userRole.getName(), HttpMethod.DELETE, entity, String.class); logger.debug(EELFLoggerDelegate.debugLogger, "updateUserRolesInExternalSystem: Finished DELETE operation in external system for user role {} and the response is {}", - userRole, deleteResponse.getBody()); + userRole.getName(), deleteResponse.getBody()); } } - // Check if user roles does not exists in External Central Auth System add them - // all + // Check if user roles does not exists in External Central Auth System add them all for (RoleInAppForUser addUserRole : roleInAppUserNonDupls) { if (!(currentUserRolesInExternalSystem - .containsKey(app.getNameSpace() + "." + addUserRole.getRoleName().replaceAll(" ", "_")))) { + .containsKey(app.getNameSpace() + "." + addUserRole.getRoleName().replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_")))) { ExternalAccessUser extUser = new ExternalAccessUser(name, - app.getNameSpace() + "." + addUserRole.getRoleName().replaceAll(" ", "_")); + app.getNameSpace() + "." + addUserRole.getRoleName().replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_")); String formattedUserRole = mapper.writeValueAsString(extUser); HttpEntity<String> entity = new HttpEntity<>(formattedUserRole, headers); - logger.debug(EELFLoggerDelegate.debugLogger, - "updateUserRolesInExternalSystem: Connecting to external system and adding user role", - addUserRole.getRoleName()); + logger.debug(EELFLoggerDelegate.debugLogger, "updateUserRolesInExternalSystem: Connecting to external system for user {} and POST {}", + name , addUserRole.getRoleName()); ResponseEntity<String> addResponse = template .exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "userRole", HttpMethod.POST, entity, String.class); logger.debug(EELFLoggerDelegate.debugLogger, "updateUserRolesInExternalSystem: Finished adding user role in external system {} and added user role {}", - getResponse.getBody(), addUserRole.getRoleName()); + addResponse.getBody(), addUserRole.getRoleName()); if (addResponse.getStatusCode().value() != 201 && addResponse.getStatusCode().value() != 404) { logger.debug(EELFLoggerDelegate.debugLogger, - "Finished POST operation in external system but unable to save user role", - getResponse.getBody(), addUserRole.getRoleName()); + "Finished POST operation in external system but unable to save user role", addResponse.getBody(), + addUserRole.getRoleName()); throw new Exception(addResponse.getBody()); } } } } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "updateUserRolesInExternalSystem: Failed to add user role for application {} due to {}", - app.getId(), e); + logger.error(EELFLoggerDelegate.errorLogger, "updateUserRolesInExternalSystem: Failed to add user role for application {} due to {}", app.getId(), e); + EPLogUtil.logExternalAuthAccessAlarm(logger, HttpStatus.BAD_REQUEST); + throw e; } } + private List<ExternalAccessUserRoleDetail> CheckIfRoleAreMatchingInUserRoleDetailList( + List<ExternalAccessUserRoleDetail> userRoleDetailList, EPApp app) { + Map<String, EPRole> epRoleList = externalAccessRolesService.getCurrentRolesInDB(app); + //Add Account Admin role for partner app to prevent conflict + if(!app.getId().equals(PortalConstants.PORTAL_APP_ID)) { + EPRole role = new EPRole(); + role.setName(PortalConstants.ADMIN_ROLE.replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_")); + epRoleList.put(role.getName(), role); + } + userRoleDetailList.removeIf(userRoleDetail -> !epRoleList.containsKey(userRoleDetail.getName().substring(app.getNameSpace().length()+1))); + return userRoleDetailList; + } + /** * * @param userId @@ -1124,30 +1121,30 @@ public class UserRolesCommonServiceImpl { ApplicationsRestClientService applicationsRestClientService, SearchService searchService, ObjectMapper mapper, boolean postOpenSource) throws Exception { - EPUser client = searchService.searchUserByUserId(userId); - - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - if (client == null) { - String msg = "cannot create user " + userId + ", because he/she cannot be found in phonebook."; - logger.error(EELFLoggerDelegate.errorLogger, msg); - throw new Exception(msg); - } + + EPUser client = searchService.searchUserByUserId(userId); + + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + if (client == null) { + String msg = "cannot create user " + userId + ", because he/she cannot be found in phonebook."; + logger.error(EELFLoggerDelegate.errorLogger, msg); + throw new Exception(msg); + } - client.setLoginId(userId); - client.setActive(true); + client.setLoginId(userId); + client.setActive(true); - String userInString = null; - userInString = mapper.writerFor(EPUser.class).writeValueAsString(client); - logger.debug(EELFLoggerDelegate.debugLogger, - "about to post new client to remote application, users json = " + userInString); - applicationsRestClientService.post(EPUser.class, app.getId(), userInString, String.format("/user", userId)); + String userInString = null; + userInString = mapper.writerFor(EPUser.class).writeValueAsString(client); + logger.debug(EELFLoggerDelegate.debugLogger, + "about to post new client to remote application, users json = " + userInString); + applicationsRestClientService.post(EPUser.class, app.getId(), userInString, String.format("/user", userId)); } - + @SuppressWarnings("unchecked") - protected void applyChangesToAppRolesRequest(Long appId, Long userId, String updateStatus, - EPUserAppRolesRequest epUserAppRolesRequest) { + protected void applyChangesToAppRolesRequest(Long appId, Long userId, String updateStatus, EPUserAppRolesRequest epUserAppRolesRequest) { final Map<String, Long> epRequestParams = new HashMap<>(); try { EPUserAppRolesRequest epAppRolesRequestData = epUserAppRolesRequest; @@ -1176,7 +1173,7 @@ public class UserRolesCommonServiceImpl { logger.error(EELFLoggerDelegate.errorLogger, "applyChangesToAppRolesRequest failed", e); } } - + @SuppressWarnings("unchecked") public void applyChangesToUserAppRolesForMyLoginsRequest(EPUser user, Long appId) { final Map<String, Long> params = new HashMap<>(); @@ -1215,7 +1212,7 @@ public class UserRolesCommonServiceImpl { logger.error(EELFLoggerDelegate.errorLogger, "applyChangesToUserAppRolesRequest failed", e); } } - + /** * Pushes specified user details to the specified remote app. * @@ -1230,29 +1227,30 @@ public class UserRolesCommonServiceImpl { */ protected void postUserToRemoteApp(String userId, EPUser user, EPApp app, ApplicationsRestClientService applicationsRestClientService) throws HTTPException { - - getUser(userId, app, applicationsRestClientService); - + + getUser(userId, app, applicationsRestClientService); + } - + /** * It returns user details for single org user id * * @param userParams - * @return if user exists it returns list of user details otherwise empty value + * @return + * if user exists it returns list of user details otherwise empty value */ @SuppressWarnings("unchecked") - private List<EPUser> checkIfUserExists(Map<String, String> userParams) { - return (List<EPUser>) dataAccessService.executeNamedQuery("epUserAppId", userParams, null); + private List<EPUser> checkIfUserExists(Map<String, String> userParams){ + return (List<EPUser>)dataAccessService.executeNamedQuery("epUserAppId", userParams, null); } - + /** * It checks whether the new user is valid or not otherwise throws exception * * @param orgUserId * @param app - * @return Checks if user is valid and returns message otherwise throws - * exception + * @return + * Checks if user is valid and returns message otherwise throws exception * @throws Exception */ private String validateNewUser(String orgUserId, EPApp app) throws Exception { @@ -1266,30 +1264,29 @@ public class UserRolesCommonServiceImpl { } return "Saved Successfully"; } - + /** - * Checks if the fields exists or not - * + * Checks if the fields exists or not + * * @param userList - * contains user information + * contains user information * @param app - * contains app name + * contains app name * @throws Exception - * throws exception if the field is not valid + * throws exception if the field is not valid */ - private void validateExternalRequestFields(List<EPUser> userList, EPApp app) throws Exception { - if (userList.size() == 0 || userList.isEmpty()) { + private void validateExternalRequestFields(List<EPUser> userList, EPApp app) throws Exception{ + if (userList.size() == 0 || userList.isEmpty() ) { throw new Exception("User does not exist"); - } else if (app == null) { + } else if(app == null) { throw new Exception("Application does not exist"); - } else if (!app.getEnabled() && !app.getId().equals(PortalConstants.PORTAL_APP_ID)) { - throw new Exception(app.getMlAppName() + " application is unavailable"); + } else if(!app.getEnabled() && !app.getId().equals(PortalConstants.PORTAL_APP_ID)) { + throw new Exception(app.getMlAppName()+" application is unavailable"); } } - + @SuppressWarnings("unchecked") - public ExternalRequestFieldsValidator setExternalRequestUserAppRole(ExternalSystemUser newAppRolesForUser, - String reqType) { + public ExternalRequestFieldsValidator setExternalRequestUserAppRole(ExternalSystemUser newAppRolesForUser, String reqType) { boolean result = false; boolean externalSystemRequest = true; final Map<String, Long> params = new HashMap<>(); @@ -1305,7 +1302,7 @@ public class UserRolesCommonServiceImpl { orgUserId = newAppRolesForUser.getLoginId().trim(); } String appName = newAppRolesForUser.getApplicationName(); - String logMessage = ("DELETE").equals(reqType) ? "Deleting" : "Assigning/Updating"; + String logMessage = ("DELETE").equals(reqType) ? "Deleting": "Assigning/Updating" ; if (orgUserId.length() > 0) { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -1327,24 +1324,28 @@ public class UserRolesCommonServiceImpl { .executeNamedQuery("userAppRolesRequestList", params, null); epRequestIdSize = epRequestId.size(); } - - // If Non-Centralized app make sure you sync app roles before assigning to user + + //If Non-Centralized app make sure you sync app roles before assigning to user if (!app.getId().equals(PortalConstants.PORTAL_APP_ID) && !app.getCentralAuth()) { + logger.debug(EELFLoggerDelegate.debugLogger, "setExternalRequestUserAppRole: Starting GET roles for app {}",app.getId()); EcompRole[] appRoles = applicationsRestClientService.get(EcompRole[].class, app.getId(), "/roles"); - syncAppRoles(sessionFactory, app.getId(), appRoles); + logger.debug(EELFLoggerDelegate.debugLogger, "setExternalRequestUserAppRole: Finshed GET roles for app {} and payload {}",app.getId(), appRoles); + if (appRoles.length > 0) { + syncAppRoles(sessionFactory, app.getId(), appRoles); + } } List<RoleInAppForUser> roleInAppForUserList = roleInAppForUserList(newAppRolesForUser.getRoles(), app.getId(), app.getMlAppName()); List<EcompUserAppRoles> userRoleList = null; - if (!userInfo.isEmpty()) { - final Map<String, Long> appParams = new HashMap<>(); - appParams.put("userId", userId.getId()); - appParams.put("appId", app.getId()); - userRoleList = dataAccessService.executeNamedQuery("getUserAppExistingRoles", appParams, null); + if(!userInfo.isEmpty()){ + final Map<String, Long> appParams = new HashMap<>(); + appParams.put("userId", userId.getId()); + appParams.put("appId", app.getId()); + userRoleList = dataAccessService.executeNamedQuery("getUserAppExistingRoles", appParams, null); } // Check if list contains just account admin role boolean checkIfAdminRoleExists = false; - if (reqType.equals("DELETE") && userRoleList != null) { + if (reqType.equals("DELETE") && userRoleList!=null) { checkIfAdminRoleExists = userRoleList.stream() .anyMatch(userRole -> userRole.getRoleId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID)); } else { @@ -1356,11 +1357,11 @@ public class UserRolesCommonServiceImpl { // We should add If user does not exist in remote application try { // If adding just account admin role dont make remote application user call - if (!app.getId().equals(PortalConstants.PORTAL_APP_ID) - && !(checkIfAdminRoleExists && reqType.equals("DELETE")) - && roleInAppForUserList.size() > 1) { + if (!app.getId().equals(PortalConstants.PORTAL_APP_ID) && !(checkIfAdminRoleExists + && reqType.equals("DELETE")) && roleInAppForUserList.size() > 1) { EPUser remoteAppUser = null; - remoteAppUser = checkIfRemoteUserExits(orgUserId, app, applicationsRestClientService); + remoteAppUser = checkIfRemoteUserExits(orgUserId, app, + applicationsRestClientService); if (remoteAppUser == null) { addRemoteUser(roleInAppForUserList, orgUserId, app, mapper, searchService, applicationsRestClientService); @@ -1369,8 +1370,7 @@ public class UserRolesCommonServiceImpl { } } catch (Exception e) { reqMessage = e.getMessage(); - logger.error(EELFLoggerDelegate.errorLogger, - "setExternalRequestUserAppRole: Failed to added remote user", e); + logger.error(EELFLoggerDelegate.errorLogger, "setExternalRequestUserAppRole: Failed to added remote user", e); throw new Exception(reqMessage); } Set<EcompRole> userRolesInLocalApp = postUsersRolesToLocalApp(roleInAppForUserList, mapper, @@ -1378,69 +1378,66 @@ public class UserRolesCommonServiceImpl { RolesInAppForUser rolesInAppForUser = constructRolesInAppForUserUpdate(orgUserId, app.getId(), userRolesInLocalApp); List<RoleInAppForUser> roleAppUserList = rolesInAppForUser.roles; + if(EcompPortalUtils.checkIfRemoteCentralAccessAllowed()) { // Apply changes in external Access system - updateUserRolesInExternalSystem(app, rolesInAppForUser.orgUserId, roleAppUserList, - externalSystemRequest); - logger.info(EELFLoggerDelegate.debugLogger, - "setExternalRequestUserAppRole: {} user app roles: for app {}, user {}", logMessage, + updateUserRolesInExternalSystem(app, rolesInAppForUser.orgUserId, roleAppUserList, externalSystemRequest); + } + logger.info(EELFLoggerDelegate.debugLogger, "setExternalRequestUserAppRole: {} user app roles: for app {}, user {}", logMessage, newAppRolesForUser.getApplicationName(), newAppRolesForUser.getLoginId()); result = applyChangesInUserRolesForAppToEcompDB(rolesInAppForUser, externalSystemRequest, reqType); - } - // If local application is not centralized - else if (!app.getCentralAuth() && app.getId().equals(PortalConstants.PORTAL_APP_ID)) { + } + // If local application is not centralized + else if(!app.getCentralAuth() && app.getId().equals(PortalConstants.PORTAL_APP_ID)){ Set<EcompRole> userRolesInLocalApp = postUsersRolesToLocalApp(roleInAppForUserList, mapper, - applicationsRestClientService, app.getId(), orgUserId); + applicationsRestClientService, app.getId(), orgUserId); RolesInAppForUser rolesInAppForUser = constructRolesInAppForUserUpdate(orgUserId, app.getId(), userRolesInLocalApp); result = applyChangesInUserRolesForAppToEcompDB(rolesInAppForUser, externalSystemRequest, reqType); } else {// remote app // If adding just account admin role don't do remote application user call - if (!((roleInAppForUserList.size() == 1 || reqType.equals("DELETE")) && checkIfAdminRoleExists)) { - EPUser remoteAppUser = null; + if(!((roleInAppForUserList.size() == 1 || reqType.equals("DELETE")) && checkIfAdminRoleExists)){ + EPUser remoteAppUser = null; remoteAppUser = checkIfRemoteUserExits(orgUserId, app, applicationsRestClientService); - if (remoteAppUser == null) { - remoteAppUser = addRemoteUser(roleInAppForUserList, orgUserId, app, mapper, searchService, - applicationsRestClientService); - reqMessage = "Saved Successfully"; - } + if (remoteAppUser == null) { + remoteAppUser = addRemoteUser(roleInAppForUserList, orgUserId, app, mapper, searchService, applicationsRestClientService); + reqMessage = "Saved Successfully"; + } if (remoteAppUser != null) { Set<EcompRole> userRolesInRemoteApp = postUsersRolesToRemoteApp(roleInAppForUserList, mapper, applicationsRestClientService, app.getId(), orgUserId); RolesInAppForUser rolesInAppForUser = constructRolesInAppForUserUpdate(orgUserId, app.getId(), userRolesInRemoteApp); - logger.info(EELFLoggerDelegate.debugLogger, - "setExternalRequestUserAppRole: {} user app roles: for app {}, user {}", logMessage, - newAppRolesForUser.getApplicationName(), newAppRolesForUser.getLoginId()); + logger.info(EELFLoggerDelegate.debugLogger, "setExternalRequestUserAppRole: {} user app roles: for app {}, user {}", + logMessage, newAppRolesForUser.getApplicationName(), + newAppRolesForUser.getLoginId()); result = applyChangesInUserRolesForAppToEcompDB(rolesInAppForUser, externalSystemRequest, reqType); // If no roles remain, request app to set user inactive. - /* - * if (userRolesInRemoteApp.size() == 0) { - * logger.debug(EELFLoggerDelegate.debugLogger, - * "setAppWithUserRoleStateForUser: no roles in app {}, set user {} to inactive" - * , app, orgUserId); //TODO Need to fix the logged in user is not set to - * inactive remoteAppUser.setActive(false); postUserToRemoteApp(orgUserId, user, - * app, applicationsRestClientService); } - */ + /*if (userRolesInRemoteApp.size() == 0) { + logger.debug(EELFLoggerDelegate.debugLogger, + "setAppWithUserRoleStateForUser: no roles in app {}, set user {} to inactive", app, + orgUserId); + //TODO Need to fix the logged in user is not set to inactive + remoteAppUser.setActive(false); + postUserToRemoteApp(orgUserId, user, app, applicationsRestClientService); + }*/ } } else { - // Here we are adding only we have single account admin in roleInAppForUserList - // and this should not add in remote - if (!(reqType.equals("DELETE")) && userInfo.isEmpty()) { + // Here we are adding only we have single account admin in roleInAppForUserList and this should not add in remote + if(!(reqType.equals("DELETE")) && userInfo.isEmpty()){ reqMessage = "Saved Successfully"; } Set<EcompRole> userRolesInRemoteApp = constructUsersEcompRoles(roleInAppForUserList); RolesInAppForUser rolesInAppForUser = constructRolesInAppForUserUpdate(orgUserId, app.getId(), userRolesInRemoteApp); - logger.info(EELFLoggerDelegate.debugLogger, - "setExternalRequestUserAppRole: {} user app roles: for app {}, user {}", logMessage, - newAppRolesForUser.getApplicationName(), newAppRolesForUser.getLoginId()); + logger.info(EELFLoggerDelegate.debugLogger, "setExternalRequestUserAppRole: {} user app roles: for app {}, user {}", + logMessage, newAppRolesForUser.getApplicationName(), newAppRolesForUser.getLoginId()); result = applyChangesInUserRolesForAppToEcompDB(rolesInAppForUser, externalSystemRequest, reqType); } - if (!result) { + if(!result){ reqMessage = "Failed to save the user app role(s)"; } if (epRequestIdSize > 0 && !userInfo.isEmpty()) { @@ -1449,22 +1446,22 @@ public class UserRolesCommonServiceImpl { } } } catch (Exception e) { - String message = String.format( - "setExternalRequestUserAppRole: Failed to create user or update user roles for User %s, AppId %s", + String message = String.format("setExternalRequestUserAppRole: Failed to create user or update user roles for User %s, AppId %s", orgUserId, appName); logger.error(EELFLoggerDelegate.errorLogger, message, e); result = false; reqMessage = e.getMessage(); - if (epRequestIdSize > 0 && userInfo != null && !userInfo.isEmpty()) { - updateStatus = "F"; - applyChangesToAppRolesRequest(app.getId(), userId.getId(), updateStatus, epRequestId.get(0)); - } + if(epRequestIdSize > 0 && userInfo!=null && !userInfo.isEmpty()){ + updateStatus = "F"; + applyChangesToAppRolesRequest(app.getId(), userId.getId(), + updateStatus, epRequestId.get(0)); + } } } return new ExternalRequestFieldsValidator(result, reqMessage); } - + /** * * @param roleInAppForUserList @@ -1472,7 +1469,7 @@ public class UserRolesCommonServiceImpl { * @param applicationsRestClientService * @param appId * @param userId - * @return Set<EcompRole> + * @return Set<EcompRole> * @throws JsonProcessingException * @throws HTTPException */ @@ -1482,16 +1479,16 @@ public class UserRolesCommonServiceImpl { Set<EcompRole> updatedUserRoles = constructUsersEcompRoles(roleInAppForUserList); return updatedUserRoles; } - + /** - * It constructs and returns list of user app roles when the external API role - * approval system calls this method + * It constructs and returns list of user app roles when the external API role approval system calls + * this method * * @param roleInAppForUserList * @param appId * @return list of user app roles * @throws Exception - * throws exceptions if role id does not exits + * throws exceptions if role id does not exits */ private List<RoleInAppForUser> roleInAppForUserList(List<ExternalSystemRoleApproval> roleInAppForUserList, Long appId, String appName) throws Exception { @@ -1503,18 +1500,14 @@ public class UserRolesCommonServiceImpl { if (existingAppRole == null) { logger.error(EELFLoggerDelegate.errorLogger, "roleInAppForUserList failed for the roles {}", roleInAppForUserList); - throw new Exception("'" + roleInAppForUser.getRoleName() + "'" + " role does not exist for " + appName - + " application"); + throw new Exception("'" +roleInAppForUser.getRoleName() + "'" +" role does not exist for " + appName + " application"); } if (!existingAppRole.getActive()) { logger.error(EELFLoggerDelegate.errorLogger, "roleInAppForUserList failed for the roles {}", roleInAppForUserList); - throw new Exception( - roleInAppForUser.getRoleName() + " role is unavailable for " + appName + " application"); + throw new Exception(roleInAppForUser.getRoleName() + " role is unavailable for "+ appName + " application"); } else { - ecompRole.roleId = (appId == 1 || roleInAppForUser.getRoleName().equals(PortalConstants.ADMIN_ROLE)) - ? existingAppRole.getId() - : existingAppRole.getAppRoleId(); + ecompRole.roleId = (appId == 1 || roleInAppForUser.getRoleName().equals(PortalConstants.ADMIN_ROLE)) ? existingAppRole.getId() : existingAppRole.getAppRoleId(); ecompRole.roleName = roleInAppForUser.getRoleName(); ecompRole.isApplied = true; existingUserRoles.add(ecompRole); @@ -1522,6 +1515,8 @@ public class UserRolesCommonServiceImpl { } return existingUserRoles; } + + /** * @@ -1531,8 +1526,8 @@ public class UserRolesCommonServiceImpl { * @return EPUser * @throws HTTPException */ - protected EPUser getUserFromApp(String userId, EPApp app, - ApplicationsRestClientService applicationsRestClientService) throws HTTPException { + protected EPUser getUserFromApp(String userId, EPApp app, ApplicationsRestClientService applicationsRestClientService) + throws HTTPException { // local app if (app.getId() == PortalConstants.PORTAL_APP_ID) { // Map<String,String> params = new HashMap<String,String>(); @@ -1546,31 +1541,32 @@ public class UserRolesCommonServiceImpl { return null; } // remote app - + return getUser(userId, app, applicationsRestClientService); } - + protected EPUser getUser(String userId, EPApp app, ApplicationsRestClientService applicationsRestClientService) throws HTTPException { return applicationsRestClientService.get(EPUser.class, app.getId(), String.format("/user/%s", userId), true); } - - protected boolean isAppUpgradeVersion(EPApp app) { + + protected boolean isAppUpgradeVersion(EPApp app){ return true; } - - public ExternalSystemAccess getExternalRequestAccess() { - ExternalSystemAccess res = null; + + + public ExternalSystemAccess getExternalRequestAccess(){ + ExternalSystemAccess res = null; try { - res = new ExternalSystemAccess(EPCommonSystemProperties.EXTERNAL_ACCESS_ENABLE, Boolean - .parseBoolean(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_ACCESS_ENABLE))); + 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; + return res; } - + /* * (non-Javadoc) * @@ -1585,10 +1581,10 @@ public class UserRolesCommonServiceImpl { try { // for ecomp portal app, no need to make a remote call List<Role> roleList = new ArrayList<>(); - if (appId == PortalConstants.PORTAL_APP_ID) { - if (app.getCentralAuth()) { - List<CentralRole> cenRoleList = externalAccessRolesService.getRolesForApp(app.getUebKey()); - for (CentralRole cenRole : cenRoleList) { + if (appId == PortalConstants.PORTAL_APP_ID) { + if(app.getCentralAuth()){ + List<CentralV2Role> cenRoleList = externalAccessRolesService.getRolesForApp(app.getUebKey()); + for(CentralV2Role cenRole : cenRoleList){ Role role = new Role(); role.setActive(cenRole.isActive()); role.setId(cenRole.getId()); @@ -1596,48 +1592,44 @@ public class UserRolesCommonServiceImpl { role.setPriority(cenRole.getPriority()); roleList.add(role); } - } else { + }else{ roleList = roleService.getAvailableRoles(userId); } List<Role> activeRoleList = new ArrayList<Role>(); - for (Role role : roleList) { - if (role.getActive()) { - if (role.getId() != 1) { // prevent portal admin from being added + for(Role role: roleList) { + if(role.getActive()) { + if(role.getId() != 1){ // prevent portal admin from being added activeRoleList.add(role); - } else if (extRequestValue) { + } else if(extRequestValue){ activeRoleList.add(role); } } - + } - EPUser localUser = getUserFromApp(userId, app, applicationsRestClientService); + EPUser localUser = getUserFromApp(userId, app, applicationsRestClientService); // If localUser does not exists return roles Set<EPRole> roleSet = null; EPRole[] roleSetList = null; - if (localUser != null) { + if(localUser != null){ roleSet = localUser.getAppEPRoles(app); roleSetList = roleSet.toArray(new EPRole[0]); } rolesInAppForUser = constructRolesInAppForUserGet(activeRoleList, roleSetList, extRequestValue); return rolesInAppForUser; } - + EcompRole[] appRoles = null; List<EcompRole> roles = new ArrayList<>(); - if (app.getCentralAuth()) { - // Sync application functions from External Access System - externalAccessRolesService.syncRoleFunctionFromExternalAccessSystem(app); - List<EPRole> applicationRoles = dataAccessService.getList(EPRole.class, - " where app_id = " + app.getId() + " and active_yn = 'Y'", null, null); - ; - for (EPRole role : applicationRoles) { + if(app.getCentralAuth()){ + List<EPRole> applicationRoles = dataAccessService.getList(EPRole.class, " where app_id = "+app.getId()+ " and active_yn = 'Y'", null, null);; + for(EPRole role : applicationRoles){ EcompRole ecompRole = new EcompRole(); ecompRole.setId(role.getId()); ecompRole.setName(role.getName()); roles.add(ecompRole); } appRoles = roles.toArray(new EcompRole[roles.size()]); - } else { + } else{ appRoles = applicationsRestClientService.get(EcompRole[].class, appId, "/roles"); } // Test this error case, for generating an internal Ecomp Portal @@ -1646,32 +1638,31 @@ public class UserRolesCommonServiceImpl { // If there is an exception in the rest client api, then null will // be returned. if (appRoles != null) { - if (!app.getCentralAuth()) { - syncAppRoles(sessionFactory, appId, appRoles); + if(!app.getCentralAuth()) { + syncAppRoles(sessionFactory, appId, appRoles); } EcompRole[] userAppRoles = null; try { try { - if (app.getCentralAuth()) { + if(app.getCentralAuth()){ final Map<String, String> params = new HashMap<>(); final Map<String, Long> userParams = new HashMap<>(); params.put("orgUserIdValue", userId); List<EPUser> user = dataAccessService.executeNamedQuery("epUserAppId", params, null); userParams.put("appId", app.getId()); - userParams.put("userId", user.get(0).getId()); - List<EPUserAppCurrentRoles> userAppsRolesList = dataAccessService - .executeNamedQuery("getUserAppCurrentRoles", userParams, null); - List<EcompRole> setUserRoles = new ArrayList<>(); - for (EPUserAppCurrentRoles role : userAppsRolesList) { - EcompRole ecompRole = new EcompRole(); - ecompRole.setId(role.getRoleId()); - ecompRole.setName(role.getRoleName()); - setUserRoles.add(ecompRole); - } - userAppRoles = setUserRoles.toArray(new EcompRole[setUserRoles.size()]); - rolesInAppForUser = constructRolesInAppForUserGet(appRoles, userAppRoles); - return rolesInAppForUser; - } else { + userParams.put("userId", user.get(0).getId()); + List<EPUserAppCurrentRoles> userAppsRolesList = dataAccessService.executeNamedQuery("getUserAppCurrentRoles", userParams, null); + List<EcompRole> setUserRoles = new ArrayList<>(); + for(EPUserAppCurrentRoles role : userAppsRolesList){ + EcompRole ecompRole = new EcompRole(); + ecompRole.setId(role.getRoleId()); + ecompRole.setName(role.getRoleName()); + setUserRoles.add(ecompRole); + } + userAppRoles = setUserRoles.toArray(new EcompRole[setUserRoles.size()]); + rolesInAppForUser = constructRolesInAppForUserGet(appRoles, userAppRoles); + return rolesInAppForUser; + }else{ userAppRoles = applicationsRestClientService.get(EcompRole[].class, appId, String.format("/user/%s/roles", userId)); } @@ -1696,21 +1687,21 @@ public class UserRolesCommonServiceImpl { logger.warn(EELFLoggerDelegate.applicationLogger, message); } } - - HashMap<Long, EcompRole> appRolesActiveMap = hashMapFromEcompRoles(appRoles); - ArrayList<EcompRole> activeRoles = new ArrayList<EcompRole>(); - if (userAppRoles != null) { - for (int i = 0; i < userAppRoles.length; i++) { - if (appRolesActiveMap.containsKey(userAppRoles[i].getId())) { - EcompRole role = new EcompRole(); - role.setId(userAppRoles[i].getId()); - role.setName(userAppRoles[i].getName()); - activeRoles.add(role); + + HashMap<Long, EcompRole> appRolesActiveMap =hashMapFromEcompRoles(appRoles); + ArrayList<EcompRole> activeRoles = new ArrayList<EcompRole>(); + if(userAppRoles != null){ + for (int i = 0; i < userAppRoles.length; i++) { + if (appRolesActiveMap.containsKey(userAppRoles[i].getId())) { + EcompRole role = new EcompRole(); + role.setId(userAppRoles[i].getId()); + role.setName(userAppRoles[i].getName()); + activeRoles.add(role); + } } } - } - EcompRole[] userAppRolesActive = activeRoles.toArray(new EcompRole[activeRoles.size()]); - + EcompRole[] userAppRolesActive = activeRoles.toArray(new EcompRole[activeRoles.size()]); + // If the remote application isn't down we MUST sync user // roles here in case we have this user here! syncUserRoles(sessionFactory, userId, appId, userAppRolesActive, extRequestValue, null); @@ -1733,7 +1724,7 @@ public class UserRolesCommonServiceImpl { return rolesInAppForUser; } - + private boolean postUserRolesToMylogins(AppWithRolesForUser userAppRolesData, ApplicationsRestClientService applicationsRestClientService, Long appId, Long userId) throws JsonProcessingException, HTTPException { @@ -1741,24 +1732,20 @@ public class UserRolesCommonServiceImpl { 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)); + 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 userAppRolesData, EPUser user) { FieldsValidator fieldsValidator = new FieldsValidator(); final Map<String, Long> params = new HashMap<>(); - EPUserAppRoles appRole = new EPUserAppRoles(); + EPUserAppRoles appRole= new EPUserAppRoles(); try { - logger.error(EELFLoggerDelegate.errorLogger, - "Should not be reached here, still the endpoint is yet to be defined"); - boolean result = postUserRolesToMylogins(userAppRolesData, applicationsRestClientService, - userAppRolesData.appId, user.getId()); - logger.debug(EELFLoggerDelegate.debugLogger, "putUserAppRolesRequest: result {}", result); - + logger.error(EELFLoggerDelegate.errorLogger,"Should not be reached here, still the endpoint is yet to be defined"); + boolean result = postUserRolesToMylogins(userAppRolesData, applicationsRestClientService, userAppRolesData.appId, user.getId()); + logger.debug(EELFLoggerDelegate.debugLogger,"putUserAppRolesRequest: result {}", result); + params.put("appId", userAppRolesData.appId); EPUserAppRolesRequest epAppRolesRequestData = new EPUserAppRolesRequest(); epAppRolesRequestData.setCreatedDate(new Date()); @@ -1771,7 +1758,7 @@ public class UserRolesCommonServiceImpl { dataAccessService.saveDomainObject(epAppRolesRequestData, null); for (RoleInAppForUser userAppRoles : appRoleIdList) { Boolean isAppliedVal = userAppRoles.isApplied; - params.put("appRoleId", userAppRoles.roleId); + params.put("appRoleId", userAppRoles.roleId); if (isAppliedVal) { appRole = (EPUserAppRoles) dataAccessService.executeNamedQuery("appRoles", params, null).get(0); EPUserAppRolesRequestDetail epAppRoleDetail = new EPUserAppRolesRequestDetail(); @@ -1779,7 +1766,7 @@ public class UserRolesCommonServiceImpl { epAppRoleDetail.setReqType("P"); epAppRoleDetail.setEpRequestIdData(epAppRolesRequestData); dataAccessService.saveDomainObject(epAppRoleDetail, null); - } + } } epAppRolesRequestData.setEpRequestIdDetail(appRoleDetails); fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_OK); @@ -1791,18 +1778,18 @@ public class UserRolesCommonServiceImpl { return fieldsValidator; } - public List<EPUserAppCatalogRoles> getUserAppCatalogRoles(EPUser userid, String appName) { + public List<EPUserAppCatalogRoles> getUserAppCatalogRoles(EPUser userid, String appName) { Map<String, String> params = new HashMap<>(); params.put("userid", userid.getId().toString()); - // params.put("appid", appid); + //params.put("appid", appid); params.put("appName", appName); - + @SuppressWarnings("unchecked") List<EPUserAppCatalogRoles> userAppRoles = (List<EPUserAppCatalogRoles>) dataAccessService .executeNamedQuery("userAppCatalogRoles", params, null); - return userAppRoles; + return userAppRoles; } - + public String updateRemoteUserProfile(String orgUserId, Long appId) { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -1838,6 +1825,7 @@ public class UserRolesCommonServiceImpl { return "success"; } + /* * (non-Javadoc) * @@ -1852,20 +1840,19 @@ public class UserRolesCommonServiceImpl { logger.debug(EELFLoggerDelegate.debugLogger, "getCachedAppRolesForUser: list size is {}", roleList.size()); return roleList; } - + /** - * Retrieves and returns a list of user app roles for local and remote - * applications based on the app id. + * It retrieves and returns list of user app roles for local and remote applications based app id * * @param appId * @return list of user app roles - * @throws HTTPException + * @throws HTTPException */ public List<UserApplicationRoles> getUsersFromAppEndpoint(Long appId) throws HTTPException { ArrayList<UserApplicationRoles> userApplicationRoles = new ArrayList<UserApplicationRoles>(); - + EPApp app = appsService.getApp(appId); - // If local or centralized application + //If local or centralized application if (appId == PortalConstants.PORTAL_APP_ID || app.getCentralAuth()) { @SuppressWarnings("unchecked") List<EPUser> userList = (List<EPUser>) dataAccessService.executeNamedQuery("getActiveUsers", null, null); @@ -1874,26 +1861,30 @@ public class UserRolesCommonServiceImpl { if (userWithAppRoles.getRoles() != null && userWithAppRoles.getRoles().size() > 0) userApplicationRoles.add(userWithAppRoles); } - } + + } // remote app - else { + else { RemoteUserWithRoles[] remoteUsers = null; String remoteUsersString = applicationsRestClientService.getIncomingJsonString(appId, "/users"); + remoteUsers = doGetUsers(isAppUpgradeVersion(app), remoteUsersString); + userApplicationRoles = new ArrayList<UserApplicationRoles>(); 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."); + logger.debug(EELFLoggerDelegate.debugLogger, + "User " + userWithRemoteAppRoles.getOrgUserId() + " doesn't have any roles assigned to any app."); } } } + return userApplicationRoles; } - + /** * * @param appId @@ -1929,19 +1920,14 @@ public class UserRolesCommonServiceImpl { return roleList; } - /** - * - * Returns RemoteUserWithRoles reading the value from remote application user in the form a string from an ObjectMapper - * @param postOpenSource - * @param remoteUsersString - * @return RemoteUserWithRoles - */ public RemoteUserWithRoles[] doGetUsers(boolean postOpenSource, 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", + logger.error(EELFLoggerDelegate.errorLogger, + "doGetUsers : Failed : Unexpected property in incoming JSON", e); logger.error(EELFLoggerDelegate.errorLogger, "doGetUsers : Incoming JSON that caused it --> " + remoteUsersString); @@ -1949,4 +1935,16 @@ public class UserRolesCommonServiceImpl { return new RemoteUserWithRoles[0]; } + + @SuppressWarnings("unchecked") + public List<EPUserApp> getEPUserAppList(Long appId, Long userId, Long roleId) { + List<EPUserApp> userRoleList = new ArrayList<EPUserApp>(); + final Map<String, Long> params = new HashMap<>(); + params.put("appId", appId); + params.put("userId", userId); + params.put("roleId", roleId); + userRoleList = dataAccessService.executeNamedQuery("getUserRoleOnUserIdAndRoleIdAndAppId", params, null); + return userRoleList; + } + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserRolesService.java index 57188947..1b638627 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserRolesService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -36,22 +36,22 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; import org.apache.cxf.transport.http.HTTPException; -import org.openecomp.portalapp.externalsystemapproval.model.ExternalSystemUser; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EPUserApp; -import org.openecomp.portalapp.portal.domain.EPUserAppCatalogRoles; -import org.openecomp.portalapp.portal.domain.ExternalSystemAccess; -import org.openecomp.portalapp.portal.transport.AppWithRolesForUser; -import org.openecomp.portalapp.portal.transport.ExternalRequestFieldsValidator; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.RoleInAppForUser; -import org.openecomp.portalapp.portal.transport.UserApplicationRoles; +import org.onap.portalapp.externalsystemapproval.model.ExternalSystemUser; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPUserApp; +import org.onap.portalapp.portal.domain.EPUserAppCatalogRoles; +import org.onap.portalapp.portal.domain.ExternalSystemAccess; +import org.onap.portalapp.portal.transport.AppWithRolesForUser; +import org.onap.portalapp.portal.transport.ExternalRequestFieldsValidator; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.RoleInAppForUser; +import org.onap.portalapp.portal.transport.UserApplicationRoles; public interface UserRolesService { @@ -105,5 +105,7 @@ public interface UserRolesService { public String updateRemoteUserProfile(String orgUserId, Long appId); public ExternalSystemAccess getExternalRequestAccess(); + + public List<EPUserApp> getEPUserAppList(Long appId, Long userId, Long roleId); } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserService.java index 38c7fa33..cfc32306 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,11 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; -import org.openecomp.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPUser; public interface UserService { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserServiceImpl.java index 49831435..860712bb 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.io.BufferedReader; import java.io.IOException; @@ -45,15 +45,19 @@ import java.net.URL; import java.util.ArrayList; import java.util.List; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Restrictions; import org.json.JSONArray; import org.json.JSONObject; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalsdk.core.FusionObject.Utilities; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.service.UserService; +import org.onap.portalapp.portal.service.UserServiceImpl; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalsdk.core.FusionObject.Utilities; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.onboarding.util.CipherUtil; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -139,10 +143,12 @@ public class UserServiceImpl implements UserService { } else { - List<EPUser> list = null; - StringBuffer criteria = new StringBuffer(); - criteria.append(" where org_user_id = '").append(userId).append("'"); - list = getDataAccessService().getList(EPUser.class, criteria.toString(), null, null); + List<Criterion> restrictionsList = new ArrayList<Criterion>(); + Criterion orgUserIdCriterion = Restrictions.eq("orgUserId",userId); + restrictionsList.add(orgUserIdCriterion); + + List<EPUser> list = (List<EPUser>) dataAccessService.getList(EPUser.class, null, restrictionsList, null); + return (list == null || list.size() == 0) ? null : list; } @@ -154,14 +160,12 @@ public class UserServiceImpl implements UserService { public List<EPUser> getUserByFirstLastName(String firstName, String lastName) { if (!SystemProperties.getProperty(SystemProperties.AUTHENTICATION_MECHANISM).trim().equalsIgnoreCase("OIDC")) { + List<Criterion> restrictionsList = new ArrayList<Criterion>(); + Criterion firstNameCriterion = Restrictions.eq("firstName", firstName); + Criterion lastNameCriterion = Restrictions.eq("lastName", lastName); + restrictionsList.add(Restrictions.or(firstNameCriterion, lastNameCriterion)); - List<EPUser> list = null; - StringBuffer criteria = new StringBuffer(); - if (firstName != null) - criteria.append(" where first_name = '").append(firstName).append("'"); - if (lastName != null) - criteria.append(" where last_name = '").append(lastName).append("'"); - list = getDataAccessService().getList(EPUser.class, criteria.toString(), null, null); + List<EPUser> list = (List<EPUser>) dataAccessService.getList(EPUser.class, null, restrictionsList, null); return (list == null || list.size() == 0) ? null : list; } else { @@ -239,14 +243,15 @@ public class UserServiceImpl implements UserService { try { - List<EPUser> list = null; - StringBuffer criteria = new StringBuffer(); - criteria.append(" where org_user_id = '").append(newUser.getLoginId()).append("'"); - list = getDataAccessService().getList(EPUser.class, criteria.toString(), null, null); + List<Criterion> restrictionsList = new ArrayList<Criterion>(); + Criterion orgUserIdCriterion = Restrictions.eq("orgUserId",newUser.getLoginId()); + restrictionsList.add(orgUserIdCriterion); + List<EPUser> list = (List<EPUser>) dataAccessService.getList(EPUser.class, null, restrictionsList, null); + if (list == null || list.size() == 0) { newUser.setActive(true); newUser.setOrgUserId(newUser.getLoginId()); - newUser.setLoginPwd(CipherUtil.encrypt(newUser.getLoginPwd())); + newUser.setLoginPwd(CipherUtil.encryptPKC(newUser.getLoginPwd())); getDataAccessService().saveDomainObject(newUser, null); } else { if (checkDuplicate.equals("Yes")) { @@ -259,7 +264,7 @@ public class UserServiceImpl implements UserService { oldUser.setLastName(newUser.getLastName()); oldUser.setMiddleInitial(newUser.getMiddleInitial()); if (!oldUser.getLoginPwd().equals(newUser.getLoginPwd())) - oldUser.setLoginPwd(CipherUtil.encrypt(newUser.getLoginPwd())); + oldUser.setLoginPwd(CipherUtil.encryptPKC(newUser.getLoginPwd())); else oldUser.setLoginPwd(newUser.getLoginPwd()); getDataAccessService().saveDomainObject(oldUser, null); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetParameterService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/WidgetParameterService.java index 81b5e1e2..782f54bf 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetParameterService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/WidgetParameterService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,11 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; -import org.openecomp.portalapp.portal.domain.WidgetCatalogParameter; +import org.onap.portalapp.portal.domain.WidgetCatalogParameter; public interface WidgetParameterService { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetParameterServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/WidgetParameterServiceImpl.java index e69c7275..e01e2cba 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetParameterServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/WidgetParameterServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.ArrayList; import java.util.HashMap; @@ -44,10 +44,10 @@ import java.util.Map; import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Restrictions; -import org.openecomp.portalapp.portal.domain.WidgetCatalogParameter; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.DataAccessService; +import org.onap.portalapp.portal.domain.WidgetCatalogParameter; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.service.DataAccessService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/WidgetService.java index a90fc4e2..a529ba8a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/WidgetService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,13 +35,13 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.List; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.OnboardingWidget; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.OnboardingWidget; public interface WidgetService { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/WidgetServiceImpl.java index 7633e34a..062e9cb9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/WidgetServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.ArrayList; import java.util.List; @@ -46,24 +46,25 @@ import javax.servlet.http.HttpServletResponse; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Restrictions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EPUserApp; -import org.openecomp.portalapp.portal.domain.Widget; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.logging.format.EPAppMessagesEnum; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.OnboardingWidget; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPUserApp; +import org.onap.portalapp.portal.domain.Widget; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.OnboardingWidget; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.SystemProperties; @Service("widgetService") @Transactional @@ -142,18 +143,25 @@ public class WidgetServiceImpl implements WidgetService { private boolean isUserAdminOfAppForWidget(boolean superAdmin, Long userId, Long appId) { if (!superAdmin) { - @SuppressWarnings("unchecked") - List<EPUserApp> userRoles = dataAccessService.getList(EPUserApp.class, - " where userId = " + userId + " and role.id = " + ACCOUNT_ADMIN_ROLE_ID + " and app.id = " + appId, null, null); + List<EPUserApp> userRoles = getAdminUserRoles(userId, appId); return (userRoles.size() > 0); } return true; } + @SuppressWarnings("unchecked") + private List<EPUserApp> getAdminUserRoles(Long userId, Long appId) { + List<Criterion> restrictionsList = new ArrayList<Criterion>(); + Criterion userIdCriterion = Restrictions.eq("userId",userId); + Criterion roleIDCriterion = Restrictions.eq("role.id", ACCOUNT_ADMIN_ROLE_ID); + Criterion appIDCriterion = Restrictions.eq("app.id", appId); + restrictionsList.add(Restrictions.and(userIdCriterion, roleIDCriterion,appIDCriterion)); + return (List<EPUserApp>) dataAccessService.getList(EPUserApp.class, null, restrictionsList, null); + } + private void validateOnboardingWidget(OnboardingWidget onboardingWidget, FieldsValidator fieldsValidator) { - @SuppressWarnings("unchecked") - List<Widget> widgets = dataAccessService.getList(Widget.class, - " where url = '" + onboardingWidget.url + "'" + " or name = '" + onboardingWidget.name + "'", null, null); + + List<Widget> widgets = getWidgets(onboardingWidget); boolean dublicatedUrl = false; boolean dublicatedName = false; for (Widget widget : widgets) { @@ -186,6 +194,15 @@ public class WidgetServiceImpl implements WidgetService { } } + @SuppressWarnings("unchecked") + private List<Widget> getWidgets(OnboardingWidget onboardingWidget) { + List<Criterion> restrictionsList = new ArrayList<Criterion>(); + Criterion urlCriterion = Restrictions.eq("url", onboardingWidget.url); + Criterion nameCriterion = Restrictions.eq("name", onboardingWidget.name); + restrictionsList.add(Restrictions.or(urlCriterion, nameCriterion)); + return (List<Widget>) dataAccessService.getList(Widget.class, null, restrictionsList, null); + } + private void applyOnboardingWidget(OnboardingWidget onboardingWidget, FieldsValidator fieldsValidator) { boolean result = false; Session localSession = null; @@ -249,7 +266,6 @@ public class WidgetServiceImpl implements WidgetService { if (onboardingWidget.name.length() == 0 || onboardingWidget.url.length() == 0 || onboardingWidget.appId == null || onboardingWidget.appId.equals(LONG_ECOMP_APP_ID) || onboardingWidget.width.intValue() <= 0 || onboardingWidget.height.intValue() <= 0) { if (onboardingWidget.appId.equals(LONG_ECOMP_APP_ID)) { - // logger.error("Alarm!!! Security breach attempt on user " + user.getFullName() + ", userId = " + user.getUserId()); } FieldsValidator fieldsValidator = new FieldsValidator(); fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_BAD_REQUEST); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AllAppsWithRolesForUser.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/AllAppsWithRolesForUser.java index b08eafef..2d2374ec 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AllAppsWithRolesForUser.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/AllAppsWithRolesForUser.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.util.List; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/Analytics.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/Analytics.java index fc84012d..deb36294 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/Analytics.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/Analytics.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalization.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/AppCatalogPersonalization.java index 0480f1bb..29bba67a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalization.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/AppCatalogPersonalization.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; /** * Model for the object PUT to the controller when the user takes an action on diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdmin.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/AppNameIdIsAdmin.java index 2d44b672..a554197b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdmin.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/AppNameIdIsAdmin.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; public class AppNameIdIsAdmin { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUser.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/AppWithRolesForUser.java index 7c217813..b6b10310 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUser.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/AppWithRolesForUser.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.util.List; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRole.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/AppsListWithAdminRole.java index 4bcf21a8..67189fac 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/AppsListWithAdminRole.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.util.ArrayList; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunction.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/BulkUploadRoleFunction.java index e1924fa5..9457242c 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunction.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/BulkUploadRoleFunction.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRoles.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/BulkUploadUserRoles.java index d2add21d..67260af7 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/BulkUploadUserRoles.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRole.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/BusinessCardApplicationRole.java index fff72827..a9132364 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/BusinessCardApplicationRole.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesList.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/BusinessCardApplicationRolesList.java index 74c83700..e17e53e0 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesList.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/BusinessCardApplicationRolesList.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.util.List; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralApp.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralApp.java index 6f7861b9..6fcc0dc8 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralApp.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralApp.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,36 +35,44 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; -import java.util.Arrays; +import java.io.Serializable; import java.util.Date; -public class CentralApp { - public Long id; - public Date created; - public Date modified; - public Long createdId; - public Long modifiedId; - public Long rowNum; - public String name; // app_name - public String imageUrl; // app_image_url - public String description; // app_description - public String notes; // app_notes - public String url; // app_url - public String alternateUrl; // app_alternate_url - public String restEndpoint; // app_rest_endpoint - public String mlAppName; // ml_app_name - public String mlAppAdminId; // ml_app_admin_id; - public String motsId; // mots_id - public String appPassword; // app_password - public String open; - public String enabled; - public byte[] thumbnail; - public String username; // app_username - public String uebKey; // ueb_key - public String uebSecret; // ueb_secret - public String uebTopicName; // ueb_topic_name +public class CentralApp implements Serializable{ + /** + * + */ + private static final long serialVersionUID = -3325965646585871632L; + private Long id; + private Date created; + private Date modified; + private Long createdId; + private Long modifiedId; + private Long rowNum; + private String name; // app_name + private String imageUrl; // app_image_url + private String description; // app_description + private String notes; // app_notes + private String url; // app_url + private String alternateUrl; // app_alternate_url + private String restEndpoint; // app_rest_endpoint + private String mlAppName; // ml_app_name + private String mlAppAdminId; // ml_app_admin_id; + private String motsId; // mots_id + private String appPassword; // app_password + private String open; + private String enabled; + private byte[] thumbnail; + private String username; // app_username + private String uebKey; // ueb_key + private String uebSecret; // ueb_secret + private String uebTopicName; // ueb_topic_name + + public CentralApp(){ + + } public CentralApp(Long id, Date created, Date modified, Long createdId, Long modifiedId, Long rowNum, String name, String imageUrl, String description, String notes, String url, String alternateUrl, String restEndpoint, @@ -96,195 +104,149 @@ public class CentralApp { this.uebSecret = uebSecret; this.uebTopicName = uebTopicName; } - + public Long getId() { return id; } - public void setId(Long id) { this.id = id; } - + public Date getCreated() { return created; } - public void setCreated(Date created) { this.created = created; } - public Date getModified() { return modified; } - public void setModified(Date modified) { this.modified = modified; } - public Long getCreatedId() { return createdId; } - public void setCreatedId(Long createdId) { this.createdId = createdId; } - public Long getModifiedId() { return modifiedId; } - public void setModifiedId(Long modifiedId) { this.modifiedId = modifiedId; } - public Long getRowNum() { return rowNum; } - public void setRowNum(Long rowNum) { this.rowNum = rowNum; } - public String getName() { return name; } - public void setName(String name) { this.name = name; } - public String getImageUrl() { return imageUrl; } - public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } - public String getDescription() { return description; } - public void setDescription(String description) { this.description = description; } - public String getNotes() { return notes; } - public void setNotes(String notes) { this.notes = notes; } - public String getUrl() { return url; } - public void setUrl(String url) { this.url = url; } - public String getAlternateUrl() { return alternateUrl; } - public void setAlternateUrl(String alternateUrl) { this.alternateUrl = alternateUrl; } - public String getRestEndpoint() { return restEndpoint; } - public void setRestEndpoint(String restEndpoint) { this.restEndpoint = restEndpoint; } - public String getMlAppName() { return mlAppName; } - public void setMlAppName(String mlAppName) { this.mlAppName = mlAppName; } - public String getMlAppAdminId() { return mlAppAdminId; } - public void setMlAppAdminId(String mlAppAdminId) { this.mlAppAdminId = mlAppAdminId; } - public String getMotsId() { return motsId; } - public void setMotsId(String motsId) { this.motsId = motsId; } - public String getAppPassword() { return appPassword; } - public void setAppPassword(String appPassword) { this.appPassword = appPassword; } - public String getOpen() { return open; } - public void setOpen(String open) { this.open = open; } - public String getEnabled() { return enabled; } - public void setEnabled(String enabled) { this.enabled = enabled; } - public byte[] getThumbnail() { return thumbnail; } - public void setThumbnail(byte[] thumbnail) { this.thumbnail = thumbnail; } - public String getUsername() { return username; } - public void setUsername(String username) { this.username = username; } - public String getUebKey() { return uebKey; } - public void setUebKey(String uebKey) { this.uebKey = uebKey; } - public String getUebSecret() { return uebSecret; } - public void setUebSecret(String uebSecret) { this.uebSecret = uebSecret; } - public String getUebTopicName() { return uebTopicName; } - public void setUebTopicName(String uebTopicName) { this.uebTopicName = uebTopicName; } @@ -295,7 +257,6 @@ public class CentralApp { int result = 1; result = prime * result + ((alternateUrl == null) ? 0 : alternateUrl.hashCode()); result = prime * result + ((appPassword == null) ? 0 : appPassword.hashCode()); - result = prime * result + ((created == null) ? 0 : created.hashCode()); result = prime * result + ((createdId == null) ? 0 : createdId.hashCode()); result = prime * result + ((description == null) ? 0 : description.hashCode()); result = prime * result + ((enabled == null) ? 0 : enabled.hashCode()); @@ -303,7 +264,6 @@ public class CentralApp { result = prime * result + ((imageUrl == null) ? 0 : imageUrl.hashCode()); result = prime * result + ((mlAppAdminId == null) ? 0 : mlAppAdminId.hashCode()); result = prime * result + ((mlAppName == null) ? 0 : mlAppName.hashCode()); - result = prime * result + ((modified == null) ? 0 : modified.hashCode()); result = prime * result + ((modifiedId == null) ? 0 : modifiedId.hashCode()); result = prime * result + ((motsId == null) ? 0 : motsId.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); @@ -311,7 +271,6 @@ public class CentralApp { result = prime * result + ((open == null) ? 0 : open.hashCode()); result = prime * result + ((restEndpoint == null) ? 0 : restEndpoint.hashCode()); result = prime * result + ((rowNum == null) ? 0 : rowNum.hashCode()); - result = prime * result + Arrays.hashCode(thumbnail); result = prime * result + ((uebKey == null) ? 0 : uebKey.hashCode()); result = prime * result + ((uebSecret == null) ? 0 : uebSecret.hashCode()); result = prime * result + ((uebTopicName == null) ? 0 : uebTopicName.hashCode()); @@ -339,11 +298,6 @@ public class CentralApp { return false; } else if (!appPassword.equals(other.appPassword)) return false; - if (created == null) { - if (other.created != null) - return false; - } else if (!created.equals(other.created)) - return false; if (createdId == null) { if (other.createdId != null) return false; @@ -379,11 +333,6 @@ public class CentralApp { return false; } else if (!mlAppName.equals(other.mlAppName)) return false; - if (modified == null) { - if (other.modified != null) - return false; - } else if (!modified.equals(other.modified)) - return false; if (modifiedId == null) { if (other.modifiedId != null) return false; @@ -419,8 +368,6 @@ public class CentralApp { return false; } else if (!rowNum.equals(other.rowNum)) return false; - if (!Arrays.equals(thumbnail, other.thumbnail)) - return false; if (uebKey == null) { if (other.uebKey != null) return false; @@ -448,5 +395,6 @@ public class CentralApp { return false; return true; } - + + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralRole.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralRole.java index eb90fcd9..dc1a78fe 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralRole.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,31 +35,48 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; +import java.io.Serializable; import java.util.Date; import java.util.SortedSet; +import java.util.TreeSet; -import org.openecomp.portalapp.portal.domain.CentralRoleFunction; -import org.openecomp.portalapp.portal.domain.EPRole; +public class CentralRole implements Serializable { -public class CentralRole implements Comparable { - public Long id; - public Date created; - public Date modified; - public Long createdId; - public Long modifiedId; - public Long rowNum; + private static final long serialVersionUID = -9210905386086213882L; + private Long id; + private Date created; + private Date modified; + private Long createdId; + private Long modifiedId; + private Long rowNum; - public String name; - public boolean active; - public Integer priority; + private String name; + private boolean active; + private Integer priority; - public SortedSet<CentralRoleFunction> roleFunctions = null; + private SortedSet<CentralRoleFunction> roleFunctions = new TreeSet<>(); - public SortedSet<CentralRole> childRoles = null; + private SortedSet<CentralRole> childRoles = new TreeSet<>(); - public SortedSet<CentralRole> parentRoles = null; + private SortedSet<CentralRole> parentRoles = new TreeSet<>(); + + public CentralRole(){ + + } + + public CentralRole(Long id, String name, boolean active, Integer priority, + SortedSet<CentralRoleFunction> roleFunctions) { + super(); + this.id = id; + this.name = name; + this.active = active; + this.priority = priority; + this.roleFunctions = roleFunctions; + } + + public CentralRole(Long id, Date created, Date modified, Long createdId, Long modifiedId, Long rowNum, String name, boolean active, Integer priority, SortedSet<CentralRoleFunction> roleFunctions, @@ -79,206 +96,184 @@ public class CentralRole implements Comparable { this.parentRoles = parentRoles; } - public CentralRole() { - - } - - public CentralRole(Long id, String name) { - this.id = id; - this.name = name; - } - + /** + * @return the id + */ public Long getId() { return id; } + /** + * @param id + * the id to set + */ public void setId(Long id) { this.id = id; } + /** + * @return the created + */ public Date getCreated() { return created; } + /** + * @param created + * the created to set + */ public void setCreated(Date created) { this.created = created; } + /** + * @return the modified + */ public Date getModified() { return modified; } + /** + * @param modified + * the modified to set + */ public void setModified(Date modified) { this.modified = modified; } + /** + * @return the createdId + */ public Long getCreatedId() { return createdId; } + /** + * @param createdId + * the createdId to set + */ public void setCreatedId(Long createdId) { this.createdId = createdId; } + /** + * @return the modifiedId + */ public Long getModifiedId() { return modifiedId; } + /** + * @param modifiedId + * the modifiedId to set + */ public void setModifiedId(Long modifiedId) { this.modifiedId = modifiedId; } + /** + * @return the rowNum + */ public Long getRowNum() { return rowNum; } + /** + * @param rowNum + * the rowNum to set + */ public void setRowNum(Long rowNum) { this.rowNum = rowNum; } + /** + * @return the name + */ public String getName() { return name; } + /** + * @param name + * the name to set + */ public void setName(String name) { this.name = name; } + /** + * @return the active + */ public boolean isActive() { return active; } + /** + * @param active + * the active to set + */ public void setActive(boolean active) { this.active = active; } + /** + * @return the priority + */ public Integer getPriority() { return priority; } + /** + * @param priority + * the priority to set + */ public void setPriority(Integer priority) { this.priority = priority; } + /** + * @return the roleFunctions + */ public SortedSet<CentralRoleFunction> getRoleFunctions() { return roleFunctions; } + /** + * @param roleFunctions + * the roleFunctions to set + */ public void setRoleFunctions(SortedSet<CentralRoleFunction> roleFunctions) { this.roleFunctions = roleFunctions; } + /** + * @return the childRoles + */ public SortedSet<CentralRole> getChildRoles() { return childRoles; } + /** + * @param childRoles + * the childRoles to set + */ public void setChildRoles(SortedSet<CentralRole> childRoles) { this.childRoles = childRoles; } + /** + * @return the parentRoles + */ public SortedSet<CentralRole> getParentRoles() { return parentRoles; } + /** + * @param parentRoles + * the parentRoles to set + */ public void setParentRoles(SortedSet<CentralRole> parentRoles) { this.parentRoles = parentRoles; } - public int compareTo(Object obj) { - EPRole other = (EPRole) obj; - - String c1 = getName(); - String c2 = other.getName(); - - return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + (active ? 1231 : 1237); - result = prime * result + ((childRoles == null) ? 0 : childRoles.hashCode()); - result = prime * result + ((created == null) ? 0 : created.hashCode()); - result = prime * result + ((createdId == null) ? 0 : createdId.hashCode()); - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((modified == null) ? 0 : modified.hashCode()); - result = prime * result + ((modifiedId == null) ? 0 : modifiedId.hashCode()); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((parentRoles == null) ? 0 : parentRoles.hashCode()); - result = prime * result + ((priority == null) ? 0 : priority.hashCode()); - result = prime * result + ((roleFunctions == null) ? 0 : roleFunctions.hashCode()); - result = prime * result + ((rowNum == null) ? 0 : rowNum.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - CentralRole other = (CentralRole) obj; - if (active != other.active) - return false; - if (childRoles == null) { - if (other.childRoles != null) - return false; - } else if (!childRoles.equals(other.childRoles)) - return false; - if (created == null) { - if (other.created != null) - return false; - } else if (!created.equals(other.created)) - return false; - if (createdId == null) { - if (other.createdId != null) - return false; - } else if (!createdId.equals(other.createdId)) - return false; - if (id == null) { - if (other.id != null) - return false; - } else if (!id.equals(other.id)) - return false; - if (modified == null) { - if (other.modified != null) - return false; - } else if (!modified.equals(other.modified)) - return false; - if (modifiedId == null) { - if (other.modifiedId != null) - return false; - } else if (!modifiedId.equals(other.modifiedId)) - return false; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - if (parentRoles == null) { - if (other.parentRoles != null) - return false; - } else if (!parentRoles.equals(other.parentRoles)) - return false; - if (priority == null) { - if (other.priority != null) - return false; - } else if (!priority.equals(other.priority)) - return false; - if (roleFunctions == null) { - if (other.roleFunctions != null) - return false; - } else if (!roleFunctions.equals(other.roleFunctions)) - return false; - if (rowNum == null) { - if (other.rowNum != null) - return false; - } else if (!rowNum.equals(other.rowNum)) - return false; - return true; - } - } diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralRoleFunction.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralRoleFunction.java new file mode 100644 index 00000000..6cc474a1 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralRoleFunction.java @@ -0,0 +1,251 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.transport; + +import java.io.Serializable; +import java.util.Date; +import java.util.Set; + +@SuppressWarnings("rawtypes") +public class CentralRoleFunction implements Serializable, Comparable { + private static final long serialVersionUID = 1990254299529285610L; + private Long id; + private Date created; + private Date modified; + private Long createdId; + private Long modifiedId; + private Serializable auditUserId; + private Set auditTrail; + private Long rowNum; + private String code; + private String name; + private String editUrl; + + public CentralRoleFunction(String code, String name) { + super(); + this.code = code; + this.name = name; + } + + public CentralRoleFunction() { + } + + /** + * @return the id + */ + public Long getId() { + return id; + } + + /** + * @param id + * the id to set + */ + public void setId(Long id) { + this.id = id; + } + + /** + * @return the created + */ + public Date getCreated() { + return created; + } + + /** + * @param created + * the created to set + */ + public void setCreated(Date created) { + this.created = created; + } + + /** + * @return the modified + */ + public Date getModified() { + return modified; + } + + /** + * @param modified + * the modified to set + */ + public void setModified(Date modified) { + this.modified = modified; + } + + /** + * @return the createdId + */ + public Long getCreatedId() { + return createdId; + } + + /** + * @param createdId + * the createdId to set + */ + public void setCreatedId(Long createdId) { + this.createdId = createdId; + } + + /** + * @return the modifiedId + */ + public Long getModifiedId() { + return modifiedId; + } + + /** + * @param modifiedId + * the modifiedId to set + */ + public void setModifiedId(Long modifiedId) { + this.modifiedId = modifiedId; + } + + /** + * @return the rowNum + */ + public Long getRowNum() { + return rowNum; + } + + /** + * @param rowNum + * the rowNum to set + */ + public void setRowNum(Long rowNum) { + this.rowNum = rowNum; + } + + /** + * @return the code + */ + public String getCode() { + return code; + } + + /** + * @param code + * the code to set + */ + public void setCode(String code) { + this.code = code; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public void setName(String name) { + this.name = name; + } + + public Serializable getAuditUserId() { + return auditUserId; + } + + public void setAuditUserId(Serializable auditUserId) { + this.auditUserId = auditUserId; + } + + public Set getAuditTrail() { + return auditTrail; + } + + public void setAuditTrail(Set auditTrail) { + this.auditTrail = auditTrail; + } + + public String getEditUrl() { + return editUrl; + } + + public void setEditUrl(String editUrl) { + this.editUrl = editUrl; + } + + @Override + public int compareTo(Object obj) { + String c1 = getName(); + String c2 = ((CentralRoleFunction) obj).getName(); + + return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((code == null) ? 0 : code.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + CentralRoleFunction other = (CentralRoleFunction) obj; + if (code == null) { + if (other.code != null) + return false; + } else if (!code.equals(other.code)) + return false; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + return true; + } + +} diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralUser.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralUser.java new file mode 100644 index 00000000..3b94d11a --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralUser.java @@ -0,0 +1,965 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.transport; + +import java.io.Serializable; +import java.util.Date; +import java.util.Set; +import java.util.TreeSet; + +public class CentralUser implements Serializable { + + private static final long serialVersionUID = 7060454665330579923L; + private Long id; + private Date created; + private Date modified; + private Long createdId; + private Long modifiedId; + private Long rowNum; + + private Long orgId; + private Long managerId; + private String firstName; + private String middleInitial; + private String lastName; + private String phone; + private String fax; + private String cellular; + private String email; + private Long addressId; + private String alertMethodCd; + private String hrid; + private String orgUserId; + private String orgCode; + private String address1; + private String address2; + private String city; + private String state; + private String zipCode; + private String country; + private String orgManagerUserId; + private String locationClli; + private String businessCountryCode; + private String businessCountryName; + private String businessUnit; + private String businessUnitName; + private String department; + private String departmentName; + private String companyCode; + private String company; + private String zipCodeSuffix; + private String jobTitle; + private String commandChain; + private String siloStatus; + private String costCenter; + private String financialLocCode; + + private String loginId; + private String loginPwd; + private Date lastLoginDate; + private boolean active; + private boolean internal; + private Long selectedProfileId; + private Long timeZoneId; + private boolean online; + private String chatId; + + private Set<CentralUserApp> userApps = new TreeSet<>(); + private Set<CentralRole> pseudoRoles = new TreeSet<>(); + + public CentralUser(Long id, Date created, Date modified, Long createdId, Long modifiedId, Long rowNum, Long orgId, + Long managerId, String firstName, String middleInitial, String lastName, String phone, String fax, + String cellular, String email, Long addressId, String alertMethodCd, String hrid, String orgUserId, + String orgCode, String address1, String address2, String city, String state, String zipCode, String country, + String orgManagerUserId, String locationClli, String businessCountryCode, String businessCountryName, + String businessUnit, String businessUnitName, String department, String departmentName, String companyCode, + String company, String zipCodeSuffix, String jobTitle, String commandChain, String siloStatus, + String costCenter, String financialLocCode, String loginId, String loginPwd, Date lastLoginDate, + boolean active, boolean internal, Long selectedProfileId, Long timeZoneId, boolean online, String chatId, + Set<CentralUserApp> userApps) { + super(); + this.id = id; + this.created = created; + this.modified = modified; + this.createdId = createdId; + this.modifiedId = modifiedId; + this.rowNum = rowNum; + this.orgId = orgId; + this.managerId = managerId; + this.firstName = firstName; + this.middleInitial = middleInitial; + this.lastName = lastName; + this.phone = phone; + this.fax = fax; + this.cellular = cellular; + this.email = email; + this.addressId = addressId; + this.alertMethodCd = alertMethodCd; + this.hrid = hrid; + this.orgUserId = orgUserId; + this.orgCode = orgCode; + this.address1 = address1; + this.address2 = address2; + this.city = city; + this.state = state; + this.zipCode = zipCode; + this.country = country; + this.orgManagerUserId = orgManagerUserId; + this.locationClli = locationClli; + this.businessCountryCode = businessCountryCode; + this.businessCountryName = businessCountryName; + this.businessUnit = businessUnit; + this.businessUnitName = businessUnitName; + this.department = department; + this.departmentName = departmentName; + this.companyCode = companyCode; + this.company = company; + this.zipCodeSuffix = zipCodeSuffix; + this.jobTitle = jobTitle; + this.commandChain = commandChain; + this.siloStatus = siloStatus; + this.costCenter = costCenter; + this.financialLocCode = financialLocCode; + this.loginId = loginId; + this.loginPwd = loginPwd; + this.lastLoginDate = lastLoginDate; + this.active = active; + this.internal = internal; + this.selectedProfileId = selectedProfileId; + this.timeZoneId = timeZoneId; + this.online = online; + this.chatId = chatId; + this.userApps = userApps; + } + + /** + * @return the id + */ + public Long getId() { + return id; + } + + /** + * @param id + * the id to set + */ + public void setId(Long id) { + this.id = id; + } + + /** + * @return the created + */ + public Date getCreated() { + return created; + } + + /** + * @param created + * the created to set + */ + public void setCreated(Date created) { + this.created = created; + } + + /** + * @return the modified + */ + public Date getModified() { + return modified; + } + + /** + * @param modified + * the modified to set + */ + public void setModified(Date modified) { + this.modified = modified; + } + + /** + * @return the createdId + */ + public Long getCreatedId() { + return createdId; + } + + /** + * @param createdId + * the createdId to set + */ + public void setCreatedId(Long createdId) { + this.createdId = createdId; + } + + /** + * @return the modifiedId + */ + public Long getModifiedId() { + return modifiedId; + } + + /** + * @param modifiedId + * the modifiedId to set + */ + public void setModifiedId(Long modifiedId) { + this.modifiedId = modifiedId; + } + + /** + * @return the rowNum + */ + public Long getRowNum() { + return rowNum; + } + + /** + * @param rowNum + * the rowNum to set + */ + public void setRowNum(Long rowNum) { + this.rowNum = rowNum; + } + + /** + * @return the orgId + */ + public Long getOrgId() { + return orgId; + } + + /** + * @param orgId + * the orgId to set + */ + public void setOrgId(Long orgId) { + this.orgId = orgId; + } + + /** + * @return the managerId + */ + public Long getManagerId() { + return managerId; + } + + /** + * @param managerId + * the managerId to set + */ + public void setManagerId(Long managerId) { + this.managerId = managerId; + } + + /** + * @return the firstName + */ + public String getFirstName() { + return firstName; + } + + /** + * @param firstName + * the firstName to set + */ + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + /** + * @return the middleInitial + */ + public String getMiddleInitial() { + return middleInitial; + } + + /** + * @param middleInitial + * the middleInitial to set + */ + public void setMiddleInitial(String middleInitial) { + this.middleInitial = middleInitial; + } + + /** + * @return the lastName + */ + public String getLastName() { + return lastName; + } + + /** + * @param lastName + * the lastName to set + */ + public void setLastName(String lastName) { + this.lastName = lastName; + } + + /** + * @return the phone + */ + public String getPhone() { + return phone; + } + + /** + * @param phone + * the phone to set + */ + public void setPhone(String phone) { + this.phone = phone; + } + + /** + * @return the fax + */ + public String getFax() { + return fax; + } + + /** + * @param fax + * the fax to set + */ + public void setFax(String fax) { + this.fax = fax; + } + + /** + * @return the cellular + */ + public String getCellular() { + return cellular; + } + + /** + * @param cellular + * the cellular to set + */ + public void setCellular(String cellular) { + this.cellular = cellular; + } + + /** + * @return the email + */ + public String getEmail() { + return email; + } + + /** + * @param email + * the email to set + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * @return the addressId + */ + public Long getAddressId() { + return addressId; + } + + /** + * @param addressId + * the addressId to set + */ + public void setAddressId(Long addressId) { + this.addressId = addressId; + } + + /** + * @return the alertMethodCd + */ + public String getAlertMethodCd() { + return alertMethodCd; + } + + /** + * @param alertMethodCd + * the alertMethodCd to set + */ + public void setAlertMethodCd(String alertMethodCd) { + this.alertMethodCd = alertMethodCd; + } + + /** + * @return the hrid + */ + public String getHrid() { + return hrid; + } + + /** + * @param hrid + * the hrid to set + */ + public void setHrid(String hrid) { + this.hrid = hrid; + } + + /** + * @return the orgUserId + */ + public String getOrgUserId() { + return orgUserId; + } + + /** + * @param orgUserId + * the orgUserId to set + */ + public void setOrgUserId(String orgUserId) { + this.orgUserId = orgUserId; + } + + /** + * @return the orgCode + */ + public String getOrgCode() { + return orgCode; + } + + /** + * @param orgCode + * the orgCode to set + */ + public void setOrgCode(String orgCode) { + this.orgCode = orgCode; + } + + /** + * @return the address1 + */ + public String getAddress1() { + return address1; + } + + /** + * @param address1 + * the address1 to set + */ + public void setAddress1(String address1) { + this.address1 = address1; + } + + /** + * @return the address2 + */ + public String getAddress2() { + return address2; + } + + /** + * @param address2 + * the address2 to set + */ + public void setAddress2(String address2) { + this.address2 = address2; + } + + /** + * @return the city + */ + public String getCity() { + return city; + } + + /** + * @param city + * the city to set + */ + public void setCity(String city) { + this.city = city; + } + + /** + * @return the state + */ + public String getState() { + return state; + } + + /** + * @param state + * the state to set + */ + public void setState(String state) { + this.state = state; + } + + /** + * @return the zipCode + */ + public String getZipCode() { + return zipCode; + } + + /** + * @param zipCode + * the zipCode to set + */ + public void setZipCode(String zipCode) { + this.zipCode = zipCode; + } + + /** + * @return the country + */ + public String getCountry() { + return country; + } + + /** + * @param country + * the country to set + */ + public void setCountry(String country) { + this.country = country; + } + + /** + * @return the orgManagerUserId + */ + public String getOrgManagerUserId() { + return orgManagerUserId; + } + + /** + * @param orgManagerUserId + * the orgManagerUserId to set + */ + public void setOrgManagerUserId(String orgManagerUserId) { + this.orgManagerUserId = orgManagerUserId; + } + + /** + * @return the locationClli + */ + public String getLocationClli() { + return locationClli; + } + + /** + * @param locationClli + * the locationClli to set + */ + public void setLocationClli(String locationClli) { + this.locationClli = locationClli; + } + + /** + * @return the businessCountryCode + */ + public String getBusinessCountryCode() { + return businessCountryCode; + } + + /** + * @param businessCountryCode + * the businessCountryCode to set + */ + public void setBusinessCountryCode(String businessCountryCode) { + this.businessCountryCode = businessCountryCode; + } + + /** + * @return the businessCountryName + */ + public String getBusinessCountryName() { + return businessCountryName; + } + + /** + * @param businessCountryName + * the businessCountryName to set + */ + public void setBusinessCountryName(String businessCountryName) { + this.businessCountryName = businessCountryName; + } + + /** + * @return the businessUnit + */ + public String getBusinessUnit() { + return businessUnit; + } + + /** + * @param businessUnit + * the businessUnit to set + */ + public void setBusinessUnit(String businessUnit) { + this.businessUnit = businessUnit; + } + + /** + * @return the businessUnitName + */ + public String getBusinessUnitName() { + return businessUnitName; + } + + /** + * @param businessUnitName + * the businessUnitName to set + */ + public void setBusinessUnitName(String businessUnitName) { + this.businessUnitName = businessUnitName; + } + + /** + * @return the department + */ + public String getDepartment() { + return department; + } + + /** + * @param department + * the department to set + */ + public void setDepartment(String department) { + this.department = department; + } + + /** + * @return the departmentName + */ + public String getDepartmentName() { + return departmentName; + } + + /** + * @param departmentName + * the departmentName to set + */ + public void setDepartmentName(String departmentName) { + this.departmentName = departmentName; + } + + /** + * @return the companyCode + */ + public String getCompanyCode() { + return companyCode; + } + + /** + * @param companyCode + * the companyCode to set + */ + public void setCompanyCode(String companyCode) { + this.companyCode = companyCode; + } + + /** + * @return the company + */ + public String getCompany() { + return company; + } + + /** + * @param company + * the company to set + */ + public void setCompany(String company) { + this.company = company; + } + + /** + * @return the zipCodeSuffix + */ + public String getZipCodeSuffix() { + return zipCodeSuffix; + } + + /** + * @param zipCodeSuffix + * the zipCodeSuffix to set + */ + public void setZipCodeSuffix(String zipCodeSuffix) { + this.zipCodeSuffix = zipCodeSuffix; + } + + /** + * @return the jobTitle + */ + public String getJobTitle() { + return jobTitle; + } + + /** + * @param jobTitle + * the jobTitle to set + */ + public void setJobTitle(String jobTitle) { + this.jobTitle = jobTitle; + } + + /** + * @return the commandChain + */ + public String getCommandChain() { + return commandChain; + } + + /** + * @param commandChain + * the commandChain to set + */ + public void setCommandChain(String commandChain) { + this.commandChain = commandChain; + } + + /** + * @return the siloStatus + */ + public String getSiloStatus() { + return siloStatus; + } + + /** + * @param siloStatus + * the siloStatus to set + */ + public void setSiloStatus(String siloStatus) { + this.siloStatus = siloStatus; + } + + /** + * @return the costCenter + */ + public String getCostCenter() { + return costCenter; + } + + /** + * @param costCenter + * the costCenter to set + */ + public void setCostCenter(String costCenter) { + this.costCenter = costCenter; + } + + /** + * @return the financialLocCode + */ + public String getFinancialLocCode() { + return financialLocCode; + } + + /** + * @param financialLocCode + * the financialLocCode to set + */ + public void setFinancialLocCode(String financialLocCode) { + this.financialLocCode = financialLocCode; + } + + /** + * @return the loginId + */ + public String getLoginId() { + return loginId; + } + + /** + * @param loginId + * the loginId to set + */ + public void setLoginId(String loginId) { + this.loginId = loginId; + } + + /** + * @return the loginPwd + */ + public String getLoginPwd() { + return loginPwd; + } + + /** + * @param loginPwd + * the loginPwd to set + */ + public void setLoginPwd(String loginPwd) { + this.loginPwd = loginPwd; + } + + /** + * @return the lastLoginDate + */ + public Date getLastLoginDate() { + return lastLoginDate; + } + + /** + * @param lastLoginDate + * the lastLoginDate to set + */ + public void setLastLoginDate(Date lastLoginDate) { + this.lastLoginDate = lastLoginDate; + } + + /** + * @return the active + */ + public boolean isActive() { + return active; + } + + /** + * @param active + * the active to set + */ + public void setActive(boolean active) { + this.active = active; + } + + /** + * @return the internal + */ + public boolean isInternal() { + return internal; + } + + /** + * @param internal + * the internal to set + */ + public void setInternal(boolean internal) { + this.internal = internal; + } + + /** + * @return the selectedProfileId + */ + public Long getSelectedProfileId() { + return selectedProfileId; + } + + /** + * @param selectedProfileId + * the selectedProfileId to set + */ + public void setSelectedProfileId(Long selectedProfileId) { + this.selectedProfileId = selectedProfileId; + } + + /** + * @return the timeZoneId + */ + public Long getTimeZoneId() { + return timeZoneId; + } + + /** + * @param timeZoneId + * the timeZoneId to set + */ + public void setTimeZoneId(Long timeZoneId) { + this.timeZoneId = timeZoneId; + } + + /** + * @return the online + */ + public boolean isOnline() { + return online; + } + + /** + * @param online + * the online to set + */ + public void setOnline(boolean online) { + this.online = online; + } + + /** + * @return the chatId + */ + public String getChatId() { + return chatId; + } + + /** + * @param chatId + * the chatId to set + */ + public void setChatId(String chatId) { + this.chatId = chatId; + } + + /** + * @return the userApps + */ + public Set<CentralUserApp> getUserApps() { + return userApps; + } + + /** + * @param userApps + * the userApps to set + */ + public void setUserApps(Set<CentralUserApp> userApps) { + this.userApps = userApps; + } + + /** + * @return the pseudoRoles + */ + public Set<CentralRole> getPseudoRoles() { + return pseudoRoles; + } + + /** + * @param pseudoRoles + * the pseudoRoles to set + */ + public void setPseudoRoles(Set<CentralRole> pseudoRoles) { + this.pseudoRoles = pseudoRoles; + } + +} diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralUserApp.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralUserApp.java new file mode 100644 index 00000000..59ce5fb3 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralUserApp.java @@ -0,0 +1,144 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.transport; + +import java.io.Serializable; + +@SuppressWarnings("rawtypes") +public class CentralUserApp implements Serializable, Comparable { + + private static final long serialVersionUID = -1140858385803822099L; + private Long userId; + private CentralApp app; + private CentralRole role; + private Short priority; + + /** + * @return the userId + */ + public Long getUserId() { + return userId; + } + + /** + * @param userId + * the userId to set + */ + public void setUserId(Long userId) { + this.userId = userId; + } + + /** + * @return the app + */ + public CentralApp getApp() { + return app; + } + + /** + * @param app + * the app to set + */ + public void setApp(CentralApp app) { + this.app = app; + } + + /** + * @return the role + */ + public CentralRole getRole() { + return role; + } + + /** + * @param role + * the role to set + */ + public void setRole(CentralRole role) { + this.role = role; + } + + /** + * @return the priority + */ + public Short getPriority() { + return priority; + } + + /** + * @param priority + * the priority to set + */ + public void setPriority(Short priority) { + this.priority = priority; + } + + @Override + public int compareTo(Object obj) { + String c1 = getRole().getName(); + String c2 = ((CentralUserApp) obj).getRole().getName(); + + return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((role == null) ? 0 : role.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + CentralUserApp other = (CentralUserApp) obj; + if (role == null) { + if (other.role != null) + return false; + } else if (!role.equals(other.role)) + return false; + return true; + } + +} diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralV2Role.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralV2Role.java new file mode 100644 index 00000000..8c87acb9 --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralV2Role.java @@ -0,0 +1,246 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.transport; + +import java.io.Serializable; +import java.util.Date; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.onap.portalapp.portal.domain.CentralV2RoleFunction; + +@SuppressWarnings("rawtypes") +public class CentralV2Role implements Serializable, Comparable{ + /** + * + */ + private static final long serialVersionUID = -4332644961113063714L; + private Long id; + private Date created; + private Date modified; + private Long createdId; + private Long modifiedId; + private Long rowNum; + + private String name; + private boolean active; + private Integer priority; + + private SortedSet<CentralV2RoleFunction> roleFunctions = new TreeSet<>(); + + private SortedSet<CentralV2Role> childRoles = new TreeSet<>(); + + private SortedSet<CentralV2Role> parentRoles = new TreeSet<>(); + + public CentralV2Role(Long id, Date created, Date modified, Long createdId, Long modifiedId, Long rowNum, + String name, boolean active, Integer priority, SortedSet<CentralV2RoleFunction> roleFunctions, + SortedSet<CentralV2Role> childRoles, SortedSet<CentralV2Role> parentRoles) { + super(); + this.id = id; + this.created = created; + this.modified = modified; + this.createdId = createdId; + this.modifiedId = modifiedId; + this.rowNum = rowNum; + this.name = name; + this.active = active; + this.priority = priority; + this.roleFunctions = roleFunctions; + this.childRoles = childRoles; + this.parentRoles = parentRoles; + } + + public CentralV2Role(){ + + } + + public CentralV2Role(Long id, String name){ + this.id = id; + this.name = name; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public Date getModified() { + return modified; + } + + public void setModified(Date modified) { + this.modified = modified; + } + + public Long getCreatedId() { + return createdId; + } + + public void setCreatedId(Long createdId) { + this.createdId = createdId; + } + + public Long getModifiedId() { + return modifiedId; + } + + public void setModifiedId(Long modifiedId) { + this.modifiedId = modifiedId; + } + + public Long getRowNum() { + return rowNum; + } + + public void setRowNum(Long rowNum) { + this.rowNum = rowNum; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isActive() { + return active; + } + + public void setActive(boolean active) { + this.active = active; + } + + public Integer getPriority() { + return priority; + } + + public void setPriority(Integer priority) { + this.priority = priority; + } + + public SortedSet<CentralV2RoleFunction> getRoleFunctions() { + return roleFunctions; + } + + public void setRoleFunctions(SortedSet<CentralV2RoleFunction> roleFunctions) { + this.roleFunctions = roleFunctions; + } + + public SortedSet<CentralV2Role> getChildRoles() { + return childRoles; + } + + public void setChildRoles(SortedSet<CentralV2Role> childRoles) { + this.childRoles = childRoles; + } + + public SortedSet<CentralV2Role> getParentRoles() { + return parentRoles; + } + + public void setParentRoles(SortedSet<CentralV2Role> parentRoles) { + this.parentRoles = parentRoles; + } + public void addRoleFunction(CentralV2RoleFunction roleFunction) { + this.roleFunctions.add(roleFunction); + } + + public void addChildRole(CentralV2Role role) { + this.childRoles.add(role); + } + + public void addParentRole(CentralV2Role role) { + this.parentRoles.add(role); + } + + public int compareTo(Object obj){ + CentralV2Role other = (CentralV2Role)obj; + + String c1 = getName(); + String c2 = other.getName(); + + return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + CentralV2Role other = (CentralV2Role) obj; + if (id == null) { + if (other.id != null) + return false; + } else if (!id.equals(other.id)) + return false; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + return true; + } + + + +} diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralUser.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralV2User.java index e402456b..bdbf3924 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralUser.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralV2User.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,75 +35,81 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; +import java.io.Serializable; import java.util.Date; import java.util.Set; -public class CentralUser { - - public Long id; - public Date created; - public Date modified; - public Long createdId; - public Long modifiedId; - public Long rowNum; - - public Long orgId; - public Long managerId; - public String firstName; - public String middleInitial; - public String lastName; - public String phone; - public String fax; - public String cellular; - public String email; - public Long addressId; - public String alertMethodCd; - public String hrid; - public String orgUserId; - public String orgCode; - public String address1; - public String address2; - public String city; - public String state; - public String zipCode; - public String country; - public String orgManagerUserId; - public String locationClli; - public String businessCountryCode; - public String businessCountryName; - public String businessUnit; - public String businessUnitName; - public String department; - public String departmentName; - public String companyCode; - public String company; - public String zipCodeSuffix; - public String jobTitle; - public String commandChain; - public String siloStatus; - public String costCenter; - public String financialLocCode; - - public String loginId; - public String loginPwd; - public Date lastLoginDate; - public boolean active; - public boolean internal; - public Long selectedProfileId; - public Long timeZoneId; - public boolean online; - public String chatId; - - public Set<CentralUserApp> userApps = null; - public Set<CentralRole> pseudoRoles = null; - - public CentralUser() { - - } - - public CentralUser(Long id, Date created, Date modified, Long createdId, Long modifiedId, Long rowNum, Long orgId, +public class CentralV2User implements Serializable { + + + /** + * + */ + private static final long serialVersionUID = -2673289523184880563L; + private Long id; + private Date created; + private Date modified; + private Long createdId; + private Long modifiedId; + private Long rowNum; + + private Long orgId; + private Long managerId; + private String firstName; + private String middleInitial; + private String lastName; + private String phone; + private String fax; + private String cellular; + private String email; + private Long addressId; + private String alertMethodCd; + private String hrid; + private String orgUserId; + private String orgCode; + private String address1; + private String address2; + private String city; + private String state; + private String zipCode; + private String country; + private String orgManagerUserId; + private String locationClli; + private String businessCountryCode; + private String businessCountryName; + private String businessUnit; + private String businessUnitName; + private String department; + private String departmentName; + private String companyCode; + private String company; + private String zipCodeSuffix; + private String jobTitle; + private String commandChain; + private String siloStatus; + private String costCenter; + private String financialLocCode; + + private String loginId; + private String loginPwd; + private Date lastLoginDate; + private boolean active; + private boolean internal; + private Long selectedProfileId; + private Long timeZoneId; + private boolean online; + private String chatId; + + private Set<CentralV2UserApp> userApps = null; + private Set<CentralV2Role> pseudoRoles = null; + + public CentralV2User(){ + + } + + public CentralV2User(Long id, Date created, Date modified, Long createdId, Long modifiedId, Long rowNum, Long orgId, Long managerId, String firstName, String middleInitial, String lastName, String phone, String fax, String cellular, String email, Long addressId, String alertMethodCd, String hrid, String orgUserId, String orgCode, String address1, String address2, String city, String state, String zipCode, String country, @@ -112,7 +118,7 @@ public class CentralUser { String company, String zipCodeSuffix, String jobTitle, String commandChain, String siloStatus, String costCenter, String financialLocCode, String loginId, String loginPwd, Date lastLoginDate, boolean active, boolean internal, Long selectedProfileId, Long timeZoneId, boolean online, String chatId, - Set<CentralUserApp> userApps, Set<CentralRole> pseudoRoles) { + Set<CentralV2UserApp> userApps, Set<CentralV2Role> pseudoRoles) { super(); this.id = id; this.created = created; @@ -169,6 +175,748 @@ public class CentralUser { this.pseudoRoles = pseudoRoles; } + /** + * @return the id + */ + public Long getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(Long id) { + this.id = id; + } + + /** + * @return the created + */ + public Date getCreated() { + return created; + } + + /** + * @param created the created to set + */ + public void setCreated(Date created) { + this.created = created; + } + + /** + * @return the modified + */ + public Date getModified() { + return modified; + } + + /** + * @param modified the modified to set + */ + public void setModified(Date modified) { + this.modified = modified; + } + + /** + * @return the createdId + */ + public Long getCreatedId() { + return createdId; + } + + /** + * @param createdId the createdId to set + */ + public void setCreatedId(Long createdId) { + this.createdId = createdId; + } + + /** + * @return the modifiedId + */ + public Long getModifiedId() { + return modifiedId; + } + + /** + * @param modifiedId the modifiedId to set + */ + public void setModifiedId(Long modifiedId) { + this.modifiedId = modifiedId; + } + + /** + * @return the rowNum + */ + public Long getRowNum() { + return rowNum; + } + + /** + * @param rowNum the rowNum to set + */ + public void setRowNum(Long rowNum) { + this.rowNum = rowNum; + } + + /** + * @return the orgId + */ + public Long getOrgId() { + return orgId; + } + + /** + * @param orgId the orgId to set + */ + public void setOrgId(Long orgId) { + this.orgId = orgId; + } + + /** + * @return the managerId + */ + public Long getManagerId() { + return managerId; + } + + /** + * @param managerId the managerId to set + */ + public void setManagerId(Long managerId) { + this.managerId = managerId; + } + + /** + * @return the firstName + */ + public String getFirstName() { + return firstName; + } + + /** + * @param firstName the firstName to set + */ + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + /** + * @return the middleInitial + */ + public String getMiddleInitial() { + return middleInitial; + } + + /** + * @param middleInitial the middleInitial to set + */ + public void setMiddleInitial(String middleInitial) { + this.middleInitial = middleInitial; + } + + /** + * @return the lastName + */ + public String getLastName() { + return lastName; + } + + /** + * @param lastName the lastName to set + */ + public void setLastName(String lastName) { + this.lastName = lastName; + } + + /** + * @return the phone + */ + public String getPhone() { + return phone; + } + + /** + * @param phone the phone to set + */ + public void setPhone(String phone) { + this.phone = phone; + } + + /** + * @return the fax + */ + public String getFax() { + return fax; + } + + /** + * @param fax the fax to set + */ + public void setFax(String fax) { + this.fax = fax; + } + + /** + * @return the cellular + */ + public String getCellular() { + return cellular; + } + + /** + * @param cellular the cellular to set + */ + public void setCellular(String cellular) { + this.cellular = cellular; + } + + /** + * @return the email + */ + public String getEmail() { + return email; + } + + /** + * @param email the email to set + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * @return the addressId + */ + public Long getAddressId() { + return addressId; + } + + /** + * @param addressId the addressId to set + */ + public void setAddressId(Long addressId) { + this.addressId = addressId; + } + + /** + * @return the alertMethodCd + */ + public String getAlertMethodCd() { + return alertMethodCd; + } + + /** + * @param alertMethodCd the alertMethodCd to set + */ + public void setAlertMethodCd(String alertMethodCd) { + this.alertMethodCd = alertMethodCd; + } + + /** + * @return the hrid + */ + public String getHrid() { + return hrid; + } + + /** + * @param hrid the hrid to set + */ + public void setHrid(String hrid) { + this.hrid = hrid; + } + + /** + * @return the orgUserId + */ + public String getOrgUserId() { + return orgUserId; + } + + /** + * @param orgUserId the orgUserId to set + */ + public void setOrgUserId(String orgUserId) { + this.orgUserId = orgUserId; + } + + /** + * @return the orgCode + */ + public String getOrgCode() { + return orgCode; + } + + /** + * @param orgCode the orgCode to set + */ + public void setOrgCode(String orgCode) { + this.orgCode = orgCode; + } + + /** + * @return the address1 + */ + public String getAddress1() { + return address1; + } + + /** + * @param address1 the address1 to set + */ + public void setAddress1(String address1) { + this.address1 = address1; + } + + /** + * @return the address2 + */ + public String getAddress2() { + return address2; + } + + /** + * @param address2 the address2 to set + */ + public void setAddress2(String address2) { + this.address2 = address2; + } + + /** + * @return the city + */ + public String getCity() { + return city; + } + + /** + * @param city the city to set + */ + public void setCity(String city) { + this.city = city; + } + + /** + * @return the state + */ + public String getState() { + return state; + } + + /** + * @param state the state to set + */ + public void setState(String state) { + this.state = state; + } + + /** + * @return the zipCode + */ + public String getZipCode() { + return zipCode; + } + + /** + * @param zipCode the zipCode to set + */ + public void setZipCode(String zipCode) { + this.zipCode = zipCode; + } + + /** + * @return the country + */ + public String getCountry() { + return country; + } + + /** + * @param country the country to set + */ + public void setCountry(String country) { + this.country = country; + } + + /** + * @return the orgManagerUserId + */ + public String getOrgManagerUserId() { + return orgManagerUserId; + } + + /** + * @param orgManagerUserId the orgManagerUserId to set + */ + public void setOrgManagerUserId(String orgManagerUserId) { + this.orgManagerUserId = orgManagerUserId; + } + + /** + * @return the locationClli + */ + public String getLocationClli() { + return locationClli; + } + + /** + * @param locationClli the locationClli to set + */ + public void setLocationClli(String locationClli) { + this.locationClli = locationClli; + } + + /** + * @return the businessCountryCode + */ + public String getBusinessCountryCode() { + return businessCountryCode; + } + + /** + * @param businessCountryCode the businessCountryCode to set + */ + public void setBusinessCountryCode(String businessCountryCode) { + this.businessCountryCode = businessCountryCode; + } + + /** + * @return the businessCountryName + */ + public String getBusinessCountryName() { + return businessCountryName; + } + + /** + * @param businessCountryName the businessCountryName to set + */ + public void setBusinessCountryName(String businessCountryName) { + this.businessCountryName = businessCountryName; + } + + /** + * @return the businessUnit + */ + public String getBusinessUnit() { + return businessUnit; + } + + /** + * @param businessUnit the businessUnit to set + */ + public void setBusinessUnit(String businessUnit) { + this.businessUnit = businessUnit; + } + + /** + * @return the businessUnitName + */ + public String getBusinessUnitName() { + return businessUnitName; + } + + /** + * @param businessUnitName the businessUnitName to set + */ + public void setBusinessUnitName(String businessUnitName) { + this.businessUnitName = businessUnitName; + } + + /** + * @return the department + */ + public String getDepartment() { + return department; + } + + /** + * @param department the department to set + */ + public void setDepartment(String department) { + this.department = department; + } + + /** + * @return the departmentName + */ + public String getDepartmentName() { + return departmentName; + } + + /** + * @param departmentName the departmentName to set + */ + public void setDepartmentName(String departmentName) { + this.departmentName = departmentName; + } + + /** + * @return the companyCode + */ + public String getCompanyCode() { + return companyCode; + } + + /** + * @param companyCode the companyCode to set + */ + public void setCompanyCode(String companyCode) { + this.companyCode = companyCode; + } + + /** + * @return the company + */ + public String getCompany() { + return company; + } + + /** + * @param company the company to set + */ + public void setCompany(String company) { + this.company = company; + } + + /** + * @return the zipCodeSuffix + */ + public String getZipCodeSuffix() { + return zipCodeSuffix; + } + + /** + * @param zipCodeSuffix the zipCodeSuffix to set + */ + public void setZipCodeSuffix(String zipCodeSuffix) { + this.zipCodeSuffix = zipCodeSuffix; + } + + /** + * @return the jobTitle + */ + public String getJobTitle() { + return jobTitle; + } + + /** + * @param jobTitle the jobTitle to set + */ + public void setJobTitle(String jobTitle) { + this.jobTitle = jobTitle; + } + + /** + * @return the commandChain + */ + public String getCommandChain() { + return commandChain; + } + + /** + * @param commandChain the commandChain to set + */ + public void setCommandChain(String commandChain) { + this.commandChain = commandChain; + } + + /** + * @return the siloStatus + */ + public String getSiloStatus() { + return siloStatus; + } + + /** + * @param siloStatus the siloStatus to set + */ + public void setSiloStatus(String siloStatus) { + this.siloStatus = siloStatus; + } + + /** + * @return the costCenter + */ + public String getCostCenter() { + return costCenter; + } + + /** + * @param costCenter the costCenter to set + */ + public void setCostCenter(String costCenter) { + this.costCenter = costCenter; + } + + /** + * @return the financialLocCode + */ + public String getFinancialLocCode() { + return financialLocCode; + } + + /** + * @param financialLocCode the financialLocCode to set + */ + public void setFinancialLocCode(String financialLocCode) { + this.financialLocCode = financialLocCode; + } + + /** + * @return the loginId + */ + public String getLoginId() { + return loginId; + } + + /** + * @param loginId the loginId to set + */ + public void setLoginId(String loginId) { + this.loginId = loginId; + } + + /** + * @return the loginPwd + */ + public String getLoginPwd() { + return loginPwd; + } + + /** + * @param loginPwd the loginPwd to set + */ + public void setLoginPwd(String loginPwd) { + this.loginPwd = loginPwd; + } + + /** + * @return the lastLoginDate + */ + public Date getLastLoginDate() { + return lastLoginDate; + } + + /** + * @param lastLoginDate the lastLoginDate to set + */ + public void setLastLoginDate(Date lastLoginDate) { + this.lastLoginDate = lastLoginDate; + } + + /** + * @return the active + */ + public boolean isActive() { + return active; + } + + /** + * @param active the active to set + */ + public void setActive(boolean active) { + this.active = active; + } + + /** + * @return the internal + */ + public boolean isInternal() { + return internal; + } + + /** + * @param internal the internal to set + */ + public void setInternal(boolean internal) { + this.internal = internal; + } + + /** + * @return the selectedProfileId + */ + public Long getSelectedProfileId() { + return selectedProfileId; + } + + /** + * @param selectedProfileId the selectedProfileId to set + */ + public void setSelectedProfileId(Long selectedProfileId) { + this.selectedProfileId = selectedProfileId; + } + + /** + * @return the timeZoneId + */ + public Long getTimeZoneId() { + return timeZoneId; + } + + /** + * @param timeZoneId the timeZoneId to set + */ + public void setTimeZoneId(Long timeZoneId) { + this.timeZoneId = timeZoneId; + } + + /** + * @return the online + */ + public boolean isOnline() { + return online; + } + + /** + * @param online the online to set + */ + public void setOnline(boolean online) { + this.online = online; + } + + /** + * @return the chatId + */ + public String getChatId() { + return chatId; + } + + /** + * @param chatId the chatId to set + */ + public void setChatId(String chatId) { + this.chatId = chatId; + } + + /** + * @return the userApps + */ + public Set<CentralV2UserApp> getUserApps() { + return userApps; + } + + /** + * @param userApps the userApps to set + */ + public void setUserApps(Set<CentralV2UserApp> userApps) { + this.userApps = userApps; + } + + /** + * @return the pseudoRoles + */ + public Set<CentralV2Role> getPseudoRoles() { + return pseudoRoles; + } + + /** + * @param pseudoRoles the pseudoRoles to set + */ + public void setPseudoRoles(Set<CentralV2Role> pseudoRoles) { + this.pseudoRoles = pseudoRoles; + } + @Override public int hashCode() { final int prime = 31; @@ -237,7 +985,7 @@ public class CentralUser { return false; if (getClass() != obj.getClass()) return false; - CentralUser other = (CentralUser) obj; + CentralV2User other = (CentralV2User) obj; if (active != other.active) return false; if (address1 == null) { @@ -497,4 +1245,6 @@ public class CentralUser { return true; } + + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserApp.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralV2UserApp.java index 8f6c15bd..a8718574 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserApp.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CentralV2UserApp.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,57 +35,79 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; -@SuppressWarnings("rawtypes") -public class CentralUserApp implements Comparable { +import java.io.Serializable; +@SuppressWarnings("rawtypes") +public class CentralV2UserApp implements Serializable, Comparable{ + + /** + * + */ + private static final long serialVersionUID = 4954830080839125389L; private Long userId; private CentralApp app; - private CentralRole role; + private CentralV2Role role; private Short priority; - + + + public Long getUserId() { return userId; } + + public void setUserId(Long userId) { this.userId = userId; } + + public CentralApp getApp() { return app; } + + public void setApp(CentralApp app) { this.app = app; } - public CentralRole getRole() { + + + public CentralV2Role getRole() { return role; } - public void setRole(CentralRole role) { + + + public void setRole(CentralV2Role role) { this.role = role; } + + public Short getPriority() { return priority; } + + public void setPriority(Short priority) { this.priority = priority; } - public int compareTo(Object other) { - CentralUserApp castOther = (CentralUserApp) other; - Long c1 = (this.getUserId() == null ? 0 : this.getUserId()) + (this.priority == null ? 0 : this.priority); - Long c2 = (castOther.getUserId() == null ? 0 : castOther.getUserId()) - + (castOther.getApp() == null || castOther.getApp().getId() == null ? 0 : castOther.getApp().getId()) - + (castOther.priority == null ? 0 : castOther.priority); - return c1.compareTo(c2); - } + public int compareTo(Object other){ + CentralV2UserApp castOther = (CentralV2UserApp) other; + Long c1 = (this.getUserId()==null ? 0 : this.getUserId()) + (this.priority==null ? 0 : this.priority); + Long c2 = (castOther.getUserId()==null ? 0 : castOther.getUserId()) + (castOther.getApp()==null||castOther.getApp().getId()==null ? 0 : castOther.getApp().getId()) + (castOther.priority==null ? 0 : castOther.priority); + + return c1.compareTo(c2); + } + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CommonWidget.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CommonWidget.java index ae759868..18110e1b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CommonWidget.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CommonWidget.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import javax.persistence.Column; import javax.persistence.Entity; @@ -44,7 +44,7 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; import com.fasterxml.jackson.annotation.JsonInclude; /** diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CommonWidgetMeta.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CommonWidgetMeta.java index 2e82f579..173718ae 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CommonWidgetMeta.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CommonWidgetMeta.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.util.List; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreference.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EPAppsManualPreference.java index cd59cdb0..e5472061 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreference.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EPAppsManualPreference.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; public class EPAppsManualPreference { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreference.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EPAppsSortPreference.java index eef43c63..367d1d33 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreference.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EPAppsSortPreference.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; public class EPAppsSortPreference { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPref.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EPDeleteAppsManualSortPref.java index 341ed48b..12786416 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPref.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EPDeleteAppsManualSortPref.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; public class EPDeleteAppsManualSortPref { private Long appId; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRoles.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EPUserAppCurrentRoles.java index 8e140ad8..ee88bd49 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EPUserAppCurrentRoles.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreference.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EPWidgetsSortPreference.java index d8a2b2dc..072abe78 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreference.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EPWidgetsSortPreference.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.util.List; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserAppRoles.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EcompUserAppRoles.java index e98421f6..b6caccb3 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserAppRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EcompUserAppRoles.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserRoles.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EcompUserRoles.java index 953b7b81..73409ede 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EcompUserRoles.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItem.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EpNotificationItem.java index c5256957..ea3e6a72 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItem.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EpNotificationItem.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.util.Date; import java.util.List; @@ -53,7 +53,7 @@ import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Transient; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; /** diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVO.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EpNotificationItemExtVO.java index d7170fea..9a6a58b3 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVO.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EpNotificationItemExtVO.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.util.Date; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVO.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EpNotificationItemVO.java index 2bf5a105..7c2da309 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVO.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EpNotificationItemVO.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,14 +35,14 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.util.Date; import javax.persistence.Entity; import javax.persistence.Id; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; /** * This is to handle notifications in user notifications and in notification history diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItem.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EpRoleNotificationItem.java index 5ec117d9..a1b4377b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItem.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EpRoleNotificationItem.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import javax.persistence.Column; import javax.persistence.Entity; @@ -44,7 +44,7 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; -import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.DomainVo; @Entity @Table(name="ep_role_notification") diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EventWidget.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EventWidget.java index 1da7f7ff..96562399 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EventWidget.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EventWidget.java @@ -1,12 +1,13 @@ +package org.onap.portalapp.portal.transport; /*- * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +20,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EventWidgetMeta.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EventWidgetMeta.java index 34471087..a27aa65e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EventWidgetMeta.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/EventWidgetMeta.java @@ -1,12 +1,13 @@ +package org.onap.portalapp.portal.transport; /*- * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +20,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPerms.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAccessPerms.java index aeb2ad36..db9107fe 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPerms.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAccessPerms.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,11 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.io.Serializable; -public class ExternalAccessPerms implements Serializable, Comparable { +public class ExternalAccessPerms implements Serializable, Comparable{ /** * @@ -49,11 +49,14 @@ public class ExternalAccessPerms implements Serializable, Comparable { public String instance; public String action; public String description; - + + public ExternalAccessPerms() { super(); } - + + + public ExternalAccessPerms(String type, String instance, String action, String description) { super(); this.type = type; @@ -69,46 +72,39 @@ public class ExternalAccessPerms implements Serializable, Comparable { this.action = action; } + /** * @return the type */ public String getType() { return type; } - /** - * @param type - * the type to set + * @param type the type to set */ public void setType(String type) { this.type = type; } - /** * @return the instance */ public String getInstance() { return instance; } - /** - * @param instance - * the instance to set + * @param instance the instance to set */ public void setInstance(String instance) { this.instance = instance; } - /** * @return the action */ public String getAction() { return action; } - /** - * @param action - * the action to set + * @param action the action to set */ public void setAction(String action) { this.action = action; @@ -122,16 +118,19 @@ public class ExternalAccessPerms implements Serializable, Comparable { this.description = description; } + @Override - public int compareTo(Object obj) { - ExternalAccessPerms other = (ExternalAccessPerms) obj; + public int compareTo(Object obj){ + ExternalAccessPerms other = (ExternalAccessPerms)obj; - String c1 = getInstance(); - String c2 = other.getInstance(); + String c1 = getInstance(); + String c2 = other.getInstance(); - return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); + return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); } + + @Override public int hashCode() { final int prime = 31; @@ -143,6 +142,8 @@ public class ExternalAccessPerms implements Serializable, Comparable { return result; } + + @Override public boolean equals(Object obj) { if (this == obj) @@ -174,5 +175,6 @@ public class ExternalAccessPerms implements Serializable, Comparable { return false; return true; } - + + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetail.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAccessPermsDetail.java index 554aebb5..49167c88 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetail.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAccessPermsDetail.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.util.List; @@ -43,7 +43,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonRootName; @JsonIgnoreProperties(ignoreUnknown = true) -@JsonRootName(value = "perm") +@JsonRootName(value="perm") public class ExternalAccessPermsDetail { private String type; @@ -51,7 +51,9 @@ public class ExternalAccessPermsDetail { private String action; private List<String> roles; private String description; - + + + public ExternalAccessPermsDetail() { super(); } @@ -72,45 +74,40 @@ public class ExternalAccessPermsDetail { this.roles = roles; this.description = description; } - + /** * @param type * @param instance * @param action * @param description */ - public ExternalAccessPermsDetail(String type, String instance, String action, String description) { + public ExternalAccessPermsDetail(String type, String instance, String action, + String description) { super(); this.type = type; this.instance = instance; this.action = action; this.description = description; } - + public String getType() { return type; } - public void setType(String type) { this.type = type; } - public String getInstance() { return instance; } - public void setInstance(String instance) { this.instance = instance; } - public String getAction() { return action; } - public void setAction(String action) { this.action = action; } - public List<String> getRoles() { return roles; } @@ -122,9 +119,9 @@ public class ExternalAccessPermsDetail { public String getDescription() { return description; } - public void setDescription(String description) { this.description = description; } - + + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRole.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAccessRole.java index 415665a5..3a377f32 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAccessRole.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.io.Serializable; @@ -47,17 +47,17 @@ public class ExternalAccessRole implements Serializable { private static final long serialVersionUID = 3439986826362436339L; public String name; public String description; - + public ExternalAccessRole() { - + } - + public ExternalAccessRole(String name, String description) { super(); this.name = name; this.description = description; } - + public String getName() { return name; } @@ -69,9 +69,8 @@ public class ExternalAccessRole implements Serializable { public String getDescription() { return description; } - public void setDescription(String description) { this.description = description; } - + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePerms.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAccessRolePerms.java index 314df1d6..1235f62d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePerms.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAccessRolePerms.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,33 +35,32 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; public class ExternalAccessRolePerms { - - private ExternalAccessPerms perm; + + private ExternalAccessPerms perm; private String role; - + + public ExternalAccessRolePerms(ExternalAccessPerms perm, String role) { super(); this.perm = perm; this.role = role; } - + public ExternalAccessPerms getPerm() { return perm; } - public void setPerm(ExternalAccessPerms perm) { this.perm = perm; } - public String getRole() { return role; } - public void setRole(String role) { this.role = role; } - + + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUser.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAccessUser.java index 4b181302..63d11449 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUser.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAccessUser.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; public class ExternalAccessUser { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetail.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAccessUserRoleDetail.java index 45b2819e..fe92fb4c 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetail.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAccessUserRoleDetail.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,13 +35,14 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; public class ExternalAccessUserRoleDetail { - + private String name; private ExternalRoleDescription description; - + + /** * */ @@ -54,19 +55,16 @@ public class ExternalAccessUserRoleDetail { this.name = name; this.description = description; } - + public String getName() { return name; } - public void setName(String name) { this.name = name; } - public ExternalRoleDescription getDescription() { return description; } - public void setDescription(ExternalRoleDescription description) { this.description = description; } @@ -101,5 +99,6 @@ public class ExternalAccessUserRoleDetail { return false; return true; } - + + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/properties/VidProperties.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAuthUserRole.java index e18f43f1..0b143bd9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/properties/VidProperties.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalAuthUserRole.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,24 +35,40 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ +package org.onap.portalapp.portal.transport; -package org.openecomp.portalapp.portal.scheduler.properties; -import org.openecomp.portalsdk.core.util.SystemProperties; -/** - * The Class VidProperties. - */ -public class VidProperties extends SystemProperties { +import java.io.Serializable; - //VID General Properties +public class ExternalAuthUserRole implements Serializable{ - /** The Constant VID_TRUSTSTORE_FILENAME. */ - public static final String VID_TRUSTSTORE_FILENAME = "vid.truststore.filename"; + /** + * + */ + private static final long serialVersionUID = 5066251837431287376L; - /** The Constant VID_TRUSTSTORE_PASSWD_X. */ - public static final String VID_TRUSTSTORE_PASSWD_X = "vid.truststore.passwd.x"; + private String role; + private String user; + private String expiryDate; - /** The Constant FILESEPARATOR. */ - public static final String FILESEPARATOR = (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator"); + public String getRole() { + return role; + } + public void setRole(String role) { + this.role = role; + } + public String getUser() { + return user; + } + public void setUser(String user) { + this.user = user; + } + public String getExpiryDate() { + return expiryDate; + } + public void setExpiryDate(String expiryDate) { + this.expiryDate = expiryDate; + } + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRequestFieldsValidator.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalRequestFieldsValidator.java index 0e7581af..75418df5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRequestFieldsValidator.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalRequestFieldsValidator.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; public class ExternalRequestFieldsValidator { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescription.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalRoleDescription.java index 5c73c1fc..262cc8ff 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescription.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ExternalRoleDescription.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; public class ExternalRoleDescription { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FavoritesFunctionalMenuItem.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/FavoritesFunctionalMenuItem.java index df382721..aff15cd3 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FavoritesFunctionalMenuItem.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/FavoritesFunctionalMenuItem.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FavoritesFunctionalMenuItemJson.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/FavoritesFunctionalMenuItemJson.java index ea64f13a..73b01e29 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FavoritesFunctionalMenuItemJson.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/FavoritesFunctionalMenuItemJson.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FieldsValidator.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/FieldsValidator.java index f029e8af..7c9b6961 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FieldsValidator.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/FieldsValidator.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.util.ArrayList; import java.util.List; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItem.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/FunctionalMenuItem.java index 3deb49b1..fcee6207 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItem.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/FunctionalMenuItem.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.io.Serializable; import java.util.List; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemWithRoles.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/FunctionalMenuItemWithRoles.java index 0dc64023..f1a48aca 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemWithRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/FunctionalMenuItemWithRoles.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.io.Serializable; import java.util.List; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRole.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/FunctionalMenuRole.java index 83aab184..0f4a6b4f 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/FunctionalMenuRole.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.io.Serializable; import javax.persistence.Column; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/GlobalRoleWithApplicationRoleFunction.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/GlobalRoleWithApplicationRoleFunction.java new file mode 100644 index 00000000..b872409e --- /dev/null +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/GlobalRoleWithApplicationRoleFunction.java @@ -0,0 +1,130 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ + +package org.onap.portalapp.portal.transport; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +public class GlobalRoleWithApplicationRoleFunction implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + @Id + @Column(name = "role_id") + private Long roleId; + @Id + @Column(name = "role_name") + private String roleName; + @Id + @Column(name = "active_Yn") + private boolean active; + @Id + @Column(name = "priority") + private Integer priority; + @Id + @Column(name = "function_cd") + private String functionCd; + @Id + @Column(name = "function_name") + private String functionName; + @Id + @Column(name = "app_id") + private long appId; + + @Id + @Column(name = "role_app_id") + private long roleAppId; + + public Long getRoleId() { + return roleId; + } + public void setRoleId(long roleId) { + this.roleId = roleId; + } + public String getRoleName() { + return roleName; + } + public void setRoleName(String roleName) { + this.roleName = roleName; + } + public boolean isActive() { + return active; + } + public void setActive(boolean active) { + this.active = active; + } + public Integer getPriority() { + return priority; + } + public void setPriority(Integer priority) { + this.priority = priority; + } + public String getFunctionCd() { + return functionCd; + } + public void setFunctionCd(String functionCd) { + this.functionCd = functionCd; + } + public String getFunctionName() { + return functionName; + } + public void setFunctionName(String functionName) { + this.functionName = functionName; + } + public long getAppId() { + return appId; + } + public void setAppId(long appId) { + this.appId = appId; + } + @Override + public String toString() { + return "GlobalRoleWithApplicationRoleFucnction [roleId=" + roleId + ", roleName=" + roleName + ", active=" + + active + ", priority=" + priority + ", functionCd=" + functionCd + ", functionName=" + functionName + + ", appId=" + appId + "]"; + } + + +} diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/LocalRole.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/LocalRole.java index 05dfc5bb..3d9ec973 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/LocalRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/LocalRole.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingApp.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/OnboardingApp.java index 54fe7fba..8347d4f0 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingApp.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/OnboardingApp.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; /** * Model of rows in the fn_app table; serialized as a message add or update an diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingWidget.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/OnboardingWidget.java index 26a6d6ae..4205324c 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingWidget.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/OnboardingWidget.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/PortalAdmin.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/PortalAdmin.java index 643af75c..f3ec7794 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/PortalAdmin.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/PortalAdmin.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/PortalAdminUserRole.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/PortalAdminUserRole.java index 9e187162..a79075b7 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/PortalAdminUserRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/PortalAdminUserRole.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ProfileDetail.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ProfileDetail.java index cbc6b692..d1901899 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ProfileDetail.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/ProfileDetail.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,22 +35,19 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; public class ProfileDetail { - + private String firstName; private String lastName; private String middleName; private String email; private String loginId; private String loginPassword; - - public ProfileDetail() { - } - - public ProfileDetail(String firstName, String lastName, String middleName, String email, String loginId, - String loginPassword) { + + public ProfileDetail(){} + public ProfileDetail(String firstName, String lastName, String middleName, String email, String loginId, String loginPassword) { this.firstName = firstName; this.lastName = lastName; this.middleName = middleName; @@ -62,49 +59,39 @@ public class ProfileDetail { public String getFirstName() { return firstName; } - public void setFirstName(String firstName) { this.firstName = firstName; } - public String getLastName() { return lastName; } - public void setLastName(String lastName) { this.lastName = lastName; } - public String getMiddleName() { return middleName; } - public void setMiddleName(String middleName) { this.middleName = middleName; } - public String getEmail() { return email; } - public void setEmail(String email) { this.email = email; } - public String getLoginId() { return loginId; } - public void setLoginId(String loginId) { this.loginId = loginId; } - public String getLoginPassword() { return loginPassword; } - public void setLoginPassword(String loginPassword) { this.loginPassword = loginPassword; } - + + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RemoteRole.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/RemoteRole.java index 6de32280..a86f10fc 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RemoteRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/RemoteRole.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; public class RemoteRole { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRoles.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/RemoteUserWithRoles.java index 4aa30577..39127c12 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/RemoteUserWithRoles.java @@ -1,17 +1,12 @@ -package org.openecomp.portalapp.portal.transport; - -import java.util.ArrayList; -import java.util.List; - /*- * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -24,7 +19,7 @@ import java.util.List; * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -40,6 +35,10 @@ import java.util.List; * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ +package org.onap.portalapp.portal.transport; + +import java.util.ArrayList; +import java.util.List; /** * User description which we receive in response from request to remote diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RoleInAppForUser.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/RoleInAppForUser.java index 76018b39..12fc0ab0 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RoleInAppForUser.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/RoleInAppForUser.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; public class RoleInAppForUser { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RolesInAppForUser.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/RolesInAppForUser.java index ea6f92b8..0d79020c 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RolesInAppForUser.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/RolesInAppForUser.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.util.ArrayList; import java.util.List; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/UserApplicationRoles.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/UserApplicationRoles.java index b1af0818..3f88bc0e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/UserApplicationRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/UserApplicationRoles.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.util.ArrayList; import java.util.List; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitle.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/UserWithNameSurnameTitle.java index b14fc8de..dab2c5fd 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitle.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/UserWithNameSurnameTitle.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; public class UserWithNameSurnameTitle { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalization.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/WidgetCatalogPersonalization.java index bc39014d..6ca466aa 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalization.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/WidgetCatalogPersonalization.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; /** * Model for the object PUT to the controller when the user takes an action on diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebHelper.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ueb/EPUebHelper.java index a56cfb62..d006f8ea 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebHelper.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ueb/EPUebHelper.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.ueb; +package org.onap.portalapp.portal.ueb; import java.net.HttpURLConnection; import java.net.URL; @@ -46,20 +46,22 @@ import javax.annotation.PostConstruct; import org.hibernate.Session; import org.hibernate.SessionFactory; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EcompApp; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.logging.format.EPAppMessagesEnum; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.portal.service.EPAppService; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.ueb.Helper; -import org.openecomp.portalsdk.core.onboarding.ueb.Publisher; -import org.openecomp.portalsdk.core.onboarding.ueb.UebException; -import org.openecomp.portalsdk.core.onboarding.ueb.UebManager; -import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg; -import org.openecomp.portalsdk.core.onboarding.util.PortalApiConstants; -import org.openecomp.portalsdk.core.onboarding.util.PortalApiProperties; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EcompApp; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.service.EPAppService; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.onboarding.ueb.Helper; +import org.onap.portalsdk.core.onboarding.ueb.Publisher; +import org.onap.portalsdk.core.onboarding.ueb.UebException; +import org.onap.portalsdk.core.onboarding.ueb.UebManager; +import org.onap.portalsdk.core.onboarding.ueb.UebMsg; +import org.onap.portalsdk.core.onboarding.util.PortalApiConstants; +import org.onap.portalsdk.core.onboarding.util.PortalApiProperties; +import org.onap.portalapp.portal.ueb.EPUebHelper; +import org.onap.portalapp.portal.ueb.EPUebMsgTypes; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Component; @@ -169,7 +171,7 @@ public class EPUebHelper { // (ie http://uebsb91kcdc.it.com:3904/topics/ECOMP-PORTAL-INBOX) // boolean available = true; - LinkedList<String> urlList = Helper.uebUrlList(); + LinkedList<String> urlList = (LinkedList<String>) Helper.uebUrlList(); if (!urlList.isEmpty()) { String url = "http://" + urlList.getFirst() + ":3904/topics/" + PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME); if (!url.isEmpty()) { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebMsgTypes.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ueb/EPUebMsgTypes.java index 720e0615..7e49f8f2 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebMsgTypes.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/ueb/EPUebMsgTypes.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,9 +35,9 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.ueb; +package org.onap.portalapp.portal.ueb; -import org.openecomp.portalsdk.core.onboarding.ueb.UebMsgTypes; +import org.onap.portalsdk.core.onboarding.ueb.UebMsgTypes; public interface EPUebMsgTypes extends UebMsgTypes { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/CustomLoggingFilter.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/CustomLoggingFilter.java index ab41daac..0b564eec 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/CustomLoggingFilter.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/CustomLoggingFilter.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.utils; +package org.onap.portalapp.portal.utils; import ch.qos.logback.classic.Level; import ch.qos.logback.classic.spi.ILoggingEvent; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EPCommonSystemProperties.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EPCommonSystemProperties.java index fd15634b..0d3ff519 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EPCommonSystemProperties.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EPCommonSystemProperties.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,9 +35,9 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.utils; +package org.onap.portalapp.portal.utils; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalsdk.core.util.SystemProperties; public class EPCommonSystemProperties extends SystemProperties { @@ -85,8 +85,11 @@ public class EPCommonSystemProperties extends SystemProperties { public static final String EXTERNAL_CENTRAL_AUTH_PASSWORD = "ext_central_access_password"; public static final String EXTERNAL_CENTRAL_ACCESS_URL = "ext_central_access_url"; public static final String EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN = "ext_central_access_user_domain"; - + public static final String REMOTE_CENTRALISED_SYSTEM_ACCESS = "remote_centralized_system_access"; + public static final String WIDGET_MS_PROTOCOL = "microservices.widget.protocol"; public static final String WIDGET_MS_HOSTNAME = "microservices.widget.hostname"; + + public static final String REMOTE_CENTRALIZED_SYSTEM_ACCESS = "remote_centralized_system_access"; } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java index 2d4d214f..efd84b90 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,8 +35,9 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.utils; +package org.onap.portalapp.portal.utils; +import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; import java.text.SimpleDateFormat; @@ -47,14 +48,16 @@ import java.util.List; import javax.servlet.http.HttpServletResponse; import javax.xml.bind.DatatypeConverter; +import org.apache.commons.lang.StringUtils; import org.hibernate.Session; import org.hibernate.Transaction; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.logging.format.EPAppMessagesEnum; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.onboarding.util.CipherUtil; +import org.onap.portalsdk.core.onboarding.util.PortalApiConstants; +import org.onap.portalsdk.core.util.SystemProperties; import org.slf4j.MDC; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -65,11 +68,16 @@ import com.fasterxml.jackson.databind.ObjectMapper; public class EcompPortalUtils { private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EcompPortalUtils.class); - + + private static final String FUNCTION_PIPE = "|"; + // TODO: GLOBAL_LOGIN_URL is the same as in SessionTimeoutInterceptor. // It should be defined in SystemProperties. private static final String GLOBAL_LOGIN_URL = "global-login-url"; - + + // It is a regular expression used for while creating a External Central Auth Role + public static final String EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS = "([^A-Z^a-z^0-9^\\.^%^(^)^=^:])"; + /** * @param orgUserId * User ID to validate @@ -238,8 +246,9 @@ public class EcompPortalUtils { // This method might be just for testing purposes. public static void setExternalAppResponseCode(int responseCode) { try { - String responseCodeString = String.valueOf(responseCode); - MDC.put(EPCommonSystemProperties.EXTERNAL_API_RESPONSE_CODE, responseCodeString); + String code = String.valueOf(responseCode); + MDC.put(EPCommonSystemProperties.EXTERNAL_API_RESPONSE_CODE,code ); + code=StringUtils.EMPTY; } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "setExternalAppResponseCode failed", e); } @@ -414,7 +423,7 @@ public class EcompPortalUtils { String result = ""; if (encrypted != null && encrypted.length() > 0) { try { - result = CipherUtil.decrypt(encrypted, SystemProperties.getProperty(SystemProperties.Decryption_Key)); + result = CipherUtil.decryptPKC(encrypted, SystemProperties.getProperty(SystemProperties.Decryption_Key)); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "decryptedPassword failed", e); throw e; @@ -433,4 +442,122 @@ public class EcompPortalUtils { } return originString; } + + /** + * + * If function code value has any pipes it does pipe filter and + * returns value. + * + * @param functionCode + * @return function instance without pipe + */ + public static String getFunctionCode(String functionCode) { + String finalFunctionCodeVal = ""; + if (functionCode.contains(FUNCTION_PIPE)) { + int count = StringUtils.countMatches(functionCode, FUNCTION_PIPE); + if (count == 2) + finalFunctionCodeVal = functionCode.substring( + functionCode.indexOf(FUNCTION_PIPE) + 1, + functionCode.lastIndexOf(FUNCTION_PIPE)); + else + finalFunctionCodeVal = functionCode + .substring(functionCode.lastIndexOf(FUNCTION_PIPE) + 1); + } else{ + finalFunctionCodeVal = functionCode; + } + return finalFunctionCodeVal; + } + + /** + * + * If function code value has any pipes it does pipe filter and + * returns value. + * + * @param functionCode + * @return function Type without pipe + */ + public static String getFunctionType(String functionCode) { + String finalFunctionCodeVal = ""; + if (functionCode.contains(FUNCTION_PIPE)) { + int count = StringUtils.countMatches(functionCode, FUNCTION_PIPE); + if (count == 2){ + String[] getTypeValue = functionCode.split("\\"+FUNCTION_PIPE); + finalFunctionCodeVal = getTypeValue[0]; + } + } else{ + finalFunctionCodeVal = functionCode; + } + return finalFunctionCodeVal; + } + + /** + * + * If function code value has any pipes it does pipe filter and + * returns value. + * + * @param functionCode + * @return function Action without pipe + */ + public static String getFunctionAction(String functionCode) { + String finalFunctionCodeVal = ""; + if (functionCode.contains(FUNCTION_PIPE)) { + int count = StringUtils.countMatches(functionCode, FUNCTION_PIPE); + if (count == 2) + finalFunctionCodeVal = functionCode.substring( + functionCode.lastIndexOf(FUNCTION_PIPE)+1); + } else{ + finalFunctionCodeVal = functionCode; + } + return finalFunctionCodeVal; + } + + /** + * + * It check whether the external auth namespace is matching with current namepsace exists in local DB + * + * @param permTypeVal + * @param appNamespaceVal + * @return true or false + */ + public static boolean checkNameSpaceMatching(String permTypeVal, String appNamespaceVal) { + String[] typeNamespace = permTypeVal.split("\\."); + String[] appNamespace = appNamespaceVal.split("\\."); + boolean isNamespaceMatching = true; + for (int k = 0; k < appNamespace.length; k++) { + if (!appNamespace[k].equals(typeNamespace[k])) + isNamespaceMatching = false; + } + return isNamespaceMatching; + } + + public static boolean checkIfRemoteCentralAccessAllowed() { + boolean result = false; + String rmtCentralAccess = SystemProperties.getProperty(EPCommonSystemProperties.REMOTE_CENTRALISED_SYSTEM_ACCESS); + if(rmtCentralAccess == null) { + logger.error(EELFLoggerDelegate.errorLogger, "Please check in system.properties whether the property exists or not!"); + return false; + }else if(new Boolean(rmtCentralAccess)){ + logger.debug(EELFLoggerDelegate.debugLogger, "checkIfRemoteCentralAccessAllowed: {}",rmtCentralAccess); + result = true; + } + return result; + } + + /** + * + * It validates whether given string is JSON or not + * + * @param jsonInString + * @return true or false + */ + public static boolean isJSONValid(String jsonInString ) { + try { + final ObjectMapper mapper = new ObjectMapper(); + mapper.readTree(jsonInString); + return true; + } catch (IOException e) { + logger.error(EELFLoggerDelegate.errorLogger, "Failed to parse Json!", e); + return false; + } + } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompVersion.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompVersion.java index 9e9c5aab..7e05754f 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompVersion.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompVersion.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.utils; +package org.onap.portalapp.portal.utils; // // Hardcoded for now, wanted to use maven and resource file. Possibly just read diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/HashMapFromList.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/HashMapFromList.java index 5abc498d..e31c73b5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/HashMapFromList.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/HashMapFromList.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,14 +35,14 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.utils; +package org.onap.portalapp.portal.utils; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.HashMap; import java.util.List; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; /** * diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/ParallelExecutor.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/ParallelExecutor.java index 8dfacb5c..b4ad9c9f 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/ParallelExecutor.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/ParallelExecutor.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.utils; +package org.onap.portalapp.portal.utils; import java.util.ArrayList; import java.util.List; @@ -44,7 +44,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; public abstract class ParallelExecutor<T> { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/PortalConstants.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/PortalConstants.java index 413b11a7..7f924834 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/PortalConstants.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/PortalConstants.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,13 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.utils; +package org.onap.portalapp.portal.utils; public interface PortalConstants { public static final Long PORTAL_APP_ID = 1L; public static final Long DEFAULT_NOTIFICATION_CREATOR = 1L; public static final String REST_AUX_API = "/auxapi"; + public static final String PORTAL_AUX_API = "/portalApi"; public static final Long ACCOUNT_ADMIN_ROLE_ID = 999L; public static final Long SYS_ADMIN_ROLE_ID = 1L; public static final String ADMIN_ROLE = "Account Administrator"; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/AdminAuthExtension.java index fc88d4fa..7f401ff6 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/AdminAuthExtension.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,13 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.service; +package org.onap.portalapp.service; +import org.onap.portalapp.portal.domain.EPUser; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.openecomp.portalapp.portal.domain.EPUser; - @Service("adminAuthExtension") @Transactional diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/EPProfileService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/EPProfileService.java index 54ce80b7..a08e2748 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/EPProfileService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/EPProfileService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.service; +package org.onap.portalapp.service; import java.util.List; -import org.openecomp.portalsdk.core.domain.Profile; -import org.openecomp.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalsdk.core.domain.Profile; public interface EPProfileService { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/EPProfileServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/EPProfileServiceImpl.java index 373b2b00..35090d94 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/EPProfileServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/EPProfileServiceImpl.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,15 +35,15 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.service; +package org.onap.portalapp.service; import java.util.List; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalsdk.core.dao.ProfileDao; -import org.openecomp.portalsdk.core.domain.Profile; -import org.openecomp.portalsdk.core.service.DataAccessService; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalsdk.core.dao.ProfileDao; +import org.onap.portalsdk.core.domain.Profile; +import org.onap.portalsdk.core.service.DataAccessService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/RemoteWebServiceCallService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/RemoteWebServiceCallService.java index be2fe7cf..91b9e0cf 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/RemoteWebServiceCallService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/RemoteWebServiceCallService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.service; +package org.onap.portalapp.service; public interface RemoteWebServiceCallService { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/CoreTimeoutHandler.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/CoreTimeoutHandler.java index 152c68b1..03bc7296 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/CoreTimeoutHandler.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/CoreTimeoutHandler.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.service.sessionmgt; +package org.onap.portalapp.service.sessionmgt; import java.util.Calendar; import java.util.Hashtable; @@ -43,10 +43,10 @@ import java.util.Map; import javax.servlet.http.HttpSession; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalsdk.core.domain.sessionmgt.TimeoutVO; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.util.PortalApiConstants; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalsdk.core.domain.sessionmgt.TimeoutVO; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.onboarding.util.PortalApiConstants; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/ManageService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/ManageService.java index 2628cd86..3c08f910 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/ManageService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/ManageService.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,18 +35,19 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.service.sessionmgt; +package org.onap.portalapp.service.sessionmgt; +import java.text.ParseException; import java.util.Calendar; import java.util.Date; import java.util.List; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.service.EPAppService; -import org.openecomp.portalapp.portal.transport.OnboardingApp; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.listener.PortalTimeoutHandler; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.service.EPAppService; +import org.onap.portalapp.portal.transport.OnboardingApp; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.onboarding.listener.PortalTimeoutHandler; +import org.onap.portalsdk.core.util.SystemProperties; import org.quartz.CronExpression; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; @@ -66,7 +67,7 @@ public class ManageService implements PortalTimeoutHandler.SessionCommInf { @Autowired private SessionCommunication sessionCommunication; - public Integer fetchSessionSlotCheckInterval(String... params) throws Exception { + public Integer fetchSessionSlotCheckInterval(String... params) { String defaultCronExpressionStr = "0 0/5 * * * ? *"; String cronExpressionStr = SystemProperties.getProperty(SystemProperties.SESSIONTIMEOUT_FEED_CRON); @@ -75,7 +76,13 @@ public class ManageService implements PortalTimeoutHandler.SessionCommInf { cronExpressionStr = defaultCronExpressionStr; } - CronExpression cal = new CronExpression(cronExpressionStr); + CronExpression cal = null; + try { + cal = new CronExpression(cronExpressionStr); + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } final Date nowTime = Calendar.getInstance().getTime(); Date nextTime = cal.getNextValidTimeAfter(nowTime); Date nextNextTime = cal.getNextValidTimeAfter(nextTime); @@ -86,7 +93,7 @@ public class ManageService implements PortalTimeoutHandler.SessionCommInf { return timeDiff; } - public void extendSessionTimeOuts(String... params) throws Exception { + public void extendSessionTimeOuts(String... params) { try { String sessionMap = params[3]; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/SessionCommunication.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/SessionCommunication.java index 13044c4d..ee525796 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/SessionCommunication.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/SessionCommunication.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.service.sessionmgt; +package org.onap.portalapp.service.sessionmgt; import java.io.BufferedReader; import java.io.InputStreamReader; @@ -45,15 +45,15 @@ import java.util.UUID; import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.logging.format.EPAppMessagesEnum; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.portal.transport.OnboardingApp; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalsdk.core.exception.UrlAccessRestrictedException; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalapp.portal.logging.aop.EPAuditLog; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.transport.OnboardingApp; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalsdk.core.exception.UrlAccessRestrictedException; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.slf4j.MDC; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/TimeoutHandler.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/TimeoutHandler.java index d7945c53..e795e98a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/TimeoutHandler.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/TimeoutHandler.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.service.sessionmgt; +package org.onap.portalapp.service.sessionmgt; import java.util.Hashtable; import java.util.List; @@ -51,16 +51,16 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.scheduling.quartz.QuartzJobBean; +import org.onap.portalapp.portal.logging.aop.EPMetricsLog; +import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum; +import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.service.EPAppService; +import org.onap.portalapp.portal.transport.OnboardingApp; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalsdk.core.domain.sessionmgt.TimeoutVO; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.onboarding.util.PortalApiConstants; -import org.openecomp.portalsdk.core.domain.sessionmgt.TimeoutVO; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.util.PortalApiConstants; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.logging.format.EPAppMessagesEnum; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.portal.service.EPAppService; -import org.openecomp.portalapp.portal.transport.OnboardingApp; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/util/EPUserUtils.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/util/EPUserUtils.java index 4c3462af..2292934b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/util/EPUserUtils.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/util/EPUserUtils.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,8 +35,9 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.util; +package org.onap.portalapp.util; +import java.util.ArrayList; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; @@ -44,23 +45,26 @@ import java.util.Iterator; import java.util.List; import java.util.Set; import java.util.UUID; +import java.util.regex.Pattern; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EPUserApp; -import org.openecomp.portalapp.portal.service.EPRoleFunctionService; -import org.openecomp.portalsdk.core.domain.RoleFunction; -import org.openecomp.portalsdk.core.exception.SessionExpiredException; -import org.openecomp.portalsdk.core.lm.FusionLicenseManager; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.menu.MenuBuilder; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.portalsdk.core.web.support.AppUtils; +import org.apache.commons.codec.DecoderException; +import org.apache.commons.codec.binary.Hex; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPUserApp; +import org.onap.portalapp.portal.exceptions.RoleFunctionException; +import org.onap.portalapp.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; +import org.onap.portalsdk.core.menu.MenuBuilder; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.SystemProperties; +import org.onap.portalsdk.core.web.support.AppUtils; import org.springframework.beans.factory.annotation.Autowired; public class EPUserUtils { @@ -70,6 +74,11 @@ public class EPUserUtils { private final static Long ACCOUNT_ADMIN_ROLE_ID = 999L; public static final String ALL_ROLE_FUNCTIONS = "allRoleFunctions"; + + // These decode values are based on HexDecoder + private static final String decodeValueOfForwardSlash = "2f"; + private static final String decodeValueOfHyphen = "2d"; + private static final String decodeValueOfAsterisk = "2a"; private static DataAccessService dataAccessService; @@ -104,10 +113,11 @@ public class EPUserUtils { * How the user authenticated; ignored * @param ePRoleFunctionService * role function service + * @throws DecoderException */ @SuppressWarnings("rawtypes") public static void setUserSession(HttpServletRequest request, EPUser user, Set applicationMenuData, - Set businessDirectMenuData, String loginMethod_ignored, EPRoleFunctionService ePRoleFunctionService) { + Set businessDirectMenuData, String loginMethod_ignored, EPRoleFunctionService ePRoleFunctionService) throws RoleFunctionException { HttpSession session = request.getSession(true); // clear the current user session to avoid any conflicts @@ -131,24 +141,7 @@ public class EPUserUtils { logger.error(EELFLoggerDelegate.errorLogger, "setUserSession failed to get licenseVerification attribute", e); } - switch (licenseVerificationFlag) { - case FusionLicenseManager.DEVELOPER_LICENSE: - session.setAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME), - "My Portal [Development Version]"); - break; - case FusionLicenseManager.EXPIRED_LICENSE: - session.setAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME), - "My Portal [LICENSE EXPIRED]"); - break; - case FusionLicenseManager.VALID_LICENSE: - session.setAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME), "My Portal"); - break; - default: - session.setAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME), - "My Portal [INVALID LICENSE]"); - break; - } - + session.setAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME), "My Portal"); session.setAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME), MenuBuilder.filterMenu(applicationMenuData, request)); session.setAttribute(SystemProperties.getProperty(SystemProperties.BUSINESS_DIRECT_MENU_ATTRIBUTE_NAME), @@ -163,16 +156,39 @@ public class EPUserUtils { * List of role functions. * @param session * HttpSession + * @throws DecoderException */ - private static void setAllRoleFunctions(List<RoleFunction> allRoleFunctions, HttpSession session) { + private static void setAllRoleFunctions(List<RoleFunction> allRoleFunctions, HttpSession session) throws RoleFunctionException { if (allRoleFunctions == null) return; Set<String> roleFnSet = new HashSet<String>(); - for (RoleFunction roleFn : allRoleFunctions) - roleFnSet.add(roleFn.getCode()); + for (RoleFunction roleFn : allRoleFunctions){ + roleFnSet.add(decodeFunctionCode(roleFn.getCode())); + } session.setAttribute(ALL_ROLE_FUNCTIONS, roleFnSet); } + + public static String decodeFunctionCode(String str) throws RoleFunctionException{ + String decodedString = str; + List<Pattern> decodingList = new ArrayList<>(); + decodingList.add(Pattern.compile(decodeValueOfForwardSlash)); + decodingList.add(Pattern.compile(decodeValueOfHyphen)); + decodingList.add(Pattern.compile(decodeValueOfAsterisk)); + for (Pattern xssInputPattern : decodingList) { + try { + decodedString = decodedString.replaceAll("%" + xssInputPattern, + new String(Hex.decodeHex(xssInputPattern.toString().toCharArray()))); + } catch (DecoderException e) { + logger.error(EELFLoggerDelegate.errorLogger, "Failed to decode the Rolefunction: "+ str, + e); + throw new RoleFunctionException("decode failed", e); + } + } + + return decodedString; + } + /** * Removes all stored attributes from the user's session * diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/util/SystemType.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/util/SystemType.java index 31d54fda..bf277491 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/util/SystemType.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/util/SystemType.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.util; +package org.onap.portalapp.util; public enum SystemType { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PolicyController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PolicyController.java deleted file mode 100644 index 2fb5e9ad..00000000 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PolicyController.java +++ /dev/null @@ -1,121 +0,0 @@ -/*- - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ - -package org.openecomp.portalapp.portal.controller; - -import java.util.UUID; - -import javax.servlet.http.HttpServletRequest; - -import org.json.simple.JSONObject; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.scheduler.policy.PolicyProperties; -import org.openecomp.portalapp.portal.scheduler.policy.PolicyResponseWrapper; -import org.openecomp.portalapp.portal.scheduler.policy.PolicyRestInterfaceFactory; -import org.openecomp.portalapp.portal.scheduler.policy.PolicyRestInterfaceIfc; -import org.openecomp.portalapp.portal.scheduler.policy.PolicyUtil; -import org.openecomp.portalapp.portal.scheduler.policy.RestObject; -import org.openecomp.portalapp.portal.utils.PortalConstants; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -/** - * Controller to handle Policy requests. - */ - -@RestController -@RequestMapping(PortalConstants.REST_AUX_API) -@Configuration -@EnableAspectJAutoProxy -@EPAuditLog -public class PolicyController implements BasicAuthenticationController { - - /** The logger. */ - private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PolicyController.class); - - @RequestMapping(value = "/get_policy", method = RequestMethod.POST) - public ResponseEntity<String> getPolicyInfo(HttpServletRequest request, @RequestBody JSONObject policy_request) - throws Exception { - - logger.debug(EELFLoggerDelegate.debugLogger, "#####################POLICY API CALL STARTED ###############" - + PolicyProperties.POLICY_GET_CONFIG_VAL); - logger.debug(EELFLoggerDelegate.debugLogger, - "#####################Policy Request ###############" + policy_request.toString()); - - String path = SystemProperties.getProperty(PolicyProperties.POLICY_GET_CONFIG_VAL); - PolicyResponseWrapper policyResWrapper = getPolicyConfig(policy_request, path); - - logger.debug(EELFLoggerDelegate.debugLogger, "$$$$$$$$$$$$$$$$$$$$$$ " - + new ResponseEntity<String>(policyResWrapper.getResponse(), HttpStatus.OK).toString()); - - return (new ResponseEntity<String>(policyResWrapper.getResponse(), - HttpStatus.valueOf(policyResWrapper.getStatus()))); - } - - protected static PolicyResponseWrapper getPolicyConfig(JSONObject request, String path) throws Exception { - String methodName = "getPolicyConfig"; - String uuid = UUID.randomUUID().toString(); - logger.debug(EELFLoggerDelegate.debugLogger, "starting getPolicyConfig "); - - try { - // STARTING REST API CALL AS AN FACTORY INSTACE - PolicyRestInterfaceIfc policyRestController = PolicyRestInterfaceFactory.getInstance(); - - RestObject<String> restObjStr = new RestObject<String>(); - String str = new String(); - restObjStr.set(str); - policyRestController.<String>Post(str, request, uuid, path, restObjStr); - PolicyResponseWrapper policyRespWrapper = PolicyUtil.wrapResponse(restObjStr); - logger.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + " w=" + policyRespWrapper.getResponse()); - return policyRespWrapper; - } catch (Exception e) { - logger.debug(EELFLoggerDelegate.debugLogger, - "EXCEPTION in getPolicyConfig <== " + "." + methodName + e.toString()); - - throw e; - } - } -} diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RoleManageController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RoleManageController.java deleted file mode 100644 index 7c4a4e8d..00000000 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RoleManageController.java +++ /dev/null @@ -1,201 +0,0 @@ -/*- - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ -package org.openecomp.portalapp.portal.controller; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.openecomp.portalapp.controller.EPRestrictedBaseController; -import org.openecomp.portalapp.controller.core.RoleController; -import org.openecomp.portalapp.controller.core.RoleFunctionListController; -import org.openecomp.portalapp.controller.core.RoleListController; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.service.ExternalAccessRolesService; -import org.openecomp.portalapp.portal.service.ExternalAccessRolesServiceImpl; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.servlet.ModelAndView; - -/** - * Proxies REST calls to role-management functions that arrive on paths - * /portalApi/* over to controller methods provided by the SDK-Core library. - * Those controller methods are mounted on paths not exposed by the Portal FE. - */ -@RestController -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -@EPAuditLog -public class RoleManageController extends EPRestrictedBaseController { - private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RoleManageController.class); - - @Autowired - private RoleController roleController; - - @Autowired - private RoleListController roleListController; - - @Autowired - private RoleFunctionListController roleFunctionListController; - - - @Autowired - ExternalAccessRolesService externalAccessRolesService; - /** - * Calls an SDK-Core library method that gets the available roles and writes - * them to the request object. Portal specifies a Hibernate mappings from - * the Role class to the fn_role_v view, which ensures that only Portal - * (app_id is null) roles are fetched. - * - * Any method declared void (no return value) or returning null causes the - * audit log aspect method to declare failure. TODO: should return a JSON - * string. - * - * @param request - * @param response - */ - @RequestMapping(value = { "/portalApi/get_roles" }, method = RequestMethod.GET) - public void getRoles(HttpServletRequest request, HttpServletResponse response) { - getRoleListController().getRoles(request, response); - } - - @RequestMapping(value = { "/portalApi/role_list/toggleRole" }, method = RequestMethod.POST) - public PortalRestResponse<String> toggleRole(HttpServletRequest request, HttpServletResponse response) { - PortalRestResponse<String> portalRestResponse = null; - try{ - getRoleListController().toggleRole(request, response); - portalRestResponse = new PortalRestResponse<String>(PortalRestStatusEnum.OK, "success", null); - }catch (Exception e) { - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "failure", e.getMessage()); - } - return portalRestResponse; - } - - @RequestMapping(value = { "/portalApi/role_list/removeRole" }, method = RequestMethod.POST) - public ModelAndView removeRole(HttpServletRequest request, HttpServletResponse response) throws Exception { - return getRoleListController().removeRole(request, response); - } - - @RequestMapping(value = { "/portalApi/role/saveRole" }, method = RequestMethod.POST) - public ModelAndView saveRole(HttpServletRequest request, HttpServletResponse response) throws Exception { - return getRoleController().saveRole(request, response); - } - - @RequestMapping(value = { "/portalApi/role/removeRoleFunction" }, method = RequestMethod.POST) - public ModelAndView removeRoleRoleFunction(HttpServletRequest request, HttpServletResponse response) - throws Exception { - return getRoleController().removeRoleFunction(request, response); - } - - @RequestMapping(value = { "/portalApi/role/addRoleFunction" }, method = RequestMethod.POST) - public ModelAndView addRoleRoRoleFunction(HttpServletRequest request, HttpServletResponse response) - throws Exception { - return getRoleController().addRoleFunction(request, response); - } - - @RequestMapping(value = { "/portalApi/role/removeChildRole" }, method = RequestMethod.POST) - public ModelAndView removeChildRole(HttpServletRequest request, HttpServletResponse response) throws Exception { - return getRoleController().removeChildRole(request, response); - } - - @RequestMapping(value = { "/portalApi/role/addChildRole" }, method = RequestMethod.POST) - public ModelAndView addChildRole(HttpServletRequest request, HttpServletResponse response) throws Exception { - return getRoleController().addChildRole(request, response); - } - - @RequestMapping(value = { "/portalApi/get_role" }, method = RequestMethod.GET) - public void getRole(HttpServletRequest request, HttpServletResponse response) throws Exception{ - getRoleController().getRole(request, response); - } - - @RequestMapping(value = { "/portalApi/get_role_functions" }, method = RequestMethod.GET) - public void getRoleFunctionList(HttpServletRequest request, HttpServletResponse response) { - getRoleFunctionListController().getRoleFunctionList(request, response); - } - - @RequestMapping(value = { "/portalApi/role_function_list/saveRoleFunction" }, method = RequestMethod.POST) - public void saveRoleFunction(HttpServletRequest request, HttpServletResponse response, @RequestBody String roleFunc) throws Exception { - getRoleFunctionListController().saveRoleFunction(request, response, roleFunc); - } - - @RequestMapping(value = { "/portalApi/role_function_list/removeRoleFunction" }, method = RequestMethod.POST) - public void removeRoleFunction(HttpServletRequest request, HttpServletResponse response, @RequestBody String roleFunc) throws Exception { - getRoleFunctionListController().removeRoleFunction(request, response, roleFunc); - } - - public RoleListController getRoleListController() { - return roleListController; - } - - public void setRoleListController(RoleListController roleListController) { - this.roleListController = roleListController; - } - - public RoleController getRoleController() { - return roleController; - } - - public void setRoleController(RoleController roleController) { - this.roleController = roleController; - } - - public RoleFunctionListController getRoleFunctionListController() { - return roleFunctionListController; - } - - public void setRoleFunctionListController(RoleFunctionListController roleFunctionListController) { - this.roleFunctionListController = roleFunctionListController; - } - - @RequestMapping(value = { "/portalApi/syncRoles" }, method = RequestMethod.GET) - public void syncRoles(EPApp app) - { - try { - externalAccessRolesService.syncApplicationRolesWithEcompDB(app); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.debugLogger, "failed syncRoles"); - } - } -} diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SchedulerController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SchedulerController.java deleted file mode 100644 index c2d54c6b..00000000 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SchedulerController.java +++ /dev/null @@ -1,266 +0,0 @@ -/*- - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ -package org.openecomp.portalapp.portal.controller; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.UUID; - -import javax.servlet.http.HttpServletRequest; - -import org.json.simple.JSONObject; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.scheduler.SchedulerProperties; -import org.openecomp.portalapp.portal.scheduler.SchedulerRestInterface; -import org.openecomp.portalapp.portal.scheduler.SchedulerUtil; -import org.openecomp.portalapp.portal.scheduler.restobjects.GetTimeSlotsRestObject; -import org.openecomp.portalapp.portal.scheduler.restobjects.PostCreateNewVnfRestObject; -import org.openecomp.portalapp.portal.scheduler.restobjects.PostSubmitVnfChangeRestObject; -import org.openecomp.portalapp.portal.scheduler.wrapper.GetTimeSlotsWrapper; -import org.openecomp.portalapp.portal.scheduler.wrapper.PostCreateNewVnfWrapper; -import org.openecomp.portalapp.portal.scheduler.wrapper.PostSubmitVnfChangeTimeSlotsWrapper; -import org.openecomp.portalapp.portal.utils.PortalConstants; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping(PortalConstants.REST_AUX_API) -@Configuration -@EnableAspectJAutoProxy -@EPAuditLog -public class SchedulerController implements BasicAuthenticationController { - - @Autowired - private SchedulerRestInterface schedulerRestController; - - private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SchedulerController.class); - - /** The request date format. */ - public DateFormat requestDateFormat = new SimpleDateFormat("EEE, dd MMM YYYY HH:mm:ss z"); - - @RequestMapping(value = "/get_time_slots/{scheduler_request}", method = RequestMethod.GET) - public ResponseEntity<String> getTimeSlots(HttpServletRequest request, - @PathVariable("scheduler_request") String scheduler_request) throws Exception { - - Date startingTime = new Date(); - String startTimeRequest = requestDateFormat.format(startingTime); - - System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); - System.out.println(startTimeRequest + " | Controller Scheduler GET : /get_time_slots/{scheduler_request} \n"); - System.out.println("Original Request : \n " + scheduler_request + '\n'); - - String path = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_GET_TIME_SLOTS) + scheduler_request; - - GetTimeSlotsWrapper schedulerResWrapper = getTimeSlots(scheduler_request, path, scheduler_request); - - Date endTime = new Date(); - String endTimeRequest = requestDateFormat.format(endTime); - System.out.println(endTimeRequest + " | Controller Scheduler - GET\n"); - - return (new ResponseEntity<String>(schedulerResWrapper.getResponse(), HttpStatus.OK)); - - } - - protected GetTimeSlotsWrapper getTimeSlots(String request, String path, String uuid) throws Exception { - - try { - // STARTING REST API CALL AS AN FACTORY INSTACE - System.out.println("<== Get Time Slots Request START \n"); - - GetTimeSlotsRestObject<String> restObjStr = new GetTimeSlotsRestObject<String>(); - String str = new String(); - - restObjStr.set(str); - - schedulerRestController.Get(str, uuid, path, restObjStr); - GetTimeSlotsWrapper schedulerRespWrapper = SchedulerUtil.getTimeSlotsWrapResponse(restObjStr); - - System.out.println( - "<== Get Time Slots Request END : Response = " + schedulerRespWrapper.getResponse() + '\n'); - - return schedulerRespWrapper; - - } catch (Exception e) { - System.out.println("<== Get Time Slots Request ERROR : " + e.toString() + '\n'); - logger.error(EELFLoggerDelegate.errorLogger, "Get Time Slots Request failed", e); - throw e; - } - } - - @SuppressWarnings("unchecked") - @RequestMapping(value = "/post_create_new_vnf_change", method = RequestMethod.POST) - public ResponseEntity<String> postCreateNewVNFChange(HttpServletRequest request, - @RequestBody JSONObject scheduler_request) throws Exception { - - Date startingTime = new Date(); - String startTimeRequest = requestDateFormat.format(startingTime); - - System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); - System.out.println(startTimeRequest + " | Controller Scheduler POST : post_create_new_vnf_change \n"); - - // Generating uuid - String uuid = UUID.randomUUID().toString(); - - scheduler_request.put("scheduleId", uuid); - System.out.println("<== UUID : " + uuid + '\n'); - - // adding uuid to the request payload - scheduler_request.put("scheduleId", uuid); - - System.out.println("<== UUID : " + uuid + '\n'); - System.out.println("Original Request : \n " + scheduler_request.toString() + '\n'); - - String path = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_CREATE_NEW_VNF_CHANGE_INSTANCE_VAL) - + uuid; - - PostCreateNewVnfWrapper responseWrapper = postSchedulingRequest(scheduler_request, path, uuid); - - Date endTime = new Date(); - String endTimeRequest = requestDateFormat.format(endTime); - System.out.println(endTimeRequest + " | Controller Scheduler - POST\n"); - - return (new ResponseEntity<String>(responseWrapper.getResponse(), HttpStatus.OK)); - } - - protected PostCreateNewVnfWrapper postSchedulingRequest(JSONObject request, String path, String uuid) - throws Exception { - - try { - // STARTING REST API CALL AS AN FACTORY INSTACE - System.out.println("<== Post Create New Vnf Scheduling Request START \n"); - - PostCreateNewVnfRestObject<String> restObjStr = new PostCreateNewVnfRestObject<String>(); - String str = new String(); - - restObjStr.set(str); - schedulerRestController.<String>Post(str, request, path, restObjStr); - - int status = restObjStr.getStatusCode(); - if (status >= 200 && status <= 299) { - restObjStr.setUUID(uuid); - } - - PostCreateNewVnfWrapper responseWrapper = SchedulerUtil.postCreateNewVnfWrapResponse(restObjStr); - - System.out.println("<== Post Create New Vnf Scheduling Request END : Response = " - + responseWrapper.getResponse() + '\n'); - - return responseWrapper; - - } catch (Exception e) { - System.out.println("<== Post Create New Vnf Scheduling Request ERROR : " + e.toString() + '\n'); - logger.error(EELFLoggerDelegate.errorLogger, "Post Create New Vnf Scheduling Request failed", e); - throw e; - } - } - - @RequestMapping(value = "/submit_vnf_change_timeslots", method = RequestMethod.POST) - public ResponseEntity<String> postSubmitVnfChangeTimeslots(HttpServletRequest request, - @RequestBody JSONObject scheduler_request) throws Exception { - - Date startingTime = new Date(); - String startTimeRequest = requestDateFormat.format(startingTime); - - System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); - System.out.println(startTimeRequest + " | Controller Scheduler POST : submit_vnf_change_timeslots \n"); - - // Generating uuid - String uuid = (String) scheduler_request.get("scheduleId"); - scheduler_request.remove("scheduleId"); - - System.out.println("<== UUID : " + uuid + '\n'); - System.out.println("Original Request : \n " + scheduler_request.toString() + '\n'); - - String path = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_SUBMIT_NEW_VNF_CHANGE) - .replace("{scheduleId}", uuid); - - PostSubmitVnfChangeTimeSlotsWrapper responseWrapper = postSubmitSchedulingRequest(scheduler_request, path, - uuid); - - Date endTime = new Date(); - String endTimeRequest = requestDateFormat.format(endTime); - System.out.println(endTimeRequest + " | Controller Scheduler - POST Submit\n"); - - return (new ResponseEntity<String>(responseWrapper.getResponse(), HttpStatus.OK)); - } - - protected PostSubmitVnfChangeTimeSlotsWrapper postSubmitSchedulingRequest(JSONObject request, String path, - String uuid) throws Exception { - - try { - // STARTING REST API CALL AS AN FACTORY INSTACE - System.out.println("<== Post Submit Scheduling Request START \n"); - - PostSubmitVnfChangeRestObject<String> restObjStr = new PostSubmitVnfChangeRestObject<String>(); - String str = new String(); - - restObjStr.set(str); - schedulerRestController.<String>Post(str, request, path, restObjStr); - - int status = restObjStr.getStatusCode(); - if (status >= 200 && status <= 299) { - restObjStr.setUUID(uuid); - } - - PostSubmitVnfChangeTimeSlotsWrapper responseWrapper = SchedulerUtil - .postSubmitNewVnfWrapResponse(restObjStr); - - System.out.println( - "<== Post Submit Scheduling Request END : Response = " + responseWrapper.getResponse() + '\n'); - - return responseWrapper; - - } catch (Exception e) { - System.out.println("<== Post Submit Scheduling Request ERROR : " + e.toString() + '\n'); - logger.error(EELFLoggerDelegate.errorLogger, "Post Submit Scheduling Request failed", e); - throw e; - } - } - -} diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerProperties.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerProperties.java deleted file mode 100644 index fe6a9aca..00000000 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerProperties.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ -package org.openecomp.portalapp.portal.scheduler; - -import org.openecomp.portalsdk.core.util.SystemProperties; - -public class SchedulerProperties extends SystemProperties { - - public static final String SCHEDULER_USER_NAME_VAL = "scheduler.user.name";; - - public static final String SCHEDULER_PASSWORD_VAL = "scheduler.password"; - - public static final String SCHEDULER_SERVER_URL_VAL = "scheduler.server.url"; - - public static final String SCHEDULER_CREATE_NEW_VNF_CHANGE_INSTANCE_VAL = "scheduler.create.new.vnf.change.instance"; - - public static final String SCHEDULER_GET_TIME_SLOTS = "scheduler.get.time.slots"; - - public static final String SCHEDULER_SUBMIT_NEW_VNF_CHANGE = "scheduler.submit.new.vnf.change"; - -} diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterface.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterface.java deleted file mode 100644 index 9acfd5a0..00000000 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterface.java +++ /dev/null @@ -1,237 +0,0 @@ -/*- - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ -package org.openecomp.portalapp.portal.scheduler; - -import java.util.Collections; - -import javax.ws.rs.client.Client; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedHashMap; -import javax.ws.rs.core.Response; - -import org.apache.commons.codec.binary.Base64; -import org.json.simple.JSONObject; -import org.openecomp.portalapp.portal.scheduler.client.HttpBasicClient; -import org.openecomp.portalapp.portal.scheduler.client.HttpsBasicClient; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.springframework.stereotype.Service; -import org.openecomp.portalapp.portal.scheduler.restobjects.RestObject; - - -@Service -public class SchedulerRestInterface implements SchedulerRestInterfaceIfc { - - private static Client client = null; - - private MultivaluedHashMap<String, Object> commonHeaders; - - public SchedulerRestInterface() { - super(); - } - - public void initRestClient() - { - final String methodname = "initRestClient()"; - - final String username = "";//SystemProperties.getProperty(SchedulerProperties.SCHEDULER_USER_NAME_VAL); - //final String password = "";//SystemProperties.getProperty(SchedulerProperties.SCHEDULER_PASSWORD_VAL); - final String scheduler_url = "";//SystemProperties.getProperty(SchedulerProperties.SCHEDULER_SERVER_URL_VAL); - final String decrypted_password = "";//Password.deobfuscate(password); - - String authString = username + ":" + decrypted_password; - - byte[] authEncBytes = Base64.encodeBase64(authString.getBytes()); - String authStringEnc = new String(authEncBytes); - - commonHeaders = new MultivaluedHashMap<String, Object> (); - commonHeaders.put("Authorization", Collections.singletonList((Object) ("Basic " + authStringEnc))); - - boolean use_ssl = true; - if ( (scheduler_url != null) && ( !(scheduler_url.isEmpty()) ) ) { - if ( scheduler_url.startsWith("https")) { - use_ssl = true; - } - else { - use_ssl = false; - } - } - if (client == null) { - - try { - if ( use_ssl ) { - - client = HttpsBasicClient.getClient(); - } - else { - - client = HttpBasicClient.getClient(); - } - } catch (Exception e) { - System.out.println( methodname + " Unable to get the SSL client"); - } - } - } - - @SuppressWarnings("unchecked") - public <T> void Get (T t, String sourceId, String path, org.openecomp.portalapp.portal.scheduler.restobjects.RestObject<T> restObject ) throws Exception { - - String methodName = "Get"; - String url = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_SERVER_URL_VAL) + path; - - - System.out.println( "<== URL FOR GET : " + url + "\n"); - - initRestClient(); - - final Response cres = client.target(url) - .request() - .accept("application/json") - .headers(commonHeaders) - .get(); - - int status = cres.getStatus(); - restObject.setStatusCode (status); - - if (status == 200) { - t = (T) cres.readEntity(t.getClass()); - restObject.set(t); - - } else { - throw new Exception(methodName + " with status="+ status + ", url= " + url ); - } - - return; - } - - @SuppressWarnings("unchecked") - public <T> void Post(T t, JSONObject requestDetails, String path, RestObject<T> restObject) throws Exception { - - String methodName = "Post"; - String url = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_SERVER_URL_VAL) + path; - - System.out.println( "<== URL FOR POST : " + url + "\n"); - - try { - - initRestClient(); - - // Change the content length - final Response cres = client.target(url) - .request() - .accept("application/json") - .headers(commonHeaders) - //.header("content-length", 201) - //.header("X-FromAppId", sourceID) - .post(Entity.entity(requestDetails, MediaType.APPLICATION_JSON)); - - try { - t = (T) cres.readEntity(t.getClass()); - restObject.set(t); - } - catch ( Exception e ) { - - System.out.println("<== " + methodName + " : No response entity, this is probably ok, e=" + e.getMessage()); - } - - int status = cres.getStatus(); - restObject.setStatusCode (status); - - if ( status >= 200 && status <= 299 ) { - - System.out.println( "<== " + methodName + " : REST api POST was successful!" + "\n"); - - } else { - System.out.println( "<== " + methodName + " : FAILED with http status : "+status+", url = " + url + "\n"); - } - - } catch (Exception e) - { - System.out.println( "<== " + methodName + " : with url="+url+ ", Exception: " + e.toString() + "\n"); - throw e; - } - } - - @SuppressWarnings("unchecked") - public <T> void Delete(T t, JSONObject requestDetails, String sourceID, String path, RestObject<T> restObject) { - - String url=""; - Response cres = null; - - try { - initRestClient(); - - url = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_SERVER_URL_VAL) + path; - - cres = client.target(url) - .request() - .accept("application/json") - .headers(commonHeaders) - //.entity(r) - .build("DELETE", Entity.entity(requestDetails, MediaType.APPLICATION_JSON)).invoke(); - // .method("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON)); - //.delete(Entity.entity(r, MediaType.APPLICATION_JSON)); - - int status = cres.getStatus(); - restObject.setStatusCode (status); - - try { - t = (T) cres.readEntity(t.getClass()); - restObject.set(t); - } - catch ( Exception e ) { - } - - } - catch (Exception e) - { - throw e; - } - } - - public <T> T getInstance(Class<T> clazz) throws IllegalAccessException, InstantiationException - { - return clazz.newInstance(); - } - - @Override - public void logRequest(JSONObject requestDetails) { - // TODO Auto-generated method stub - - } -} diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyProperties.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyProperties.java deleted file mode 100644 index a89b5d61..00000000 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyProperties.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ -package org.openecomp.portalapp.portal.scheduler.policy; - -import org.openecomp.portalsdk.core.util.SystemProperties; - - -public class PolicyProperties extends SystemProperties { - - public static final String POLICY_CLIENTAUTH_VAL = "policy.ClientAuth"; - - public static final String POLICY_CLIENT_MECHID_VAL = "policy.client.mechId"; - - public static final String POLICY_CLIENT_PASSWORD_VAL = "policy.client.password"; - - public static final String POLICY_USERNAME_VAL = "policy.username"; - - public static final String POLICY_PASSWORD_VAL = "policy.password"; - - public static final String POLICY_AUTHORIZATION_VAL = "policy.Authorization"; - - public static final String POLICY_SERVER_URL_VAL = "policy.server.url"; - - public static final String POLICY_ENVIRONMENT_VAL = "policy.environment"; - - public static final String POLICY_GET_CONFIG_VAL = "policy.get.config"; - -} diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterface.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterface.java deleted file mode 100644 index e14dd107..00000000 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterface.java +++ /dev/null @@ -1,272 +0,0 @@ -/*- - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ -package org.openecomp.portalapp.portal.scheduler.policy; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Collections; -import java.util.Date; - -import javax.ws.rs.client.Client; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedHashMap; -import javax.ws.rs.core.Response; - -import org.apache.commons.codec.binary.Base64; -import org.eclipse.jetty.util.security.Password; -import org.json.simple.JSONObject; -import org.openecomp.portalapp.portal.scheduler.client.HttpBasicClient; -import org.openecomp.portalapp.portal.scheduler.policy.rest.RequestDetails; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.util.SystemProperties; - - -public class PolicyRestInterface extends PolicyRestInt implements PolicyRestInterfaceIfc { - - /** The logger. */ - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PolicyRestInterface.class); - - /** The Constant dateFormat. */ - final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS"); - - /** The client. */ - private static Client client = null; - - /** The common headers. */ - private MultivaluedHashMap<String, Object> commonHeaders; - - public PolicyRestInterface() { - super(); - } - - public void initRestClient() - { - final String methodname = "initRestClient()"; - - //final String clientAuth = SystemProperties.getProperty(PolicyProperties.POLICY_CLIENTAUTH_VAL); - //final String authorization = SystemProperties.getProperty(PolicyProperties.POLICY_AUTHORIZATION_VAL); - final String mechId = SystemProperties.getProperty(PolicyProperties.POLICY_CLIENT_MECHID_VAL); - final String clientPassword = SystemProperties.getProperty(PolicyProperties.POLICY_CLIENT_PASSWORD_VAL); - final String username = SystemProperties.getProperty(PolicyProperties.POLICY_USERNAME_VAL); - final String password = SystemProperties.getProperty(PolicyProperties.POLICY_PASSWORD_VAL); - final String environment = SystemProperties.getProperty(PolicyProperties.POLICY_ENVIRONMENT_VAL); - - final String decrypted_client_password = Password.deobfuscate(clientPassword); - String mechAuthString = mechId + ":" + decrypted_client_password; - byte[] mechAuthEncBytes = Base64.encodeBase64(mechAuthString.getBytes()); - String clientAuth = new String(mechAuthEncBytes); - - final String decrypted_password = Password.deobfuscate(password); - String authString = username + ":" + decrypted_password; - byte[] authEncBytes = Base64.encodeBase64(authString.getBytes()); - String authorization = new String(authEncBytes); - - commonHeaders = new MultivaluedHashMap<String, Object> (); - commonHeaders.put("ClientAuth", Collections.singletonList((Object) ("Basic " + clientAuth))); - commonHeaders.put("Authorization", Collections.singletonList((Object) ("Basic " + authorization))); - commonHeaders.put("Environment", Collections.singletonList((Object) (environment))); - - if (client == null) { - - try { - client = HttpBasicClient.getClient(); - } catch (Exception e) { - System.out.println( methodname + " Unable to get the SSL client"); - } - } - } - - @SuppressWarnings("unchecked") - public <T> void Get (T t, String sourceId, String path, RestObject<T> restObject ) throws Exception { - String methodName = "Get"; - - logger.debug(EELFLoggerDelegate.debugLogger, methodName + " start"); - - String url=""; - restObject.set(t); - - url = SystemProperties.getProperty(PolicyProperties.POLICY_SERVER_URL_VAL) + path; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " sending request to url= " + url); - - initRestClient(); - - final Response cres = client.target(url) - .request() - .accept("application/json") - .headers(commonHeaders) - .get(); - - int status = cres.getStatus(); - restObject.setStatusCode (status); - - if (status == 200) { - t = (T) cres.readEntity(t.getClass()); - restObject.set(t); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " REST api was successfull!"); - - } else { - throw new Exception(methodName + " with status="+ status + ", url= " + url ); - } - - logger.debug(EELFLoggerDelegate.debugLogger,methodName + " received status=" + status ); - - return; - } - - @SuppressWarnings("unchecked") - public <T> void Delete(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) { - - String methodName = "Delete"; - String url=""; - Response cres = null; - - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " start"); - logRequest (r); - - try { - initRestClient(); - - url = SystemProperties.getProperty(PolicyProperties.POLICY_SERVER_URL_VAL) + path; - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + " methodName sending request to: " + url); - - cres = client.target(url) - .request() - .accept("application/json") - .headers(commonHeaders) - //.entity(r) - .build("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON)).invoke(); - // .method("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON)); - //.delete(Entity.entity(r, MediaType.APPLICATION_JSON)); - - int status = cres.getStatus(); - restObject.setStatusCode (status); - - if (status == 404) { // resource not found - String msg = "Resource does not exist...: " + cres.getStatus(); - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg); - } else if (status == 200 || status == 204){ - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + "Resource " + url + " deleted"); - } else if (status == 202) { - String msg = "Delete in progress: " + status; - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg); - } - else { - String msg = "Deleting Resource failed: " + status; - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg); - } - - try { - t = (T) cres.readEntity(t.getClass()); - restObject.set(t); - } - catch ( Exception e ) { - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " No response entity, this is probably ok, e=" - + e.getMessage()); - } - - } - catch (Exception e) - { - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " with url="+url+ ", Exception: " + e.toString()); - throw e; - - } - } - - @SuppressWarnings("unchecked") - public <T> void Post(T t, JSONObject requestDetails, String uuid, String path, RestObject<T> restObject) throws Exception { - - String methodName = "Post"; - String url=""; - - System.out.println( "POST policy rest interface"); - - // logRequest (requestDetails); - try { - - initRestClient(); - - url = SystemProperties.getProperty(PolicyProperties.POLICY_SERVER_URL_VAL) + path; - System.out.println( "<== " + methodName + " sending request to url= " + url); - // Change the content length - final Response cres = client.target(url) - .request() - .accept("application/json") - .headers(commonHeaders) - //.header("content-length", 201) - //.header("X-FromAppId", sourceID) - .post(Entity.entity(requestDetails, MediaType.APPLICATION_JSON)); - - try { - t = (T) cres.readEntity(t.getClass()); - restObject.set(t); - } - catch ( Exception e ) { - - System.out.println("<== " + methodName + " No response entity, this is probably ok, e=" + e.getMessage()); - } - - int status = cres.getStatus(); - restObject.setStatusCode (status); - - if ( status >= 200 && status <= 299 ) { - System.out.println( "<== " + methodName + " REST api POST was successful!"); - - } else { - System.out.println( "<== " + methodName + " with status="+status+", url="+url); - } - - } catch (Exception e) - { - System.out.println( "<== " + methodName + " with url="+url+ ", Exception: " + e.toString()); - throw e; - - } - } - - public <T> T getInstance(Class<T> clazz) throws IllegalAccessException, InstantiationException - { - return clazz.newInstance(); - } - - @Override - public void logRequest(RequestDetails r) { - // TODO Auto-generated method stub - } -}
\ No newline at end of file diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImpl.java deleted file mode 100644 index 341a62cb..00000000 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImpl.java +++ /dev/null @@ -1,2338 +0,0 @@ -/*- - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ -package org.openecomp.portalapp.portal.service; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.SortedSet; -import java.util.TreeSet; -import java.util.stream.Collectors; - -import org.apache.commons.lang.StringUtils; -import org.hibernate.Query; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.Transaction; -import org.json.JSONArray; -import org.json.JSONObject; -import org.openecomp.portalapp.portal.domain.CentralRoleFunction; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPAppRoleFunction; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EPUserApp; -import org.openecomp.portalapp.portal.domain.ExternalRoleDetails; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; -import org.openecomp.portalapp.portal.transport.BulkUploadRoleFunction; -import org.openecomp.portalapp.portal.transport.BulkUploadUserRoles; -import org.openecomp.portalapp.portal.transport.CentralApp; -import org.openecomp.portalapp.portal.transport.CentralRole; -import org.openecomp.portalapp.portal.transport.CentralUser; -import org.openecomp.portalapp.portal.transport.CentralUserApp; -import org.openecomp.portalapp.portal.transport.EcompUserRoles; -import org.openecomp.portalapp.portal.transport.ExternalAccessPerms; -import org.openecomp.portalapp.portal.transport.ExternalAccessPermsDetail; -import org.openecomp.portalapp.portal.transport.ExternalAccessRole; -import org.openecomp.portalapp.portal.transport.ExternalAccessRolePerms; -import org.openecomp.portalapp.portal.transport.ExternalAccessUser; -import org.openecomp.portalapp.portal.transport.ExternalRoleDescription; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.portal.utils.PortalConstants; -import org.openecomp.portalsdk.core.domain.Role; -import org.openecomp.portalsdk.core.domain.RoleFunction; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.restful.domain.EcompRole; -import org.openecomp.portalsdk.core.restful.domain.EcompUser; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.type.TypeFactory; - -@Service("externalAccessRolesService") -@EnableAspectJAutoProxy -@EPMetricsLog -@EPAuditLog -public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesService { - - private static final String AND_FUNCTION_CD_EQUALS = " and function_cd = '"; - - private static final String OWNER = ".owner"; - - private static final String ADMIN = ".admin"; - - private static final String ACCOUNT_ADMINISTRATOR = ".Account_Administrator"; - - private static final String FUNCTION_CD_LIKE_CLAUSE = " and function_cd like '%"; - - private static final String FUNCTION_PIPE = "|"; - - private static final String IS_NULL_STRING = "null"; - - private static final String EXTERNAL_AUTH_PERMS = "perms"; - - private static final String EXTERNAL_AUTH_ROLE_DESCRIPTION = "description"; - - private static final String WHERE_APP_ID_EQUALS = " where app_id = "; - - private static final String IS_EMPTY_JSON_STRING = "{}"; - - private static final String CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE = "Connecting to External Auth system"; - - private static final String WHERE_ROLE_ID_EQUALS = " where role_id = "; - - private static final String APP_ROLE_ID = "appRoleId"; - - private static final String APP_ID = "appId"; - - private static final String PRIORITY = "priority"; - - private static final String ACTIVE = "active"; - - private static final String ROLE_NAME = "name"; - - private static final String ID = "id"; - - private static final String WHERE_ROLE_NAME_EQUALS = " where role_name = '"; - - private static final String APP_ID_EQUALS = " app_id = "; - - private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ExternalAccessRolesServiceImpl.class); - - @Autowired - private DataAccessService dataAccessService; - - @Autowired - private SessionFactory sessionFactory; - - RestTemplate template = new RestTemplate(); - - @SuppressWarnings("unchecked") - public List<EPRole> getAppRoles(Long appId) throws Exception { - List<EPRole> applicationRoles = null; - String filter = null; - try { - if (appId == 1) { - filter = " where app_id is null"; - } else { - filter = WHERE_APP_ID_EQUALS + appId; - } - applicationRoles = dataAccessService.getList(EPRole.class, filter, null, null); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "getAppRoles: failed", e); - throw new Exception(e.getMessage()); - } - return applicationRoles; - } - - @SuppressWarnings("unchecked") - @Override - public List<EPApp> getApp(String uebkey) throws Exception { - List<EPApp> app = null; - try { - app = (List<EPApp>) dataAccessService.getList(EPApp.class, " where ueb_key = '" + uebkey + "'", null, null); - if(!app.get(0).getEnabled() && !app.get(0).getId().equals(PortalConstants.PORTAL_APP_ID)){ - throw new Exception("Application:"+app.get(0).getName()+" is Unavailable"); - } - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "getApp: failed", e); - throw new Exception(e.getMessage()); - } - return app; - } - - /** - * It returns single application role from external auth system - * @param addRole - * @param app - * @return JSON string which contains application role details - * @throws Exception - */ - private String getSingleAppRole(String addRole, EPApp app) throws Exception { - HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); - HttpEntity<String> entity = new HttpEntity<>(headers); - logger.debug(EELFLoggerDelegate.debugLogger, "getSingleAppRole: Connecting to External Auth system"); - ResponseEntity<String> response = template - .exchange( - SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "roles/" - + app.getNameSpace() + "." + addRole.replaceAll(" ", "_"), - HttpMethod.GET, entity, String.class); - logger.debug(EELFLoggerDelegate.debugLogger, - "getSingleAppRole: Finished GET app role from External Auth system and status code: {} ", response.getStatusCode().value()); - return response.getBody(); - } - - @Override - public boolean addRole(Role addRole, String uebkey) throws Exception { - boolean response = false; - ResponseEntity<String> addResponse = null; - HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); - EPApp app = getApp(uebkey).get(0); - String newRole = updateExistingRoleInExternalSystem(addRole, app); - HttpEntity<String> entity = new HttpEntity<>(newRole, headers); - logger.debug(EELFLoggerDelegate.debugLogger, "addRole: Connecting to External Auth system"); - addResponse = template.exchange( - SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role", - HttpMethod.POST, entity, String.class); - if (addResponse.getStatusCode().value() == 201) { - response = true; - logger.debug(EELFLoggerDelegate.debugLogger, "addRole: Finished adding role in the External Auth system and response code: {} ", addResponse.getStatusCode().value()); - } - if (addResponse.getStatusCode().value() == 406) { - logger.error(EELFLoggerDelegate.errorLogger, - "addRole: Failed to add in the External Auth system due to {} and status code: {}", addResponse.getBody(), addResponse.getStatusCode().value()); - } - return response; - } - - /** - * - * It deletes record in external auth system - * - * @param delRole - * @return JSON String which has status code and response body - * @throws Exception - */ - private ResponseEntity<String> deleteRoleInExternalSystem(String delRole) throws Exception { - ResponseEntity<String> delResponse = null; - HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); - HttpEntity<String> entity = new HttpEntity<>(delRole, headers); - logger.debug(EELFLoggerDelegate.debugLogger, "deleteRoleInExternalSystem: {} " , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); - delResponse = template.exchange( - SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role?force=true", - HttpMethod.DELETE, entity, String.class); - logger.debug(EELFLoggerDelegate.debugLogger, "deleteRoleInExternalSystem: Finished DELETE operation in the External Auth system and status code: {} ", delResponse.getStatusCode().value()); - return delResponse; - } - - /** - * It updates role in external auth system - * - * @param updateExtRole - * @param app - * @return true if success else false - * @throws Exception - * If updateRoleInExternalSystem fails we catch it in logger for detail message - */ - @SuppressWarnings("unchecked") - private boolean updateRoleInExternalSystem(Role updateExtRole, EPApp app) throws Exception { - boolean response = false; - ObjectMapper mapper = new ObjectMapper(); - ResponseEntity<String> deleteResponse = null; - HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); - ExternalAccessRolePerms extRolePerms = null; - ExternalAccessPerms extPerms = null; - List<EPRole> epRoleList = null; - if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) { - epRoleList = dataAccessService.getList(EPRole.class, - WHERE_ROLE_ID_EQUALS + updateExtRole.getId() + " and app_id is null", null, null); - } else { - epRoleList = dataAccessService.getList(EPRole.class, - " where app_role_id = " + updateExtRole.getId() + " and app_id = " + app.getId(), null, null); - } - String appRole = getSingleAppRole(epRoleList.get(0).getName(), app); - if (!appRole.equals(IS_EMPTY_JSON_STRING)) { - JSONObject jsonObj = new JSONObject(appRole); - JSONArray extRole = jsonObj.getJSONArray("role"); - if (!extRole.getJSONObject(0).has(EXTERNAL_AUTH_ROLE_DESCRIPTION)) { - String roleName = extRole.getJSONObject(0).getString(ROLE_NAME); - Map<String, String> delRoleKeyMapper = new HashMap<>(); - delRoleKeyMapper.put(ROLE_NAME, roleName); - String delRoleKeyValue = mapper.writeValueAsString(delRoleKeyMapper); - deleteResponse = deleteRoleInExternalSystem(delRoleKeyValue); - if (deleteResponse.getStatusCode().value() != 200) { - throw new Exception(deleteResponse.getBody()); - } - addRole(updateExtRole, app.getUebKey()); - } else { - String desc = extRole.getJSONObject(0).getString(EXTERNAL_AUTH_ROLE_DESCRIPTION); - String name = extRole.getJSONObject(0).getString(ROLE_NAME); - List<ExternalAccessPerms> list = null; - if (extRole.getJSONObject(0).has(EXTERNAL_AUTH_PERMS)) { - JSONArray perms = extRole.getJSONObject(0).getJSONArray(EXTERNAL_AUTH_PERMS); - list = mapper.readValue(perms.toString(), TypeFactory.defaultInstance() - .constructCollectionType(List.class, ExternalAccessPerms.class)); - } - ExternalRoleDescription sysRoleList = mapper.readValue(desc, ExternalRoleDescription.class); - // If role name or role functions are updated then delete record in External System and add new record to avoid conflicts - Boolean existingRoleActive; - boolean isActiveValueChanged; - // check role active status - existingRoleActive = new Boolean(sysRoleList.getActive()); - isActiveValueChanged = existingRoleActive.equals(updateExtRole.getActive()); - if (!sysRoleList.getName().equals(updateExtRole.getName())) { - Map<String, String> delRoleKeyMapper = new HashMap<>(); - delRoleKeyMapper.put(ROLE_NAME, name); - String delRoleKeyValue = mapper.writeValueAsString(delRoleKeyMapper); - deleteResponse = deleteRoleInExternalSystem(delRoleKeyValue); - if (deleteResponse.getStatusCode().value() != 200) { - logger.error(EELFLoggerDelegate.errorLogger, "updateRoleInExternalSystem: Failed to delete role in external system due to {} ", deleteResponse.getBody()); - throw new Exception(deleteResponse.getBody()); - } - addRole(updateExtRole, app.getUebKey()); - addRoleFunctionsInExternalSystem(updateExtRole, mapper, app); - } - boolean checkPriorityStatus = StringUtils.equals(String.valueOf(sysRoleList.getPriority()),String.valueOf(updateExtRole.getPriority())); - ExternalAccessRole updateRole = new ExternalAccessRole(); - if (!isActiveValueChanged - || !checkPriorityStatus - || sysRoleList.getId().equals(IS_NULL_STRING) - || !sysRoleList.getId().equals(String.valueOf(epRoleList.get(0).getId()))) { - String updateDesc = ""; - String appId = (app.getId().equals(PortalConstants.PORTAL_APP_ID)) ? " app_id is null" - : APP_ID_EQUALS + app.getId(); - List<EPRole> getRole = dataAccessService.getList(EPRole.class, - WHERE_ROLE_NAME_EQUALS + updateExtRole.getName() + "' and " + appId, null, null); - Map<String, String> extSystemUpdateRoleJsonMapper = new LinkedHashMap<>(); - extSystemUpdateRoleJsonMapper.put(ID, String.valueOf(getRole.get(0).getId())); - extSystemUpdateRoleJsonMapper.put(ROLE_NAME, String.valueOf(updateExtRole.getName())); - extSystemUpdateRoleJsonMapper.put(ACTIVE, String.valueOf(updateExtRole.getActive())); - extSystemUpdateRoleJsonMapper.put(PRIORITY, String.valueOf(updateExtRole.getPriority())); - if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) { - extSystemUpdateRoleJsonMapper.put(APP_ID, "null"); - extSystemUpdateRoleJsonMapper.put(APP_ROLE_ID, "null"); - } else { - extSystemUpdateRoleJsonMapper.put(APP_ID, String.valueOf(app.getId())); - extSystemUpdateRoleJsonMapper.put(APP_ROLE_ID, String.valueOf(getRole.get(0).getAppRoleId())); - - } - updateDesc = mapper.writeValueAsString(extSystemUpdateRoleJsonMapper); - updateRole.setName(app.getNameSpace() + "." + updateExtRole.getName().replaceAll(" ", "_")); - updateRole.setDescription(updateDesc); - String updateRoleDesc = mapper.writeValueAsString(updateRole); - HttpEntity<String> entity = new HttpEntity<>(updateRoleDesc, headers); - logger.debug(EELFLoggerDelegate.debugLogger, - "updateRoleInExternalSystem: {} " , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); - ResponseEntity<String> updatePermsResponse = template.exchange( - SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role", - HttpMethod.PUT, entity, String.class); - logger.debug(EELFLoggerDelegate.debugLogger, - "updateRoleInExternalSystem: Finished updating in External Auth system and status code: {} ", - updatePermsResponse.getStatusCode().value()); - } - List<RoleFunction> roleFunctionListNew = convertSetToListOfRoleFunctions(updateExtRole); - Map<String, RoleFunction> updateRoleFunc = new HashMap<>(); - for (RoleFunction addPerm : roleFunctionListNew) { - updateRoleFunc.put(addPerm.getCode(), addPerm); - } - final Map<String, ExternalAccessPerms> extRolePermMap = new HashMap<>(); - // Update permissions in the ExternalAccess System - if (list != null) { - for (ExternalAccessPerms perm : list) { - if (!updateRoleFunc.containsKey(perm.getInstance())) { - removePermForRole(perm, mapper, name, headers); - } - extRolePermMap.put(perm.getInstance(), perm); - } - } - response = true; - if (!roleFunctionListNew.isEmpty()) { - for (RoleFunction roleFunc : roleFunctionListNew) { - if (!extRolePermMap.containsKey(roleFunc.getCode())) { - String checkType = roleFunc.getCode().contains("menu") ? "menu" : "url"; - extPerms = new ExternalAccessPerms(app.getNameSpace() + "." + checkType, roleFunc.getCode(), - "*"); - extRolePerms = new ExternalAccessRolePerms(extPerms, - app.getNameSpace() + "." + updateExtRole.getName().replaceAll(" ", "_")); - String updateRolePerms = mapper.writeValueAsString(extRolePerms); - HttpEntity<String> entity = new HttpEntity<>(updateRolePerms, headers); - logger.debug(EELFLoggerDelegate.debugLogger, "updateRoleInExternalSystem: {} " , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); - ResponseEntity<String> addResponse = template.exchange( - SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) - + "role/perm", - HttpMethod.POST, entity, String.class); - if (addResponse.getStatusCode().value() != 201) { - response = false; - logger.debug(EELFLoggerDelegate.debugLogger, - "updateRoleInExternalSystem: Connected to External Auth system but something went wrong! due to {} and statuscode: {}", - addResponse.getStatusCode().getReasonPhrase(), - addResponse.getStatusCode().value()); - } else { - response = true; - logger.debug(EELFLoggerDelegate.debugLogger, "updateRoleInExternalSystem: Finished adding permissions to roles in External Auth system and status code: {} ", addResponse.getStatusCode().value()); - } - } - } - } - } - } else { - // It seems like role exists in local DB but not in External Access system - addRole(updateExtRole, app.getUebKey()); - List<RoleFunction> roleFunctionListUpdate = convertSetToListOfRoleFunctions(updateExtRole); - response = true; - if (!roleFunctionListUpdate.isEmpty()) { - addRoleFunctionsInExternalSystem(updateExtRole, mapper, app); - } - } - return response; - } - - /** - * - * It adds functions to the role in external auth system - * - * @param updateExtRole - * @param addPermsMapper - * @param app - * @return true if success else false - * @throws Exception - */ - private boolean addRoleFunctionsInExternalSystem(Role updateExtRole, ObjectMapper addPermsMapper, EPApp app) - throws Exception { - boolean response = false; - ExternalAccessRolePerms extAddRolePerms = null; - ExternalAccessPerms extAddPerms = null; - List<RoleFunction> roleFunctionListAdd = convertSetToListOfRoleFunctions(updateExtRole); - HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); - for (RoleFunction roleFunc : roleFunctionListAdd) { - String checkType = roleFunc.getCode().contains("menu") ? "menu" : "url"; - extAddPerms = new ExternalAccessPerms(app.getNameSpace() + "." + checkType, roleFunc.getCode(), "*"); - extAddRolePerms = new ExternalAccessRolePerms(extAddPerms, - app.getNameSpace() + "." + updateExtRole.getName().replaceAll(" ", "_")); - String updateRolePerms = addPermsMapper.writeValueAsString(extAddRolePerms); - HttpEntity<String> entity = new HttpEntity<>(updateRolePerms, headers); - logger.debug(EELFLoggerDelegate.debugLogger, "addRoleFunctionsInExternalSystem: {} " , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); - ResponseEntity<String> addResponse = template.exchange( - SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role/perm", - HttpMethod.POST, entity, String.class); - if (addResponse.getStatusCode().value() != 201) { - response = false; - logger.debug(EELFLoggerDelegate.debugLogger, - "addRoleFunctionsInExternalSystem: While adding permission to the role in External Auth system something went wrong! due to {} and statuscode: {}", - addResponse.getStatusCode().getReasonPhrase(), addResponse.getStatusCode().value()); - } else { - response = true; - logger.debug(EELFLoggerDelegate.debugLogger, "addRoleFunctionsInExternalSystem: Finished adding permissions to roles in External Auth system and status code: {} ", addResponse.getStatusCode().value()); - } - } - return response; - } - - /** - * - * It converts list of functions in updateExtRole parameter to the RoleFunction object - * - * @param updateExtRole - * @return list of functions - */ - @SuppressWarnings("unchecked") - private List<RoleFunction> convertSetToListOfRoleFunctions(Role updateExtRole) { - Set<RoleFunction> roleFunctionSetList = updateExtRole.getRoleFunctions(); - List<RoleFunction> roleFunctionList = new ArrayList<>(); - ObjectMapper roleFuncMapper = new ObjectMapper(); - Iterator<RoleFunction> itetaror = roleFunctionSetList.iterator(); - while (itetaror.hasNext()) { - Object nextValue = itetaror.next(); - RoleFunction roleFunction = roleFuncMapper.convertValue(nextValue, RoleFunction.class); - roleFunctionList.add(roleFunction); - } - return roleFunctionList.stream().distinct().collect(Collectors.toList()); - } - - /** - * It delete permissions/functions in the external auth system - * - * @param perm - * @param permMapper - * @param name - * @param headers - * @throws Exception - */ - private void removePermForRole(ExternalAccessPerms perm, ObjectMapper permMapper, String name, HttpHeaders headers) - throws Exception { - ExternalAccessRolePerms extAccessRolePerms = new ExternalAccessRolePerms(perm, name); - String permDetails = permMapper.writeValueAsString(extAccessRolePerms); - HttpEntity<String> deleteEntity = new HttpEntity<>(permDetails, headers); - logger.debug(EELFLoggerDelegate.debugLogger, "removePermForRole: {} " , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); - ResponseEntity<String> deletePermResponse = template - .exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role/" - + name + "/perm", HttpMethod.DELETE, deleteEntity, String.class); - if (deletePermResponse.getStatusCode().value() != 200) { - throw new Exception(deletePermResponse.getBody()); - } - logger.debug(EELFLoggerDelegate.debugLogger, "removePermForRole: Finished deleting permission to role in External Auth system and status code: {}", - deletePermResponse.getStatusCode().value()); - } - - /** - * It will create new role in the External Auth System - * - * @param newRole - * @param app - * @return true if successfully added in the system else false - * @throws Exception - * If fails to add role in the system - */ - private boolean addNewRoleInExternalSystem(List<EPRole> newRole, EPApp app) throws Exception { - boolean response = false; - HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); - ObjectMapper mapper = new ObjectMapper(); - String addNewRole = ""; - ExternalAccessRole extRole = new ExternalAccessRole(); - String addDesc = null; - Map<String, String> extSystemJsonMapper = new LinkedHashMap<>(); - extSystemJsonMapper.put(ID, String.valueOf(newRole.get(0).getId())); - extSystemJsonMapper.put(ROLE_NAME, String.valueOf(newRole.get(0).getName())); - extSystemJsonMapper.put(ACTIVE, String.valueOf(newRole.get(0).getActive())); - extSystemJsonMapper.put(PRIORITY, String.valueOf(newRole.get(0).getPriority())); - extSystemJsonMapper.put(APP_ID, String.valueOf(newRole.get(0).getAppId())); - extSystemJsonMapper.put(APP_ROLE_ID, String.valueOf(newRole.get(0).getAppRoleId())); - addDesc = mapper.writeValueAsString(extSystemJsonMapper); - extRole.setName(app.getNameSpace() + "." + newRole.get(0).getName().replaceAll(" ", "_")); - extRole.setDescription(addDesc); - addNewRole = mapper.writeValueAsString(extRole); - HttpEntity<String> deleteEntity = new HttpEntity<>(addNewRole, headers); - logger.debug(EELFLoggerDelegate.debugLogger, "addNewRoleInExternalSystem: {} " , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); - ResponseEntity<String> addNewRoleInExternalSystem = template.exchange( - SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role", - HttpMethod.POST, deleteEntity, String.class); - if (addNewRoleInExternalSystem.getStatusCode().value() != 201) { - throw new Exception(addNewRoleInExternalSystem.getBody()); - } else { - logger.debug(EELFLoggerDelegate.debugLogger, "addNewRoleInExternalSystem: Finished adding into External Auth system and status code: {}", - addNewRoleInExternalSystem.getStatusCode().value()); - response = true; - } - return response; - } - - /** - * - * It updates existing role in the External Auth System - * - * @param addRole - * It Contains role information - * @param app - * @return string which is formatted to match with the external auth system - * @throws JsonProcessingException - */ - @SuppressWarnings("unchecked") - private String updateExistingRoleInExternalSystem(Role addRole, EPApp app) throws JsonProcessingException { - ObjectMapper mapper = new ObjectMapper(); - String addNewRole = ""; - ExternalAccessRole extRole = new ExternalAccessRole(); - List<EPRole> role = null; - String addDesc = null; - Map<String, String> extSystemUpdateRole = new LinkedHashMap<>(); - if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) { - role = dataAccessService.getList(EPRole.class, WHERE_ROLE_ID_EQUALS + addRole.getId() + " and app_id is null", null, null); - } else { - role = dataAccessService.getList(EPRole.class, " where app_role_id = " + addRole.getId() + " and app_id ="+app.getId(), null, null); - } - extSystemUpdateRole.put(ID, String.valueOf(role.get(0).getId())); - extSystemUpdateRole.put(ROLE_NAME, String.valueOf(addRole.getName())); - extSystemUpdateRole.put(ACTIVE, String.valueOf(role.get(0).getActive())); - extSystemUpdateRole.put(PRIORITY, String.valueOf(role.get(0).getPriority())); - extSystemUpdateRole.put(APP_ID, String.valueOf(role.get(0).getAppId())); - extSystemUpdateRole.put(APP_ROLE_ID, String.valueOf(role.get(0).getAppRoleId())); - addDesc = mapper.writeValueAsString(extSystemUpdateRole); - extRole.setName(app.getNameSpace() + "." + addRole.getName().replaceAll(" ", "_")); - extRole.setDescription(addDesc); - addNewRole = mapper.writeValueAsString(extRole); - return addNewRole; - } - - /** - * It create a role in the external auth system and then in our local - * - * @param addRoleInDB - * @param app - * @return true else false - * @throws Exception - */ - @SuppressWarnings("unchecked") - @Transactional - private boolean addRoleInEcompDB(Role addRoleInDB, EPApp app) throws Exception { - boolean result = false; - List<EPRole> applicationRoles = null; - EPRole epRole = null; - Set<RoleFunction> roleFunctionList = addRoleInDB.getRoleFunctions(); - List<RoleFunction> roleFunctionListNew = new ArrayList<>(); - ObjectMapper mapper = new ObjectMapper(); - Iterator<RoleFunction> itetaror = roleFunctionList.iterator(); - while (itetaror.hasNext()) { - Object nextValue = itetaror.next(); - RoleFunction roleFunction = mapper.convertValue(nextValue, RoleFunction.class); - roleFunctionListNew.add(roleFunction); - } - List<RoleFunction> listWithoutDuplicates = roleFunctionListNew.stream().distinct().collect(Collectors.toList()); - try { - if (addRoleInDB.getId() == null) { // check if it is new role - checkIfRoleExitsInExternalSystem(addRoleInDB, app); - EPRole epRoleNew = new EPRole(); - epRoleNew.setActive(addRoleInDB.getActive()); - epRoleNew.setName(addRoleInDB.getName()); - epRoleNew.setPriority(addRoleInDB.getPriority()); - if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) { - epRoleNew.setAppId(null); - } else { - epRoleNew.setAppId(app.getId()); - } - dataAccessService.saveDomainObject(epRoleNew, null); - List<EPRole> getRoleCreated = null; - if (!app.getId().equals(PortalConstants.PORTAL_APP_ID)) { - List<EPRole> roleCreated = dataAccessService.getList(EPRole.class, - WHERE_ROLE_NAME_EQUALS + addRoleInDB.getName() + "' and app_id = " + app.getId(), null, - null); - EPRole epUpdateRole = roleCreated.get(0); - epUpdateRole.setAppRoleId(epUpdateRole.getId()); - dataAccessService.saveDomainObject(epUpdateRole, null); - getRoleCreated = dataAccessService.getList(EPRole.class, - WHERE_ROLE_NAME_EQUALS + addRoleInDB.getName() + "' and app_id = " + app.getId(), null, - null); - } else { - getRoleCreated = dataAccessService.getList(EPRole.class, - WHERE_ROLE_NAME_EQUALS + addRoleInDB.getName() + "' and app_id is null", null, null); - } - // Add role in External Auth system - result = addNewRoleInExternalSystem(getRoleCreated, app); - } else { // if role already exists then update it - if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) { - applicationRoles = dataAccessService.getList(EPRole.class, - " where app_id is null " + " and role_id = " + addRoleInDB.getId(), null, null); - } else { - applicationRoles = dataAccessService.getList(EPRole.class, - WHERE_APP_ID_EQUALS + app.getId() + " and app_role_id = " + addRoleInDB.getId(), null, null); - } - if (applicationRoles.isEmpty()) { - applicationRoles = dataAccessService.getList(EPRole.class, - WHERE_APP_ID_EQUALS + app.getId() + " and role_name = '" + addRoleInDB.getName() + "'", null, - null); - } - updateRoleInExternalSystem(addRoleInDB, app); - deleteRoleFunction(app, applicationRoles); - if (!applicationRoles.isEmpty()) { - epRole = applicationRoles.get(0); - epRole.setName(addRoleInDB.getName()); - epRole.setPriority(addRoleInDB.getPriority()); - epRole.setActive(addRoleInDB.getActive()); - if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) { - epRole.setAppId(null); - epRole.setAppRoleId(null); - } else if (!app.getId().equals(PortalConstants.PORTAL_APP_ID) - && applicationRoles.get(0).getAppRoleId() == null) { - epRole.setAppRoleId(epRole.getId()); - } - dataAccessService.saveDomainObject(epRole, null); - } - - saveRoleFunction(listWithoutDuplicates, app, applicationRoles); - result = true; - } - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "addRoleInEcompDB is failed", e); - throw new Exception(e.getMessage()); - } - return result; - } - - /** - * - * It validates whether role exists in external auth system - * - * @param checkRole - * @param app - * @throws Exception - * If role exits - */ - private void checkIfRoleExitsInExternalSystem(Role checkRole, EPApp app) throws Exception { - HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); - String roleName = app.getNameSpace() + "." + checkRole.getName().replaceAll(" ", "_"); - HttpEntity<String> checkRoleEntity = new HttpEntity<>(headers); - logger.debug(EELFLoggerDelegate.debugLogger, "checkIfRoleExitsInExternalSystem: {} " , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); - ResponseEntity<String> checkRoleInExternalSystem = template - .exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "roles/" - + roleName, HttpMethod.GET, checkRoleEntity, String.class); - if (!checkRoleInExternalSystem.getBody().equals(IS_EMPTY_JSON_STRING)) { - logger.debug("checkIfRoleExitsInExternalSystem: Role already exists in external system {} and status code: {} ", checkRoleInExternalSystem.getBody(), checkRoleInExternalSystem.getStatusCode().value()); - throw new Exception("Role already exists in external system"); - } - } - - /** - * It saves list of functions to the role in portal - * - * @param roleFunctionListNew - * @param app - * @param applicationRoles - * @throws Exception - */ - @SuppressWarnings("unchecked") - private void saveRoleFunction(List<RoleFunction> roleFunctionListNew, EPApp app, List<EPRole> applicationRoles) - throws Exception { - for (RoleFunction roleFunc : roleFunctionListNew) { - EPAppRoleFunction appRoleFunc = new EPAppRoleFunction(); - appRoleFunc.setAppId(app.getId()); - appRoleFunc.setRoleId(applicationRoles.get(0).getId()); - // query to check if function code is different for safe operation - List<CentralRoleFunction> roleFunction = dataAccessService.getList(CentralRoleFunction.class, - WHERE_APP_ID_EQUALS+ app.getId()+FUNCTION_CD_LIKE_CLAUSE + roleFunc.getCode() + "'", null, null); - appRoleFunc.setCode(roleFunction.get(0).getCode()); - dataAccessService.saveDomainObject(appRoleFunc, null); - } - } - - /** - * It deletes all EPAppRoleFunction records in the portal - * - * @param app - * @param role - */ - @SuppressWarnings("unchecked") - private void deleteRoleFunction(EPApp app, List<EPRole> role) { - List<EPAppRoleFunction> appRoleFunctionList = dataAccessService.getList(EPAppRoleFunction.class, - WHERE_APP_ID_EQUALS + app.getId() + " and role_id = " + role.get(0).getId(), null, null); - if (!appRoleFunctionList.isEmpty()) { - for (EPAppRoleFunction approleFunction : appRoleFunctionList) { - dataAccessService.deleteDomainObject(approleFunction, null); - } - } - } - - @Override - @SuppressWarnings("unchecked") - public List<EPUser> getUser(String loginId){ - return (List<EPUser>) dataAccessService.getList(EPUser.class, - " where org_user_id = '" + loginId + "'", null, null); - } - - @Override - public String getUserWithRoles(String loginId, String uebkey) throws Exception { - final Map<String, String> params = new HashMap<>(); - List<EPUser> userList = null; - CentralUser cenUser = null; - EPApp app = null; - String result = null; - try { - params.put("orgUserIdValue", loginId); - List<EPApp> appList = getApp(uebkey); - if (!appList.isEmpty()) { - app = appList.get(0); - userList = getUser(loginId); - if (!userList.isEmpty()) { - EPUser user = userList.get(0); - ObjectMapper mapper = new ObjectMapper(); - Set<EPUserApp> userAppSet = user.getEPUserApps(); - cenUser = createEPUser(user, userAppSet, app); - result = mapper.writeValueAsString(cenUser); - } else if (userList.isEmpty()) { - throw new Exception("User not found"); - } - } else { - throw new Exception("Application not found"); - } - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "getUser: failed", e); - throw new Exception(e.getMessage()); - } - return result; - } - - @Override - public List<CentralRole> getRolesForApp(String uebkey) throws Exception { - logger.debug(EELFLoggerDelegate.debugLogger, "getRolesForApp: Entering into getRolesForApp"); - List<CentralRole> roleList = new ArrayList<>(); - final Map<String, Long> params = new HashMap<>(); - try { - List<EPApp> app = getApp(uebkey); - List<EPRole> appRolesList = getAppRoles(app.get(0).getId()); - createCentralRoleObject(app, appRolesList, roleList, params); - } catch (Exception e) { - throw new Exception("getRolesForApp Failed", e); - } - logger.debug(EELFLoggerDelegate.debugLogger, "getRolesForApp: Finished getRolesForApp"); - return roleList; - } - - @SuppressWarnings("unchecked") - @Override - public List<CentralRoleFunction> getRoleFuncList(String uebkey) throws Exception { - EPApp app = getApp(uebkey).get(0); - List<CentralRoleFunction> finalRoleList = new ArrayList<>(); - final Map<String, Long> params = new HashMap<>(); - params.put(APP_ID, app.getId()); - // Sync all functions from external system into Ecomp portal DB - logger.debug(EELFLoggerDelegate.debugLogger, "getRoleFuncList: Entering into syncRoleFunctionFromExternalAccessSystem"); - syncRoleFunctionFromExternalAccessSystem(app); - logger.debug(EELFLoggerDelegate.debugLogger, "getRoleFuncList: Finished syncRoleFunctionFromExternalAccessSystem"); - List<CentralRoleFunction> getRoleFuncList = dataAccessService.executeNamedQuery("getAllRoleFunctions", params, null); - for(CentralRoleFunction roleFuncItem : getRoleFuncList ){ - if(roleFuncItem.getCode().contains(FUNCTION_PIPE)){ - String code = ""; - int count = StringUtils.countMatches(roleFuncItem.getCode(), FUNCTION_PIPE); - if (count == 2) - code = roleFuncItem.getCode().substring( - roleFuncItem.getCode().indexOf(FUNCTION_PIPE) + 1, - roleFuncItem.getCode().lastIndexOf(FUNCTION_PIPE)); - else - code = roleFuncItem.getCode() - .substring(roleFuncItem.getCode().lastIndexOf(FUNCTION_PIPE) + 1); - - roleFuncItem.setCode(code); - finalRoleList.add(roleFuncItem); - } else{ - finalRoleList.add(roleFuncItem); - } - } - return finalRoleList; - } - - /** - * It returns user detail information which is deep copy of EPUser.class object - * - * @param userInfo - * @param userAppSet - * @param app - * @return - * @throws Exception - */ - @SuppressWarnings("unchecked") - private CentralUser createEPUser(EPUser userInfo, Set<EPUserApp> userAppSet, EPApp app) throws Exception { - - final Map<String, Long> params = new HashMap<>(); - CentralUser userAppList = new CentralUser(); - CentralUser user1 = null; - try { - userAppList.userApps = new TreeSet<CentralUserApp>(); - for (EPUserApp userApp : userAppSet) { - if (userApp.getRole().getActive()) { - EPApp epApp = userApp.getApp(); - String globalRole = userApp.getRole().getName().toLowerCase(); - if (((epApp.getId().equals(app.getId())) - && (!userApp.getRole().getId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID))) - || ((epApp.getId().equals(PortalConstants.PORTAL_APP_ID)) - && (globalRole.toLowerCase().startsWith("global_")))) { - CentralUserApp cua = new CentralUserApp(); - cua.setUserId(null); - CentralApp cenApp = new CentralApp(1L, epApp.getCreated(), epApp.getModified(), - epApp.getCreatedId(), epApp.getModifiedId(), epApp.getRowNum(), epApp.getName(), - epApp.getImageUrl(), epApp.getDescription(), epApp.getNotes(), epApp.getUrl(), - epApp.getAlternateUrl(), epApp.getAppRestEndpoint(), epApp.getMlAppName(), - epApp.getMlAppAdminId(), String.valueOf(epApp.getMotsId()), epApp.getAppPassword(), - String.valueOf(epApp.getOpen()), String.valueOf(epApp.getEnabled()), - epApp.getThumbnail(), epApp.getUsername(), epApp.getUebKey(), epApp.getUebSecret(), - epApp.getUebTopicName()); - cua.setApp(cenApp); - params.put("roleId", userApp.getRole().getId()); - params.put(APP_ID, userApp.getApp().getId()); - List<CentralRoleFunction> appRoleFunctionList = dataAccessService - .executeNamedQuery("getAppRoleFunctionList", params, null); - SortedSet<CentralRoleFunction> roleFunctionSet = new TreeSet<>(); - for (CentralRoleFunction roleFunc : appRoleFunctionList) { - String functionCode = ""; - if (roleFunc.getCode().contains(FUNCTION_PIPE)) { - int count = StringUtils.countMatches(roleFunc.getCode(), FUNCTION_PIPE); - String finalFunctionCodeVal; - if (count == 2) - finalFunctionCodeVal = roleFunc.getCode().substring( - roleFunc.getCode().indexOf(FUNCTION_PIPE) + 1, - roleFunc.getCode().lastIndexOf(FUNCTION_PIPE)); - else - finalFunctionCodeVal = roleFunc.getCode() - .substring(roleFunc.getCode().lastIndexOf(FUNCTION_PIPE) + 1); - - functionCode = finalFunctionCodeVal; - } else { - functionCode = roleFunc.getCode(); - } - CentralRoleFunction cenRoleFunc = new CentralRoleFunction(roleFunc.getId(), functionCode, - roleFunc.getName(), null, null); - roleFunctionSet.add(cenRoleFunc); - } - Long userRoleId = null; - if (globalRole.toLowerCase().startsWith("global_") - && epApp.getId().equals(PortalConstants.PORTAL_APP_ID)) { - userRoleId = userApp.getRole().getId(); - } else { - userRoleId = userApp.getRole().getAppRoleId(); - } - CentralRole cenRole = new CentralRole(userRoleId, userApp.getRole().getCreated(), - userApp.getRole().getModified(), userApp.getRole().getCreatedId(), - userApp.getRole().getModifiedId(), userApp.getRole().getRowNum(), - userApp.getRole().getName(), userApp.getRole().getActive(), - userApp.getRole().getPriority(), roleFunctionSet, null, null); - cua.setRole(cenRole); - - userAppList.userApps.add(cua); - } - } - } - - user1 = new CentralUser(null, userInfo.getCreated(), userInfo.getModified(), userInfo.getCreatedId(), - userInfo.getModifiedId(), userInfo.getRowNum(), userInfo.getOrgId(), userInfo.getManagerId(), - userInfo.getFirstName(), userInfo.getMiddleInitial(), userInfo.getLastName(), userInfo.getPhone(), - userInfo.getFax(), userInfo.getCellular(), userInfo.getEmail(), userInfo.getAddressId(), - userInfo.getAlertMethodCd(), userInfo.getHrid(), userInfo.getOrgUserId(), userInfo.getOrgCode(), - userInfo.getAddress1(), userInfo.getAddress2(), userInfo.getCity(), userInfo.getState(), - userInfo.getZipCode(), userInfo.getCountry(), userInfo.getOrgManagerUserId(), - userInfo.getLocationClli(), userInfo.getBusinessCountryCode(), userInfo.getBusinessCountryName(), - userInfo.getBusinessUnit(), userInfo.getBusinessUnitName(), userInfo.getDepartment(), - userInfo.getDepartmentName(), userInfo.getCompanyCode(), userInfo.getCompany(), - userInfo.getZipCodeSuffix(), userInfo.getJobTitle(), userInfo.getCommandChain(), - userInfo.getSiloStatus(), userInfo.getCostCenter(), userInfo.getFinancialLocCode(), - userInfo.getLoginId(), userInfo.getLoginPwd(), userInfo.getLastLoginDate(), userInfo.getActive(), - userInfo.getInternal(), userInfo.getSelectedProfileId(), userInfo.getTimeZoneId(), - userInfo.isOnline(), userInfo.getChatId(), userAppList.userApps, null); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "createEPUser: createEPUser failed", e); - throw new Exception(e.getMessage()); - } - - return user1; - } - - @SuppressWarnings("unchecked") - @Override - public CentralRole getRoleInfo(Long roleId, String uebkey) throws Exception { - final Map<String, Long> params = new HashMap<>(); - List<CentralRole> roleList = new ArrayList<>(); - CentralRole cenRole = new CentralRole(); - List<EPRole> roleInfo = null; - List<EPApp> app = null; - try { - app = getApp(uebkey); - if (app.isEmpty()) { - throw new Exception("Application not found"); - } - String filter = null; - if (app.get(0).getId().equals(PortalConstants.PORTAL_APP_ID)) { - filter = WHERE_ROLE_ID_EQUALS + roleId + " and app_id is null "; - } else { - filter = " where app_role_id = " + roleId + " and app_id = " + app.get(0).getId(); - - } - roleInfo = dataAccessService.getList(EPRole.class, filter, null, null); - roleList = createCentralRoleObject(app, roleInfo, roleList, params); - if (roleList.isEmpty()) { - return cenRole; - } - - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "getRoleInfo: failed", e); - throw new Exception(e.getMessage()); - - } - return roleList.get(0); - } - - /** - * - * It returns list of app roles along with role functions and which went through deep copy - * - * @param app - * @param roleInfo - * @param roleList - * @param params - * @return - */ - @SuppressWarnings("unchecked") - private List<CentralRole> createCentralRoleObject(List<EPApp> app, List<EPRole> roleInfo, - List<CentralRole> roleList, Map<String, Long> params) { - for (EPRole role : roleInfo) { - params.put("roleId", role.getId()); - params.put(APP_ID, app.get(0).getId()); - List<CentralRoleFunction> cenRoleFuncList = dataAccessService.executeNamedQuery("getAppRoleFunctionList", - params, null); - SortedSet<CentralRoleFunction> roleFunctionSet = new TreeSet<>(); - for (CentralRoleFunction roleFunc : cenRoleFuncList) { - String functionCode = ""; - if (roleFunc.getCode().contains(FUNCTION_PIPE)) { - int count = StringUtils.countMatches(roleFunc.getCode(), FUNCTION_PIPE); - String finalFunctionCodeVal; - if (count == 2) - finalFunctionCodeVal = roleFunc.getCode().substring( - roleFunc.getCode().indexOf(FUNCTION_PIPE) + 1, - roleFunc.getCode().lastIndexOf(FUNCTION_PIPE)); - else - finalFunctionCodeVal = roleFunc.getCode() - .substring(roleFunc.getCode().lastIndexOf(FUNCTION_PIPE) + 1); - functionCode = finalFunctionCodeVal; - } else { - functionCode = roleFunc.getCode(); - } - CentralRoleFunction cenRoleFunc = new CentralRoleFunction(role.getId(), functionCode, - roleFunc.getName(), null, null); - roleFunctionSet.add(cenRoleFunc); - } - SortedSet<CentralRole> childRoles = new TreeSet<>(); - CentralRole cenRole = null; - if (role.getAppRoleId() == null) { - cenRole = new CentralRole(role.getId(), role.getCreated(), role.getModified(), role.getCreatedId(), - role.getModifiedId(), role.getRowNum(), role.getName(), role.getActive(), role.getPriority(), - roleFunctionSet, childRoles, null); - } else { - cenRole = new CentralRole(role.getAppRoleId(), role.getCreated(), role.getModified(), - role.getCreatedId(), role.getModifiedId(), role.getRowNum(), role.getName(), role.getActive(), - role.getPriority(), roleFunctionSet, childRoles, null); - } - roleList.add(cenRole); - } - return roleList; - } - - @SuppressWarnings("unchecked") - @Override - public CentralRoleFunction getRoleFunction(String functionCode, String uebkey) throws Exception { - CentralRoleFunction roleFunc = null; - EPApp app = getApp(uebkey).get(0); - List<CentralRoleFunction> getRoleFuncList = null; - final Map<String, String> params = new HashMap<>(); - try { - params.put("functionCode", functionCode); - params.put(APP_ID, String.valueOf(app.getId())); - getRoleFuncList = dataAccessService.executeNamedQuery("getRoleFunction", params, null); - if (getRoleFuncList.isEmpty()) { - return roleFunc; - } else{ - String functionCodeFormat = getRoleFuncList.get(0).getCode(); - if(functionCodeFormat.contains(FUNCTION_PIPE)){ - String newfunctionCodeFormat = functionCodeFormat.substring(functionCodeFormat.lastIndexOf(FUNCTION_PIPE)+1); - roleFunc = new CentralRoleFunction(getRoleFuncList.get(0).getId(), newfunctionCodeFormat, getRoleFuncList.get(0).getName(), getRoleFuncList.get(0).getAppId(), getRoleFuncList.get(0).getEditUrl()); - } else{ - roleFunc = new CentralRoleFunction(getRoleFuncList.get(0).getId(), functionCodeFormat, getRoleFuncList.get(0).getName(), getRoleFuncList.get(0).getAppId(), getRoleFuncList.get(0).getEditUrl()); - } - } - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "getRoleFunction: failed", e); - throw new Exception("getRoleFunction failed", e); - } - return roleFunc; - } - - @Override - public boolean saveCentralRoleFunction(CentralRoleFunction domainCentralRoleFunction, EPApp app) throws Exception { - boolean saveOrUpdateFunction = false; - try { - addRoleFunctionInExternalSystem(domainCentralRoleFunction, app); - dataAccessService.saveDomainObject(domainCentralRoleFunction, null); - saveOrUpdateFunction = true; - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "saveCentralRoleFunction: failed", e); - saveOrUpdateFunction = false; - } - return saveOrUpdateFunction; - } - - /** - * It creates application permission in external auth system - * - * @param domainCentralRoleFunction - * @param app - * @throws Exception - */ - @SuppressWarnings("unchecked") - private void addRoleFunctionInExternalSystem(CentralRoleFunction domainCentralRoleFunction, EPApp app) - throws Exception { - ObjectMapper mapper = new ObjectMapper(); - ExternalAccessPerms extPerms = new ExternalAccessPerms(); - HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); - List<CentralRoleFunction> appRoleFunc = dataAccessService.getList(CentralRoleFunction.class, - WHERE_APP_ID_EQUALS + app.getId() + AND_FUNCTION_CD_EQUALS + domainCentralRoleFunction.getCode() + "'", null, null); - String roleFuncName = null; - if (!appRoleFunc.isEmpty()) { - roleFuncName = appRoleFunc.get(0).getCode(); - } else { - roleFuncName = domainCentralRoleFunction.getCode(); - } - String checkType = domainCentralRoleFunction.getCode().contains("menu") ? "menu" : "url"; - HttpEntity<String> getSinglePermEntity = new HttpEntity<>(headers); - logger.debug(EELFLoggerDelegate.debugLogger, "addRoleFunctionInExternalSystem: {} ", CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); - ResponseEntity<String> getResponse = template.exchange( - SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "perms/" - + app.getNameSpace() + "." + checkType + "/" + roleFuncName + "/*", - HttpMethod.GET, getSinglePermEntity, String.class); - if (getResponse.getStatusCode().value() != 200) { - EPLogUtil.logExternalAuthAccessAlarm(logger, getResponse.getStatusCode()); - throw new Exception(getResponse.getBody()); - } - logger.debug(EELFLoggerDelegate.debugLogger, "addRoleFunctionInExternalSystem: Finished GET permission from External Auth system and response: {} ", getResponse.getBody()); - String res = getResponse.getBody(); - if (res.equals(IS_EMPTY_JSON_STRING)) { - try { - extPerms.setAction("*"); - extPerms.setInstance(domainCentralRoleFunction.getCode()); - extPerms.setType(app.getNameSpace() + "." + checkType); - extPerms.setDescription(domainCentralRoleFunction.getName()); - String updateRole = mapper.writeValueAsString(extPerms); - HttpEntity<String> entity = new HttpEntity<>(updateRole, headers); - logger.debug(EELFLoggerDelegate.debugLogger, "addRoleFunctionInExternalSystem: {} " , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); - ResponseEntity<String> addPermResponse= template.exchange( - SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "perm", - HttpMethod.POST, entity, String.class); - logger.debug(EELFLoggerDelegate.debugLogger, "addRoleFunctionInExternalSystem: Finished adding permission in and status code: {} ", addPermResponse.getStatusCode().value()); - } catch(HttpClientErrorException e){ - logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to add function in external central auth system", e); - EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); - }catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "addRoleFunctionInExternalSystem: Failed to add fucntion in external central auth system", - e); - } - } else { - try { - extPerms.setAction("*"); - extPerms.setInstance(domainCentralRoleFunction.getCode()); - extPerms.setType(app.getNameSpace() + "." + checkType); - extPerms.setDescription(domainCentralRoleFunction.getName()); - String updateRole = mapper.writeValueAsString(extPerms); - HttpEntity<String> entity = new HttpEntity<>(updateRole, headers); - logger.debug(EELFLoggerDelegate.debugLogger, "addRoleFunctionInExternalSystem: {} " , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); - ResponseEntity<String> updatePermResponse = template.exchange( - SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "perm", - HttpMethod.PUT, entity, String.class); - logger.debug(EELFLoggerDelegate.debugLogger, "addRoleFunctionInExternalSystem: Finished updating permission in External Auth system and response: {} ", updatePermResponse.getBody()); - } catch(HttpClientErrorException e){ - logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to add function in external central auth system", e); - EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "addRoleFunctionInExternalSystem: Failed to update function in external central auth system", - e); - } - } - } - - @Override - @Transactional - public boolean deleteCentralRoleFunction(String code, EPApp app) { - boolean deleteFunctionResponse = false; - try { - final Map<String, String> params = new HashMap<>(); - params.put("functionCode", code); - params.put(APP_ID, String.valueOf(app.getId())); - CentralRoleFunction domainCentralRoleFunction = (CentralRoleFunction) dataAccessService - .executeNamedQuery("getRoleFunction", params, null).get(0); - deleteRoleFunctionInExternalSystem(domainCentralRoleFunction, app); - // Delete role function dependency records - deleteAppRoleFunctions(code, app); - dataAccessService.deleteDomainObject(domainCentralRoleFunction, null); - deleteFunctionResponse = true; - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "deleteCentralRoleFunction: failed", e); - } - return deleteFunctionResponse; - } - - /** - * It deletes app function record in portal - * - * @param code - * @param app - */ - private void deleteAppRoleFunctions(String code, EPApp app) { - dataAccessService.deleteDomainObjects(EPAppRoleFunction.class, - APP_ID_EQUALS + app.getId() + FUNCTION_CD_LIKE_CLAUSE + code + "'", null); - } - - /** - * - * It deletes permission in the external auth system - * - * @param domainCentralRoleFunction - * @param app - * @throws Exception - */ - private void deleteRoleFunctionInExternalSystem(CentralRoleFunction domainCentralRoleFunction, EPApp app) - throws Exception { - try { - ObjectMapper mapper = new ObjectMapper(); - ExternalAccessPerms extPerms = new ExternalAccessPerms(); - String instanceValue = ""; - if(domainCentralRoleFunction.getCode().contains(FUNCTION_PIPE)){ - instanceValue = domainCentralRoleFunction.getCode().substring(domainCentralRoleFunction.getCode().lastIndexOf(FUNCTION_PIPE)+1); - }else{ - instanceValue = domainCentralRoleFunction.getCode(); - } - String checkType = instanceValue.contains("menu") ? "menu" : "url"; - HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); - extPerms.setAction("*"); - extPerms.setInstance(domainCentralRoleFunction.getCode()); - extPerms.setType(app.getNameSpace() + "." + checkType); - extPerms.setDescription(domainCentralRoleFunction.getName()); - String updateRole = mapper.writeValueAsString(extPerms); - HttpEntity<String> entity = new HttpEntity<>(updateRole, headers); - logger.debug(EELFLoggerDelegate.debugLogger,"deleteRoleFunctionInExternalSystem: {} " , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); - ResponseEntity<String> delPermResponse = template.exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) - + "perm?force=true", HttpMethod.DELETE, entity, String.class); - logger.debug(EELFLoggerDelegate.debugLogger, "deleteRoleFunctionInExternalSystem: Finished deleting permission in External Auth system and status code: {} ", delPermResponse.getStatusCode().value()); - } catch(HttpClientErrorException e){ - logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to delete functions in External System", e); - EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); - } catch (Exception e) { - if (e.getMessage().equalsIgnoreCase("404 Not Found")) { - logger.debug(EELFLoggerDelegate.debugLogger, - " deleteRoleFunctionInExternalSystem: It seems like function is already deleted in external central auth system but exists in local DB", - e.getMessage()); - } else { - logger.error(EELFLoggerDelegate.errorLogger, "deleteRoleFunctionInExternalSystem: Failed to delete functions in External System", e); - } - } - } - - @Override - public boolean saveRoleForApplication(Role saveRole, String uebkey) throws Exception { - boolean addRoleResponse = false; - try { - EPApp app = getApp(uebkey).get(0); - addRoleInEcompDB(saveRole, app); - addRoleResponse = true; - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "saveRoleForApplication failed", e); - } - return addRoleResponse; - } - - @SuppressWarnings("unchecked") - @Override - public boolean deleteRoleForApplication(String deleteRole, String uebkey) throws Exception { - Session localSession = sessionFactory.openSession(); - Transaction transaction = null; - boolean result = false; - try { - transaction = localSession.beginTransaction(); - - List<EPRole> epRoleList = null; - ResponseEntity<String> deleteResponse = null; - EPApp app = getApp(uebkey).get(0); - if (app.getId() == 1) { - epRoleList = dataAccessService.getList(EPRole.class, - " where app_id is null " + "and role_name = '" + deleteRole + "'", null, null); - } else { - epRoleList = dataAccessService.getList(EPRole.class, - WHERE_APP_ID_EQUALS + app.getId() + " and role_name = '" + deleteRole + "'", null, null); - } - // Delete app role functions before deleting role - deleteRoleFunction(app, epRoleList); - if (app.getId() == 1) { - // Delete fn_user_ role - dataAccessService.deleteDomainObjects(EPUserApp.class, - APP_ID_EQUALS + app.getId() + " and role_id = " + epRoleList.get(0).getId(), null); - - deleteRoleDependencyRecords(localSession, epRoleList.get(0).getId(), app.getId()); - } - // Delete Role in External System - String deleteRoleKey = "{\"name\":\"" + app.getNameSpace() + "." - + epRoleList.get(0).getName().replaceAll(" ", "_") + "\"}"; - deleteResponse = deleteRoleInExternalSystem(deleteRoleKey); - if (deleteResponse.getStatusCode().value() != 200 || deleteResponse.getStatusCode().value() != 404) { - EPLogUtil.logExternalAuthAccessAlarm(logger, deleteResponse.getStatusCode()); - logger.error(EELFLoggerDelegate.errorLogger, - "deleteRoleForApplication: Failed to delete role in external auth system! due to {} ", - deleteResponse.getBody()); - } - logger.debug(EELFLoggerDelegate.debugLogger, "deleteRoleForApplication: about to commit the transaction"); - transaction.commit(); - logger.debug(EELFLoggerDelegate.debugLogger, "deleteRoleForApplication: committed the transaction"); - dataAccessService.deleteDomainObject(epRoleList.get(0), null); - result = true; - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "deleteRoleForApplication: failed", e); - result = false; - } finally { - localSession.close(); - } - return result; - } - - /** - * - * It deletes application user role in external auth system - * - * @param role - * @param app - * @param LoginId - * @throws Exception - */ - private void deleteUserRoleInExternalSystem(EPRole role, EPApp app, String LoginId) throws Exception { - HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); - HttpEntity<String> entity = new HttpEntity<>(headers); - logger.debug(EELFLoggerDelegate.debugLogger,"deleteUserRoleInExternalSystem: {} " , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); - ResponseEntity<String> getResponse = template - .exchange( - SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "userRole/" - + LoginId - + SystemProperties - .getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN) - + "/" + app.getNameSpace() + "." + role.getName().replaceAll(" ", "_"), - HttpMethod.GET, entity, String.class); - logger.debug(EELFLoggerDelegate.debugLogger, "deleteUserRoleInExternalSystem: Finished GET user roles from External Auth system and response: {} ", getResponse.getBody()); - if (getResponse.getStatusCode().value() != 200) { - throw new Exception(getResponse.getBody()); - } - String res = getResponse.getBody(); - if (!res.equals(IS_EMPTY_JSON_STRING)) { - HttpEntity<String> userRoleentity = new HttpEntity<>(headers); - logger.debug(EELFLoggerDelegate.debugLogger, "deleteUserRoleInExternalSystem: {} " , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); - ResponseEntity<String> deleteResponse = template - .exchange( - SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) - + "userRole/" + LoginId - + SystemProperties - .getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN) - + "/" + app.getNameSpace() + "." + role.getName().replaceAll(" ", "_"), - HttpMethod.DELETE, userRoleentity, String.class); - if (deleteResponse.getStatusCode().value() != 200) { - throw new Exception("Failed to delete user role"); - } - logger.debug(EELFLoggerDelegate.debugLogger, "deleteUserRoleInExternalSystem: Finished deleting user role in External Auth system and status code: {} ", deleteResponse.getStatusCode().value()); - } - } - - @SuppressWarnings("unchecked") - @Override - public List<CentralRole> getActiveRoles(String uebkey) throws Exception { - List<CentralRole> roleList = new ArrayList<>(); - try { - List<EPApp> app = getApp(uebkey); - final Map<String, Long> params = new HashMap<>(); - // check if portal - Long appId = null; - if (!app.get(0).getId().equals(PortalConstants.PORTAL_APP_ID)) { - appId = app.get(0).getId(); - } - List<EPRole> epRole = dataAccessService.getList(EPRole.class, - WHERE_APP_ID_EQUALS + appId + " and active_yn = 'Y'", null, null); - roleList = createCentralRoleObject(app, epRole, roleList, params); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "getActiveRoles: failed", e); - throw new Exception(e.getMessage()); - } - return roleList; - - } - - @SuppressWarnings("unchecked") - @Override - public boolean deleteDependencyRoleRecord(Long roleId, String uebkey, String LoginId) throws Exception { - boolean result = false; - Session localSession = sessionFactory.openSession(); - Transaction transaction = null; - EPApp app = null; - try { - transaction = localSession.beginTransaction(); - List<EPRole> epRoleList = null; - app = getApp(uebkey).get(0); - epRoleList = dataAccessService.getList(EPRole.class, - WHERE_APP_ID_EQUALS + app.getId() + " and app_role_id = " + roleId, null, null); - if (epRoleList.isEmpty()) { - epRoleList = dataAccessService.getList(EPRole.class, - WHERE_APP_ID_EQUALS + app.getId() + " and role_id = " + roleId, null, null); - } - // Delete User Role in External System before deleting role - deleteUserRoleInExternalSystem(epRoleList.get(0), app, LoginId); - // Delete user app roles - dataAccessService.deleteDomainObjects(EPUserApp.class, - APP_ID_EQUALS + app.getId() + " and role_id = " + epRoleList.get(0).getId(), null); - - deleteRoleDependencyRecords(localSession, epRoleList.get(0).getId(), app.getId()); - logger.debug(EELFLoggerDelegate.debugLogger, "deleteDependencyRoleRecord: about to commit the transaction"); - transaction.commit(); - logger.debug(EELFLoggerDelegate.debugLogger, "deleteDependencyRoleRecord: committed the transaction"); - result = true; - } catch(HttpClientErrorException e){ - logger.error(EELFLoggerDelegate.errorLogger, "deleteDependencyRoleRecord: HttpClientErrorException", e); - EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "deleteDependencyRoleRecord failed", e); - EcompPortalUtils.rollbackTransaction(transaction, - "deleteDependencyRoleRecord rollback, exception = " + e.toString()); - } finally { - localSession.close(); - } - return result; - } - - @Override - @SuppressWarnings("unchecked") - @Transactional - public void syncRoleFunctionFromExternalAccessSystem(EPApp app) { - try { - ResponseEntity<String> response = null; - HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); - HttpEntity<String> entity = new HttpEntity<>(headers); - logger.debug(EELFLoggerDelegate.debugLogger, "syncRoleFunctionFromExternalAccessSystem: {} " , CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); - response = template - .exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) - + "perms/ns/" + app.getNameSpace(), HttpMethod.GET, entity, String.class); - - String res = response.getBody(); - logger.debug(EELFLoggerDelegate.debugLogger, "syncRoleFunctionFromExternalAccessSystem: Finished GET permissions from External Auth system and response: {} ", response.getBody()); - JSONObject jsonObj = new JSONObject(res); - JSONArray extPerms = jsonObj.getJSONArray("perm"); - for (int i = 0; i < extPerms.length(); i++) { - if (extPerms.getJSONObject(i).getString("type").equals(app.getNameSpace() + ".access")) { - extPerms.remove(i); - i--; - } - } - ExternalAccessPermsDetail permDetails = null; - List<ExternalAccessPermsDetail> permsDetailList = new ArrayList<>(); - for (int i = 0; i < extPerms.length(); i++) { - String description = null; - if(extPerms.getJSONObject(i).has("description")){ - description = extPerms.getJSONObject(i).getString(EXTERNAL_AUTH_ROLE_DESCRIPTION); - } else{ - description = extPerms.getJSONObject(i).getString("instance"); - } - if (extPerms.getJSONObject(i).has("roles")) { - ObjectMapper rolesListMapper = new ObjectMapper(); - JSONArray resRoles = extPerms.getJSONObject(i).getJSONArray("roles"); - List<String> list = rolesListMapper.readValue(resRoles.toString(), - TypeFactory.defaultInstance().constructCollectionType(List.class, String.class)); - permDetails = new ExternalAccessPermsDetail(extPerms.getJSONObject(i).getString("type"), - extPerms.getJSONObject(i).getString("type").substring(app.getNameSpace().length() + 1) - + FUNCTION_PIPE + extPerms.getJSONObject(i).getString("instance") + FUNCTION_PIPE - + extPerms.getJSONObject(i).getString("action"), - extPerms.getJSONObject(i).getString("action"), list, description); - permsDetailList.add(permDetails); - } else { - permDetails = new ExternalAccessPermsDetail(extPerms.getJSONObject(i).getString("type"), - extPerms.getJSONObject(i).getString("type").substring(app.getNameSpace().length() + 1) - + FUNCTION_PIPE + extPerms.getJSONObject(i).getString("instance") + FUNCTION_PIPE - + extPerms.getJSONObject(i).getString("action"), - extPerms.getJSONObject(i).getString("action"), description); - permsDetailList.add(permDetails); - } - } - - final Map<String, Long> params = new HashMap<>(); - final Map<String, CentralRoleFunction> roleFuncMap = new HashMap<>(); - params.put(APP_ID, app.getId()); - List<CentralRoleFunction> appFunctions = dataAccessService.executeNamedQuery("getAllRoleFunctions", params, - null); - if (!appFunctions.isEmpty()) { - for (CentralRoleFunction roleFunc : appFunctions) { - roleFuncMap.put(roleFunc.getCode(), roleFunc); - } - } - // delete all application role functions - dataAccessService.deleteDomainObjects(EPAppRoleFunction.class, APP_ID_EQUALS + app.getId(), null); - // Add if new functions and app role functions were added in external auth system - for (ExternalAccessPermsDetail permsDetail : permsDetailList) { - String code = permsDetail.getInstance(); - CentralRoleFunction getFunctionCodeKey = roleFuncMap.get(permsDetail.getInstance()); - if (null == getFunctionCodeKey) { - String finalFunctionCodeVal = ""; - if (permsDetail.getInstance().contains(FUNCTION_PIPE)) { - int count = StringUtils.countMatches(permsDetail.getInstance(), FUNCTION_PIPE); - if (count == 2) - finalFunctionCodeVal = permsDetail.getInstance().substring( - permsDetail.getInstance().indexOf(FUNCTION_PIPE) + 1, - permsDetail.getInstance().lastIndexOf(FUNCTION_PIPE)); - else - finalFunctionCodeVal = permsDetail.getInstance() - .substring(permsDetail.getInstance().lastIndexOf(FUNCTION_PIPE) + 1); - } else { - finalFunctionCodeVal = permsDetail.getInstance(); - } - CentralRoleFunction checkIfCodeStillExits = roleFuncMap.get(finalFunctionCodeVal); - if (null == checkIfCodeStillExits) { - logger.debug(EELFLoggerDelegate.debugLogger, - "syncRoleFunctionFromExternalAccessSystem: Adding function: {} ", code); - addFunctionInEcompDB(app, permsDetail, code); - logger.debug(EELFLoggerDelegate.debugLogger, - "syncRoleFunctionFromExternalAccessSystem: Finished adding function: {} ", code); - - } - } - List<EPRole> epRolesList = null; - List<String> roles = permsDetail.getRoles(); - if (roles != null) { - for (String roleList : roles) { - if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) { - epRolesList = dataAccessService.getList(EPRole.class, - " where app_id is null " + " and role_name = '" - + roleList.substring(app.getNameSpace().length() + 1).replaceAll("_", " ") - + "'", - null, null); - } else { - epRolesList = dataAccessService.getList(EPRole.class, - WHERE_APP_ID_EQUALS + app.getId() + " and role_name = '" - + roleList.substring(app.getNameSpace().length() + 1).replaceAll("_", " ") - + "'", - null, null); - } - if (epRolesList.isEmpty()) { - if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) { - epRolesList = dataAccessService.getList(EPRole.class, - " where app_id is null " + " and role_name = '" - + roleList.substring(app.getNameSpace().length() + 1) + "'", - null, null); - } else { - epRolesList = dataAccessService.getList(EPRole.class, - WHERE_APP_ID_EQUALS + app.getId() + " and role_name = '" - + roleList.substring(app.getNameSpace().length() + 1) + "'", - null, null); - } - // Adding new role thats does not exits in Local but exists in external access system - if (epRolesList.isEmpty()) { - Role role = addRoleInDBIfDoesNotExists(app, roleList.substring(app.getNameSpace().length() + 1)); - addIfRoleDescriptionNotExitsInExtSystem(role, app); - epRolesList = dataAccessService.getList(EPRole.class, - WHERE_APP_ID_EQUALS + app.getId() + " and role_name = '" - + role.getName() + "'", - null, null); - } - } - // save all application role functions - if (!epRolesList.isEmpty()) { - try { - List<CentralRoleFunction> roleFunctionList = null; - String functionCode = ""; - if (permsDetail.getInstance().contains(FUNCTION_PIPE)) { - int count = StringUtils.countMatches(permsDetail.getInstance(), FUNCTION_PIPE); - String finalFunctionCodeVal; - if (count == 2) - finalFunctionCodeVal = permsDetail.getInstance().substring( - permsDetail.getInstance().indexOf(FUNCTION_PIPE) + 1, - permsDetail.getInstance().lastIndexOf(FUNCTION_PIPE)); - else - finalFunctionCodeVal = permsDetail.getInstance() - .substring(permsDetail.getInstance().lastIndexOf(FUNCTION_PIPE) + 1); - - functionCode = finalFunctionCodeVal; - } - roleFunctionList = dataAccessService.getList(CentralRoleFunction.class, - " where app_id = " + app.getId() + AND_FUNCTION_CD_EQUALS + functionCode + "'", - null, null); - if (roleFunctionList.isEmpty()) { - roleFunctionList = dataAccessService.getList(CentralRoleFunction.class, - " where app_id = " + app.getId() + AND_FUNCTION_CD_EQUALS + code + "'", - null, null); - } - if (!roleFunctionList.isEmpty()) { - EPAppRoleFunction addAppRoleFunc = new EPAppRoleFunction(); - addAppRoleFunc.setAppId(app.getId()); - addAppRoleFunc.setCode(roleFunctionList.get(0).getCode()); - addAppRoleFunc.setRoleId(epRolesList.get(0).getId()); - dataAccessService.saveDomainObject(addAppRoleFunc, null); - } - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "syncRoleFunctionFromExternalAccessSystem: Failed to save app role function ", - e); - } - } - } - } - } - logger.debug(EELFLoggerDelegate.debugLogger, "syncRoleFunctionFromExternalAccessSystem: Finished syncRoleFunctionFromExternalAccessSystem"); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "syncRoleFunctionFromExternalAccessSystem: Failed syncRoleFunctionFromExternalAccessSystem", e); - - } - } - - /** - * - * Add function into local DB - * - * @param app - * @param permsDetail - * @param code - */ - private void addFunctionInEcompDB(EPApp app, ExternalAccessPermsDetail permsDetail, String code) { - try{ - CentralRoleFunction addFunction = new CentralRoleFunction(); - addFunction.setAppId(app.getId()); - addFunction.setCode(code); - addFunction.setName(permsDetail.getDescription()); - dataAccessService.saveDomainObject(addFunction, null); - } catch(Exception e){ - logger.error(EELFLoggerDelegate.errorLogger, "addFunctionInEcompDB: Failed to add function", e); - } - } - - /** - * - * It updates description of a role in external auth system - * - * @param role - * @param app - * @throws Exception - */ - private void addIfRoleDescriptionNotExitsInExtSystem(Role role, EPApp app) throws Exception { - String addRoleNew = updateExistingRoleInExternalSystem(role, app); - HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); - try { - HttpEntity<String> entity = new HttpEntity<>(addRoleNew, headers); - template.exchange( - SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role", - HttpMethod.PUT, entity, String.class); - } catch (HttpClientErrorException e) { - logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to addIfRoleDescriptionNotExitsInExtSystem", - e); - EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "addIfRoleDescriptionNotExitsInExtSystem: Failed", - e); - } - } - - /** - * - * While sync functions form external auth system if new role found we should add in local and return Role.class object - * - * @param app - * @param role - * @return - */ - @SuppressWarnings("unchecked") - private Role addRoleInDBIfDoesNotExists(EPApp app, String role) { - Role setNewRole = new Role(); - EPRole epRoleNew = new EPRole(); - try { - epRoleNew.setActive(true); - epRoleNew.setName(role); - if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) { - epRoleNew.setAppId(null); - } else { - epRoleNew.setAppId(app.getId()); - } - dataAccessService.saveDomainObject(epRoleNew, null); - List<EPRole> getRoleCreated = null; - if (!app.getId().equals(PortalConstants.PORTAL_APP_ID)) { - List<EPRole> roleCreated = dataAccessService.getList(EPRole.class, - WHERE_ROLE_NAME_EQUALS + role + "' and app_id = " + app.getId(), null, null); - EPRole epUpdateRole = roleCreated.get(0); - epUpdateRole.setAppRoleId(epUpdateRole.getId()); - dataAccessService.saveDomainObject(epUpdateRole, null); - getRoleCreated = dataAccessService.getList(EPRole.class, - WHERE_ROLE_NAME_EQUALS + role + "' and app_id = " + app.getId(), null, null); - } else { - getRoleCreated = dataAccessService.getList(EPRole.class, - WHERE_ROLE_NAME_EQUALS + role + "' and app_id is null", null, null); - } - EPRole roleObject = getRoleCreated.get(0); - setNewRole.setId(roleObject.getId()); - setNewRole.setName(roleObject.getName()); - setNewRole.setActive(roleObject.getActive()); - setNewRole.setPriority(roleObject.getPriority()); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "addRoleInDBIfDoesNotExists: Failed", e); - } - return setNewRole; - } - - @Override - @SuppressWarnings("unchecked") - public Integer bulkUploadFunctions(String uebkey) throws Exception { - EPApp app = getApp(uebkey).get(0); - List<RoleFunction> roleFuncList = null; - roleFuncList = dataAccessService.getList(RoleFunction.class, null); - CentralRoleFunction cenRoleFunc = null; - Integer functionsAdded = 0; - try { - for (RoleFunction roleFunc : roleFuncList) { - cenRoleFunc = new CentralRoleFunction(roleFunc.getCode(), roleFunc.getName()); - addRoleFunctionInExternalSystem(cenRoleFunc, app); - functionsAdded++; - } - } catch(HttpClientErrorException e){ - logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - bulkUploadFunctions failed", e); - EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadFunctions: failed", e.getMessage(), e); - } - return functionsAdded; - } - - @Override - public Integer bulkUploadRoles(String uebkey) throws Exception { - List<EPApp> app = getApp(uebkey); - List<EPRole> roles = getAppRoles(app.get(0).getId()); - List<CentralRole> cenRoleList = new ArrayList<>(); - final Map<String, Long> params = new HashMap<>(); - Integer rolesListAdded = 0; - try { - cenRoleList = createCentralRoleObject(app, roles, cenRoleList, params); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false); - String roleList = mapper.writeValueAsString(cenRoleList); - List<Role> roleObjectList = mapper.readValue(roleList, - TypeFactory.defaultInstance().constructCollectionType(List.class, Role.class)); - for (Role role : roleObjectList) { - addRoleInExternalSystem(role, app.get(0)); - rolesListAdded++; - } - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRoles: failed", e); - throw new Exception(e.getMessage()); - } - return rolesListAdded; - } - - /** - * It creating new role in external auth system while doing bulk upload - * - * @param role - * @param app - * @throws Exception - */ - private void addRoleInExternalSystem(Role role, EPApp app) throws Exception { - String addRoleNew = updateExistingRoleInExternalSystem(role, app); - HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); - try { - HttpEntity<String> entity = new HttpEntity<>(addRoleNew, headers); - template.exchange( - SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role", - HttpMethod.POST, entity, String.class); - } catch(HttpClientErrorException e){ - logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to addRoleInExternalSystem", e); - EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); - } catch (Exception e) { - if (e.getMessage().equalsIgnoreCase("409 Conflict")) { - logger.error(EELFLoggerDelegate.errorLogger, "addRoleInExternalSystem: Role already exits but does not break functionality", e); - } else { - logger.error(EELFLoggerDelegate.errorLogger, "addRoleInExternalSystem: Failed to addRoleInExternalSystem", e.getMessage()); - } - } - } - - @Override - @SuppressWarnings("unchecked") - public Integer bulkUploadRolesFunctions(String uebkey) throws Exception { - EPApp app = getApp(uebkey).get(0); - List<EPRole> roles = getAppRoles(app.getId()); - final Map<String, Long> params = new HashMap<>(); - Integer roleFunctions = 0; - try { - for (EPRole role : roles) { - params.put("roleId", role.getId()); - List<BulkUploadRoleFunction> appRoleFunc = dataAccessService.executeNamedQuery("uploadAllRoleFunctions", - params, null); - if (!appRoleFunc.isEmpty()) { - for (BulkUploadRoleFunction addRoleFunc : appRoleFunc) { - addRoleFunctionsInExternalSystem(addRoleFunc, role, app); - roleFunctions++; - } - } - } - } catch(HttpClientErrorException e){ - logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to bulkUploadRolesFunctions", e); - EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRolesFunctions: failed", e); - } - return roleFunctions; - } - - /** - * Its adding a role function while doing bulk upload - * - * @param addRoleFunc - * @param role - * @param app - */ - private void addRoleFunctionsInExternalSystem(BulkUploadRoleFunction addRoleFunc, EPRole role, EPApp app) { - String checkType = addRoleFunc.getFunctionCd().contains("menu") ? "menu" : "url"; - ExternalAccessRolePerms extRolePerms = null; - ExternalAccessPerms extPerms = null; - ObjectMapper mapper = new ObjectMapper(); - try { - HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); - - extPerms = new ExternalAccessPerms(app.getNameSpace() + "." + checkType, addRoleFunc.getFunctionCd(), "*", - addRoleFunc.getFunctionName()); - extRolePerms = new ExternalAccessRolePerms(extPerms, - app.getNameSpace() + "." + role.getName().replaceAll(" ", "_")); - String updateRolePerms = mapper.writeValueAsString(extRolePerms); - HttpEntity<String> entity = new HttpEntity<>(updateRolePerms, headers); - template.exchange( - SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role/perm", - HttpMethod.POST, entity, String.class); - } catch (Exception e) { - if (e.getMessage().equalsIgnoreCase("409 Conflict")) { - logger.error(EELFLoggerDelegate.errorLogger, - "addRoleFunctionsInExternalSystem: RoleFunction already exits but does not break functionality", e); - } else { - logger.error(EELFLoggerDelegate.errorLogger, "addRoleFunctionsInExternalSystem: Failed to addRoleFunctionsInExternalSystem", - e.getMessage()); - } - } - } - - @Override - public void bulkUploadPartnerFunctions(String uebkey, List<RoleFunction> roleFunctionsList) throws Exception { - EPApp app = getApp(uebkey).get(0); - CentralRoleFunction cenRoleFunc = null; - for (RoleFunction roleFunction : roleFunctionsList) { - cenRoleFunc = new CentralRoleFunction(roleFunction.getCode(), roleFunction.getName()); - addRoleFunctionInExternalSystem(cenRoleFunc, app); - } - } - - @Override - public void bulkUploadPartnerRoles(String uebkey, List<Role> roleList) throws Exception { - EPApp app = getApp(uebkey).get(0); - for (Role role : roleList) { - addRoleInExternalSystem(role, app); - } - } - - @SuppressWarnings("unchecked") - @Override - public void bulkUploadPartnerRoleFunctions(String uebkey, List<Role> roleList) throws Exception { - EPApp app = getApp(uebkey).get(0); - HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); - for (Role role : roleList) { - try { - Set<RoleFunction> roleFunctionList = role.getRoleFunctions(); - List<RoleFunction> roleFunctionListNew = new ArrayList<>(); - ObjectMapper roleFunctionsMapper = new ObjectMapper(); - Iterator<RoleFunction> itetaror = roleFunctionList.iterator(); - while (itetaror.hasNext()) { - Object nextValue = itetaror.next(); - RoleFunction roleFunction = roleFunctionsMapper.convertValue(nextValue, RoleFunction.class); - roleFunctionListNew.add(roleFunction); - } - List<RoleFunction> listWithoutDuplicates = roleFunctionListNew.stream().distinct() - .collect(Collectors.toList()); - for (RoleFunction roleFunction : listWithoutDuplicates) { - String checkType = roleFunction.getCode().contains("menu") ? "menu" : "url"; - ExternalAccessRolePerms extRolePerms = null; - ExternalAccessPerms extPerms = null; - ObjectMapper mapper = new ObjectMapper(); - extPerms = new ExternalAccessPerms(app.getNameSpace() + "." + checkType, roleFunction.getCode(), - "*"); - extRolePerms = new ExternalAccessRolePerms(extPerms, - app.getNameSpace() + "." + role.getName().replaceAll(" ", "_")); - String updateRolePerms = mapper.writeValueAsString(extRolePerms); - HttpEntity<String> entity = new HttpEntity<>(updateRolePerms, headers); - template.exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) - + "role/perm", HttpMethod.PUT, entity, String.class); - } - } catch (Exception e) { - if (e.getMessage().equalsIgnoreCase("409 Conflict")) { - logger.error(EELFLoggerDelegate.errorLogger, - "bulkUploadPartnerRoleFunctions: RoleFunction already exits but does not break functionality"); - } else { - logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadPartnerRoleFunctions: Failed to addRoleFunctionsInExternalSystem", - e.getMessage()); - } - } - - } - } - - @Override - @SuppressWarnings("unchecked") - @Transactional - public void syncApplicationRolesWithEcompDB(EPApp app) { - try { - ResponseEntity<String> response = null; - List<EPRole> finalRoleList = new ArrayList<>(); - ExternalRoleDescription ApplicationRole = new ExternalRoleDescription(); - ExternalAccessPerms externalAccessPerms = null; - List<String> functionCodelist = new ArrayList<>(); - List<ExternalRoleDetails> externalRoleDetailsList = new ArrayList<>(); - ObjectMapper mapper = new ObjectMapper(); - HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); - HttpEntity<String> entity = new HttpEntity<>(headers); - logger.debug(EELFLoggerDelegate.debugLogger, "syncApplicationRolesWithEcompDB: {} ", - CONNECTING_TO_EXTERNAL_AUTH_SYSTEM_LOG_MESSAGE); - response = template - .exchange(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) - + "roles/ns/" + app.getNameSpace(), HttpMethod.GET, entity, String.class); - String res = response.getBody(); - logger.debug(EELFLoggerDelegate.debugLogger, - "syncApplicationRolesWithEcompDB: Finished GET roles from External Auth system and the result is :", - res); - JSONObject jsonObj = new JSONObject(res); - JSONArray extRole = jsonObj.getJSONArray("role"); - for (int i = 0; i < extRole.length(); i++) { - if (extRole.getJSONObject(i).getString(ROLE_NAME).equals(app.getNameSpace() + ADMIN) - || extRole.getJSONObject(i).getString(ROLE_NAME).equals(app.getNameSpace() + OWNER) - || (extRole.getJSONObject(i).getString(ROLE_NAME).equals(app.getNameSpace() + ACCOUNT_ADMINISTRATOR) - && !app.getId().equals(PortalConstants.PORTAL_APP_ID))) { - extRole.remove(i); - i--; - } - } - dataAccessService.deleteDomainObjects(EPAppRoleFunction.class, APP_ID_EQUALS + app.getId(), null); - for (int i = 0; i < extRole.length(); i++) { - ExternalRoleDetails externalRoleDetail = new ExternalRoleDetails(); - EPAppRoleFunction ePAppRoleFunction = new EPAppRoleFunction(); - JSONObject Role = (JSONObject) extRole.get(i); - if (!extRole.getJSONObject(i).has(EXTERNAL_AUTH_ROLE_DESCRIPTION)) { - ApplicationRole.setActive("true"); - ApplicationRole.setAppId(IS_NULL_STRING); - ApplicationRole.setPriority(IS_NULL_STRING); - ApplicationRole.setAppRoleId(IS_NULL_STRING); - String roleName = extRole.getJSONObject(i).getString(ROLE_NAME); - ApplicationRole.setName(roleName.substring(app.getNameSpace().length() + 1)); - } else { - String desc = extRole.getJSONObject(i).getString(EXTERNAL_AUTH_ROLE_DESCRIPTION); - ApplicationRole = mapper.readValue(desc, ExternalRoleDescription.class); - } - - SortedSet<ExternalAccessPerms> externalAccessPermsOfRole = new TreeSet<>(); - if (extRole.getJSONObject(i).has(EXTERNAL_AUTH_PERMS)) { - JSONArray extPerm = (JSONArray) Role.get(EXTERNAL_AUTH_PERMS); - for (int j = 0; j < extPerm.length(); j++) { - JSONObject perms = extPerm.getJSONObject(j); - externalAccessPerms = new ExternalAccessPerms(perms.getString("type"), - perms.getString("instance"), perms.getString("action")); - ePAppRoleFunction.setCode(externalAccessPerms.getInstance()); - functionCodelist.add(ePAppRoleFunction.getCode()); - externalAccessPermsOfRole.add(externalAccessPerms); - } - } - - if (ApplicationRole.getActive().equals(IS_NULL_STRING)) { - externalRoleDetail.setActive(false); - } else { - externalRoleDetail.setActive(Boolean.parseBoolean(ApplicationRole.getActive())); - } - externalRoleDetail.setName(ApplicationRole.getName()); - - if (ApplicationRole.getAppId().equals(IS_NULL_STRING) && app.getId() == 1) { - externalRoleDetail.setAppId(null); - } else if (ApplicationRole.getAppId().equals(IS_NULL_STRING)) { - externalRoleDetail.setAppId(app.getId()); - } else { - externalRoleDetail.setAppId(Long.parseLong(ApplicationRole.getAppId())); - } - - if (ApplicationRole.getPriority().equals(IS_NULL_STRING)) { - externalRoleDetail.setPriority(null); - } else { - externalRoleDetail.setPriority(Integer.parseInt(ApplicationRole.getPriority())); - } - - if (ApplicationRole.getAppRoleId().equals(IS_NULL_STRING) && app.getId() == 1) { - externalRoleDetail.setAppRoleId(null); - } - - if (!externalAccessPermsOfRole.isEmpty()) { - // Adding functions to roles - for (ExternalAccessPerms externalpermission : externalAccessPermsOfRole) { - try { - logger.debug(EELFLoggerDelegate.debugLogger, - "SyncApplicationRolesWithEcompDB: Adding function to the role: {}", - externalpermission.getInstance()); - List<CentralRoleFunction> roleFunction = null; - roleFunction = dataAccessService.getList( - CentralRoleFunction.class, " where function_cd = '" - + externalpermission.getInstance() + "' and " + APP_ID_EQUALS + app.getId(), - null, null); - if (roleFunction.isEmpty()) { - String funcCode = externalpermission.getType() - .substring(app.getNameSpace().length() + 1) + FUNCTION_PIPE - + externalAccessPerms.getInstance(); - roleFunction = dataAccessService.getList(CentralRoleFunction.class, - " where function_cd = '" + funcCode + "' and " + APP_ID_EQUALS + app.getId(), null, - null); - } - if(!roleFunction.isEmpty()){ - EPAppRoleFunction apRoleFunction = new EPAppRoleFunction(); - apRoleFunction.setAppId(app.getId()); - apRoleFunction.setRoleId(Long.parseLong(ApplicationRole.getId())); - apRoleFunction.setCode(roleFunction.get(0).getCode()); - dataAccessService.saveDomainObject(apRoleFunction, null); - } - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "SyncApplicationRolesWithEcompDB: Failed to add role function", e); - } - } - } - externalRoleDetailsList.add(externalRoleDetail); - } - for (ExternalRoleDetails externalRole : externalRoleDetailsList) { - EPRole ecompRole = convertExternalRoleDetailstoEpRole(externalRole); - finalRoleList.add(ecompRole); - } - - List<EPRole> applicationRolesList = new ArrayList<>(); - applicationRolesList = getAppRoles(app.getId()); - List<String> applicationRoleIdList = new ArrayList<>(); - for (EPRole applicationRole : applicationRolesList) { - applicationRoleIdList.add(applicationRole.getName()); - } - - List<EPRole> roleListToBeAddInEcompDB = new ArrayList<>(); - for (EPRole aafRole : finalRoleList) { - if (!applicationRoleIdList.contains(aafRole.getName())) { - roleListToBeAddInEcompDB.add(aafRole); - } - } - - // Check if roles exits in external Access system and make it inactive - final Map<String, EPRole> checkRolesInactive = new HashMap<>(); - for (EPRole extrole : finalRoleList) { - checkRolesInactive.put(extrole.getName(), extrole); - } - for (EPRole role : applicationRolesList) { - try { - final Map<String, String> extRoleParams = new HashMap<>(); - List<EPRole> roleList = null; - extRoleParams.put("appRoleName", role.getName()); - if (!checkRolesInactive.containsKey(role.getName())) { - if (app.getId() == 1) { - roleList = dataAccessService.executeNamedQuery("getPortalAppRoles", extRoleParams, null); - } else { - extRoleParams.put(APP_ID, app.getId().toString()); - roleList = dataAccessService.executeNamedQuery("getRoletoUpdateAAF", extRoleParams, null); - } - EPRole updateRoleInactive = roleList.get(0); - updateRoleInactive.setActive(false); - dataAccessService.saveDomainObject(updateRoleInactive, null); - } - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "syncApplicationRolesWithEcompDB: Failed to de-activate role ", e); - } - } - - // It checks properties in the external auth system app role description and updates role in local - for (EPRole roleItem : finalRoleList) { - final Map<String, String> roleParams = new HashMap<>(); - List<EPRole> currentList = null; - roleParams.put("appRoleName", roleItem.getName()); - if (app.getId() == 1) { - currentList = dataAccessService.executeNamedQuery("getPortalAppRoles", roleParams, null); - } else { - roleParams.put(APP_ID, app.getId().toString()); - currentList = dataAccessService.executeNamedQuery("getRoletoUpdateAAF", roleParams, null); - } - - if (!currentList.isEmpty()) { - try { - Boolean aafRoleActive; - Boolean localRoleActive; - boolean result; - aafRoleActive = Boolean.valueOf(roleItem.getActive()); - localRoleActive = Boolean.valueOf(currentList.get(0).getActive()); - result = aafRoleActive.equals(localRoleActive); - EPRole updateRole = currentList.get(0); - - if (!result) { - updateRole.setActive(roleItem.getActive()); - dataAccessService.saveDomainObject(updateRole, null); - } - if (roleItem.getPriority() != null - && !currentList.get(0).getPriority().equals(roleItem.getPriority())) { - updateRole.setPriority(roleItem.getPriority()); - dataAccessService.saveDomainObject(updateRole, null); - } - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "syncApplicationRolesWithEcompDB: Failed to update role ", e); - } - } - } - - EPRole roleToBeAddedInEcompDB = new EPRole(); - for (int i = 0; i < roleListToBeAddInEcompDB.size(); i++) { - try { - roleToBeAddedInEcompDB = roleListToBeAddInEcompDB.get(i); - if (app.getId() == 1) { - roleToBeAddedInEcompDB.setAppRoleId(null); - } - dataAccessService.saveDomainObject(roleToBeAddedInEcompDB, null); - List<EPRole> getRoleCreatedInSync = null; - if (!app.getId().equals(PortalConstants.PORTAL_APP_ID)) { - getRoleCreatedInSync = dataAccessService.getList(EPRole.class, - WHERE_ROLE_NAME_EQUALS + roleToBeAddedInEcompDB.getName() + "' and app_id = "+app.getId(), null, null); - EPRole epUpdateRole = getRoleCreatedInSync.get(0); - epUpdateRole.setAppRoleId(epUpdateRole.getId()); - dataAccessService.saveDomainObject(epUpdateRole, null); - } - List<EPRole> roleList = new ArrayList<>(); - final Map<String, String> params = new HashMap<>(); - - params.put("appRoleName", roleToBeAddedInEcompDB.getName()); - if (app.getId() == 1) { - roleList = dataAccessService.executeNamedQuery("getPortalAppRoles", params, null); - } else { - params.put(APP_ID, app.getId().toString()); - roleList = dataAccessService.executeNamedQuery("getRoletoUpdateAAF", params, null); - } - EPRole role = roleList.get(0); - Role aaFrole = new Role(); - aaFrole.setId(role.getId()); - aaFrole.setActive(role.getActive()); - aaFrole.setPriority(role.getPriority()); - aaFrole.setName(role.getName()); - updateRoleInExternalSystem(aaFrole, app); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "SyncApplicationRolesWithEcompDB: Failed to add or update role in external auth system", e); - } - } - logger.debug(EELFLoggerDelegate.debugLogger, "syncApplicationRolesWithEcompDB: Finished"); - } catch (HttpClientErrorException e) { - logger.error(EELFLoggerDelegate.errorLogger, "Failed to SyncApplicationRolesWithEcompDB", e); - EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "syncApplicationRolesWithEcompDB: Failed ", e); - } - } - - /** - * - * It converts from ExternalRoleDetails.class object to EPRole.class object - * - * @param externalRoleDetails - * @return EPRole object - */ - private EPRole convertExternalRoleDetailstoEpRole(ExternalRoleDetails externalRoleDetails) { - EPRole role = new EPRole(); - role.setActive(externalRoleDetails.isActive()); - role.setAppId(externalRoleDetails.getAppId()); - role.setAppRoleId(externalRoleDetails.getAppRoleId()); - role.setName(externalRoleDetails.getName()); - role.setPriority(externalRoleDetails.getPriority()); - return role; - } - - @SuppressWarnings("unchecked") - @Override - public Integer bulkUploadUserRoles(String uebkey) throws Exception { - EPApp app = getApp(uebkey).get(0); - final Map<String, String> params = new HashMap<>(); - params.put("uebKey", app.getUebKey()); - List<BulkUploadUserRoles> userRolesList = null; - Integer userRolesAdded = 0; - if (app.getCentralAuth()) { - userRolesList = dataAccessService.executeNamedQuery("getBulkUserRoles", params, null); - for (BulkUploadUserRoles userRolesUpload : userRolesList) { - addUserRoleInExternalSystem(userRolesUpload); - userRolesAdded++; - } - } - return userRolesAdded; - } - - /** - * Its adding a user role in external auth system while doing bulk upload - * - * @param userRolesUpload - */ - private void addUserRoleInExternalSystem(BulkUploadUserRoles userRolesUpload) { - try { - String name = ""; - ObjectMapper mapper = new ObjectMapper(); - if (EPCommonSystemProperties - .containsProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN)) { - name = userRolesUpload.getOrgUserId() - + SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN); - } - ExternalAccessUser extUser = new ExternalAccessUser(name, - userRolesUpload.getAppNameSpace() + "." + userRolesUpload.getRoleName().replaceAll(" ", "_")); - String userRole = mapper.writeValueAsString(extUser); - HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth(); - HttpEntity<String> entity = new HttpEntity<>(userRole, headers); - template.exchange( - SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "userRole", - HttpMethod.POST, entity, String.class); - } catch(HttpClientErrorException e){ - logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to addUserRoleInExternalSystem", e); - EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); - } catch (Exception e) { - if (e.getMessage().equalsIgnoreCase("409 Conflict")) { - logger.error(EELFLoggerDelegate.errorLogger, "addUserRoleInExternalSystem: UserRole already exits but does not break functionality"); - } else { - logger.error(EELFLoggerDelegate.errorLogger, "addUserRoleInExternalSystem: Failed to addUserRoleInExternalSystem", e.getMessage()); - } - } - } - - @Override - public void deleteRoleDependencyRecords(Session localSession, Long roleId, Long appId) throws Exception { - try { - String sql = ""; - Query query = null; - - //It should delete only when it portal's roleId - if(appId.equals(PortalConstants.PORTAL_APP_ID)){ - // Delete from fn_role_function - sql = "DELETE FROM fn_role_function WHERE role_id=" + roleId; - logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql); - query = localSession.createSQLQuery(sql); - query.executeUpdate(); - - // Delete from fn_role_composite - sql = "DELETE FROM fn_role_composite WHERE parent_role_id=" + roleId + " OR child_role_id=" + roleId; - logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql); - query = localSession.createSQLQuery(sql); - query.executeUpdate(); - } - - // Delete from ep_app_role_function - sql = "DELETE FROM ep_app_role_function WHERE role_id=" + roleId; - logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql); - query = localSession.createSQLQuery(sql); - query.executeUpdate(); - - // Delete from ep_role_notification - sql = "DELETE FROM ep_role_notification WHERE role_id=" + roleId; - logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql); - query = localSession.createSQLQuery(sql); - query.executeUpdate(); - - // Delete from fn_user_pseudo_role - sql = "DELETE FROM fn_user_pseudo_role WHERE pseudo_role_id=" + roleId; - logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql); - query = localSession.createSQLQuery(sql); - query.executeUpdate(); - - // Delete form EP_WIDGET_CATALOG_ROLE - sql = "DELETE FROM EP_WIDGET_CATALOG_ROLE WHERE role_id=" + roleId; - logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql); - query = localSession.createSQLQuery(sql); - query.executeUpdate(); - - // Delete form EP_WIDGET_CATALOG_ROLE - sql = "DELETE FROM ep_user_roles_request_det WHERE requested_role_id=" + roleId; - logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql); - query = localSession.createSQLQuery(sql); - query.executeUpdate(); - - // Delete form fn_menu_functional_roles - sql = "DELETE FROM fn_menu_functional_roles WHERE role_id=" + roleId; - logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql); - query = localSession.createSQLQuery(sql); - query.executeUpdate(); - - } catch (Exception e) { - logger.debug(EELFLoggerDelegate.debugLogger, "deleteRoleDependeciesRecord: failed ", e); - throw new Exception("delete Failed" + e.getMessage()); - } - - } - - @SuppressWarnings("unchecked") - @Override - public List<String> getMenuFunctionsList(String uebkey) throws Exception { - List<String> appMenuFunctionsList = null; - try { - EPApp app = getApp(uebkey).get(0); - final Map<String, Long> appParams = new HashMap<>(); - appParams.put(APP_ID, app.getId()); - appMenuFunctionsList = dataAccessService.executeNamedQuery("getMenuFunctions", appParams, null); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "getMenuFunctionsList: Failed", e); - return appMenuFunctionsList; - } - return appMenuFunctionsList; - } - - @SuppressWarnings({ "unchecked"}) - @Override - public List<EcompUser> getAllAppUsers(String uebkey) throws Exception { - List<String> usersList = new ArrayList<>(); - List<EcompUser> usersfinalList = new ArrayList<>(); - try { - EPApp app = getApp(uebkey).get(0); - final Map<String, Long> appParams = new HashMap<>(); - appParams.put("appId", app.getId()); - List<EcompUserRoles> userList = (List<EcompUserRoles>) dataAccessService - .executeNamedQuery("ApplicationUserRoles", appParams, null); - for (EcompUserRoles ecompUserRole : userList) { - boolean found = false; - Set<EcompRole> roles = null; - for (EcompUser user : usersfinalList) { - if (user.getOrgUserId().equals(ecompUserRole.getOrgUserId())) { - EcompRole ecompRole = new EcompRole(); - ecompRole.setId(ecompUserRole.getRoleId()); - ecompRole.setName(ecompUserRole.getRoleName()); - roles = user.getRoles(); - roles.add(ecompRole); - user.setRoles(roles); - found = true; - break; - } - } - - if (!found) { - EcompUser epUser = new EcompUser(); - epUser.setOrgId(ecompUserRole.getOrgId()); - epUser.setManagerId(ecompUserRole.getManagerId()); - epUser.setFirstName(ecompUserRole.getFirstName()); - epUser.setLastName(ecompUserRole.getLastName()); - epUser.setPhone(ecompUserRole.getPhone()); - epUser.setEmail(ecompUserRole.getEmail()); - epUser.setOrgUserId(ecompUserRole.getOrgUserId()); - epUser.setOrgCode(ecompUserRole.getOrgCode()); - epUser.setOrgManagerUserId(ecompUserRole.getOrgManagerUserId()); - epUser.setJobTitle(ecompUserRole.getJobTitle()); - epUser.setLoginId(ecompUserRole.getLoginId()); - epUser.setActive(true); - roles = new HashSet<>(); - EcompRole ecompRole = new EcompRole(); - ecompRole.setId(ecompUserRole.getRoleId()); - ecompRole.setName(ecompUserRole.getRoleName()); - roles.add(ecompRole); - epUser.setRoles(roles); - usersfinalList.add(epUser); - } - } - ObjectMapper mapper = new ObjectMapper(); - - for (EcompUser u1 : usersfinalList) { - String str = mapper.writeValueAsString(u1); - usersList.add(str); - } - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "getAllUsers failed", e); - throw e; - } - return usersfinalList; - } -} diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalsdk/core/lm/FusionLicenseManagerUtils.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalsdk/core/lm/FusionLicenseManagerUtils.java deleted file mode 100644 index ecfc0ea4..00000000 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalsdk/core/lm/FusionLicenseManagerUtils.java +++ /dev/null @@ -1,93 +0,0 @@ -/*- - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ -package org.openecomp.portalsdk.core.lm; - -import java.util.Date; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; - -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalsdk.core.util.SystemProperties; -//import org.openecomp.portalapp.lm.FusionLicenseManagerImpl; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.servlet.support.RequestContextUtils; - -@Component -public class FusionLicenseManagerUtils { - - @Autowired - private FusionLicenseManager licenseManager; - - @Autowired - private EPCommonSystemProperties sysProps; - static { - } - - public int verifyLicense(ServletContext context) { - if(sysProps == null) { - try { - sysProps = new EPCommonSystemProperties(); - sysProps.setServletContext(context); -// sysProps.load(); -// licenseManager = new FusionLicenseManagerImpl(new LicenseableClassImpl()); - System.out.println(licenseManager); - licenseManager.installLicense(); - } - catch(Exception ex) { - ex.printStackTrace(); - } - } - - - -// WebApplicationContext ctx =RequestContextUtils.getWebApplicationContext(request); -// int flag = ((FusionLicenseManager)ctx.getBean("fusionLicenseManager")).verifyLicense(request); -// logger.debug("****************FLAG ******************** " + flag); -// return flag; -// return 2; - return licenseManager.verifyLicense(context); - } - - public static Date getLicenseExpiryDate(HttpServletRequest request) { - WebApplicationContext ctx =RequestContextUtils.getWebApplicationContext(request); - return ((FusionLicenseManager)ctx.getBean("fusionLicenseManager")).getExpiredDate(); - } -} diff --git a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/defs/definitions.xml b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/defs/definitions.xml index f8207a1f..34995ae2 100644 --- a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/defs/definitions.xml +++ b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/defs/definitions.xml @@ -3,11 +3,11 @@ ============LICENSE_START========================================== ONAP Portal =================================================================== - Copyright © 2017 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. =================================================================== Unless otherwise specified, all software contained herein is licensed - under the Apache License, Version 2.0 (the “License”); + 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 @@ -20,7 +20,7 @@ limitations under the License. Unless otherwise specified, all documentation contained herein is licensed - under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + 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 diff --git a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/defs/definitions.xml b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/defs/definitions.xml index fd810ae8..2214b93a 100644 --- a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/defs/definitions.xml +++ b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/defs/definitions.xml @@ -3,11 +3,11 @@ ============LICENSE_START========================================== ONAP Portal =================================================================== - Copyright © 2017 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. =================================================================== Unless otherwise specified, all software contained herein is licensed - under the Apache License, Version 2.0 (the “License”); + 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 @@ -20,7 +20,7 @@ limitations under the License. Unless otherwise specified, all documentation contained herein is licensed - under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + 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 diff --git a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml index 8fe369fa..f82d2cb7 100644 --- a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml +++ b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml @@ -3,11 +3,11 @@ ============LICENSE_START========================================== ONAP Portal =================================================================== - Copyright © 2017 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. =================================================================== Unless otherwise specified, all software contained herein is licensed - under the Apache License, Version 2.0 (the “License”); + 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 @@ -20,7 +20,7 @@ limitations under the License. Unless otherwise specified, all documentation contained herein is licensed - under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + 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 @@ -41,7 +41,7 @@ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- Publishes mappings and queries specific to the ECOMP Portal application. --> -<hibernate-mapping package="org.openecomp.portalapp.portal.domain"> +<hibernate-mapping package="org.onap.portalapp.portal.domain"> <!-- Widget class mapping details --> <class name="Widget" table="FN_WIDGET"> @@ -195,6 +195,7 @@ <property name="jobTitle" column="job_title" /> <property name="siloStatus" column="silo_status" /> <property name="financialLocCode" column="fin_loc_code" /> + <property name="costCenter" column="cost_center" /> <property name="active" column="active_yn" type="yes_no" /> <property name="internal" column="is_internal_yn" type="yes_no" /> @@ -209,7 +210,7 @@ <set name="EPUserApps" table="FN_USER_ROLE" lazy="false" sort="natural" inverse="true"> <key column="user_id" /> - <one-to-many class="org.openecomp.portalapp.portal.domain.EPUserApp" /> + <one-to-many class="org.onap.portalapp.portal.domain.EPUserApp" /> </set> </class> @@ -282,9 +283,9 @@ <column name="user_id" precision="11" scale="0" /> </key-property> <key-many-to-one name="app" - class="org.openecomp.portalapp.portal.domain.EPApp" column="app_id" /> + class="org.onap.portalapp.portal.domain.EPApp" column="app_id" /> <key-many-to-one name="role" - class="org.openecomp.portalapp.portal.domain.EPRole" column="role_id" /> + class="org.onap.portalapp.portal.domain.EPRole" column="role_id" /> </composite-id> <property name="priority" type="java.lang.Short"> <column name="priority" precision="4" scale="0" /> @@ -408,21 +409,21 @@ sort="natural"> <key column="role_id" /> <many-to-many column="function_cd" - class="org.openecomp.portalsdk.core.domain.RoleFunction" /> + class="org.onap.portalsdk.core.domain.RoleFunction" /> </set> <set name="childRoles" table="FN_ROLE_COMPOSITE" lazy="false" sort="natural"> <key column="parent_role_id" /> <many-to-many column="child_role_id" - class="org.openecomp.portalapp.portal.domain.EPRole" /> + class="org.onap.portalapp.portal.domain.EPRole" /> </set> <set name="parentRoles" table="FN_ROLE_COMPOSITE" lazy="false" sort="natural"> <key column="child_role_id" /> <many-to-many column="parent_role_id" - class="org.openecomp.portalapp.portal.domain.EPRole" /> + class="org.onap.portalapp.portal.domain.EPRole" /> </set> </class> @@ -466,10 +467,11 @@ <property name="roleId" column="role_id"></property> <property name="appId" column="app_id"></property> <property name="code" column="function_cd"></property> + <property name="roleAppId" column="role_app_id"></property> </class> <!-- CentralRoleFunction class mapping details --> - <class name="CentralRoleFunction" table="ep_app_function"> + <class name="CentralV2RoleFunction" table="ep_app_function"> <composite-id> <key-property name="appId" column="app_id" /> @@ -507,7 +509,7 @@ lazy="false" cascade="save-update, persist" inverse="true" fetch="select"> <key column="req_id" /> <one-to-many - class="org.openecomp.portalapp.portal.domain.EPUserAppRolesRequestDetail" /> + class="org.onap.portalapp.portal.domain.EPUserAppRolesRequestDetail" /> </set> </class> @@ -521,7 +523,7 @@ <property name="reqRoleId" column="requested_role_id" /> <property name="reqType" column="request_type" /> <many-to-one name="epRequestIdData" fetch="select" - class="org.openecomp.portalapp.portal.domain.EPUserAppRolesRequest"> + class="org.onap.portalapp.portal.domain.EPUserAppRolesRequest"> <column name="req_id" not-null="true" /> </many-to-one> </class> @@ -550,7 +552,7 @@ <!-- requires values for named parameters :searchQuery and :userId --> <sql-query name="searchPortal"> <return alias="searchResult" - class="org.openecomp.portalapp.portal.ecomp.model.SearchResultItem" /> + class="org.onap.portalapp.portal.ecomp.model.SearchResultItem" /> <![CDATA[ select @rn /*'*/:=/*'*/ @rn+1 AS rowId, CATEGORY, NAME, UUID, TARGET from ( ( @@ -559,7 +561,15 @@ upper( :searchQuery ) != '' and (upper(first_name) like upper(CONCAT('%', :searchQuery, '%')) or upper(last_name) like upper(CONCAT('%', :searchQuery, '%')) - or upper(org_user_id) like upper(CONCAT('%', :searchQuery, '%'))) + or upper(org_user_id) like upper(CONCAT('%', :searchQuery, '%')) + or + ((first_name LIKE (SELECT concat('%',trim(SUBSTRING(:searchQuery, 1, INSTR(:searchQuery,' '))),'%')) + AND + last_name LIKE (concat('%',(SELECT(SUBSTRING(:searchQuery, INSTR(:searchQuery,' ')+1, LENGTH(:searchQuery)))),'%'))) + OR + (last_name LIKE (SELECT concat('%',trim(SUBSTRING(:searchQuery, 1, INSTR(:searchQuery,' '))),'%')) + AND + first_name LIKE (concat('%',(SELECT(SUBSTRING(:searchQuery, INSTR(:searchQuery,' ')+1, LENGTH(:searchQuery)))),'%'))))) and upper(active_yn) = 'Y' ) union @@ -656,7 +666,7 @@ <!-- requires values for named parameters :searchQuery and :userId --> <sql-query name="getNotifications"> <return alias="notificationResult" - class="org.openecomp.portalapp.portal.transport.EpNotificationItem" /> + class="org.onap.portalapp.portal.transport.EpNotificationItem" /> <![CDATA[ select @rn /*'*/:=/*'*/ @rn+1 AS rowId, notification_ID, is_for_online_users,is_for_all_roles, msg_header, msg_description,msg_source, start_Time, end_time, priority, created_date, creator_ID,notification_hyperlink, active_YN from ( @@ -730,9 +740,8 @@ ]]> </sql-query> - <sql-query name="getUsersByOrgIdsNotifications"> - <return alias="getUsersByOrgIdsNotificationsResult" class="org.openecomp.portalapp.portal.domain.EPUser"/> + <return alias="getUsersByOrgIdsNotificationsResult" class="org.onap.portalapp.portal.domain.EPUser"/> <![CDATA[ SELECT * from fn_user where org_user_id in (:OrgIds) ]]> @@ -743,7 +752,7 @@ <!-- Gets all Admin notification history; accepts no parameters --> <sql-query name="getAdminNotificationHistoryVO"> <return alias="adminNotificationHistoryVOResult" - class="org.openecomp.portalapp.portal.transport.EpNotificationItemVO" /> + class="org.onap.portalapp.portal.transport.EpNotificationItemVO" /> <![CDATA[ SELECT * from ( SELECT @@ -799,7 +808,7 @@ SELECT <sql-query name="getEpNotificationAppRoles"> <return alias="notificationAppRoles" - class="org.openecomp.portalapp.portal.domain.EcompAppRole" /> + class="org.onap.portalapp.portal.domain.EcompAppRole" /> <!-- This query requires no parameters. --> <![CDATA[ @@ -819,7 +828,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!-- Gets all notification history --> <sql-query name="getNotificationHistoryVO"> <return alias="notificationHistoryVOResult" - class="org.openecomp.portalapp.portal.transport.EpNotificationItemVO" /> + class="org.onap.portalapp.portal.transport.EpNotificationItemVO" /> <![CDATA[ SELECT notificationId, isForOnlineUsers, isForAllRoles, msgHeader, msgDescription,msgSource, @@ -957,7 +966,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!-- Gets role details for a specified notification --> <sql-query name="getNotificationRoles"> <return alias="notificationRolesResult" - class="org.openecomp.portalapp.portal.transport.EpRoleNotificationItem" /> + class="org.onap.portalapp.portal.transport.EpRoleNotificationItem" /> <![CDATA[ SELECT * FROM @@ -970,7 +979,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!-- Gets all applications, possibly with contact information --> <sql-query name="getAppsAndContacts"> <return alias="appContactUs" - class="org.openecomp.portalapp.portal.ecomp.model.AppContactUsItem" /> + class="org.onap.portalapp.portal.ecomp.model.AppContactUsItem" /> <!-- This query requires no parameters. --> <![CDATA[ select @@ -992,7 +1001,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!-- Gets all rows from the app-contact-us table, extended with app information --> <sql-query name="getAppContactUsItems"> <return alias="appContactUs" - class="org.openecomp.portalapp.portal.ecomp.model.AppContactUsItem" /> + class="org.onap.portalapp.portal.ecomp.model.AppContactUsItem" /> <!-- This query requires no parameters. --> <![CDATA[ select @@ -1013,7 +1022,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!-- Gets one row for each app with the category and catenated functions. --> <sql-query name="getAppCategoryFunctions"> <return alias="appCategoryFunctions" - class="org.openecomp.portalapp.portal.ecomp.model.AppCategoryFunctionsItem" /> + class="org.onap.portalapp.portal.ecomp.model.AppCategoryFunctionsItem" /> <!-- This query requires no parameters. --> <![CDATA[ SELECT @rn /*'*/:=/*'*/ @rn+1 AS rowId, @@ -1051,7 +1060,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!-- Gets one row for each function-application-role combination. --> <sql-query name="getAppAccessFunctionRole"> <return alias="appAccessFunctionRole" - class="org.openecomp.portalapp.portal.domain.GetAccessResult" /> + class="org.onap.portalapp.portal.domain.GetAccessResult" /> <!-- This query requires one parameters. --> <![CDATA[ select @rn /*'*/:=/*'*/ @rn+1 AS row_id, t.role_id, t.ECOMP_FUNCTION, t.APP_NAME, t.APP_MOTS_ID, t.ROLE_NAME, @@ -1099,21 +1108,21 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y </sql-query> <sql-query name="getActiveUsers"> - <return alias="EPUser" class="org.openecomp.portalapp.portal.domain.EPUser" /> + <return alias="EPUser" class="org.onap.portalapp.portal.domain.EPUser" /> <![CDATA[ SELECT * FROM FN_USER WHERE active_yn='Y' ]]> </sql-query> <sql-query name="getAppsAdmins"> - <return alias="adminUserApp" class="org.openecomp.portalapp.portal.domain.AdminUserApp" /> + <return alias="adminUserApp" class="org.onap.portalapp.portal.domain.AdminUserApp" /> <![CDATA[ SELECT apps.APP_NAME, apps.APP_ID, user.USER_ID, user.FIRST_NAME, user.LAST_NAME, user.org_user_id FROM fn_user_role userrole INNER JOIN fn_user user ON user.USER_ID = userrole.USER_ID INNER JOIN fn_app apps ON apps.APP_ID = userrole.APP_ID WHERE user.active_yn='Y' AND userrole.ROLE_ID = :accountAdminRoleId AND (apps.ENABLED = 'Y' OR apps.APP_ID=1) ]]> </sql-query> <sql-query name="getPortalAdmins"> - <return alias="portalAdmin" class="org.openecomp.portalapp.portal.transport.PortalAdmin" /> + <return alias="portalAdmin" class="org.onap.portalapp.portal.transport.PortalAdmin" /> <![CDATA[ SELECT u.user_id, u.first_name, u.last_name, u.login_id FROM fn_user u, fn_user_role ur WHERE u.active_yn = 'Y' AND u.user_id = ur.user_id AND ur.role_id= :adminRoleId ]]> @@ -1121,7 +1130,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!-- Gets personalized list of enabled and accessible apps for regular user --> <sql-query name="getPersUserApps"> - <return alias="persUserApps" class="org.openecomp.portalapp.portal.domain.EPApp" /> + <return alias="persUserApps" class="org.onap.portalapp.portal.domain.EPApp" /> <!-- This query requires one parameter: userId (number) --> <![CDATA[ select @@ -1149,7 +1158,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!-- Gets personalized list of enabled and accessible apps for Portal (super) admin --> <sql-query name="getPersAdminApps"> - <return alias="persAdminApps" class="org.openecomp.portalapp.portal.domain.EPApp" /> + <return alias="persAdminApps" class="org.onap.portalapp.portal.domain.EPApp" /> <!-- This query requires one parameter: userId (number) --> <![CDATA[ select @@ -1179,7 +1188,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!-- Gets personalized list of enabled and accessible Admin apps by name --> <sql-query name="getPersAdminAppsOrderByName"> - <return alias="AdminAppsOrderByName" class="org.openecomp.portalapp.portal.domain.EPApp" /> + <return alias="AdminAppsOrderByName" class="org.onap.portalapp.portal.domain.EPApp" /> <!-- This query requires one parameter: userId (number) --> <![CDATA[ select @@ -1202,15 +1211,25 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y or (a.OPEN = 'N' and r.ROLE_ID is null and p.STATUS_CD = 'S') ) - order by app_name - ; + union + select distinct -- multiple roles yield multiple rows + b.APP_ID , b.APP_NAME , b.APP_IMAGE_URL ,b.APP_DESCRIPTION , + b.APP_NOTES , b.APP_URL , b.APP_ALTERNATE_URL , b.APP_REST_ENDPOINT , + b.ML_APP_NAME , b.ML_APP_ADMIN_ID , b.MOTS_ID , b.APP_PASSWORD , + b.THUMBNAIL , b.APP_USERNAME , b.OPEN , b.ENABLED , + b.UEB_TOPIC_NAME , b.UEB_KEY , b.UEB_SECRET , b.APP_TYPE , b.AUTH_CENTRAL , + b.AUTH_NAMESPACE + from fn_user_role a, fn_app b, ep_app_role_function c , fn_role d , ep_app_function e + where a.user_id =:userId and b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and a.role_id = d.role_id and e.app_id = c.app_id + order by app_name + ; ]]> </sql-query> <!--Gets personalized list of enabled and accessible User apps by name --> <sql-query name="getPersUserAppsOrderByName"> - <return alias="UserAppsOrderByName" class="org.openecomp.portalapp.portal.domain.EPApp" /> + <return alias="UserAppsOrderByName" class="org.onap.portalapp.portal.domain.EPApp" /> <!-- This query requires one parameter: userId (number) --> <![CDATA[ select @@ -1231,8 +1250,18 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y or (a.OPEN = 'N' and r.USER_ID is not null and (p.STATUS_CD is null or p.STATUS_CD != 'H')) ) - order by app_name - ; + union + select distinct -- multiple roles yield multiple rows + b.APP_ID , b.APP_NAME , b.APP_IMAGE_URL ,b.APP_DESCRIPTION , + b.APP_NOTES , b.APP_URL , b.APP_ALTERNATE_URL , b.APP_REST_ENDPOINT , + b.ML_APP_NAME , b.ML_APP_ADMIN_ID , b.MOTS_ID , b.APP_PASSWORD , + b.THUMBNAIL , b.APP_USERNAME , b.OPEN , b.ENABLED , + b.UEB_TOPIC_NAME , b.UEB_KEY , b.UEB_SECRET , b.APP_TYPE , b.AUTH_CENTRAL , + b.AUTH_NAMESPACE + from fn_user_role a, fn_app b, ep_app_role_function c , fn_role d , ep_app_function e + where a.user_id =:userId and b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and a.role_id = d.role_id and e.app_id = c.app_id + order by app_name + ; ]]> </sql-query> @@ -1241,8 +1270,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!--Gets personalized list of enabled and accessible Super Admin apps by LastUsed --> <sql-query name="getAdminAppsOrderByLastUsed"> - <return alias="AdminAppsOrderByLastUsed" class="org.openecomp.portalapp.portal.domain.EPApp" /> - + <return alias="AdminAppsOrderByLastUsed" class="org.onap.portalapp.portal.domain.EPApp" /> <![CDATA[ select * @@ -1266,6 +1294,16 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y or (a.OPEN = 'N' and r.ROLE_ID is null and p.STATUS_CD = 'S') ) + union + select distinct -- multiple roles yield multiple rows + b.APP_ID , b.APP_NAME , b.APP_IMAGE_URL ,b.APP_DESCRIPTION , + b.APP_NOTES , b.APP_URL , b.APP_ALTERNATE_URL , b.APP_REST_ENDPOINT , + b.ML_APP_NAME , b.ML_APP_ADMIN_ID , b.MOTS_ID , b.APP_PASSWORD , + b.THUMBNAIL , b.APP_USERNAME , b.OPEN , b.ENABLED , + b.UEB_TOPIC_NAME , b.UEB_KEY , b.UEB_SECRET , b.APP_TYPE , b.AUTH_CENTRAL , + b.AUTH_NAMESPACE + from fn_user_role a, fn_app b, ep_app_role_function c , fn_role d , ep_app_function e + where a.user_id =:userId and b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and a.role_id = d.role_id and e.app_id = c.app_id ) A left outer join (select distinct @@ -1279,8 +1317,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!--Gets personalized list of enabled and accessible User apps by LastUsed --> <sql-query name="getUserAppsOrderByLastUsed"> - <return alias="UserAppsOrderByLastUsed" class="org.openecomp.portalapp.portal.domain.EPApp" /> - + <return alias="UserAppsOrderByLastUsed" class="org.onap.portalapp.portal.domain.EPApp" /> <![CDATA[ select * from (select distinct -- multiple roles yield multiple rows @@ -1299,7 +1336,18 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y (a.OPEN = 'Y' and p.STATUS_CD = 'S') or (a.OPEN = 'N' and r.USER_ID is not null and (p.STATUS_CD is null or p.STATUS_CD != 'H')) - )) A + )union + select distinct -- multiple roles yield multiple rows + b.APP_ID , b.APP_NAME , b.APP_IMAGE_URL ,b.APP_DESCRIPTION , + b.APP_NOTES , b.APP_URL , b.APP_ALTERNATE_URL , b.APP_REST_ENDPOINT , + b.ML_APP_NAME , b.ML_APP_ADMIN_ID , b.MOTS_ID , b.APP_PASSWORD , + b.THUMBNAIL , b.APP_USERNAME , b.OPEN , b.ENABLED , + b.UEB_TOPIC_NAME , b.UEB_KEY , b.UEB_SECRET , b.APP_TYPE , b.AUTH_CENTRAL , + b.AUTH_NAMESPACE + from fn_user_role a, fn_app b, ep_app_role_function c , fn_role d , ep_app_function e + where a.user_id =:userId and b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and a.role_id = d.role_id and e.app_id = c.app_id + + ) A left outer join (select distinct c.AFFECTED_RECORD_ID, c.AUDIT_DATE @@ -1316,8 +1364,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!--Gets personalized list of enabled and accessible Super Admin apps by Most Used --> <sql-query name="getAdminAppsOrderByMostUsed"> - <return alias="AdminAppsOrderByMostUsed" class="org.openecomp.portalapp.portal.domain.EPApp" /> - + <return alias="AdminAppsOrderByMostUsed" class="org.onap.portalapp.portal.domain.EPApp" /> <![CDATA[ select * @@ -1340,7 +1387,16 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y (a.OPEN = 'N' and r.ROLE_ID is not null and (p.STATUS_CD is null or p.STATUS_CD != 'H')) or (a.OPEN = 'N' and r.ROLE_ID is null and p.STATUS_CD = 'S') - ) + )union + select distinct -- multiple roles yield multiple rows + b.APP_ID , b.APP_NAME , b.APP_IMAGE_URL ,b.APP_DESCRIPTION , + b.APP_NOTES , b.APP_URL , b.APP_ALTERNATE_URL , b.APP_REST_ENDPOINT , + b.ML_APP_NAME , b.ML_APP_ADMIN_ID , b.MOTS_ID , b.APP_PASSWORD , + b.THUMBNAIL , b.APP_USERNAME , b.OPEN , b.ENABLED , + b.UEB_TOPIC_NAME , b.UEB_KEY , b.UEB_SECRET , b.APP_TYPE , b.AUTH_CENTRAL , + b.AUTH_NAMESPACE + from fn_user_role a, fn_app b, ep_app_role_function c , fn_role d , ep_app_function e + where a.user_id =:userId and b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and a.role_id = d.role_id and e.app_id = c.app_id ) A left outer join (select FN_AUDIT_LOG.AFFECTED_RECORD_ID, COUNT(*) AS total_visits @@ -1359,8 +1415,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!--Gets personalized list of enabled and accessible NON Super Admin User apps by Most Used --> <sql-query name="getUserAppsOrderByMostUsed"> - <return alias="UserAppsOrderByMostUsed" class="org.openecomp.portalapp.portal.domain.EPApp" /> - + <return alias="UserAppsOrderByMostUsed" class="org.onap.portalapp.portal.domain.EPApp" /> <![CDATA[ select * from (select @@ -1380,7 +1435,17 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y (a.OPEN = 'Y' and p.STATUS_CD = 'S') or (a.OPEN = 'N' and r.USER_ID is not null and (p.STATUS_CD is null or p.STATUS_CD != 'H')) - ))A + )union + select distinct -- multiple roles yield multiple rows + b.APP_ID , b.APP_NAME , b.APP_IMAGE_URL ,b.APP_DESCRIPTION , + b.APP_NOTES , b.APP_URL , b.APP_ALTERNATE_URL , b.APP_REST_ENDPOINT , + b.ML_APP_NAME , b.ML_APP_ADMIN_ID , b.MOTS_ID , b.APP_PASSWORD , + b.THUMBNAIL , b.APP_USERNAME , b.OPEN , b.ENABLED , + b.UEB_TOPIC_NAME , b.UEB_KEY , b.UEB_SECRET , b.APP_TYPE , b.AUTH_CENTRAL , + b.AUTH_NAMESPACE + from fn_user_role a, fn_app b, ep_app_role_function c , fn_role d, ep_app_function e + where a.user_id =:userId and b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and a.role_id = d.role_id and e.app_id = c.app_id + )A left outer join (select FN_AUDIT_LOG.AFFECTED_RECORD_ID, COUNT(*) AS total_visits from FN_APP LEFT JOIN FN_AUDIT_LOG @@ -1397,8 +1462,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!--Gets personalized list of enabled and accessible Super Admin apps by Manual --> <sql-query name="getAdminAppsOrderByManual"> - <return alias="AdminAppsOrderByManual" class="org.openecomp.portalapp.portal.domain.EPApp" /> - + <return alias="AdminAppsOrderByManual" class="org.onap.portalapp.portal.domain.EPApp" /> <![CDATA[ select * from (select @@ -1420,7 +1484,17 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y (a.OPEN = 'N' and r.ROLE_ID is not null and (p.STATUS_CD is null or p.STATUS_CD != 'H')) or (a.OPEN = 'N' and r.ROLE_ID is null and p.STATUS_CD = 'S') - )) A + )union + select distinct -- multiple roles yield multiple rows + b.APP_ID , b.APP_NAME , b.APP_IMAGE_URL ,b.APP_DESCRIPTION , + b.APP_NOTES , b.APP_URL , b.APP_ALTERNATE_URL , b.APP_REST_ENDPOINT , + b.ML_APP_NAME , b.ML_APP_ADMIN_ID , b.MOTS_ID , b.APP_PASSWORD , + b.THUMBNAIL , b.APP_USERNAME , b.OPEN , b.ENABLED , + b.UEB_TOPIC_NAME , b.UEB_KEY , b.UEB_SECRET , b.APP_TYPE , b.AUTH_CENTRAL , + b.AUTH_NAMESPACE + from fn_user_role a, fn_app b, ep_app_role_function c , fn_role d, ep_app_function e + where a.user_id =:userId and b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and a.role_id = d.role_id and e.app_id = c.app_id + ) A left outer join (select m.app_id, m.sort_order from ep_pers_user_app_man_sort m @@ -1436,8 +1510,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!--Gets personalized list of enabled and accessible NON Super admin User apps by Manual --> <sql-query name="getUserAppsOrderByManual"> - <return alias="UserAppsOrderByManual" class="org.openecomp.portalapp.portal.domain.EPApp" /> - + <return alias="UserAppsOrderByManual" class="org.onap.portalapp.portal.domain.EPApp" /> <![CDATA[ select * from (select distinct -- multiple roles yield multiple rows @@ -1456,7 +1529,17 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y (a.OPEN = 'Y' and p.STATUS_CD = 'S') or (a.OPEN = 'N' and r.USER_ID is not null and (p.STATUS_CD is null or p.STATUS_CD != 'H')) - )) A + )union + select distinct -- multiple roles yield multiple rows + b.APP_ID , b.APP_NAME , b.APP_IMAGE_URL ,b.APP_DESCRIPTION , + b.APP_NOTES , b.APP_URL , b.APP_ALTERNATE_URL , b.APP_REST_ENDPOINT , + b.ML_APP_NAME , b.ML_APP_ADMIN_ID , b.MOTS_ID , b.APP_PASSWORD , + b.THUMBNAIL , b.APP_USERNAME , b.OPEN , b.ENABLED , + b.UEB_TOPIC_NAME , b.UEB_KEY , b.UEB_SECRET , b.APP_TYPE , b.AUTH_CENTRAL , + b.AUTH_NAMESPACE + from fn_user_role a, fn_app b, ep_app_role_function c , fn_role d, ep_app_function e + where a.user_id =:userId and b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and a.role_id = d.role_id and e.app_id = c.app_id + ) A left outer join (select m.app_id, m.sort_order from ep_pers_user_app_man_sort m @@ -1472,7 +1555,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y statuses --> <sql-query name="getUserAppCatalog"> <return alias="userAppCatalog" - class="org.openecomp.portalapp.portal.ecomp.model.AppCatalogItem" /> + class="org.onap.portalapp.portal.ecomp.model.AppCatalogItem" /> <!-- This query requires one parameter: userId (number) --> <![CDATA[ select @@ -1517,19 +1600,24 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y </sql-query> <sql-query name="getMyloginAppDetails"> - <return alias="myloginAppDetails" class="org.openecomp.portalapp.portal.domain.EPApp" /> - + <return alias="myloginAppDetails" class="org.onap.portalapp.portal.domain.EPApp" /> <![CDATA[ SELECT * FROM fn_app where ml_app_name =:appName ; ]]> </sql-query> + <sql-query name="getAppDetailsByAppName"> + <return alias="appDetailsByAppName" class="org.onap.portalapp.portal.domain.EPApp" /> + <![CDATA[ + SELECT * FROM fn_app where app_name =:appName + ; + ]]> + </sql-query> + <sql-query name="getMyAppDetailsByUebKey"> - <return alias="myAppDetailsByUebKey" class="org.openecomp.portalapp.portal.domain.EPApp" /> - + <return alias="myAppDetailsByUebKey" class="org.onap.portalapp.portal.domain.EPApp" /> <![CDATA[ - SELECT * FROM fn_app where ueb_key =:appKey ; ]]> @@ -1565,19 +1653,56 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y </sql-query> <sql-query name="getAppRoles"> - <return alias="appRoles" class="org.openecomp.portalapp.portal.domain.EPRole" /> - + <return alias="appRoles" class="org.onap.portalapp.portal.domain.EPRole" /> <![CDATA[ SELECT * FROM fn_role where role_name =:roleName and app_id =:appId ; ]]> </sql-query> + <sql-query name="getPartnerAppRolesList"> + <return alias="partnerAppRolesList" class="org.onap.portalapp.portal.domain.EPRole" /> + <![CDATA[ + SELECT * FROM fn_role where app_id =:appId + ; + ]]> + </sql-query> + + <sql-query name="getPortalAppRolesList"> + <return alias="portalAppRolesList" class="org.onap.portalapp.portal.domain.EPRole" /> + <![CDATA[ + SELECT * FROM fn_role where app_id is null + ; + ]]> + </sql-query> + + <sql-query name="getPortalAppRoleByRoleId"> + <return alias="portalAppByRoleId" class="org.onap.portalapp.portal.domain.EPRole" /> + <![CDATA[ + SELECT * FROM fn_role where role_id =:roleId and app_id is null + ; + ]]> + </sql-query> + + <sql-query name="getPartnerAppRoleByRoleId"> + <return alias="portalAppByRoleId" class="org.onap.portalapp.portal.domain.EPRole" /> + <![CDATA[ + SELECT * FROM fn_role where app_role_id =:appRoleId and app_id =:appId + ; + ]]> + </sql-query> + + <sql-query name="getPartnerAppRoleById"> + <return alias="portalAppByRoleId" class="org.onap.portalapp.portal.domain.EPRole" /> + <![CDATA[ + SELECT * FROM fn_role where role_id =:appRoleId and app_id =:appId + ; + ]]> + </sql-query> + <sql-query name="getPortalAppRoles"> - <return alias="appRoles" class="org.openecomp.portalapp.portal.domain.EPRole" /> - + <return alias="appRoles" class="org.onap.portalapp.portal.domain.EPRole" /> <![CDATA[ - SELECT * FROM fn_role where role_name =:appRoleName and app_id is null ; ]]> @@ -1585,7 +1710,6 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <sql-query name="deleteMicroserviceParameter"> <![CDATA[ - DELETE FROM ep_microservice_parameter WHERE service_id =:serviceId ; ]]> @@ -1593,7 +1717,6 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <sql-query name="deleteMicroserviceParameterById"> <![CDATA[ - DELETE FROM ep_microservice_parameter WHERE id =:paramId ; ]]> @@ -1601,7 +1724,6 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <sql-query name="deleteWidgetCatalogParameter"> <![CDATA[ - DELETE FROM ep_widget_catalog_parameter WHERE param_id =:paramId ; ]]> @@ -1609,17 +1731,14 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <sql-query name="deleteMicroservice"> <![CDATA[ - DELETE FROM ep_microservice WHERE id =:serviceId ; ]]> </sql-query> <sql-query name="epUserAppId"> - <return alias="userAppId" class="org.openecomp.portalapp.portal.domain.EPUser" /> - + <return alias="userAppId" class="org.onap.portalapp.portal.domain.EPUser" /> <![CDATA[ - SELECT * FROM FN_USER where ORG_USER_ID = :orgUserIdValue ; ]]> @@ -1627,10 +1746,8 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <sql-query name="userAppsSortPreferenceQuery"> <return alias="appsSortPreferenceQuery" - class="org.openecomp.portalapp.portal.domain.EPUserAppsSortPreference" /> - + class="org.onap.portalapp.portal.domain.EPUserAppsSortPreference" /> <![CDATA[ - SELECT * from EP_PERS_USER_APP_SORT e where e.USER_ID = :userId ]]> @@ -1638,10 +1755,8 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <sql-query name="userAppsManualSortPrfQuery"> <return alias="AppsManualSortPrfQuery" - class="org.openecomp.portalapp.portal.domain.EPUserAppsManualSortPreference" /> - + class="org.onap.portalapp.portal.domain.EPUserAppsManualSortPreference" /> <![CDATA[ - SELECT * from EP_PERS_USER_APP_MAN_SORT where USER_ID =:userId ]]> @@ -1649,7 +1764,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <sql-query name="userWidgetManualSortPrfQuery"> <return alias="widgetManualSortPrfQuery" - class="org.openecomp.portalapp.portal.domain.EPWidgetsManualSortPreference" /> + class="org.onap.portalapp.portal.domain.EPWidgetsManualSortPreference" /> <![CDATA[ SELECT * from EP_PERS_USER_WIDGET_PLACEMENT where USER_ID =:userId ]]> @@ -1657,7 +1772,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <sql-query name="appRoles"> <return alias="rolesForApp" - class="org.openecomp.portalapp.portal.domain.EPUserAppRoles" /> + class="org.onap.portalapp.portal.domain.EPUserAppRoles" /> <![CDATA[ SELECT ROLE_ID, APP_ID from FN_ROLE where APP_ROLE_ID = :appRoleId and app_id = :appId ; @@ -1666,7 +1781,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <sql-query name="userAppRolesRequestList"> <return alias="appRolesRequestList" - class="org.openecomp.portalapp.portal.domain.EPUserAppRolesRequest" /> + class="org.onap.portalapp.portal.domain.EPUserAppRolesRequest" /> <![CDATA[ SELECT req_id, user_id, app_id, created_date, updated_date, request_status from EP_USER_ROLES_REQUEST where user_id =:userId and app_id=:appId and request_status = 'P' ; @@ -1675,7 +1790,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <sql-query name="userAppRolesRequestDetailList"> <return alias="appRolesRequestDetailList" - class="org.openecomp.portalapp.portal.domain.EPUserAppRolesRequestDetail" /> + class="org.onap.portalapp.portal.domain.EPUserAppRolesRequestDetail" /> <![CDATA[ SELECT id, req_id, requested_role_id, request_type from EP_USER_ROLES_REQUEST_DET where req_id =:reqId @@ -1686,7 +1801,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!-- Gets list of enabled apps including accessible and select statuses --> <sql-query name="getAdminAppCatalog"> <return alias="adminAppCatalog" - class="org.openecomp.portalapp.portal.ecomp.model.AppCatalogItem" /> + class="org.onap.portalapp.portal.ecomp.model.AppCatalogItem" /> <!-- This query requires one parameter: userId (number) --> <![CDATA[ select @@ -1735,7 +1850,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <sql-query name="userAppCatalogRoles"> <return alias="epUserAppCatalogRoles" - class="org.openecomp.portalapp.portal.domain.EPUserAppCatalogRoles" /> + class="org.onap.portalapp.portal.domain.EPUserAppCatalogRoles" /> <![CDATA[ select a.req_id, B.requested_role_id , A.request_status , A.app_id , (select role_name from fn_role where role_id = B.requested_role_id) as role_name from ep_user_roles_request A left join ep_user_roles_request_det B @@ -1749,8 +1864,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <sql-query name="getUserApproles"> <return alias="businessCardUserApplicationRoles" - class="org.openecomp.portalapp.portal.transport.BusinessCardApplicationRole" /> - + class="org.onap.portalapp.portal.transport.BusinessCardApplicationRole" /> <![CDATA[ select fr.role_name, fa.app_name @@ -1764,7 +1878,6 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!--delete the records from ep_notification table when the endtime is more than 3 months--> <sql-query name="deleteNotificationsFromEpNotificationTable"> - <![CDATA[ delete from ep_notification where curdate() >= DATE_ADD(end_time,INTERVAL 3 MONTH) ]]> @@ -1773,7 +1886,6 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!-- delete the records from ep_role_notification table when the endtime is more than 3 months --> <sql-query name="deleteNotificationsFromEpRoleNotificationTable"> - <![CDATA[ delete from ep_role_notification where notification_id in (select notification_id from ep_notification where curdate() >= DATE_ADD(end_time,INTERVAL 3 MONTH)) ]]> @@ -1781,7 +1893,6 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!-- delete the records from ep_user_notification table when the endtime is more than 3 months--> <sql-query name="deleteNotificationsFromEpUserNotificationTable"> - <![CDATA[ delete from ep_user_notification where notification_id in (select notification_id from ep_notification where curdate() >= DATE_ADD(end_time,INTERVAL 3 MONTH)) ]]> @@ -1790,7 +1901,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!-- Gets list of role functions and it requires two parameters appId and roleId--> <sql-query name="getAppRoleFunctionList"> <return alias="appRoleFunctionList" - class="org.openecomp.portalapp.portal.domain.CentralRoleFunction" /> + class="org.onap.portalapp.portal.domain.CentralV2RoleFunction" /> <![CDATA[ SELECT DISTINCT f.app_id , f.function_cd, f.function_name from ep_app_role_function rf, ep_app_function f @@ -1803,7 +1914,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!-- Gets list of all role functions --> <sql-query name="getAllRoleFunctions"> <return alias="allRoleFunctions" - class="org.openecomp.portalapp.portal.domain.CentralRoleFunction" /> + class="org.onap.portalapp.portal.domain.CentralV2RoleFunction" /> <![CDATA[ SELECT * from ep_app_function where app_id =:appId @@ -1815,7 +1926,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!-- Get ep_app_function records provided by single parameter --> <sql-query name="getRoleFunction"> <return alias="RoleFunction" - class="org.openecomp.portalapp.portal.domain.CentralRoleFunction" /> + class="org.onap.portalapp.portal.domain.CentralV2RoleFunction" /> <![CDATA[ SELECT * from ep_app_function where function_cd like CONCAT('%', :functionCode,'%') and app_id =:appId @@ -1827,7 +1938,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!-- Gets the current user app roles records and requires two parameters --> <sql-query name="getUserAppCurrentRoles"> <return alias="userAppCurrentRoles" - class="org.openecomp.portalapp.portal.transport.EPUserAppCurrentRoles" /> + class="org.onap.portalapp.portal.transport.EPUserAppCurrentRoles" /> <![CDATA[ select distinct fu.role_id, fr.user_id, fu.role_name, fu.priority from fn_role fu left outer join fn_user_role fr ON fu.role_id = fr.role_id and fu.app_id = fr.app_id and fr.role_id != 999 where fu.app_id =:appId and fr.user_id =:userId @@ -1838,7 +1949,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!-- Gets the current user app roles along with account administrator and requires two parameters --> <sql-query name="getUserAppExistingRoles"> <return alias="userAppExistingRoles" - class="org.openecomp.portalapp.portal.transport.EcompUserAppRoles" /> + class="org.onap.portalapp.portal.transport.EcompUserAppRoles" /> <![CDATA[ select fr.role_name, fu.app_id, fu.user_id, fu.priority, fu.role_id from fn_user_role fu left outer join fn_role fr on fu.role_id = fr.role_id @@ -1850,7 +1961,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!-- Gets the current user app roles records and requires two parameters --> <sql-query name="getAllFunctions"> <return alias="allFunctions" - class="org.openecomp.portalsdk.core.domain.RoleFunction" /> + class="org.onap.portalsdk.core.domain.RoleFunction" /> <![CDATA[ select * from fn_function ; @@ -1860,15 +1971,15 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y <!-- Gets the all role functions and requires one parameters --> <sql-query name="uploadAllRoleFunctions"> <return alias="allRoleFunctions" - class="org.openecomp.portalapp.portal.transport.BulkUploadRoleFunction" /> + class="org.onap.portalapp.portal.transport.BulkUploadRoleFunction" /> <![CDATA[ select fr.function_cd, fn.function_name from fn_role_function fr left outer join fn_function fn on fr.function_cd = fn.function_cd where role_id =:roleId ; ]]> </sql-query> - <sql-query name="getRoletoUpdateAAF"> - <return alias="getRoletoUpdateAAF" class="org.openecomp.portalapp.portal.domain.EPRole" /> + <sql-query name="getRoletoUpdateInExternalAuthSystem"> + <return alias="roletoUpdateInExternalAuthSystem" class="org.onap.portalapp.portal.domain.EPRole" /> <![CDATA[ SELECT * FROM fn_role where role_name =:appRoleName and app_id =:appId ; @@ -1876,18 +1987,29 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y </sql-query> <sql-query name="getBulkUserRoles"> - <return alias="bulkUserRoles" class="org.openecomp.portalapp.portal.transport.BulkUploadUserRoles" /> + <return alias="bulkUserRoles" class="org.onap.portalapp.portal.transport.BulkUploadUserRoles" /> <![CDATA[ select fr.role_name, fu.org_user_id, fa.auth_namespace from fn_user_role fur left outer join fn_role fr on fr.role_id = fur.role_id left outer join fn_app fa on fa.app_id = fur.app_id - left outer join fn_user fu on fu.user_id = fur.user_id where fa.ueb_key =:uebKey and fu.org_user_id != 'su1234' + left outer join fn_user fu on fu.user_id = fur.user_id where fa.ueb_key =:uebKey + ; + ]]> + </sql-query> + + <sql-query name="getBulkUsersForSingleRole"> + <return alias="bulkUsersForSingleRole" class="org.onap.portalapp.portal.transport.BulkUploadUserRoles" /> + <![CDATA[ + select fr.role_name, fu.org_user_id, fa.auth_namespace from fn_user_role fur + left outer join fn_role fr on fr.role_id = fur.role_id + left outer join fn_app fa on fa.app_id = fur.app_id + left outer join fn_user fu on fu.user_id = fur.user_id where fa.ueb_key =:uebKey and fr.role_id =:roleId ; ]]> </sql-query> <sql-query name="getCentralizedApps"> - <return alias="centralizedApps" class="org.openecomp.portalapp.portal.domain.EPApp" /> + <return alias="centralizedApps" class="org.onap.portalapp.portal.domain.EPApp" /> <![CDATA[ select * from fn_app where auth_central = 'Y' and open = 'N'; ; @@ -1895,8 +2017,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y </sql-query> <sql-query name="getUserRoles"> - <return alias="getUserRolesList" class="org.openecomp.portalapp.portal.domain.UserRole" /> - + <return alias="getUserRolesList" class="org.onap.portalapp.portal.domain.UserRole" /> <![CDATA[ SELECT DISTINCT user.USER_ID, role.ROLE_ID, user.org_user_id, user.FIRST_NAME, user.LAST_NAME, role.ROLE_NAME FROM fn_user_role userrole INNER JOIN fn_user user ON user.USER_ID = userrole.USER_ID INNER JOIN fn_role role ON role.ROLE_ID = userrole.ROLE_ID WHERE user.org_user_id =:org_user_id and userrole.app_id = 1 @@ -1910,12 +2031,20 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y and fu.app_id = ep.app_id and fu.user_id =:userId and ep.app_id = 1 and ea.function_cd = ep.function_cd - ; + union + select distinct app_r_f.function_cd from ep_app_role_function app_r_f, ep_app_function a_f + where role_id = 999 + and app_r_f.function_cd = a_f.function_cd + and exists + ( + select fa.app_id from fn_user fu, fn_user_role ur, fn_app fa where fu.user_id =:userId and fu.user_id = ur.user_id + and ur.role_id = 999 and ur.app_id = fa.app_id and fa.enabled = 'Y' + ); ]]> </sql-query> <sql-query name="getUserRolesForLeftMenu"> - <return alias="getUserRolesListForLeftMenu" class="org.openecomp.portalapp.portal.domain.UserRole" /> + <return alias="getUserRolesListForLeftMenu" class="org.onap.portalapp.portal.domain.UserRole" /> <![CDATA[ SELECT DISTINCT user.USER_ID, role.ROLE_ID, user.org_user_id, user.FIRST_NAME, user.LAST_NAME, role.ROLE_NAME FROM fn_user_role userrole @@ -1927,6 +2056,19 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y ]]> </sql-query> + <sql-query name="getRolesForLeftMenu"> + <return alias="getUserRolesListForLeftMenu" class="org.onap.portalapp.portal.domain.UserRole" /> + + <![CDATA[ + SELECT DISTINCT user.USER_ID, role.ROLE_ID, user.org_user_id, user.FIRST_NAME, user.LAST_NAME, role.ROLE_NAME FROM fn_user_role userrole + INNER JOIN fn_user user ON user.USER_ID = userrole.USER_ID + INNER JOIN fn_app app ON app.app_id= userrole.app_id + INNER JOIN fn_role role ON role.ROLE_ID = userrole.ROLE_ID + WHERE user.org_user_id =:org_user_id and (userrole.app_id = 1 or role.role_id = 999) and ((app.enabled='Y' and auth_central='Y' ) or app.app_id=1) + ; + ]]> + </sql-query> + <!-- Gets all functions for an application along with global functions and requires single parameter --> <sql-query name="getMenuFunctions"> <![CDATA[ @@ -1934,21 +2076,21 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y where f.app_id =:appId UNION select epa.function_cd from fn_role fnr, ep_app_role_function epr, ep_app_function epa where epr.role_id = fnr.role_id - and epa.function_cd = epr.function_cd and fnr.role_name like 'global%' + and epa.function_cd = epr.function_cd and fnr.role_name like 'global%' and fnr.app_id is null and epr.app_id = 1 ; ]]> </sql-query> <sql-query name="getRequestIdsForApp"> - <return alias="getRequestIdsForApp" class="org.openecomp.portalapp.portal.domain.EPUserAppRolesRequest" /> + <return alias="getRequestIdsForApp" class="org.onap.portalapp.portal.domain.EPUserAppRolesRequest" /> <![CDATA[ select * from ep_user_roles_request where app_id =:app_id ; ]]> </sql-query> - + <sql-query name="ApplicationUserRoles"> - <return alias="ApplicationUserRoles" class="org.openecomp.portalapp.portal.transport.EcompUserRoles" /> + <return alias="ApplicationUserRoles" class="org.onap.portalapp.portal.transport.EcompUserRoles" /> <![CDATA[ select distinct fu.org_id, fu.manager_id, fu.first_name, fu.middle_name, fu.last_name, fu.phone, fu.email, fu.hrid, fu.org_user_id, fu.org_code, fu.org_manager_userid, fu.job_title, fu.login_id, fu.active_yn , fr.app_role_id, fr.role_name @@ -1962,6 +2104,35 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y ]]> </sql-query> + <sql-query name="getCurrentAppRoleFunctions"> + <return alias="ApplicationUserRoles" class="org.onap.portalapp.portal.transport.LocalRole" /> + <![CDATA[ + select distinct fr.role_id, fr.role_name from fn_role fr, ep_app_function ef, ep_app_role_function epr where fr.role_id = epr.role_id and epr.function_cd = ef.function_cd + and ef.function_cd =:functionCd and epr.app_id =:appId + ; + ]]> + </sql-query> + + <sql-query name="deleteUserWidgetPlacement"> + <![CDATA[ + DELETE FROM ep_pers_user_widget_placement WHERE user_id =:userId AND widget_id =:widgetId + ; + ]]> + </sql-query> + + <sql-query name="getCentralizedAppsOfUser"> + <return alias="CentralizedAppsForRoles" class="org.onap.portalapp.portal.domain.CentralizedApp" /> + <![CDATA[ + + select distinct fa.app_id, fa.app_name + from fn_role fr, fn_user_role fur, fn_app fa, fn_user fu + Where fu.user_id = fur.user_id and fur.role_id = fr.role_id and fa.app_id = fur.app_id + and fu.org_user_id = :userId and (fur.role_id = 999 or fur.role_id = 1) and fr.active_yn='Y' and ((fa.enabled = 'Y' and fa.auth_central='Y') or fa.app_id =1) + ; + + ]]> + </sql-query> + <query name="getEPUserByOrgUserId"> <![CDATA[ FROM EPUser WHERE orgUserId = :org_user_id @@ -1979,5 +2150,193 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y FROM EPUser WHERE loginId = :login_id and loginPwd = :login_pwd ]]> </query> - + + <sql-query name="getGlobalRoleWithApplicationRoleFunctions"> + <return alias="getGlobalRoleWithApplicationRoleFunctions" class="org.onap.portalapp.portal.transport.GlobalRoleWithApplicationRoleFunction" /> + <![CDATA[ + + select distinct d.role_id, d.role_name , c.function_cd , e.function_name , d.active_yn , d.priority , c.app_id, c.role_app_id + from fn_user_role a, fn_app b, ep_app_role_function c , fn_role d , ep_app_function e + where b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and e.function_cd = c.function_cd and c.app_id= :appId and e.app_id=c.app_id + ; + + ]]> + </sql-query> + + <sql-query name="getGlobalRolesOfPortal"> + <return alias="getGlobalRolesOfPortal" class="org.onap.portalapp.portal.domain.EPRole" /> + <![CDATA[ + select * from fn_role where role_name like 'global_%' and app_id is null and active_yn='Y' + ; + ]]> + </sql-query> + + <sql-query name="getAppRoleFunctionOnRoleIdandAppId"> + <return alias="appRoleFunctionOnRoleIdandAppId" class="org.onap.portalapp.portal.domain.EPAppRoleFunction" /> + <![CDATA[ + select * from ep_app_role_function where app_id =:appId and role_id =:roleId + ; + ]]> + </sql-query> + + <sql-query name="getAppFunctionOnCodeAndAppId"> + <return alias="appFunctionOnCodeAndAppId" class="org.onap.portalapp.portal.domain.CentralV2RoleFunction" /> + <![CDATA[ + select * from ep_app_function where app_id =:appId and function_cd =:functionCd + ; + ]]> + </sql-query> + + <sql-query name="getGlobalRoleForRequestedApp"> + <return alias="getGlobalRoleForRequestedApp" class="org.onap.portalapp.portal.transport.GlobalRoleWithApplicationRoleFunction" /> + <![CDATA[ + + select distinct d.role_id, d.role_name , c.function_cd , e.function_name , d.active_yn , d.priority , c.app_id, c.role_app_id + from fn_user_role a, fn_app b, ep_app_role_function c , fn_role d , ep_app_function e + where b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and e.function_cd = c.function_cd and c.app_id=:requestedAppId and c.role_id =:roleId and e.app_id = c.app_id + ; + + ]]> + </sql-query> + + <sql-query name="updateMenuFunctionalAndRoles"> + <![CDATA[ + UPDATE fn_menu_functional m, fn_menu_functional_roles mr SET m.url='' WHERE m.menu_id=mr.menu_id AND mr.app_id=:app_id + ; + ]]> + </sql-query> + + <!-- Remove any favorites associated with a menu item that is associated with this app --> + <sql-query name="removeAppFromMenuFavorites"> + <![CDATA[ + DELETE FROM fn_menu_favorites using fn_menu_favorites inner join fn_menu_functional_roles where fn_menu_functional_roles.app_id=:app_id AND fn_menu_functional_roles.menu_id=fn_menu_favorites.menu_id + ; + ]]> + </sql-query> + + <!-- Remove all role, appid records from fn_menu_functional_role that is associated with this app --> + <sql-query name="removeAppFromMenuFunctionalRoles"> + <![CDATA[ + DELETE FROM fn_menu_functional_roles WHERE app_id=:app_id + ; + ]]> + </sql-query> + + <!-- Remove all roles, rolefunctions, appid records from ep_app_role_function that is associated with this app --> + <sql-query name="removeAppFromEpAppRoleFunction"> + <![CDATA[ + DELETE FROM ep_app_role_function WHERE app_id=:app_id + ; + ]]> + </sql-query> + + <!-- Remove all rolefunctions, appid records from ep_app_function that is associated with this app --> + <sql-query name="removeAppFromEpAppFunction"> + <![CDATA[ + DELETE FROM ep_app_function WHERE app_id=:app_id + ; + ]]> + </sql-query> + + <!-- Remove all records from fn_user_role associated with this app that is associated with this app --> + <sql-query name="removeAppFromFnUserRole"> + <![CDATA[ + DELETE FROM fn_user_role WHERE app_id=:app_id + ; + ]]> + </sql-query> + + <!-- Remove any widgets that is associated with this app--> + <sql-query name="removeAppFromEpWidgetCatalogRole"> + <![CDATA[ + DELETE FROM ep_widget_catalog_role WHERE app_id=:app_id + ; + ]]> + </sql-query> + + <!-- Remove any notifications that is associated with this app--> + <sql-query name="removeAppFromEpRoleNotification"> + <![CDATA[ + DELETE FROM ep_role_notification using ep_role_notification inner join fn_role + where fn_role.app_id=:app_id and ep_role_notification.role_id= fn_role.role_id + ; + ]]> + </sql-query> + + <!-- Remove all records from fn_role that is associated with this app--> + <sql-query name="removeAppFromFnRole"> + <![CDATA[ + DELETE FROM fn_role where app_id=:app_id + ; + ]]> + </sql-query> + + <!-- Remove app contact us entries that is associated with this app--> + <sql-query name="removeAppFromAppContactUs"> + <![CDATA[ + DELETE FROM fn_app_contact_us where app_id=:app_id + ; + ]]> + </sql-query> + + <!-- Remove app personalization entries that is associated with this app--> + <sql-query name="removeAppFromEpPersUserAppSel"> + <![CDATA[ + DELETE FROM fn_pers_user_app_sel where app_id=:app_id + ; + ]]> + </sql-query> + + <!-- Remove app personalization sorting entries that is associated with this app--> + <sql-query name="removeAppFromEpPersUserAppManSort"> + <![CDATA[ + DELETE FROM ep_pers_user_app_man_sort where app_id=:app_id + ; + ]]> + </sql-query> + + <!-- Remove rows from user role request table entries that is associated with this app--> + <sql-query name="removeAppFromEpUserRolesRequest"> + <![CDATA[ + DELETE FROM ep_user_roles_request where app_id=:app_id + ; + ]]> + </sql-query> + + <!-- Remove rows from web analytics table entries that is associated with this app--> + <sql-query name="removeAppFromEpWebAnalytics"> + <![CDATA[ + DELETE FROM ep_web_analytics_source where app_id=:app_id + ; + ]]> + </sql-query> + + <!-- Remove row from fn app table --> + <sql-query name="removeAppFromFnApp"> + <![CDATA[ + DELETE FROM fn_app where app_id=:app_id + ; + ]]> + </sql-query> + + <sql-query name="getUserRoleOnUserIdAndRoleIdAndAppId"> + <return alias="getUserRoleOnUserIdAndRoleIdAndAppId" class="org.onap.portalapp.portal.domain.EPUserApp" /> + <![CDATA[ + + select * from fn_user_role where user_id= :userId + and role_id= :roleId + and app_id= :appId + ; + + ]]> + </sql-query> + + <query name="getBasicauthAccount"> + select id,password from BasicAuthCredentials + </query> + + <query name="getMicroserviceInfo"> + select id,password from MicroserviceData + </query> + </hibernate-mapping> diff --git a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml index 1a72eae7..819a5212 100644 --- a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml +++ b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml @@ -3,11 +3,11 @@ ============LICENSE_START========================================== ONAP Portal =================================================================== - Copyright © 2017 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. =================================================================== Unless otherwise specified, all software contained herein is licensed - under the Apache License, Version 2.0 (the “License”); + 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 @@ -20,7 +20,7 @@ limitations under the License. Unless otherwise specified, all documentation contained herein is licensed - under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + 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 @@ -45,7 +45,7 @@ Publishes mappings and queries for EP SDK library features ONLY. Portal app mappings and features are in EP.hbm.xml. --> -<hibernate-mapping package="org.openecomp.portalsdk.core.domain"> +<hibernate-mapping package="org.onap.portalsdk.core.domain"> <!-- User class mapping details --> <class name="User" table="FN_USER"> @@ -104,12 +104,12 @@ Portal app mappings and features are in EP.hbm.xml. <set name="userApps" table="FN_USER_ROLE" lazy="false" sort="natural" inverse="true" cascade="all-delete-orphan"> <key column="user_id"/> - <one-to-many class="org.openecomp.portalsdk.core.domain.UserApp" /> + <one-to-many class="org.onap.portalsdk.core.domain.UserApp" /> </set> <set name="pseudoRoles" table="FN_USER_PSEUDO_ROLE" lazy="false" sort="natural"> <key column="user_id"/> - <many-to-many column="pseudo_role_id" class="org.openecomp.portalsdk.core.domain.Role" /> + <many-to-many column="pseudo_role_id" class="org.onap.portalsdk.core.domain.Role" /> </set> </class> @@ -118,8 +118,8 @@ Portal app mappings and features are in EP.hbm.xml. <key-property name="userId" type="long"> <column name="user_id" precision="11" scale="0" /> </key-property> - <key-many-to-one name="app" class="org.openecomp.portalsdk.core.domain.App" column="app_id" /> - <key-many-to-one name="role" class="org.openecomp.portalsdk.core.domain.Role" column="role_id" /> + <key-many-to-one name="app" class="org.onap.portalsdk.core.domain.App" column="app_id" /> + <key-many-to-one name="role" class="org.onap.portalsdk.core.domain.Role" column="role_id" /> </composite-id> <property name="priority" type="java.lang.Short"> <column name="priority" precision="4" scale="0" /> @@ -149,17 +149,17 @@ Portal app mappings and features are in EP.hbm.xml. <set name="roleFunctions" table="FN_ROLE_FUNCTION" lazy="false" sort="natural"> <key column="role_id"/> - <many-to-many column="function_cd" class="org.openecomp.portalsdk.core.domain.RoleFunction"/> + <many-to-many column="function_cd" class="org.onap.portalsdk.core.domain.RoleFunction"/> </set> <set name="childRoles" table="FN_ROLE_COMPOSITE" lazy="false" sort="natural"> <key column="parent_role_id"/> - <many-to-many column="child_role_id" class="org.openecomp.portalsdk.core.domain.Role"/> + <many-to-many column="child_role_id" class="org.onap.portalsdk.core.domain.Role"/> </set> <set name="parentRoles" table="FN_ROLE_COMPOSITE" lazy="false" sort="natural"> <key column="child_role_id"/> - <many-to-many column="parent_role_id" class="org.openecomp.portalsdk.core.domain.Role"/> + <many-to-many column="parent_role_id" class="org.onap.portalsdk.core.domain.Role"/> </set> </class> @@ -277,14 +277,14 @@ Portal app mappings and features are in EP.hbm.xml. <!-- Lookup (id/value bean) class mapping details --> <class name="Lookup"> - <composite-id name="nameValueId" class="org.openecomp.portalsdk.core.domain.support.NameValueId"> + <composite-id name="nameValueId" class="org.onap.portalsdk.core.domain.support.NameValueId"> <key-property name="val"/> <key-property name="lab" /> </composite-id> </class> <class name="UrlsAccessible" table="V_URL_ACCESS"> - <composite-id name="urlsAccessibleKey" class="org.openecomp.portalsdk.core.domain.UrlsAccessibleKey"> + <composite-id name="urlsAccessibleKey" class="org.onap.portalsdk.core.domain.UrlsAccessibleKey"> <key-property name="url" column="url"/> <key-property name="functionCd" column="function_cd"/> </composite-id> @@ -309,6 +309,10 @@ Portal app mappings and features are in EP.hbm.xml. select email from User where id = :user_id </query> + <query name="getAppPassword"> + select id,appPassword from App + </query> + <query name="getAllUsers"> select id, firstName, lastName from User where active = true order by lastName, firstName </query> diff --git a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/Workflow.hbm.xml b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/Workflow.hbm.xml index 6a4118b7..b85fa994 100644 --- a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/Workflow.hbm.xml +++ b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/Workflow.hbm.xml @@ -3,11 +3,11 @@ ============LICENSE_START========================================== ONAP Portal =================================================================== - Copyright © 2017 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. =================================================================== Unless otherwise specified, all software contained herein is licensed - under the Apache License, Version 2.0 (the “License”); + 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 @@ -20,7 +20,7 @@ limitations under the License. Unless otherwise specified, all documentation contained herein is licensed - under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + 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 @@ -41,7 +41,7 @@ "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping package="org.openecomp.portalsdk.workflow.domain"> +<hibernate-mapping package="org.onap.portalsdk.workflow.domain"> <!-- WorkflowSchedule mapping details --> diff --git a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/jsp/error.jsp b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/jsp/error.jsp index ed3f0b9b..ec932022 100644 --- a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/jsp/error.jsp +++ b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/jsp/error.jsp @@ -2,11 +2,11 @@ ============LICENSE_START========================================== ONAP Portal =================================================================== - Copyright © 2017 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. =================================================================== Unless otherwise specified, all software contained herein is licensed - under the Apache License, Version 2.0 (the “License”); + 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 @@ -19,7 +19,7 @@ limitations under the License. Unless otherwise specified, all documentation contained herein is licensed - under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + 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 diff --git a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/jsp/index.jsp b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/jsp/index.jsp index 318ce4e3..5cd8060b 100644 --- a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/jsp/index.jsp +++ b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/jsp/index.jsp @@ -2,11 +2,11 @@ ============LICENSE_START========================================== ONAP Portal =================================================================== - Copyright © 2017 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. =================================================================== Unless otherwise specified, all software contained herein is licensed - under the Apache License, Version 2.0 (the “License”); + 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 @@ -19,7 +19,7 @@ limitations under the License. Unless otherwise specified, all documentation contained herein is licensed - under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + 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 diff --git a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/web.xml b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/web.xml index 55fa3444..613848cc 100644 --- a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/web.xml +++ b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/web.xml @@ -3,11 +3,11 @@ ============LICENSE_START========================================== ONAP Portal =================================================================== - Copyright © 2017 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. =================================================================== Unless otherwise specified, all software contained herein is licensed - under the Apache License, Version 2.0 (the “License”); + 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 @@ -20,7 +20,7 @@ limitations under the License. Unless otherwise specified, all documentation contained herein is licensed - under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + 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 diff --git a/ecomp-portal-BE-common/src/main/webapp/index.jsp b/ecomp-portal-BE-common/src/main/webapp/index.jsp index 58b9e3cd..0b39db04 100644 --- a/ecomp-portal-BE-common/src/main/webapp/index.jsp +++ b/ecomp-portal-BE-common/src/main/webapp/index.jsp @@ -2,11 +2,11 @@ ============LICENSE_START========================================== ONAP Portal =================================================================== - Copyright © 2017 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. =================================================================== Unless otherwise specified, all software contained herein is licensed - under the Apache License, Version 2.0 (the “License”); + 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 @@ -19,7 +19,7 @@ limitations under the License. Unless otherwise specified, all documentation contained herein is licensed - under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + 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 diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/command/EPLoginBeanTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/command/EPLoginBeanTest.java index e540bd85..88ba024b 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/command/EPLoginBeanTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/command/EPLoginBeanTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,13 +35,13 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.command; +package org.onap.portalapp.command; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import org.junit.Test; -import org.openecomp.portalapp.command.EPLoginBean; +import org.onap.portalapp.command.EPLoginBean; public class EPLoginBeanTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/command/PostSearchBeanTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/command/PostSearchBeanTest.java index 324d91d7..2b095731 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/command/PostSearchBeanTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/command/PostSearchBeanTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,14 +35,15 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.command; +package org.onap.portalapp.command; import static org.junit.Assert.*; import org.junit.Test; import org.mockito.InjectMocks; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.EPUser; +import org.onap.portalapp.command.PostSearchBean; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPUser; public class PostSearchBeanTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/config/NotificationCleanupTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/config/NotificationCleanupTest.java index 0cd82ae7..8d374526 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/config/NotificationCleanupTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/config/NotificationCleanupTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.config; +package org.onap.portalapp.config; import org.junit.Before; import org.junit.Test; @@ -44,8 +44,8 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.service.UserNotificationService; -import org.openecomp.portalapp.portal.service.UserNotificationServiceImpl; +import org.onap.portalapp.portal.service.UserNotificationService; +import org.onap.portalapp.portal.service.UserNotificationServiceImpl; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @@ -54,30 +54,32 @@ import org.springframework.context.ApplicationContext; @RunWith(PowerMockRunner.class) @PrepareForTest(NotificationCleanupConfig.class) public class NotificationCleanupTest { - + + @InjectMocks NotificationCleanup notificationCleanup = new NotificationCleanup(); - + @Before public void setup() { MockitoAnnotations.initMocks(this); } - @Mock - UserNotificationService userNotificationService = new UserNotificationServiceImpl(); + UserNotificationService userNotificationService = new UserNotificationServiceImpl(); @Mock - ApplicationContext applicationContext; - + ApplicationContext applicationContext ; + + @Test - public void runTest() { - PowerMockito.mockStatic(NotificationCleanupConfig.class); + public void runTest() + { + PowerMockito.mockStatic(NotificationCleanupConfig.class); Mockito.when(NotificationCleanupConfig.getApplicationContext()).thenReturn(applicationContext); - Mockito.when((applicationContext).getBean(UserNotificationService.class)).thenReturn(userNotificationService); + Mockito.when((applicationContext).getBean(UserNotificationService.class)).thenReturn(userNotificationService); Mockito.doNothing().when(userNotificationService).deleteNotificationsFromEpUserNotificationTable(); Mockito.doNothing().when(userNotificationService).deleteNotificationsFromEpRoleNotificationTable(); Mockito.doNothing().when(userNotificationService).deleteNotificationsFromEpNotificationTable(); - notificationCleanup.run(); + notificationCleanup.run(); } diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/config/PortalCentralAccessConfigurationTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/config/PortalCentralAccessConfigurationTest.java index d58beac9..a472f05f 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/config/PortalCentralAccessConfigurationTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/config/PortalCentralAccessConfigurationTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.config; +package org.onap.portalapp.config; import static org.junit.Assert.assertEquals; @@ -44,9 +44,10 @@ import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.service.EPRoleFunctionService; -import org.openecomp.portalapp.portal.service.EPRoleFunctionServiceCentralizedImpl; -import org.openecomp.portalapp.portal.service.EPRoleFunctionServiceImpl; +import org.onap.portalapp.config.PortalCentralAccessConfiguration; +import org.onap.portalapp.portal.service.EPRoleFunctionService; +import org.onap.portalapp.portal.service.EPRoleFunctionServiceCentralizedImpl; +import org.onap.portalapp.portal.service.EPRoleFunctionServiceImpl; public class PortalCentralAccessConfigurationTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppCatalogControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AppCatalogControllerTest.java index a04c1b07..7b099824 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppCatalogControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AppCatalogControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; @@ -55,23 +55,23 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.AppCatalogController; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.AppCatalogItem; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl; -import org.openecomp.portalapp.portal.service.EPAppCommonServiceImpl; -import org.openecomp.portalapp.portal.service.EPAppService; -import org.openecomp.portalapp.portal.service.PersUserAppService; -import org.openecomp.portalapp.portal.service.PersUserAppServiceImpl; -import org.openecomp.portalapp.portal.transport.AppCatalogPersonalization; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.FieldsValidator.FieldName; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.controller.AppCatalogController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.ecomp.model.AppCatalogItem; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.AdminRolesServiceImpl; +import org.onap.portalapp.portal.service.EPAppCommonServiceImpl; +import org.onap.portalapp.portal.service.EPAppService; +import org.onap.portalapp.portal.service.PersUserAppService; +import org.onap.portalapp.portal.service.PersUserAppServiceImpl; +import org.onap.portalapp.portal.transport.AppCatalogPersonalization; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.FieldsValidator.FieldName; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.util.SystemProperties; public class AppCatalogControllerTest extends MockitoTestSuite { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppContactUsControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AppContactUsControllerTest.java index 487b116e..522ef7ca 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppContactUsControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AppContactUsControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -54,18 +54,18 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.AppContactUsController; -import org.openecomp.portalapp.portal.ecomp.model.AppCategoryFunctionsItem; -import org.openecomp.portalapp.portal.ecomp.model.AppContactUsItem; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.AppContactUsService; -import org.openecomp.portalapp.portal.service.AppContactUsServiceImpl; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.domain.support.CollaborateList; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.controller.AppContactUsController; +import org.onap.portalapp.portal.ecomp.model.AppCategoryFunctionsItem; +import org.onap.portalapp.portal.ecomp.model.AppContactUsItem; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.AppContactUsService; +import org.onap.portalapp.portal.service.AppContactUsServiceImpl; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.domain.support.CollaborateList; +import org.onap.portalsdk.core.util.SystemProperties; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequestTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AppsControllerExternalRequestTest.java index a979a5b1..3a81a6f8 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequestTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AppsControllerExternalRequestTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertEquals; @@ -51,21 +51,21 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.AppsControllerExternalRequest; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.EPAppService; -import org.openecomp.portalapp.portal.service.PortalAdminService; -import org.openecomp.portalapp.portal.service.UserService; -import org.openecomp.portalapp.portal.service.UserServiceImpl; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.OnboardingApp; -import org.openecomp.portalapp.util.EPUserUtils; +import org.onap.portalapp.portal.controller.AppsControllerExternalRequest; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.EPAppService; +import org.onap.portalapp.portal.service.PortalAdminService; +import org.onap.portalapp.portal.service.UserService; +import org.onap.portalapp.portal.service.UserServiceImpl; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.OnboardingApp; +import org.onap.portalapp.util.EPUserUtils; public class AppsControllerExternalRequestTest extends MockitoTestSuite { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppsControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AppsControllerTest.java index e5c30ed5..95f1d224 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppsControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AppsControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.*; @@ -52,36 +52,37 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; +import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.AppsController; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.AdminUserApplications; -import org.openecomp.portalapp.portal.domain.AppIdAndNameTransportModel; -import org.openecomp.portalapp.portal.domain.AppsResponse; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EcompApp; -import org.openecomp.portalapp.portal.domain.UserRole; -import org.openecomp.portalapp.portal.domain.UserRoles; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl; -import org.openecomp.portalapp.portal.service.EPAppCommonServiceImpl; -import org.openecomp.portalapp.portal.service.EPAppService; -import org.openecomp.portalapp.portal.service.EPLeftMenuService; -import org.openecomp.portalapp.portal.service.EPLeftMenuServiceImpl; -import org.openecomp.portalapp.portal.transport.EPAppsManualPreference; -import org.openecomp.portalapp.portal.transport.EPAppsSortPreference; -import org.openecomp.portalapp.portal.transport.EPDeleteAppsManualSortPref; -import org.openecomp.portalapp.portal.transport.EPWidgetsSortPreference; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.LocalRole; -import org.openecomp.portalapp.portal.transport.OnboardingApp; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.portalsdk.core.web.support.AppUtils; +import org.onap.portalapp.portal.controller.AppsController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.AdminUserApplications; +import org.onap.portalapp.portal.domain.AppIdAndNameTransportModel; +import org.onap.portalapp.portal.domain.AppsResponse; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EcompApp; +import org.onap.portalapp.portal.domain.UserRole; +import org.onap.portalapp.portal.domain.UserRoles; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.AdminRolesServiceImpl; +import org.onap.portalapp.portal.service.EPAppCommonServiceImpl; +import org.onap.portalapp.portal.service.EPAppService; +import org.onap.portalapp.portal.service.EPLeftMenuService; +import org.onap.portalapp.portal.service.EPLeftMenuServiceImpl; +import org.onap.portalapp.portal.transport.EPAppsManualPreference; +import org.onap.portalapp.portal.transport.EPAppsSortPreference; +import org.onap.portalapp.portal.transport.EPDeleteAppsManualSortPref; +import org.onap.portalapp.portal.transport.EPWidgetsSortPreference; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.LocalRole; +import org.onap.portalapp.portal.transport.OnboardingApp; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.util.SystemProperties; +import org.onap.portalsdk.core.web.support.AppUtils; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @@ -676,7 +677,10 @@ public class AppsControllerTest extends MockitoTestSuite{ expectedRoleList.add(localRole); long appId = 1; Mockito.when(appService.getAppRoles(appId)).thenReturn(expectedRoleList); - List<LocalRole> actualRoleList = appsController.getAppRoles(mockedRequest, appId); + EPUser user = mockUser.mockEPUser(); + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + Mockito.when(adminRolesService.isAccountAdminOfApplication(Matchers.anyObject(), Matchers.anyObject())).thenReturn(true); + List<LocalRole> actualRoleList = appsController.getAppRoles(mockedRequest, appId, mockedResponse); assertEquals(actualRoleList, expectedRoleList); } @@ -684,7 +688,7 @@ public class AppsControllerTest extends MockitoTestSuite{ public void getAppRolesExceptionTest() { long appId = 1; Mockito.when(appService.getAppRoles(appId)).thenThrow(nullPointerException); - assertNull(appsController.getAppRoles(mockedRequest, appId)); + assertNull(appsController.getAppRoles(mockedRequest, appId, mockedResponse)); } @Test diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AuditLogControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AuditLogControllerTest.java index 68371d06..27e72b64 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AuditLogControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/AuditLogControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -47,12 +47,12 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.AuditLogController; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.service.AuditService; +import org.onap.portalapp.portal.controller.AuditLogController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.service.AuditService; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/BEPropertyReaderControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/BEPropertyReaderControllerTest.java index 41233c82..3ece25ff 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/BEPropertyReaderControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/BEPropertyReaderControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertTrue; @@ -47,12 +47,12 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.BEPropertyReaderController; -import org.openecomp.portalapp.portal.domain.BEProperty; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.controller.BEPropertyReaderController; +import org.onap.portalapp.portal.domain.BEProperty; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalsdk.core.util.SystemProperties; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/BasicAuthAccountControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/BasicAuthAccountControllerTest.java index 5a27755a..bec28d59 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/BasicAuthAccountControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/BasicAuthAccountControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertEquals; @@ -51,19 +51,19 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.BasicAuthAccountController; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.BasicAuthCredentials; -import org.openecomp.portalapp.portal.domain.EPEndpoint; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl; -import org.openecomp.portalapp.portal.service.BasicAuthAccountService; -import org.openecomp.portalapp.portal.service.BasicAuthAccountServiceImpl; -import org.openecomp.portalapp.util.EPUserUtils; +import org.onap.portalapp.portal.controller.BasicAuthAccountController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.BasicAuthCredentials; +import org.onap.portalapp.portal.domain.EPEndpoint; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.AdminRolesServiceImpl; +import org.onap.portalapp.portal.service.BasicAuthAccountService; +import org.onap.portalapp.portal.service.BasicAuthAccountServiceImpl; +import org.onap.portalapp.util.EPUserUtils; public class BasicAuthAccountControllerTest extends MockitoTestSuite { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/CommonWidgetControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/CommonWidgetControllerTest.java index 51d871d9..76961f89 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/CommonWidgetControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/CommonWidgetControllerTest.java @@ -1,12 +1,13 @@ + /*- * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +20,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -34,8 +35,7 @@ * ============LICENSE_END============================================ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ -package org.openecomp.portalapp.portal.controller; + */package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertTrue; @@ -47,13 +47,13 @@ import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.CommonWidgetController; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.DashboardSearchService; -import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl; -import org.openecomp.portalapp.portal.transport.CommonWidgetMeta; +import org.onap.portalapp.portal.controller.CommonWidgetController; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.DashboardSearchService; +import org.onap.portalapp.portal.service.DashboardSearchServiceImpl; +import org.onap.portalapp.portal.transport.CommonWidgetMeta; public class CommonWidgetControllerTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ConsulClientControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ConsulClientControllerTest.java index d9e50467..8481413e 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ConsulClientControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ConsulClientControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertTrue; @@ -51,13 +51,13 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.ConsulClientController; -import org.openecomp.portalapp.portal.domain.BEProperty; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.ConsulHealthService; -import org.openecomp.portalapp.portal.service.ConsulHealthServiceImpl; +import org.onap.portalapp.portal.controller.ConsulClientController; +import org.onap.portalapp.portal.domain.BEProperty; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.ConsulHealthService; +import org.onap.portalapp.portal.service.ConsulHealthServiceImpl; import com.orbitz.consul.ConsulException; import com.orbitz.consul.model.health.ServiceHealth; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/DashboardControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/DashboardControllerTest.java index 0e8b74d8..37f7f687 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/DashboardControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/DashboardControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.*; @@ -51,23 +51,26 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; +import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.DashboardController; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.DashboardSearchService; -import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl; -import org.openecomp.portalapp.portal.transport.CommonWidget; -import org.openecomp.portalapp.portal.transport.CommonWidgetMeta; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.domain.support.CollaborateList; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.controller.DashboardController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.AdminRolesServiceImpl; +import org.onap.portalapp.portal.service.DashboardSearchService; +import org.onap.portalapp.portal.service.DashboardSearchServiceImpl; +import org.onap.portalapp.portal.transport.CommonWidget; +import org.onap.portalapp.portal.transport.CommonWidgetMeta; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.domain.support.CollaborateList; +import org.onap.portalsdk.core.util.SystemProperties; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @@ -83,6 +86,8 @@ public class DashboardControllerTest { @InjectMocks DashboardController dashboardController = new DashboardController(); + @Mock + AdminRolesService adminRolesService = new AdminRolesServiceImpl(); @Before public void setup() { MockitoAnnotations.initMocks(this); @@ -155,7 +160,6 @@ public class DashboardControllerTest { expectedData.setResponse(commonWidgetMeta); PortalRestResponse<CommonWidgetMeta> actualResponse = dashboardController.getWidgetData(mockedRequest, resourceType); - System.out.println(actualResponse); assertEquals(expectedData,actualResponse); } @@ -239,7 +243,8 @@ public class DashboardControllerTest { expectedData.setMessage("ERROR"); expectedData.setResponse("Category cannot be null or empty"); - PortalRestResponse<String> actualResponse = dashboardController.saveWidgetData(commonWidget); + Mockito.when(adminRolesService.isSuperAdmin(Matchers.anyObject())).thenReturn(true); + PortalRestResponse<String> actualResponse = dashboardController.saveWidgetData(commonWidget, mockedRequest, mockedResponse); assertEquals(expectedData,actualResponse); } @@ -252,8 +257,8 @@ public class DashboardControllerTest { expectedData.setStatus(PortalRestStatusEnum.ERROR); expectedData.setMessage("Invalid category: test"); expectedData.setResponse(null); - - PortalRestResponse<String> actualResponse = dashboardController.saveWidgetData(commonWidget); + Mockito.when(adminRolesService.isSuperAdmin(Matchers.anyObject())).thenReturn(true); + PortalRestResponse<String> actualResponse = dashboardController.saveWidgetData(commonWidget, mockedRequest, mockedResponse); assertEquals(expectedData,actualResponse); } @@ -279,10 +284,9 @@ public class DashboardControllerTest { expectedData.setStatus(PortalRestStatusEnum.OK); expectedData.setMessage("success"); expectedData.setResponse("success"); - + Mockito.when(adminRolesService.isSuperAdmin(Matchers.anyObject())).thenReturn(true); Mockito.when(searchService.saveWidgetData(commonWidget)).thenReturn("success"); - - PortalRestResponse<String> actualResponse = dashboardController.saveWidgetData(commonWidget); + PortalRestResponse<String> actualResponse = dashboardController.saveWidgetData(commonWidget, mockedRequest, mockedResponse); assertEquals(expectedData,actualResponse); } diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/DashboardSearchResultControllerTest.java index 9ac81b6c..229f1ba9 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/DashboardSearchResultControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertEquals; @@ -53,18 +53,18 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.DashboardSearchResultController; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.ecomp.model.SearchResultItem; -import org.openecomp.portalapp.portal.service.DashboardSearchService; -import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl; -import org.openecomp.portalapp.portal.transport.CommonWidget; -import org.openecomp.portalapp.portal.transport.CommonWidgetMeta; -import org.openecomp.portalapp.util.EPUserUtils; +import org.onap.portalapp.portal.controller.DashboardSearchResultController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.ecomp.model.SearchResultItem; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.DashboardSearchService; +import org.onap.portalapp.portal.service.DashboardSearchServiceImpl; +import org.onap.portalapp.portal.transport.CommonWidget; +import org.onap.portalapp.portal.transport.CommonWidgetMeta; +import org.onap.portalapp.util.EPUserUtils; public class DashboardSearchResultControllerTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/EPFusionBaseControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/EPFusionBaseControllerTest.java index ef857d0d..d7950e37 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/EPFusionBaseControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/EPFusionBaseControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.*; @@ -55,17 +55,17 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.controller.EPFusionBaseController; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.service.DashboardSearchService; -import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.domain.MenuData; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.controller.EPFusionBaseController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.DashboardSearchService; +import org.onap.portalapp.portal.service.DashboardSearchServiceImpl; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.domain.MenuData; +import org.onap.portalsdk.core.util.SystemProperties; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/EPRestrictedBaseControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/EPRestrictedBaseControllerTest.java index 6bcf2733..ca415121 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/EPRestrictedBaseControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/EPRestrictedBaseControllerTest.java @@ -1,12 +1,13 @@ + /*- * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +20,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +36,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.*; @@ -43,7 +44,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.controller.EPRestrictedBaseController; +import org.onap.portalapp.controller.EPRestrictedBaseController; public class EPRestrictedBaseControllerTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ExternalAccessRolesControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ExternalAccessRolesControllerTest.java index e578844f..859cc4c2 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ExternalAccessRolesControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ExternalAccessRolesControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,39 +35,52 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import java.io.PrintWriter; +import java.io.StringWriter; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.mockito.InjectMocks; +import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.CentralRoleFunction; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.service.ExternalAccessRolesService; -import org.openecomp.portalapp.portal.service.ExternalAccessRolesServiceImpl; -import org.openecomp.portalapp.portal.transport.CentralRole; -import org.openecomp.portalsdk.core.domain.AuditLog; -import org.openecomp.portalsdk.core.domain.Role; -import org.openecomp.portalsdk.core.restful.domain.EcompUser; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.CentralV2RoleFunction; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.ExternalAccessRolesService; +import org.onap.portalapp.portal.service.ExternalAccessRolesServiceImpl; +import org.onap.portalapp.portal.transport.CentralRoleFunction; +import org.onap.portalapp.portal.transport.CentralV2Role; +import org.onap.portalapp.portal.transport.ExternalRequestFieldsValidator; +import org.onap.portalsdk.core.domain.AuditLog; +import org.onap.portalsdk.core.domain.Role; +import org.onap.portalsdk.core.restful.domain.EcompUser; +import org.springframework.beans.BeanUtils; import org.springframework.http.HttpStatus; import org.springframework.web.client.HttpClientErrorException; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + public class ExternalAccessRolesControllerTest { @Mock @@ -96,16 +109,26 @@ public class ExternalAccessRolesControllerTest { @Test public void getUserTest() throws Exception { - List<EPUser> userList = new ArrayList<>(); + String reason = getInvalidKeyJson(); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); + List<EPUser> userList = new ArrayList<>(); Mockito.when(externalAccessRolesService.getUser(loginId)).thenReturn(userList); - assertNull(externalAccessRolesController.getUser(mockedRequest, mockedResponse, loginId)); + externalAccessRolesController.getUser(mockedRequest, mockedResponse, loginId); + String result = sw.getBuffer().toString().trim(); + assertEquals(reason, result); } @Test public void getUserExceptionTest() throws Exception { - Mockito.when(externalAccessRolesService.getUser(loginId)) - .thenThrow(nullPointerException); - assertNull(externalAccessRolesController.getUser(mockedRequest, mockedResponse, loginId)); + String reason = getInvalidKeyJson(); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); + externalAccessRolesController.getUser(mockedRequest, mockedResponse, loginId); + String result = sw.getBuffer().toString().trim(); + assertEquals(reason, result); } public EPApp mockApp() @@ -133,81 +156,114 @@ public class ExternalAccessRolesControllerTest { return app; } - @Test + @Test(expected = NullPointerException.class) public void getRolesForAppTest() throws Exception { List<EPApp> applicationList = new ArrayList<EPApp>(); - List<CentralRole> answer = new ArrayList<>(); + List<CentralV2Role> answer = new ArrayList<>(); EPApp app = mockApp(); applicationList.add(app); Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList); Mockito.doNothing().when(externalAccessRolesService).syncApplicationRolesWithEcompDB(app); Mockito.when(externalAccessRolesService.getRolesForApp(mockedRequest.getHeader(uebKey))).thenReturn(answer); - assertEquals(externalAccessRolesController.getRolesForApp(mockedRequest, mockedResponse), answer); + assertEquals(externalAccessRolesController.getRolesForApp(mockedRequest, mockedResponse), null); } - @Test + @Test(expected = NullPointerException.class) public void getRolesForAppExceptionTest() throws Exception { List<EPApp> applicationList = new ArrayList<EPApp>(); - List<CentralRole> answer = new ArrayList<>(); EPApp app = mockApp(); applicationList.add(app); Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList); Mockito.doNothing().when(externalAccessRolesService).syncApplicationRolesWithEcompDB(app); - Mockito.when(externalAccessRolesService.getRolesForApp(mockedRequest.getHeader(uebKey))) - .thenThrow(httpClientErrorException); - assertNull(externalAccessRolesController.getRolesForApp(mockedRequest, mockedResponse)); + externalAccessRolesController.getRolesForApp(mockedRequest,mockedResponse); + List<CentralV2Role> role = externalAccessRolesService.getRolesForApp(mockedRequest.getHeader(uebKey)); + assertEquals(null,role); } @Test public void getRoleFunctionsListTest() throws Exception { - List<CentralRoleFunction> answer = new ArrayList<>(); - Mockito.when(externalAccessRolesService.getRoleFuncList(mockedRequest.getHeader(uebKey))).thenReturn(answer); + String reason = getInvalidKeyJson(); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); + List<CentralV2RoleFunction> answer = null; + Mockito.when(externalAccessRolesService.getRoleFuncList(mockedRequest.getHeader(uebKey))).thenReturn(null); assertEquals(externalAccessRolesController.getRoleFunctionsList(mockedRequest, mockedResponse), answer); + String result = sw.getBuffer().toString().trim(); + assertEquals(reason, result); } @Test public void getRoleFunctionsListExceptionTest() throws Exception { - Mockito.when(externalAccessRolesService.getRoleFuncList(mockedRequest.getHeader(uebKey))) - .thenThrow(httpClientErrorException); - assertNull(externalAccessRolesController.getRoleFunctionsList(mockedRequest, mockedResponse)); + String reason = getInvalidKeyJson(); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); + externalAccessRolesController.getRoleFunctionsList(mockedRequest, mockedResponse); + String result = sw.getBuffer().toString().trim(); + assertEquals(reason, result); } @Test public void getRoleInfoTest() throws Exception { - CentralRole answer = new CentralRole(); + String reason = getInvalidKeyJson(); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); + CentralV2Role answer = new CentralV2Role(); long roleId = 1; Mockito.when(externalAccessRolesService.getRoleInfo(roleId, mockedRequest.getHeader(uebKey))) .thenReturn(answer); - assertEquals(externalAccessRolesController.getRoleInfo(mockedRequest, mockedResponse, roleId), answer); + externalAccessRolesController.getRoleInfo(mockedRequest, mockedResponse, roleId); + String result = sw.getBuffer().toString().trim(); + assertEquals(reason, result); } @Test public void getRoleInfoExceptionTest() throws Exception { + String reason = getInvalidKeyJson(); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); long roleId = 1; - Mockito.when(externalAccessRolesService.getRoleInfo(roleId, mockedRequest.getHeader(uebKey))) - .thenThrow(httpClientErrorException); assertNull(externalAccessRolesController.getRoleInfo(mockedRequest, mockedResponse, roleId)); + String result = sw.getBuffer().toString().trim(); + assertEquals(reason, result); } @Test public void getRoleFunctionTest() throws Exception { + String reason = getInvalidKeyJson(); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); + CentralV2RoleFunction centralV2RoleFunction = new CentralV2RoleFunction(); CentralRoleFunction centralRoleFunction = new CentralRoleFunction(); String code = "test_menu"; Mockito.when(externalAccessRolesService.getRoleFunction(code, mockedRequest.getHeader(uebKey))) - .thenReturn(centralRoleFunction); - assertEquals(externalAccessRolesController.getRoleFunction(mockedRequest, mockedResponse, code), - centralRoleFunction); + .thenReturn(centralV2RoleFunction); + CentralRoleFunction returnedValue = externalAccessRolesController.getRoleFunction(mockedRequest, mockedResponse, code); + BeanUtils.copyProperties(centralV2RoleFunction, centralRoleFunction, "type","action"); + assertEquals(returnedValue,centralRoleFunction); + String result = sw.getBuffer().toString().trim(); + assertEquals(reason, result); } @Test public void getRoleFunctionExceptionTest() throws Exception { + String reason = getInvalidKeyJson(); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); String code = "test_menu"; Mockito.when(externalAccessRolesService.getRoleFunction(code, mockedRequest.getHeader(uebKey))) .thenThrow(httpClientErrorException); - assertNull(externalAccessRolesController.getRoleFunction(mockedRequest, mockedResponse, code)); + assertEquals(new CentralRoleFunction(),externalAccessRolesController.getRoleFunction(mockedRequest, mockedResponse, code)); + String result = sw.getBuffer().toString().trim(); + assertEquals(reason, result); } - @Test + @Test(expected = NullPointerException.class) public void saveRoleFunctionIfIsIsNotDeletedTest() throws Exception { List<EPApp> applicationList = new ArrayList<EPApp>(); EPApp app = mockApp(); @@ -215,18 +271,17 @@ public class ExternalAccessRolesControllerTest { Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList); PortalRestResponse<String> portalRestResponse = null; PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage(null); + expectedportalRestResponse.setMessage("Invalid uebkey!"); expectedportalRestResponse.setResponse("Failed"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); + expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); String data = null; - CentralRoleFunction centralRoleFunction = new CentralRoleFunction(); - Mockito.when(externalAccessRolesService.saveCentralRoleFunction(centralRoleFunction, app)).thenReturn(false); + CentralV2RoleFunction centralV2RoleFunction = new CentralV2RoleFunction(); + Mockito.when(externalAccessRolesService.saveCentralRoleFunction(centralV2RoleFunction, app)).thenReturn(false); portalRestResponse = externalAccessRolesController.saveRoleFunction(mockedRequest, mockedResponse, data); assertEquals(portalRestResponse, expectedportalRestResponse); } - @Test + @Test(expected = NullPointerException.class) public void saveRoleFunctionExceptionTest() throws Exception { List<EPApp> applicationList = new ArrayList<EPApp>(); EPApp app = mockApp(); @@ -234,22 +289,17 @@ public class ExternalAccessRolesControllerTest { Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList); PortalRestResponse<String> portalRestResponse = null; PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage(null); + expectedportalRestResponse.setMessage("Invalid uebkey!"); expectedportalRestResponse.setResponse("Failed"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); - String data = null; - CentralRoleFunction centralRoleFunction = new CentralRoleFunction(); - Mockito.when(externalAccessRolesService.saveCentralRoleFunction(centralRoleFunction, app)).thenThrow(nullPointerException); - portalRestResponse = externalAccessRolesController.saveRoleFunction(mockedRequest, mockedResponse, data); + expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); + portalRestResponse = externalAccessRolesController.saveRoleFunction(mockedRequest, mockedResponse, null); System.out.println(portalRestResponse); assertEquals(portalRestResponse, expectedportalRestResponse); } - @Test + @Test(expected = NullPointerException.class) public void saveRoleFunctionTest() throws Exception { List<EPApp> applicationList = new ArrayList<EPApp>(); - List<CentralRole> answer = new ArrayList<>(); EPApp app = mockApp(); applicationList.add(app); Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList); @@ -260,51 +310,76 @@ public class ExternalAccessRolesControllerTest { PortalRestStatusEnum portalRestStatusEnum = null; expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); String data = null; - CentralRoleFunction centralRoleFunction = new CentralRoleFunction(); - Mockito.when(externalAccessRolesService.saveCentralRoleFunction(centralRoleFunction, app)).thenReturn(true); + CentralV2RoleFunction centralV2RoleFunction = new CentralV2RoleFunction(); + Mockito.when(externalAccessRolesService.saveCentralRoleFunction(centralV2RoleFunction, app)).thenReturn(true); portalRestResponse = externalAccessRolesController.saveRoleFunction(mockedRequest, mockedResponse, data); System.out.println(portalRestResponse); assertEquals(portalRestResponse, expectedportalRestResponse); } -// @Test -// public void deleteRoleFunctionTest() throws Exception { -// PortalRestResponse<String> portalRestResponse = null; -// PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); -// expectedportalRestResponse.setMessage("Successfully Deleted"); -// expectedportalRestResponse.setResponse("Success"); -// PortalRestStatusEnum portalRestStatusEnum = null; -// EPUser user = mockUser.mockEPUser(); -// EPApp app = mockApp(); -// expectedportalRestResponse.setStatus(portalRestStatusEnum.OK); -// String code ="testNew"; -// Mockito.when(externalAccessRolesService.getUser(mockedRequest.getHeader("LOGIN_ID"))).thenReturn((List<EPUser>) user); -// Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader("UEBKEY")).get(0)).thenReturn(app); -// Mockito.when(externalAccessRolesService.deleteCentralRoleFunction(code, app)).thenReturn(true); -// portalRestResponse = externalAccessRolesController.deleteRoleFunction(mockedRequest, mockedResponse, code); -// assertEquals(portalRestResponse, expectedportalRestResponse); -// } + @Test + @Ignore + public void deleteRoleFunctionTest() throws Exception { + PortalRestResponse<String> portalRestResponse = null; + PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); + expectedportalRestResponse.setMessage("Successfully Deleted"); + expectedportalRestResponse.setResponse("Success"); + PortalRestStatusEnum portalRestStatusEnum = null; + EPUser user = mockUser.mockEPUser(); + EPApp app = mockApp(); + expectedportalRestResponse.setStatus(portalRestStatusEnum.OK); + String code ="testNew"; + Mockito.when(externalAccessRolesService.getUser(mockedRequest.getHeader("LOGIN_ID"))).thenReturn((List<EPUser>) user); + Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader("UEBKEY")).get(0)).thenReturn(app); + Mockito.when(externalAccessRolesService.deleteCentralRoleFunction(code, app)).thenReturn(true); + portalRestResponse = externalAccessRolesController.deleteRoleFunction(mockedRequest, mockedResponse, code); + assertEquals(portalRestResponse, expectedportalRestResponse); + } @Test public void getActiveRolesTest() throws Exception { - List<CentralRole> cenRole = new ArrayList<>(); - Mockito.when(externalAccessRolesService.getActiveRoles(mockedRequest.getHeader(uebKey))).thenReturn(cenRole); - List<CentralRole> expectedCenRole = externalAccessRolesController.getActiveRoles(mockedRequest, mockedResponse); - assertEquals(expectedCenRole, cenRole); + String reason = getInvalidKeyJson(); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); + Mockito.when(externalAccessRolesService.getActiveRoles(mockedRequest.getHeader(uebKey))).thenReturn(null); + List<CentralV2Role> expectedCenRole = externalAccessRolesController.getActiveRoles(mockedRequest, mockedResponse); + assertNull(expectedCenRole); + String result = sw.getBuffer().toString().trim(); + assertEquals(reason, result); } @Test public void getActiveRolesExceptionTest() throws Exception { - Mockito.when(externalAccessRolesService.getActiveRoles(mockedRequest.getHeader(uebKey))) - .thenThrow(httpClientErrorException); - assertNull(externalAccessRolesController.getActiveRoles(mockedRequest, mockedResponse)); + String reason = getInvalidKeyJson(); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); + externalAccessRolesController.getActiveRoles(mockedRequest, mockedResponse); + String result = sw.getBuffer().toString().trim(); + assertEquals(reason, result); + } + + /** + * It return JSON string which has error information + * + * @return JSON String + * @throws JsonProcessingException + */ + private String getInvalidKeyJson() throws JsonProcessingException { + final Map<String,String> uebkeyResponse = new HashMap<>(); + String reason = ""; + ObjectMapper mapper = new ObjectMapper(); + uebkeyResponse.put("error","Invalid uebkey!"); + reason = mapper.writeValueAsString(uebkeyResponse); + return reason; } @Test public void deleteDependcyRoleRecordExceptionTest() throws Exception { PortalRestResponse<String> portalRestResponse = null; PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Failed to deleteDependencyRoleRecord"); + expectedportalRestResponse.setMessage("Invalid uebkey!"); expectedportalRestResponse.setResponse("Failed"); PortalRestStatusEnum portalRestStatusEnum = null; expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); @@ -473,47 +548,45 @@ public class ExternalAccessRolesControllerTest { @Test public void getMenuFunctionsTest() throws Exception { - List<String> functionsList = new ArrayList<>(); + String reason = getInvalidKeyJson(); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); Mockito.when(externalAccessRolesService.getMenuFunctionsList(mockedRequest.getHeader(uebKey))) - .thenReturn(functionsList); + .thenReturn(null); List<String> expectedFunctionsList = externalAccessRolesController.getMenuFunctions(mockedRequest, mockedResponse); - assertEquals(functionsList, expectedFunctionsList); + assertNull(expectedFunctionsList); + String result = sw.getBuffer().toString().trim(); + assertEquals(reason, result); } @Test public void getMenuFunctionsExceptionTest() throws Exception { + String reason = getInvalidKeyJson(); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); Mockito.when(externalAccessRolesService.getMenuFunctionsList(mockedRequest.getHeader(uebKey))) .thenThrow(httpClientErrorException); assertNull(externalAccessRolesController.getMenuFunctions(mockedRequest, mockedResponse)); + String result = sw.getBuffer().toString().trim(); + assertEquals(reason, result); } -// @Test -// public void getUsersOfApplicationTest() throws Exception { -// List<String> users = new ArrayList<>(); -// Mockito.when(externalAccessRolesService.getAllUsers(mockedRequest.getHeader(uebKey))).thenReturn(users); -// List<String> expectedusers = externalAccessRolesController.getUsersOfApplication(mockedRequest, mockedResponse); -// assertEquals(users, expectedusers); -// } - -// @Test -// public void getUsersOfApplicationExceptionTest() throws Exception { -// Mockito.when(externalAccessRolesService.getAllUsers(mockedRequest.getHeader(uebKey))) -// .thenThrow(httpClientErrorException); -// assertNull(externalAccessRolesController.getUsersOfApplication(mockedRequest, mockedResponse)); -// } @Test public void saveRoleExceptionTest() throws Exception { Role role = new Role(); PortalRestResponse<String> portalRestResponse = null; PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Failed to saveRole"); + expectedportalRestResponse.setMessage("Invalid uebkey!"); expectedportalRestResponse.setResponse("Failed"); PortalRestStatusEnum portalRestStatusEnum = null; expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); List<Role> upload = new ArrayList<>(); portalRestResponse = externalAccessRolesController.saveRole(mockedRequest, mockedResponse,role); + assertEquals(portalRestResponse, expectedportalRestResponse); } @@ -522,7 +595,7 @@ public class ExternalAccessRolesControllerTest { String role = "TestNew"; PortalRestResponse<String> portalRestResponse = null; PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Failed to deleteRole for 'TestNew'"); + expectedportalRestResponse.setMessage("Invalid uebkey!"); expectedportalRestResponse.setResponse("Failed"); PortalRestStatusEnum portalRestStatusEnum = null; expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); @@ -566,4 +639,73 @@ public class ExternalAccessRolesControllerTest { Mockito.when(externalAccessRolesService.getAllAppUsers(mockedRequest.getHeader(uebKey))).thenThrow(nullPointerException); assertNull(externalAccessRolesController.getUsersOfApplication(mockedRequest, mockedResponse)); } + + @Test(expected = NullPointerException.class) + public void deleteRoleV2Test() throws Exception + { + List<EPApp> applicationList = new ArrayList<EPApp>(); + EPApp app = mockApp(); + applicationList.add(app); + Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList); + ExternalRequestFieldsValidator externalRequestFieldsValidator = new ExternalRequestFieldsValidator(true, "Success"); + Mockito.when(externalAccessRolesService.deleteDependencyRoleRecord(Matchers.anyLong(),Matchers.anyString(),Matchers.anyString())).thenReturn(externalRequestFieldsValidator); + PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); + expectedportalRestResponse.setMessage("Successfully Deleted"); + expectedportalRestResponse.setResponse("Success"); + PortalRestStatusEnum portalRestStatusEnum = null; + expectedportalRestResponse.setStatus(portalRestStatusEnum.OK); + PortalRestResponse<String> actualResponse = externalAccessRolesController.deleteRole(mockedRequest, mockedResponse, (long)1); + assertNull(actualResponse); + } + + @Test + public void deleteRoleV2InvalidUebKeyTest() throws Exception + { + List<EPApp> applicationList = new ArrayList<EPApp>(); + EPApp app = mockApp(); + applicationList.add(app); + Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenThrow(new Exception("Invalid uebkey!")); + PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); + expectedportalRestResponse.setMessage("Invalid uebkey!"); + expectedportalRestResponse.setResponse("Failed"); + PortalRestStatusEnum portalRestStatusEnum = null; + expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); + PortalRestResponse<String> actualResponse = externalAccessRolesController.deleteRole(mockedRequest, mockedResponse, (long)1); + assertEquals(actualResponse, expectedportalRestResponse); + } + + @Test + public void deleteRoleV2InvalidUebKeyWithDiffErrorTest() throws Exception + { + List<EPApp> applicationList = new ArrayList<EPApp>(); + EPApp app = mockApp(); + applicationList.add(app); + Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenThrow(new Exception("test")); + PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); + expectedportalRestResponse.setMessage("test"); + expectedportalRestResponse.setResponse("Failed"); + PortalRestStatusEnum portalRestStatusEnum = null; + expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); + PortalRestResponse<String> actualResponse = externalAccessRolesController.deleteRole(mockedRequest, mockedResponse, (long)1); + assertEquals(actualResponse, expectedportalRestResponse); + } + + + @Test(expected = NullPointerException.class) + public void deleteRoleV2ExceptionTest() throws Exception + { + List<EPApp> applicationList = new ArrayList<EPApp>(); + EPApp app = mockApp(); + applicationList.add(app); + Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList); + ExternalRequestFieldsValidator externalRequestFieldsValidator = new ExternalRequestFieldsValidator(false, "failed"); + Mockito.when(externalAccessRolesService.deleteDependencyRoleRecord(Matchers.anyLong(),Matchers.anyString(),Matchers.anyString())).thenReturn(externalRequestFieldsValidator); + PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); + expectedportalRestResponse.setMessage("Failed to deleteRole"); + expectedportalRestResponse.setResponse("Failed"); + PortalRestStatusEnum portalRestStatusEnum = null; + expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); + PortalRestResponse<String> actualResponse = externalAccessRolesController.deleteRole(mockedRequest, mockedResponse, (long)1); + assertEquals(actualResponse, null); + } } diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ExternalAppsRestfulControllerTest.java index 4bd3288a..ae2497e4 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ExternalAppsRestfulControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; @@ -53,26 +53,26 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.ExternalAppsRestfulController; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl; -import org.openecomp.portalapp.portal.service.EPLoginService; -import org.openecomp.portalapp.portal.service.EPLoginServiceImpl; -import org.openecomp.portalapp.portal.service.EPRoleService; -import org.openecomp.portalapp.portal.service.EPRoleServiceImpl; -import org.openecomp.portalapp.portal.service.FunctionalMenuService; -import org.openecomp.portalapp.portal.service.FunctionalMenuServiceImpl; -import org.openecomp.portalapp.portal.service.UserNotificationService; -import org.openecomp.portalapp.portal.service.UserNotificationServiceImpl; -import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItemJson; -import org.openecomp.portalapp.portal.transport.FunctionalMenuItem; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.service.DataAccessServiceImpl; +import org.onap.portalapp.portal.controller.ExternalAppsRestfulController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.AdminRolesServiceImpl; +import org.onap.portalapp.portal.service.EPLoginService; +import org.onap.portalapp.portal.service.EPLoginServiceImpl; +import org.onap.portalapp.portal.service.EPRoleService; +import org.onap.portalapp.portal.service.EPRoleServiceImpl; +import org.onap.portalapp.portal.service.FunctionalMenuService; +import org.onap.portalapp.portal.service.FunctionalMenuServiceImpl; +import org.onap.portalapp.portal.service.UserNotificationService; +import org.onap.portalapp.portal.service.UserNotificationServiceImpl; +import org.onap.portalapp.portal.transport.FavoritesFunctionalMenuItemJson; +import org.onap.portalapp.portal.transport.FunctionalMenuItem; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.service.DataAccessServiceImpl; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/FunctionalMenuControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/FunctionalMenuControllerTest.java index b72ef9af..488717ca 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/FunctionalMenuControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/FunctionalMenuControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -56,28 +56,28 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.runners.MockitoJUnitRunner; -import org.openecomp.portalapp.portal.controller.FunctionalMenuController; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl; -import org.openecomp.portalapp.portal.service.FunctionalMenuService; -import org.openecomp.portalapp.portal.service.FunctionalMenuServiceImpl; -import org.openecomp.portalapp.portal.service.SearchService; -import org.openecomp.portalapp.portal.transport.BusinessCardApplicationRole; -import org.openecomp.portalapp.portal.transport.BusinessCardApplicationRolesList; -import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItem; -import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItemJson; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.FieldsValidator.FieldName; -import org.openecomp.portalapp.portal.transport.FunctionalMenuItem; -import org.openecomp.portalapp.portal.transport.FunctionalMenuItemWithRoles; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.controller.FunctionalMenuController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.AdminRolesServiceImpl; +import org.onap.portalapp.portal.service.FunctionalMenuService; +import org.onap.portalapp.portal.service.FunctionalMenuServiceImpl; +import org.onap.portalapp.portal.service.SearchService; +import org.onap.portalapp.portal.transport.BusinessCardApplicationRole; +import org.onap.portalapp.portal.transport.BusinessCardApplicationRolesList; +import org.onap.portalapp.portal.transport.FavoritesFunctionalMenuItem; +import org.onap.portalapp.portal.transport.FavoritesFunctionalMenuItemJson; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.FunctionalMenuItem; +import org.onap.portalapp.portal.transport.FunctionalMenuItemWithRoles; +import org.onap.portalapp.portal.transport.FieldsValidator.FieldName; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.SystemProperties; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @@ -293,7 +293,7 @@ public class FunctionalMenuControllerTest extends MockitoTestSuite { @Test public void getFunctionalMenuItemDetailsBadPermissionTest(){ - Integer menuId = 1234; + Long menuId = 1234L; FunctionalMenuItem actualmenuItem = null; FunctionalMenuItem expectedmenuItem = null; EPUser user = mockUser.mockEPUser(); @@ -305,7 +305,7 @@ public class FunctionalMenuControllerTest extends MockitoTestSuite { @Test public void getFunctionalMenuItemDetailsExceptionTest(){ - Integer menuId = 1234; + Long menuId = 1234L; FunctionalMenuItem actualmenuItem = null; FunctionalMenuItem expectedmenuItem = null; EPUser user = mockUser.mockEPUser(); @@ -319,7 +319,7 @@ public class FunctionalMenuControllerTest extends MockitoTestSuite { @Test public void getFunctionalMenuItemDetailsTest(){ - Integer menuId = 1234; + Long menuId = 1234L; FunctionalMenuItem actualmenuItem = null; FunctionalMenuItem expectedmenuItem = null; EPUser user = mockUser.mockEPUser(); diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/GetAccessControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/GetAccessControllerTest.java index e18704fe..dbe4b7b7 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/GetAccessControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/GetAccessControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertTrue; @@ -52,14 +52,14 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.GetAccessController; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.GetAccessResult; -import org.openecomp.portalapp.portal.service.GetAccessService; -import org.openecomp.portalapp.portal.service.GetAccessServiceImpl; -import org.openecomp.portalapp.util.EPUserUtils; +import org.onap.portalapp.portal.controller.GetAccessController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.GetAccessResult; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.GetAccessService; +import org.onap.portalapp.portal.service.GetAccessServiceImpl; +import org.onap.portalapp.util.EPUserUtils; public class GetAccessControllerTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ManifestControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ManifestControllerTest.java index 61d5bb34..fdab8151 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ManifestControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ManifestControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertTrue; @@ -50,10 +50,10 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.ManifestController; -import org.openecomp.portalapp.portal.service.ManifestService; -import org.openecomp.portalapp.portal.service.ManifestServiceImpl; +import org.onap.portalapp.portal.controller.ManifestController; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.ManifestService; +import org.onap.portalapp.portal.service.ManifestServiceImpl; public class ManifestControllerTest extends MockitoTestSuite{ diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/MicroserviceControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/MicroserviceControllerTest.java index 3b569aca..e6e9f759 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/MicroserviceControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/MicroserviceControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertEquals; @@ -52,18 +52,19 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.domain.MicroserviceData; -import org.openecomp.portalapp.portal.domain.WidgetCatalog; -import org.openecomp.portalapp.portal.domain.WidgetServiceHeaders; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.service.ConsulHealthService; -import org.openecomp.portalapp.portal.service.ConsulHealthServiceImpl; -import org.openecomp.portalapp.portal.service.MicroserviceService; -import org.openecomp.portalapp.portal.service.MicroserviceServiceImpl; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.controller.MicroserviceController; +import org.onap.portalapp.portal.domain.MicroserviceData; +import org.onap.portalapp.portal.domain.WidgetCatalog; +import org.onap.portalapp.portal.domain.WidgetServiceHeaders; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.ConsulHealthService; +import org.onap.portalapp.portal.service.ConsulHealthServiceImpl; +import org.onap.portalapp.portal.service.MicroserviceService; +import org.onap.portalapp.portal.service.MicroserviceServiceImpl; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalsdk.core.util.SystemProperties; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/MicroserviceProxyControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/MicroserviceProxyControllerTest.java index e712e4d2..446c11c4 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/MicroserviceProxyControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/MicroserviceProxyControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertTrue; @@ -46,13 +46,13 @@ import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.MicroserviceProxyController; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.service.MicroserviceProxyService; -import org.openecomp.portalapp.portal.service.MicroserviceProxyServiceImpl; -import org.openecomp.portalapp.util.EPUserUtils; +import org.onap.portalapp.portal.controller.MicroserviceProxyController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.MicroserviceProxyService; +import org.onap.portalapp.portal.service.MicroserviceProxyServiceImpl; +import org.onap.portalapp.util.EPUserUtils; import org.springframework.http.HttpStatus; import org.springframework.web.client.HttpClientErrorException; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/PolicyControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/PolicyControllerTest.java index 84b600be..9c1cbeeb 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/PolicyControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/PolicyControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,13 +35,13 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; - +package org.onap.portalapp.portal.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.BadRequestException; import org.json.simple.JSONObject; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -50,35 +50,31 @@ import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.scheduler.SchedulerRestInterface; -import org.openecomp.portalapp.portal.scheduler.policy.PolicyProperties; -import org.openecomp.portalapp.portal.scheduler.policy.PolicyResponseWrapper; -import org.openecomp.portalapp.portal.scheduler.policy.PolicyRestInterfaceFactory; -import org.openecomp.portalapp.portal.scheduler.policy.PolicyRestInterfaceIfc; -import org.openecomp.portalapp.portal.scheduler.policy.PolicyUtil; -import org.openecomp.portalapp.portal.scheduler.policy.RestObject; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.scheduler.SchedulerProperties; +import org.onap.portalapp.portal.scheduler.SchedulerRestInterface; +import org.onap.portalapp.portal.scheduleraux.RestObject; +import org.onap.portalapp.portal.scheduleraux.SchedulerAuxResponseWrapper; +import org.onap.portalapp.portal.scheduleraux.SchedulerAuxRestInterfaceFactory; +import org.onap.portalapp.portal.scheduleraux.SchedulerAuxRestInterfaceIfc; +import org.onap.portalapp.portal.scheduleraux.SchedulerAuxUtil; +import org.onap.portalsdk.core.web.support.UserUtils; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import junit.framework.Assert; @RunWith(PowerMockRunner.class) -@PrepareForTest({ UserUtils.class, SystemProperties.class, PolicyProperties.class, PolicyRestInterfaceFactory.class, - PolicyUtil.class }) +@PrepareForTest({ UserUtils.class, SchedulerProperties.class, SchedulerAuxRestInterfaceFactory.class,SchedulerAuxUtil.class }) public class PolicyControllerTest { - @Mock SchedulerRestInterface schedulerRestInterface; @InjectMocks - PolicyController policyController = new PolicyController(); + SchedulerAuxController policyController = new SchedulerAuxController(); @Before public void setup() { @@ -95,65 +91,58 @@ public class PolicyControllerTest { @Before public void setUp() { - PowerMockito.mockStatic(SystemProperties.class); - PowerMockito.mockStatic(PolicyProperties.class); - Mockito.when(SystemProperties.getProperty(PolicyProperties.POLICY_GET_CONFIG_VAL)).thenReturn("/api/getConfig"); - Mockito.when(SystemProperties.getProperty(PolicyProperties.POLICY_CLIENT_MECHID_VAL)) + PowerMockito.mockStatic(SchedulerProperties.class); + + Mockito.when(SchedulerProperties.getProperty(SchedulerProperties.SCHEDULERAUX_GET_CONFIG_VAL)).thenReturn("/api/getConfig"); + Mockito.when(SchedulerProperties.getProperty(SchedulerProperties.SCHEDULERAUX_CLIENT_MECHID_VAL)) .thenReturn("m06814@controller.dcae.ecomp.att.com"); - Mockito.when(SystemProperties.getProperty(PolicyProperties.POLICY_CLIENT_PASSWORD_VAL)) + Mockito.when(SchedulerProperties.getProperty(SchedulerProperties.SCHEDULERAUX_CLIENT_PASSWORD_VAL)) .thenReturn("OBF:1ffu1qvu1t2z1l161fuk1i801nz91ro41xf71xfv1rqi1nx51i7y1fuq1kxw1t371qxw1fh0"); - Mockito.when(SystemProperties.getProperty(PolicyProperties.POLICY_USERNAME_VAL)).thenReturn("testpdp"); - Mockito.when(SystemProperties.getProperty(PolicyProperties.POLICY_PASSWORD_VAL)) + Mockito.when(SchedulerProperties.getProperty(SchedulerProperties.SCHEDULERAUX_USERNAME_VAL)).thenReturn("testpdp"); + Mockito.when(SchedulerProperties.getProperty(SchedulerProperties.SCHEDULERAUX_PASSWORD_VAL)) .thenReturn("OBF:1igd1kft1l1a1sw61svs1kxs1kcl1idt"); - Mockito.when(SystemProperties.getProperty(PolicyProperties.POLICY_ENVIRONMENT_VAL)).thenReturn("TEST"); - Mockito.when(SystemProperties.getProperty(PolicyProperties.POLICY_SERVER_URL_VAL)) + Mockito.when(SchedulerProperties.getProperty(SchedulerProperties.SCHEDULERAUX_ENVIRONMENT_VAL)).thenReturn("TEST"); + Mockito.when(SchedulerProperties.getProperty(SchedulerProperties.SCHEDULERAUX_SERVER_URL_VAL)) .thenReturn("https://policypdp-conexus-e2e.ecomp.cci.att.com:8081/pdp"); } - @SuppressWarnings({ "unchecked", "deprecation" }) + @SuppressWarnings({ "unchecked" }) @Test public void getPolicyInfoTest1() throws Exception { JSONObject jsonObject = Mockito.mock(JSONObject.class); - PowerMockito.mockStatic(PolicyRestInterfaceFactory.class); - PowerMockito.mockStatic(SystemProperties.class); - PolicyRestInterfaceIfc policyRestInterface = Mockito.mock(PolicyRestInterfaceIfc.class); - PowerMockito.mockStatic(PolicyUtil.class); + PowerMockito.mockStatic(SchedulerAuxRestInterfaceFactory.class); + PowerMockito.mockStatic(SchedulerProperties.class); + SchedulerAuxRestInterfaceIfc policyRestInterface = Mockito.mock(SchedulerAuxRestInterfaceIfc.class); + PowerMockito.mockStatic(SchedulerAuxUtil.class); // RestObject restObj=Mockito.mock(RestObject.class); - PolicyResponseWrapper policyWrapper = Mockito.mock(PolicyResponseWrapper.class); - PowerMockito.when(PolicyUtil.wrapResponse(Matchers.any(RestObject.class))).thenReturn(policyWrapper); + SchedulerAuxResponseWrapper policyWrapper = Mockito.mock(SchedulerAuxResponseWrapper.class); + PowerMockito.when(SchedulerAuxUtil.wrapResponse(Matchers.any(RestObject.class))).thenReturn(policyWrapper); Mockito.when(policyWrapper.getResponse()).thenReturn("Success"); Mockito.when(policyWrapper.getStatus()).thenReturn(200); - PowerMockito.when(PolicyRestInterfaceFactory.getInstance()).thenReturn(policyRestInterface); + PowerMockito.when(SchedulerAuxRestInterfaceFactory.getInstance()).thenReturn(policyRestInterface); Mockito.doNothing().when(policyRestInterface).Post(Matchers.anyString(), Matchers.anyObject(), Matchers.anyString(), Matchers.anyString(), Matchers.anyObject()); - ResponseEntity<String> responsePolicy = policyController.getPolicyInfo(mockedRequest, jsonObject); + ResponseEntity<String> responsePolicy = policyController.getPolicyInfo(mockedRequest); Assert.assertEquals(responsePolicy.getStatusCode(), HttpStatus.OK); } @SuppressWarnings("unchecked") - @Test(expected = Exception.class) + @Test public void getPolicyInfoTestexpected() throws Exception { JSONObject jsonObject = Mockito.mock(JSONObject.class); - PowerMockito.mockStatic(PolicyRestInterfaceFactory.class); - PowerMockito.mockStatic(SystemProperties.class); - PolicyRestInterfaceIfc policyRestInterface = Mockito.mock(PolicyRestInterfaceIfc.class); - PowerMockito.mockStatic(PolicyUtil.class); - // RestObject restObj=Mockito.mock(RestObject.class); - PolicyResponseWrapper policyWrapper = Mockito.mock(PolicyResponseWrapper.class); - PowerMockito.when(PolicyUtil.wrapResponse(Matchers.any(RestObject.class))).thenReturn(policyWrapper); - Mockito.when(policyWrapper.getResponse()).thenThrow(new BadRequestException()); - Mockito.when(policyWrapper.getStatus()).thenThrow(new BadRequestException()); + PowerMockito.mockStatic(SchedulerAuxRestInterfaceFactory.class); + PowerMockito.mockStatic(SchedulerProperties.class); + Mockito.when(SchedulerProperties.getProperty(SchedulerProperties.SCHEDULERAUX_GET_CONFIG_VAL)).thenThrow(nullPointerException); + ResponseEntity<String> responsePolicy = policyController.getPolicyInfo(mockedRequest); + Assert.assertEquals(responsePolicy.getStatusCode(), HttpStatus.INTERNAL_SERVER_ERROR); - PowerMockito.when(PolicyRestInterfaceFactory.getInstance()).thenReturn(policyRestInterface); - Mockito.doNothing().when(policyRestInterface).Post(Matchers.anyString(), Matchers.anyObject(), - Matchers.anyString(), Matchers.anyString(), Matchers.anyObject()); - - policyController.getPolicyInfo(mockedRequest, jsonObject); } + + } diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/PortalAdminControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/PortalAdminControllerTest.java index 142d5ff4..0c48f176 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/PortalAdminControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/PortalAdminControllerTest.java @@ -1,12 +1,13 @@ + /*- * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +20,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -34,8 +35,7 @@ * ============LICENSE_END============================================ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ -package org.openecomp.portalapp.portal.controller; + */package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; @@ -52,19 +52,22 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl; -import org.openecomp.portalapp.portal.service.PortalAdminService; -import org.openecomp.portalapp.portal.service.PortalAdminServiceImpl; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.PortalAdmin; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.service.AuditService; -import org.openecomp.portalsdk.core.service.AuditServiceImpl; +import org.onap.portalapp.portal.controller.PortalAdminController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.exceptions.NoHealthyServiceException; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.AdminRolesServiceImpl; +import org.onap.portalapp.portal.service.PortalAdminService; +import org.onap.portalapp.portal.service.PortalAdminServiceImpl; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.PortalAdmin; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.service.AuditService; +import org.onap.portalsdk.core.service.AuditServiceImpl; public class PortalAdminControllerTest extends MockitoTestSuite{ diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/RoleManageControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/RoleManageControllerTest.java new file mode 100644 index 00000000..e63ea438 --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/RoleManageControllerTest.java @@ -0,0 +1,525 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.controller; + +import static org.junit.Assert.assertEquals; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.SortedSet; +import java.util.TreeSet; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Matchers; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.onap.portalapp.controller.core.RoleController; +import org.onap.portalapp.controller.core.RoleFunctionListController; +import org.onap.portalapp.controller.core.RoleListController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.CentralV2RoleFunction; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.EPAppService; +import org.onap.portalapp.portal.service.ExternalAccessRolesService; +import org.onap.portalapp.portal.transport.CentralV2Role; +import org.onap.portalapp.portal.transport.ExternalRequestFieldsValidator; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.service.AuditService; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.servlet.ModelAndView; + +public class RoleManageControllerTest { + + @Mock + RoleController roleController; + + @Mock + RoleListController roleListController; + + @Mock + RoleFunctionListController roleFunctionListController; + + + @Mock + ExternalAccessRolesService externalAccessRolesService; + @Mock + EPUserUtils ePUserUtils = new EPUserUtils(); + + @Mock + ExternalAccessRolesService externalAccessRolesService1 = null; + + @InjectMocks + RoleManageController roleManageController = new RoleManageController(); + + @Mock + EPAppService appService; + + @Mock + AuditService auditService; + + @Mock + AdminRolesService adminRolesService; + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + } + + MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); + + HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); + HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); + NullPointerException nullPointerException = new NullPointerException(); + MockEPUser mockUser = new MockEPUser(); + + + @Test + public void removeRoleRoleFunctionTest() throws Exception + { + + ModelAndView modelandView = new ModelAndView("login.htm"); + Mockito.when(roleController.removeRoleFunction(mockedRequest, mockedResponse)).thenReturn(modelandView); + ModelAndView expectedModelandView = roleManageController.removeRoleRoleFunction(mockedRequest, mockedResponse); + assertEquals(expectedModelandView, modelandView); + } + + @Test + public void addRoleRoRoleFunctionTest() throws Exception + { + ModelAndView modelandView = new ModelAndView("login.htm"); + Mockito.when(roleController.addRoleFunction(mockedRequest, mockedResponse)).thenReturn(modelandView); + ModelAndView expectedModelandView = roleManageController.addRoleRoRoleFunction(mockedRequest, mockedResponse); + assertEquals(expectedModelandView, modelandView); + } + + @Test + public void removeChildRoleTest() throws Exception + { + ModelAndView modelandView = new ModelAndView("login.htm"); + Mockito.when(roleController.removeChildRole(mockedRequest, mockedResponse)).thenReturn(modelandView); + ModelAndView expectedModelandView = roleManageController.removeChildRole(mockedRequest, mockedResponse); + assertEquals(expectedModelandView, modelandView); + } + + + @Test + public void getRoleIfRoleIdNullTest() throws Exception + { + Mockito.when(appService.getApp((long) 1)).thenReturn(CentralApp()); + CentralV2Role answer = new CentralV2Role(); + Mockito.when(externalAccessRolesService.getRoleInfo((long) 1, "test")).thenReturn(answer); + List<CentralV2RoleFunction> finalRoleFunctionList = new ArrayList<>(); + Mockito.when(externalAccessRolesService.getRoleFuncList("test")).thenReturn(finalRoleFunctionList); + Mockito.when(externalAccessRolesService.getRolesForApp("test")).thenReturn(null); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); + List<EPApp> appList = new ArrayList<>(); + appList.add(CentralApp()); + ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.OK); + Mockito.when( externalAccessRolesService.getNameSpaceIfExists(Matchers.anyObject())).thenReturn(response); + Mockito.when(externalAccessRolesService.getApp(Matchers.anyString())).thenReturn(appList); + roleManageController.getRole(mockedRequest, mockedResponse, (long)1,null); + +} + + @Test(expected = Exception.class) + public void getRoleExceptionTest() throws Exception + { + Mockito.when(appService.getApp((long) 1)).thenReturn(mockApp()); + CentralV2Role answer = new CentralV2Role(); + Mockito.when(externalAccessRolesService.getRoleInfo((long) 1, "test")).thenReturn(answer); + Mockito.when(externalAccessRolesService.getRoleFuncList("test")).thenThrow(nullPointerException); + roleManageController.getRole(mockedRequest, mockedResponse, (long)1,null); + +} + @Test + public void getRoleIfRoleIdNotNullTest() throws Exception + { + Mockito.when(appService.getApp((long) 1)).thenReturn(CentralApp()); + CentralV2Role answer = new CentralV2Role(); + Mockito.when(externalAccessRolesService.getRoleInfo((long) 1, "test")).thenReturn(answer); + List<CentralV2RoleFunction> finalRoleFunctionList = new ArrayList<>(); + Mockito.when(externalAccessRolesService.getRoleFuncList("test")).thenReturn(finalRoleFunctionList); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); + CentralV2Role currentRole = new CentralV2Role(); + SortedSet<CentralV2Role> parentRoles = new TreeSet<>(); + CentralV2Role centralV2Role = new CentralV2Role(); + centralV2Role.setName("test"); + parentRoles.add(centralV2Role); + currentRole.setParentRoles(parentRoles); + Mockito.when(externalAccessRolesService.getRoleInfo((long) 1, "test")).thenReturn(currentRole); + List<CentralV2Role> availableChildRoles = new ArrayList<>(); + availableChildRoles.add(currentRole); + Mockito.when(externalAccessRolesService.getRolesForApp("test")).thenReturn(availableChildRoles); + List<EPApp> appList = new ArrayList<>(); + appList.add(CentralApp()); + ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.OK); + Mockito.when( externalAccessRolesService.getNameSpaceIfExists(Matchers.anyObject())).thenReturn(response); + Mockito.when(externalAccessRolesService.getApp(Matchers.anyString())).thenReturn(appList); + roleManageController.getRole(mockedRequest, mockedResponse, (long)1,(long)1); +} + + public EPApp mockApp() + { + EPApp app = new EPApp(); + + app.setName("Test"); + app.setImageUrl("test"); + app.setDescription("test"); + app.setNotes("test"); + app.setUrl("test"); + app.setId((long) 1); + app.setAppRestEndpoint("test"); + app.setAlternateUrl("test"); + app.setName("test"); + app.setMlAppName("test"); + app.setMlAppAdminId("test"); + app.setUsername("test"); + app.setAppPassword("test"); + app.setOpen(false); + app.setEnabled(false); + app.setUebKey("test"); + app.setUebSecret("test"); + app.setUebTopicName("test"); + app.setAppType(1); + return app; + + } + @Test + public void getRolesTest() throws Exception { + EPApp app = mockApp(); + app.setCentralAuth(true); + List<CentralV2Role> answer = new ArrayList<>(); + Mockito.when(appService.getApp((long) 1)).thenReturn(app); + Mockito.when(externalAccessRolesService.getRolesForApp("test")).thenReturn(answer); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); + List<EPApp> appList = new ArrayList<>(); + appList.add(CentralApp()); + ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.OK); + Mockito.when( externalAccessRolesService.getNameSpaceIfExists(Matchers.anyObject())).thenReturn(response); + Mockito.when(externalAccessRolesService.getApp(Matchers.anyString())).thenReturn(appList); + roleManageController.getRoles(mockedRequest, mockedResponse, (long) 1); + } + + @Test + public void getRolesExceptionTest() throws Exception { + EPApp app = CentralApp(); + Mockito.when(appService.getApp((long) 1)).thenReturn(app); + Mockito.when(externalAccessRolesService.getRolesForApp("test")).thenThrow(new java.lang.Exception()); + roleManageController.getRoles(mockedRequest, mockedResponse, (long) 1); + + } + + @Test + public void getRoleFunctionListTest() throws Exception { + Mockito.when(appService.getApp((long) 1)).thenReturn(CentralApp()); + List<CentralV2RoleFunction> answer = new ArrayList<>(); + Mockito.when(externalAccessRolesService.getRoleFuncList("test")).thenReturn(answer); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); + List<EPApp> appList = new ArrayList<>(); + appList.add(CentralApp()); + ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.OK); + Mockito.when( externalAccessRolesService.getNameSpaceIfExists(Matchers.anyObject())).thenReturn(response); + Mockito.when(externalAccessRolesService.getApp(Matchers.anyString())).thenReturn(appList); + roleManageController.getRoleFunctionList(mockedRequest, mockedResponse, (long) 1); + } + + @Test(expected = Exception.class) + public void getRoleFunctionListExceptionTest() throws Exception { + Mockito.when(appService.getApp((long) 1)).thenReturn(NonCentralApp()); + roleManageController.getRoleFunctionList(mockedRequest, mockedResponse, (long) 1); + } + + @Test + public void saveRoleFunctionTest() throws Exception { + Mockito.when(appService.getApp((long) 1)).thenReturn(CentralApp()); + Mockito.doNothing().when(roleFunctionListController).saveRoleFunction(mockedRequest, mockedResponse, "test"); + CentralV2RoleFunction addNewFunc = new CentralV2RoleFunction(); + addNewFunc.setCode("Test"); + addNewFunc.setName("Test"); + CentralV2RoleFunction roleFunction = mockCentralRoleFunction(); + Mockito.when(externalAccessRolesService.getRoleFunction("Test", "test")).thenReturn(roleFunction); + Mockito.when(externalAccessRolesService.saveCentralRoleFunction(Matchers.anyObject(), Matchers.anyObject())) + .thenReturn(true); + EPUser user = mockUser.mockEPUser(); + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + List<EPUser> userList = new ArrayList<>(); + userList.add(user); + List<EPApp> appList = new ArrayList<>(); + appList.add(CentralApp()); + Mockito.when(externalAccessRolesService.getUser("guestT")).thenReturn(userList); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); + ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.OK); + Mockito.when( externalAccessRolesService.getNameSpaceIfExists(Matchers.anyObject())).thenReturn(response); + Mockito.when(externalAccessRolesService.getApp(Matchers.anyString())).thenReturn(appList); + roleManageController.saveRoleFunction(mockedRequest, mockedResponse, addNewFunc, (long) 1); + } + + @Test + public void saveRoleFunctionExceptionTest() throws Exception { + Mockito.when(appService.getApp((long) 1)).thenReturn(CentralApp()); + Mockito.doNothing().when(roleFunctionListController).saveRoleFunction(mockedRequest, mockedResponse, "test"); + CentralV2RoleFunction addNewFunc = new CentralV2RoleFunction(); + addNewFunc.setCode("Test"); + addNewFunc.setName("Test"); + Mockito.when(externalAccessRolesService.getRoleFunction("Test", "test")).thenReturn(null); + roleManageController.saveRoleFunction(mockedRequest, mockedResponse, addNewFunc, (long) 1); + } + + @Test + public void saveRoleFunctionIfAppNotCentralizedTest() throws Exception { + CentralV2RoleFunction addNewFunc = new CentralV2RoleFunction(); + addNewFunc.setCode("Test"); + addNewFunc.setName("Test"); + Mockito.when(appService.getApp((long) 1)).thenReturn(NonCentralApp()); + String roleFun = "{\"name\":\"Test\",\"code\":\"Test\"}"; + roleManageController.saveRoleFunction(mockedRequest, mockedResponse, addNewFunc, (long) 1); + } + + @Test + public void removeRoleFunctionTest() throws Exception { + EPUser user = mockUser.mockEPUser(); + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + Mockito.when(appService.getApp((long) 1)).thenReturn(CentralApp()); + String roleFun = "{\"name\":\"Test\",\"code\":\"Test\"}"; + CentralV2RoleFunction roleFunction = mockCentralRoleFunction(); + Mockito.when(externalAccessRolesService.getRoleFunction("Test", "test")).thenReturn(roleFunction); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); + Mockito.when(externalAccessRolesService.deleteCentralRoleFunction(Matchers.anyString(), Matchers.anyObject())) + .thenReturn(true); + List<EPApp> appList = new ArrayList<>(); + appList.add(CentralApp()); + ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.OK); + Mockito.when( externalAccessRolesService.getNameSpaceIfExists(Matchers.anyObject())).thenReturn(response); + Mockito.when(externalAccessRolesService.getApp(Matchers.anyString())).thenReturn(appList); + roleManageController.removeRoleFunction(mockedRequest, mockedResponse, roleFun, (long) 1); + } + + @Test + public void removeRoleFunctionExceptionTest() throws Exception { + EPUser user = mockUser.mockEPUser(); + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + Mockito.when(appService.getApp((long) 1)).thenReturn(CentralApp()); + String roleFun = "{\"name\":\"Test\",\"code\":\"Test\"}"; + CentralV2RoleFunction roleFunction = mockCentralRoleFunction(); + Mockito.when(externalAccessRolesService.getRoleFunction("Test", "test")).thenReturn(roleFunction); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); + Mockito.when(externalAccessRolesService.deleteCentralRoleFunction(Matchers.anyString(), Matchers.anyObject())) + .thenReturn(false); + List<EPApp> appList = new ArrayList<>(); + appList.add(CentralApp()); + ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.OK); + Mockito.when( externalAccessRolesService.getNameSpaceIfExists(Matchers.anyObject())).thenReturn(response); + Mockito.when(externalAccessRolesService.getApp(Matchers.anyString())).thenReturn(appList); + roleManageController.removeRoleFunction(mockedRequest, mockedResponse, roleFun, (long) 1); + } + + @Test + public void removeRoleFunctionIfAppNotCentralizedTest() throws Exception { + EPApp app = mockApp(); + app.setCentralAuth(false); + Mockito.when(appService.getApp((long) 1)).thenReturn(app); + String roleFun = "{\"name\":\"Test\",\"code\":\"Test\"}"; + roleManageController.removeRoleFunction(mockedRequest, mockedResponse, roleFun, (long) 1); + } + + @Test + public void syncRolesTest() throws Exception { + EPApp app = mockApp(); + app.setId((long) 1); + EPUser user = mockUser.mockEPUser(); + Mockito.when(appService.getApp(1l)).thenReturn(app); + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + Mockito.when(adminRolesService.isSuperAdmin(Matchers.anyObject())).thenReturn(true); + Mockito.doNothing().when(externalAccessRolesService).syncApplicationRolesWithEcompDB(app); + List<EPApp> appList = new ArrayList<>(); + appList.add(CentralApp()); + ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.OK); + Mockito.when( externalAccessRolesService.getNameSpaceIfExists(Matchers.anyObject())).thenReturn(response); + Mockito.when(externalAccessRolesService.getApp(Matchers.anyString())).thenReturn(appList); + PortalRestResponse<String> actual = roleManageController.syncRoles(mockedRequest, mockedResponse, 1l); + PortalRestResponse<String> portalRestResponse = new PortalRestResponse<>(); + portalRestResponse.setMessage("Sync roles completed successfully!"); + portalRestResponse.setResponse("Success"); + portalRestResponse.setStatus(PortalRestStatusEnum.OK); + assertEquals(portalRestResponse, actual); + } + + @Test + public void syncRolesException() throws Exception { + Mockito.when(appService.getAppDetailByAppName("test")).thenThrow(nullPointerException); + PortalRestResponse<String> actual = roleManageController.syncRoles(mockedRequest, mockedResponse, 1l); + PortalRestResponse<String> portalRestResponse = new PortalRestResponse<>(); + portalRestResponse.setMessage(null); + portalRestResponse.setResponse("Failed"); + portalRestResponse.setStatus(PortalRestStatusEnum.ERROR); + assertEquals(portalRestResponse, actual); + } + + @Test + public void syncRolesFunctionsTest() throws Exception { + EPApp app = mockApp(); + app.setId((long) 1); + EPUser user = mockUser.mockEPUser(); + Mockito.when(appService.getApp(1l)).thenReturn(app); + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + Mockito.when(adminRolesService.isSuperAdmin(Matchers.anyObject())).thenReturn(true); + Mockito.doNothing().when(externalAccessRolesService).syncRoleFunctionFromExternalAccessSystem(app); + List<EPApp> appList = new ArrayList<>(); + appList.add(CentralApp()); + ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.OK); + Mockito.when( externalAccessRolesService.getNameSpaceIfExists(Matchers.anyObject())).thenReturn(response); + Mockito.when(externalAccessRolesService.getApp(Matchers.anyString())).thenReturn(appList); + PortalRestResponse<String> actual = roleManageController.syncFunctions(mockedRequest, mockedResponse, 1l); + PortalRestResponse<String> portalRestResponse = new PortalRestResponse<>(); + portalRestResponse.setMessage("Sync Functions completed successfully!"); + portalRestResponse.setResponse("Success"); + portalRestResponse.setStatus(PortalRestStatusEnum.OK); + assertEquals(portalRestResponse, actual); + } + + @Test + public void syncRolesFunctionsException() throws Exception { + Mockito.when(appService.getAppDetailByAppName("test")).thenThrow(nullPointerException); + PortalRestResponse<String> actual = roleManageController.syncFunctions(mockedRequest, mockedResponse, 1l); + PortalRestResponse<String> portalRestResponse = new PortalRestResponse<>(); + portalRestResponse.setMessage(null); + portalRestResponse.setResponse("Failed"); + portalRestResponse.setStatus(PortalRestStatusEnum.ERROR); + assertEquals(portalRestResponse, actual); + } + + @Test + public void addeChildRoleTest() throws Exception + { + ModelAndView modelandView = new ModelAndView("login.htm"); + Mockito.when(roleController.addChildRole(mockedRequest, mockedResponse)).thenReturn(modelandView); + ModelAndView expectedModelandView = roleManageController.addChildRole(mockedRequest, mockedResponse); + assertEquals(expectedModelandView, modelandView); + } + + @Test + public void removeRoleTest() throws Exception { + List<EPUser> epuserList = new ArrayList<>(); + List<EPApp> appList = new ArrayList<>(); + appList.add(CentralApp()); + EPUser user = mockUser.mockEPUser(); + epuserList.add(user); + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + Mockito.when(appService.getApp((long) 1)).thenReturn(CentralApp()); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); + ExternalRequestFieldsValidator res = new ExternalRequestFieldsValidator(true, "success"); + Mockito.when(externalAccessRolesService.deleteDependencyRoleRecord(Matchers.anyLong(), Matchers.anyString(), + Matchers.anyString())).thenReturn(res); + Mockito.when(externalAccessRolesService.getUser(Matchers.anyString())).thenReturn(epuserList); + Mockito.when(externalAccessRolesService.getApp(Matchers.anyString())).thenReturn(appList); + ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.OK); + Mockito.when( externalAccessRolesService.getNameSpaceIfExists(Matchers.anyObject())).thenReturn(response); + Map<String, Object> expedtedResponse = new HashMap<String, Object>(); + expedtedResponse.put("restCallStatus", " Unauthorized user"); + Map<String, Object> actualResponse = roleManageController.removeRole(mockedRequest, mockedResponse, (long) 1, (long) 1); + assertEquals(actualResponse.size(), expedtedResponse.size()); + + } + + @Test(expected = Exception.class) + public void removeRoleExceptionTest() throws Exception { + EPUser user = mockUser.mockEPUser(); + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + Mockito.when(appService.getApp((long) 1)).thenThrow(nullPointerException); + StringWriter sw = new StringWriter(); + PrintWriter writer = new PrintWriter(sw); + Mockito.when(mockedResponse.getWriter()).thenReturn(writer); + roleManageController.removeRole(mockedRequest, mockedResponse, (long) 1, (long) 1); + } + + public CentralV2RoleFunction mockCentralRoleFunction() + { + CentralV2RoleFunction roleFunction = new CentralV2RoleFunction(); + roleFunction.setCode("Test"); + roleFunction.setName("Test"); + roleFunction.setAppId((long) 1); + return roleFunction; + } + + public EPApp CentralApp() + { + EPApp app = mockApp(); + app.setCentralAuth(true); + app.setNameSpace("com.test"); + return app; + } + + public EPApp NonCentralApp() + { + EPApp app = mockApp(); + app.setCentralAuth(false); + return app; + } +} diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/RolesApprovalSystemControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/RolesApprovalSystemControllerTest.java index d7cdfe7a..281a0cbe 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/RolesApprovalSystemControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/RolesApprovalSystemControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertEquals; @@ -51,14 +51,14 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.externalsystemapproval.model.ExternalSystemRoleApproval; -import org.openecomp.portalapp.externalsystemapproval.model.ExternalSystemUser; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.RolesApprovalSystemController; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.UserRolesService; -import org.openecomp.portalapp.portal.transport.ExternalRequestFieldsValidator; +import org.onap.portalapp.externalsystemapproval.model.ExternalSystemRoleApproval; +import org.onap.portalapp.externalsystemapproval.model.ExternalSystemUser; +import org.onap.portalapp.portal.controller.RolesApprovalSystemController; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.UserRolesService; +import org.onap.portalapp.portal.transport.ExternalRequestFieldsValidator; public class RolesApprovalSystemControllerTest extends MockitoTestSuite { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SchedulerControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/SchedulerControllerTest.java index 755ec51c..bafcb1c0 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SchedulerControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/SchedulerControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -48,12 +48,13 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.scheduler.SchedulerProperties; -import org.openecomp.portalapp.portal.scheduler.SchedulerRestInterface; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.onap.portalapp.portal.controller.SchedulerController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.scheduler.SchedulerProperties; +import org.onap.portalapp.portal.scheduler.SchedulerRestInterface; +import org.onap.portalsdk.core.util.SystemProperties; +import org.onap.portalsdk.core.web.support.UserUtils; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SessionCommunicationControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/SessionCommunicationControllerTest.java index e425e270..c991dede 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SessionCommunicationControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/SessionCommunicationControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,23 +35,24 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ - package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; -import static org.junit.Assert.assertEquals; +import static org.junit.Assert.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.drools.core.command.assertion.AssertEquals; import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.controller.sessionmgt.SessionCommunicationController; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.service.sessionmgt.ManageService; +import org.onap.portalapp.controller.sessionmgt.SessionCommunicationController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.service.sessionmgt.ManageService; public class SessionCommunicationControllerTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestClient.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/SharedContextRestClient.java index 8cf3e9c0..a6f0dcdc 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestClient.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/SharedContextRestClient.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.net.URI; import java.security.cert.CertificateException; @@ -94,7 +94,7 @@ public class SharedContextRestClient { properties.getProperty(SharedContextTestProperties.SECURE, true), // properties.getProperty(SharedContextTestProperties.UEBKEY), // properties.getProperty(SharedContextTestProperties.USERNAME), // - properties.getProperty(SharedContextTestProperties.PASSWORD), requestPath, // + properties.getProperty(SharedContextTestProperties.COUNTERSIGN), requestPath, // contextId, // contextKey); } @@ -203,7 +203,7 @@ public class SharedContextRestClient { properties.getProperty(SharedContextTestProperties.SECURE, true), // properties.getProperty(SharedContextTestProperties.UEBKEY), // properties.getProperty(SharedContextTestProperties.USERNAME), // - properties.getProperty(SharedContextTestProperties.PASSWORD), // + properties.getProperty(SharedContextTestProperties.COUNTERSIGN), // requestPath, // json); } diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/SharedContextRestControllerTest.java index bdede7d1..05604fd0 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/SharedContextRestControllerTest.java @@ -1,12 +1,13 @@ +package org.onap.portalapp.portal.controller; /*- * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +20,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +36,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -/*package org.openecomp.portalapp.portal.controller; + import java.io.IOException; import java.util.HashMap; @@ -45,15 +46,14 @@ import java.util.UUID; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Assert; +import org.onap.portalapp.portal.controller.SharedContextRestClient; +import org.onap.portalapp.portal.controller.SharedContextTestProperties; import com.fasterxml.jackson.databind.ObjectMapper; -*//** - * Tests the endpoints exposed by the Shared Context REST controller in Portal - * Core. - * - * @author clott - *//* +/** + * Tests the endpoints exposed by the Shared Context controller in Portal. + */ public class SharedContextRestControllerTest { private final Log logger = LogFactory.getLog(getClass()); @@ -142,4 +142,3 @@ public class SharedContextRestControllerTest { return response; } } -*/ diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextTestProperties.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/SharedContextTestProperties.java index 1c849420..49eae75b 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextTestProperties.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/SharedContextTestProperties.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import java.io.IOException; import java.io.InputStream; @@ -56,7 +56,7 @@ public class SharedContextTestProperties extends Properties { public static final String RESTPATH = "restpath"; public static final String UEBKEY = "uebkey"; public static final String USERNAME = "username"; - public static final String PASSWORD = "password"; + public static final String COUNTERSIGN = "countersign"; /** * Expected on the classpath diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/TicketEventControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/TicketEventControllerTest.java index ad696c2c..2b3598c4 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/TicketEventControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/TicketEventControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -53,14 +53,15 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.service.TicketEventService; -import org.openecomp.portalapp.portal.service.UserNotificationService; -import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.onap.portalapp.portal.controller.TicketEventController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.TicketEventService; +import org.onap.portalapp.portal.service.UserNotificationService; +import org.onap.portalsdk.core.web.support.UserUtils; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/UserControllerTest.java index b821b31a..205b2355 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/UserControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertEquals; @@ -49,17 +49,17 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.UserController; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.UserService; -import org.openecomp.portalapp.portal.service.UserServiceImpl; -import org.openecomp.portalapp.portal.transport.ProfileDetail; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; +import org.onap.portalapp.portal.controller.UserController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.UserService; +import org.onap.portalapp.portal.service.UserServiceImpl; +import org.onap.portalapp.portal.transport.ProfileDetail; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.onboarding.util.CipherUtil; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @@ -92,7 +92,7 @@ public class UserControllerTest extends MockitoTestSuite { @Test public void getLoggedinUserExceptionTest() { - EPUser epUser = mockUser.mockEPUser(); + EPUser epUser = null; Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(epUser); PortalRestResponse<ProfileDetail> expectedResponse = new PortalRestResponse<ProfileDetail>(); expectedResponse.setMessage(null); @@ -114,7 +114,7 @@ public class UserControllerTest extends MockitoTestSuite { PortalRestStatusEnum enu = null; expectedResponse.setStatus(enu.OK); PowerMockito.mockStatic(CipherUtil.class); - Mockito.when(CipherUtil.decrypt(epUser.getLoginPwd())).thenReturn("Password"); + Mockito.when(CipherUtil.decryptPKC(epUser.getLoginPwd())).thenReturn("Password"); PortalRestResponse<ProfileDetail> response = userController.getLoggedinUser(mockedRequest); assertEquals(response.getMessage(), expectedResponse.getMessage()); assertEquals(response.getStatus(), expectedResponse.getStatus()); @@ -135,11 +135,9 @@ public class UserControllerTest extends MockitoTestSuite { @Test public void modifyLoggedinUserExceptionTest() { - EPUser epUser = mockUser.mockEPUser(); - + EPUser epUser = null; PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>(); - expectedResponse.setMessage( - "java.lang.ClassCastException: com.sun.crypto.provider.AESCipher$General cannot be cast to javax.crypto.CipherSpi"); + expectedResponse.setMessage("java.lang.NullPointerException"); expectedResponse.setResponse(null); PortalRestStatusEnum enu = null; expectedResponse.setStatus(enu.ERROR); diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserNotificationControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/UserNotificationControllerTest.java index ff08d8a6..d829b60d 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserNotificationControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/UserNotificationControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertTrue; @@ -56,22 +56,22 @@ import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.UserNotificationController; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.FunctionalMenuService; -import org.openecomp.portalapp.portal.service.FunctionalMenuServiceImpl; -import org.openecomp.portalapp.portal.service.UserNotificationService; -import org.openecomp.portalapp.portal.service.UserNotificationServiceImpl; -import org.openecomp.portalapp.portal.transport.EpNotificationItem; -import org.openecomp.portalapp.portal.transport.EpNotificationItemVO; -import org.openecomp.portalapp.portal.transport.FunctionalMenuRole; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.onap.portalapp.portal.controller.UserNotificationController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; +import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.FunctionalMenuService; +import org.onap.portalapp.portal.service.FunctionalMenuServiceImpl; +import org.onap.portalapp.portal.service.UserNotificationService; +import org.onap.portalapp.portal.service.UserNotificationServiceImpl; +import org.onap.portalapp.portal.transport.EpNotificationItem; +import org.onap.portalapp.portal.transport.EpNotificationItemVO; +import org.onap.portalapp.portal.transport.FunctionalMenuRole; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.util.SystemProperties; +import org.onap.portalsdk.core.web.support.UserUtils; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserRolesControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/UserRolesControllerTest.java index 138c207b..2897413e 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserRolesControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/UserRolesControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertEquals; @@ -53,25 +53,25 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.UserRolesController; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EcompAuditLog; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.SearchService; -import org.openecomp.portalapp.portal.service.UserRolesService; -import org.openecomp.portalapp.portal.transport.AppWithRolesForUser; -import org.openecomp.portalapp.portal.transport.AppsListWithAdminRole; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.FieldsValidator.FieldName; -import org.openecomp.portalapp.portal.transport.RoleInAppForUser; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.service.AuditService; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.controller.UserRolesController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EcompAuditLog; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.SearchService; +import org.onap.portalapp.portal.service.UserRolesService; +import org.onap.portalapp.portal.transport.AppWithRolesForUser; +import org.onap.portalapp.portal.transport.AppsListWithAdminRole; +import org.onap.portalapp.portal.transport.FieldsValidator; +import org.onap.portalapp.portal.transport.RoleInAppForUser; +import org.onap.portalapp.portal.transport.FieldsValidator.FieldName; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.service.AuditService; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.SystemProperties; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WebAnalyticsExtAppControllerTest.java index 43f40192..b65c442d 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WebAnalyticsExtAppControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,9 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; + +import java.io.InputStream; +import java.nio.charset.StandardCharsets; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -50,16 +53,19 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl; -import org.openecomp.portalapp.portal.service.AppsCacheService; -import org.openecomp.portalapp.portal.service.AppsCacheServiceImple; -import org.openecomp.portalapp.portal.transport.Analytics; -import org.openecomp.portalsdk.core.onboarding.crossapi.PortalAPIResponse; -import org.openecomp.portalsdk.core.service.AuditService; -import org.openecomp.portalsdk.core.service.AuditServiceImpl; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.controller.WebAnalyticsExtAppController; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.AdminRolesServiceImpl; +import org.onap.portalapp.portal.service.AppsCacheService; +import org.onap.portalapp.portal.service.AppsCacheServiceImple; +import org.onap.portalapp.portal.transport.Analytics; +import org.onap.portalsdk.core.onboarding.crossapi.PortalAPIResponse; +import org.onap.portalsdk.core.service.AuditService; +import org.onap.portalsdk.core.service.AuditServiceImpl; +import org.onap.portalsdk.core.util.SystemProperties; +import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WidgetsCatalogControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WidgetsCatalogControllerTest.java new file mode 100644 index 00000000..50291f07 --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WidgetsCatalogControllerTest.java @@ -0,0 +1,139 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalapp.portal.controller; + +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.onap.portalapp.portal.controller.WidgetsCatalogController; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.WidgetCatalog; +import org.onap.portalapp.portal.domain.WidgetServiceHeaders; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.ConsulHealthService; +import org.onap.portalapp.portal.service.ConsulHealthServiceImpl; +import org.onap.portalapp.portal.service.MicroserviceService; +import org.onap.portalapp.portal.service.MicroserviceServiceImpl; +import org.onap.portalapp.portal.service.WidgetParameterService; +import org.onap.portalapp.portal.service.WidgetParameterServiceImpl; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.util.SystemProperties; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import org.springframework.http.HttpEntity; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.RestTemplate; + + +@Ignore +@RunWith(PowerMockRunner.class) +@PrepareForTest({EPUserUtils.class, EcompPortalUtils.class, SystemProperties.class, EPCommonSystemProperties.class}) +public class WidgetsCatalogControllerTest { + + @Mock + ConsulHealthService consulHealthService = new ConsulHealthServiceImpl(); + + @Mock + MicroserviceService microserviceService = new MicroserviceServiceImpl(); + + @Mock + WidgetParameterService widgetParameterService = new WidgetParameterServiceImpl(); + + @InjectMocks + WidgetsCatalogController widgetsCatalogController = new WidgetsCatalogController(); + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + } + @Mock + WidgetServiceHeaders widgetServiceHeaders ; + + + @Mock + RestTemplate template = new RestTemplate(); + + MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); + + HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); + HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); + + NullPointerException nullPointerException = new NullPointerException(); + + MockEPUser mockUser = new MockEPUser(); + + @Mock + HttpEntity mockHttpEntity; + + @SuppressWarnings("unchecked") + @Test + public void getUserWidgetCatalogTest() throws RestClientException, Exception{ + + String resourceType = null; + List<WidgetCatalog> widgets = new ArrayList<>(); + PowerMockito.mockStatic(EcompPortalUtils.class); + PowerMockito.mockStatic(SystemProperties.class); + PowerMockito.mockStatic(EPCommonSystemProperties.class); + Mockito.when(EcompPortalUtils.widgetMsProtocol()).thenReturn("test1"); + Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.WIDGET_MS_PROTOCOL)).thenReturn("https"); +// Mockito.when(WidgetServiceHeaders.getInstance()).thenReturn(HttpHeaders.ACCEPT); + Mockito.when(SystemProperties.getProperty("microservices.widget.local.port")).thenReturn("test"); + Mockito.when(consulHealthService.getServiceLocation("widgets-service", + "test")).thenReturn("test.com"); + Mockito.when(new HttpEntity(WidgetServiceHeaders.getInstance())).thenReturn(mockHttpEntity); +// HttpEntity<String> entity = new HttpEntity<String>("helloWorld"); +// ResponseEntity<ArrayList> ans = new ResponseEntity<>(statusCode); +// Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.GET), +// Matchers.<HttpEntity<?>>any(), Matchers.eq(ArrayList.class))).thenReturn(ans); +// List<WidgetCatalog> expectedWidgets = widgetsCatalogController.getUserWidgetCatalog(mockedRequest, mockedResponse, "guestT"); + } +} diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WidgetsCatalogMarkupControllerTest.java index 7f8d6a48..03031b40 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WidgetsCatalogMarkupControllerTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.controller; +package org.onap.portalapp.portal.controller; import static org.junit.Assert.assertTrue; @@ -49,12 +49,14 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.domain.WidgetServiceHeaders; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.service.ConsulHealthService; -import org.openecomp.portalapp.portal.service.ConsulHealthServiceImpl; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; +import org.onap.portalapp.portal.controller.WidgetsCatalogMarkupController; +import org.onap.portalapp.portal.domain.WidgetServiceHeaders; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.ConsulHealthService; +import org.onap.portalapp.portal.service.ConsulHealthServiceImpl; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalsdk.core.onboarding.util.CipherUtil; +import org.onap.portalsdk.core.util.SystemProperties; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/shared-context-test.properties b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/shared-context-test.properties new file mode 100644 index 00000000..56e5907e --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/shared-context-test.properties @@ -0,0 +1,28 @@ +### +# ================================================================================ +# ECOMP Portal +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ================================================================================ +### + +hostname= www.portal.onap.org +# port = 80 +secure = true +appname = ecompportal +restpath = context +uebkey = xgnLrmNmkfCRnIwa +username = username +countersign = pwd diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/core/MockEPUser.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/core/MockEPUser.java index 4cc471b0..c5235446 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/core/MockEPUser.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/core/MockEPUser.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,11 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.core; +package org.onap.portalapp.portal.core; import java.util.Date; -import org.openecomp.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPUser; public class MockEPUser { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/lm/FusionLicenseManagerImpl.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/core/PopulateSampleTestData.java index 1bba3c2f..e3eeaa54 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/lm/FusionLicenseManagerImpl.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/core/PopulateSampleTestData.java @@ -1,12 +1,13 @@ +package org.onap.portalapp.portal.core; /*- * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +20,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,72 +36,50 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.lm; - -import java.util.Date; -import java.util.List; -import java.util.Map; - -import javax.servlet.ServletContext; - -import org.openecomp.portalsdk.core.lm.FusionLicenseManager; -import org.springframework.stereotype.Component; - -/* - * Please note that this class is not being used; its a dummy stub to have a qualifying bean for the interface. - */ - -@Component -public class FusionLicenseManagerImpl implements FusionLicenseManager { - - @Override - public void initKeyStoreParam() { - - } - - @Override - public void initCipherParam() { - - } - - @Override - public void initLicenseParam() { - - } - - @Override - public void doInitWork() { - - } - - @Override - public int installLicense() { - return 0; - } - - @Override - public synchronized int verifyLicense(ServletContext context) { - return 0; - } - - @Override - public void generateLicense(Map<String, String> clientInfoMap, List<String> ipAddressList) throws Exception { - - } - - @Override - public String nvl(String s) { - return null; - } - - @Override - public Date getExpiredDate() { - return null; - } - - @Override - public void setExpiredDate(Date expiredDate) { - - } - -} +//package org.openecomp.portalapp.portal.core; +// +//import java.sql.Connection; +//import java.sql.SQLException; +// +//import javax.sql.DataSource; +// +//import org.junit.Before; +//import org.junit.Test; +//import org.openecomp.portalapp.framework.ApplicationCommonContextTestSuite; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.core.io.ClassPathResource; +//import org.springframework.jdbc.datasource.DataSourceUtils; +//import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; +// +//public class PopulateSampleTestData extends ApplicationCommonContextTestSuite { +// +// @Autowired +// DataSource dataSource; +// +// @Before +// public void populateTestData() throws SQLException { +// +// String sql = "PopulateTestData.sql"; +// createConnection(sql); +// } +// +// public void createConnection(String sql) { +// Connection connection = null; +// ResourceDatabasePopulator populator = new ResourceDatabasePopulator(); +// populator.addScript(new ClassPathResource(sql)); +// try { +// connection = DataSourceUtils.getConnection(dataSource); +// populator.populate(connection); +// } finally { +// if (connection != null) { +// DataSourceUtils.releaseConnection(connection, dataSource); +// } +// } +// } +// +// @Test +// public void populateTest() { +// assert (true); +// } +// +//} diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/lm/LicenseableClassImpl.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/core/RemoveSampleTestData.java index 1cb882eb..1fa6c7d1 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/lm/LicenseableClassImpl.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/core/RemoveSampleTestData.java @@ -1,12 +1,13 @@ +package org.onap.portalapp.portal.core; /*- * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +20,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,46 +36,49 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.lm; - -import java.io.FileNotFoundException; -import java.io.InputStream; - -import org.openecomp.portalsdk.core.lm.LicenseableClass; - -/* - * Please note that this class is not being used; its a dummy stub to have a qualifying bean for the interface. - */ - -public class LicenseableClassImpl implements LicenseableClass { - - public String getApplicationName() { - return ""; - } - - public InputStream getPublicKeystoreAsInputStream() throws FileNotFoundException { - return null; - } - - public String getAlias() { - return ""; - } - - public String getKeyPasswd() { - return ""; - } - - public String getPublicKeystorePassword() { - return ""; - } - - public String getCipherParamPassword() { - return ""; - } - - @SuppressWarnings("rawtypes") - public Class getClassToLicense() { - return this.getClass(); - } -} - +//package org.openecomp.portalapp.portal.core; +// +//import java.sql.Connection; +//import java.sql.SQLException; +// +//import javax.sql.DataSource; +// +//import org.junit.After; +//import org.junit.Test; +//import org.openecomp.portalapp.framework.ApplicationCommonContextTestSuite; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.core.io.ClassPathResource; +//import org.springframework.jdbc.datasource.DataSourceUtils; +//import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; +// +//public class RemoveSampleTestData extends ApplicationCommonContextTestSuite { +// @Autowired +// DataSource dataSource; +// +// public static int count = 0; +// +// @After +// public void removeTestData() throws SQLException { +// String sql = "RemoveTestData.sql"; +// createConnection(sql); +// } +// +// public void createConnection(String sql) { +// Connection connection = null; +// ResourceDatabasePopulator populator = new ResourceDatabasePopulator(); +// populator.addScript(new ClassPathResource(sql)); +// try { +// connection = DataSourceUtils.getConnection(dataSource); +// populator.populate(connection); +// } finally { +// if (connection != null) { +// DataSourceUtils.releaseConnection(connection, dataSource); +// } +// } +// } +// +// @Test +// public void removeTest() { +// assert (true); +// } +//} diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/core/RestURLsTestSuite.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/core/RestURLsTestSuite.java new file mode 100644 index 00000000..8bb21812 --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/core/RestURLsTestSuite.java @@ -0,0 +1,353 @@ +package org.onap.portalapp.portal.core; +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +//package org.openecomp.portalapp.portal.core; +// +//import static org.junit.Assert.assertEquals; +//import static org.junit.Assert.assertTrue; +// +//import java.io.IOException; +//import java.nio.charset.Charset; +//import java.util.ArrayList; +// +//import org.junit.Assert; +//import org.junit.Test; +//import org.openecomp.portalapp.framework.ApplicationCommonContextTestSuite; +//import org.openecomp.portalapp.portal.domain.EPUser; +//import org.openecomp.portalapp.portal.test.core.MockEPUser; +//import org.openecomp.portalapp.portal.transport.AppNameIdIsAdmin; +//import org.openecomp.portalapp.portal.transport.AppsListWithAdminRole; +//import org.openecomp.portalsdk.core.util.SystemProperties; +//import org.springframework.http.MediaType; +//import org.springframework.test.web.servlet.ResultActions; +//import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; +//import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +// +//import com.fasterxml.jackson.annotation.JsonInclude; +//import com.fasterxml.jackson.databind.ObjectMapper; +// +///** +// * +// * Use RestURLsTestSuite to test Rest API URL's +// */ +//public class RestURLsTestSuite extends ApplicationCommonContextTestSuite { +// +// public static final MediaType APPLICATION_JSON_UTF8 = new MediaType(MediaType.APPLICATION_JSON.getType(), +// MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8")); +// +// String url = null; +// +// MockEPUser mockUser = new MockEPUser(); +// +// public byte[] convertObjectToJsonBytes(Object object) throws IOException { +// ObjectMapper mapper = new ObjectMapper(); +// mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); +// return mapper.writeValueAsBytes(object); +// } +// +// public void requestBuilder(String url) throws Exception { +// EPUser user = mockUser.mockEPUser(); +// +// MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get(url); +// requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); +// ResultActions ra = getMockMvc().perform(requestBuilder); +// assertData(ra); +// } +// +// public void assertData(ResultActions ra) { +// Assert.assertEquals("application/json", ra.andReturn().getResponse().getContentType()); +// Assert.assertEquals(200, ra.andReturn().getResponse().getStatus()); +// +// } +// +// @Test +// public void getMenuItemsTest() throws Exception { +// url = "/portalApi/functionalMenu"; +// requestBuilder(url); +// } +// +// @Test +// public void getMenuItemsForNotificationsTest() throws Exception { +// url = "/portalApi/functionalMenuForNotificationTree"; +// requestBuilder(url); +// } +// +// @Test +// public void getUserAppsTestnew() throws Exception { +// url = "/portalApi/userApps"; +// requestBuilder(url); +// } +// +// @Test +// public void getPersUserAppsTest() throws Exception { +// url = "/portalApi/persUserApps"; +// requestBuilder(url); +// } +// +// @Test +// public void getAppCatalogTest() throws Exception { +// url = "/portalApi/appCatalog"; +// requestBuilder(url); +// } +// +// @Test +// public void getAppListNewTest() throws Exception { +// ResultActions ra = getMockMvc() +// .perform(MockMvcRequestBuilders.get("/portalApi/userApplicationRoles").param("userId", "guest")); +// assertData(ra); +// } +// +// @Test +// public void getAvailableAppListTest() throws Exception { +// url = "/portalApi/availableApps"; +// requestBuilder(url); +// } +// +// @Test +// public void getAllAppsTest() throws Exception { +// url = "/portalApi/allAvailableApps"; +// requestBuilder(url); +// } +// +// @Test +// public void getUserProfileTest() throws Exception { +// url = "/portalApi/userProfile"; +// requestBuilder(url); +// } +// +// @Test +// public void getRolesByAppTest() throws Exception { +// EPUser user = mockUser.mockEPUser(); +// MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/portalApi/adminAppsRoles/550"); +// requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); +// ResultActions ra = getMockMvc().perform(requestBuilder); +// assertData(ra); +// } +// +// @Test +// public void getAppsWithAdminRoleStateForUserTest() throws Exception { +// url = "/portalApi/adminAppsRoles?user=guest"; +// requestBuilder(url); +// +// } +// +// @Test +// public void getUsersFromAppEndpointTest() throws Exception { +// url = "/portalApi/app/550/users"; +// requestBuilder(url); +// } +// +// @Test +// public void getOnboardingAppsTest() throws Exception { +// url = "/portalApi/onboardingApps"; +// requestBuilder(url); +// } +// +// @Test +// public void getMenuItemsForAuthUserTest() throws Exception { +// url = "/portalApi/functionalMenuForAuthUser"; +// requestBuilder(url); +// } +// +// @Test +// public void getMenuItemsForEditingTest() throws Exception { +// url = "/portalApi/functionalMenuForEditing"; +// requestBuilder(url); +// } +// +// @Test +// public void getAppRolesTest() throws Exception { +// url = "/portalApi/appRoles/455"; +// requestBuilder(url); +// } +// +// @Test +// public void regenerateAncestorTableTest() throws Exception { +// +// EPUser user = mockUser.mockEPUser(); +// +// MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders +// .get("/portalApi/regenerateFunctionalMenuAncestors"); +// requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); +// ResultActions ra = getMockMvc().perform(requestBuilder); +// assertEquals("application/json;charset=UTF-8", ra.andReturn().getResponse().getContentType()); +// Assert.assertEquals(200, ra.andReturn().getResponse().getStatus()); +// +// } +// +// @Test +// public void getAppListTest() throws Exception { +// url = "/portalApi/getAppList"; +// requestBuilder(url); +// } +// +// @Test +// public void getFavoritesForUserTest() throws Exception { +// url = "/portalApi/getFavoriteItems"; +// requestBuilder(url); +// } +// +// @Test +// public void getManifestTest() throws Exception { +// url = "/portalApi/manifest"; +// requestBuilder(url); +// } +// +// @Test +// public void getActiveUsersTest() throws Exception { +// url = "/portalApi/dashboard/activeUsers"; +// requestBuilder(url); +// } +// +// @Test +// public void searchPortalTest() throws Exception { +// EPUser user = mockUser.mockEPUser(); +// MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/portalApi/dashboard/search") +// .param("searchString", "guest"); +// requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); +// ResultActions ra = getMockMvc().perform(requestBuilder); +// assertData(ra); +// } +// +// @Test +// public void getWidgetDataTest() throws Exception { +// EPUser user = mockUser.mockEPUser(); +// MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/portalApi/dashboard/widgetData") +// .param("resourceType", "guest"); +// requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); +// ResultActions ra = getMockMvc().perform(requestBuilder); +// assertData(ra); +// } +// +// @Test +// public void getAppsAndContactsTest() throws Exception { +// url = "/portalApi/contactus/allapps"; +// requestBuilder(url); +// } +// +// @Test +// public void getPortalDetailsTest() throws Exception { +// url = "/portalApi/contactus/feedback"; +// requestBuilder(url); +// } +// +// @Test +// public void getAppCategoryFunctionsTest() throws Exception { +// url = "/portalApi/contactus/functions"; +// requestBuilder(url); +// } +// +// @Test +// public void getOnlineUserUpdateRateTest() throws Exception { +// url = "/portalApi/dashboard/onlineUserUpdateRate"; +// requestBuilder(url); +// } +// +// @Test +// public void getMenuIdRoleIdTest() throws Exception { +// url = "/portalApi/getFunctionalMenuRole"; +// requestBuilder(url); +// } +// +// @Test +// public void getNotificationsTest() throws Exception { +// url = "/portalApi/getNotifications"; +// requestBuilder(url); +// } +// +// @Test +// public void getAdminNotificationsTest() throws Exception { +// url = "/portalApi/getAdminNotifications"; +// requestBuilder(url); +// } +// +// @Test +// public void getNotificationAppRolesTest() throws Exception { +// url = "/portalApi/getNotificationAppRoles"; +// requestBuilder(url); +// } +// +// @Test +// public void getNotificationUpdateRateTest() throws Exception { +// url = "/portalApi/notificationUpdateRate"; +// requestBuilder(url); +// } +// +// @Test +// public void notificationReadTest() throws Exception { +// url = "/portalApi/notificationRead?notificationId=262"; +// requestBuilder(url); +// } +// +// @Test +// public void testGetRolesTest() throws Exception { +// url = "/portalApi/notificationRole/248/roles"; +// requestBuilder(url); +// } +// +// @Test +// public void putAppsWithAdminRoleStateForUserTest() throws Exception { +// +// AppsListWithAdminRole appsListWithAdminRole = new AppsListWithAdminRole(); +// appsListWithAdminRole.setOrgUserId("guest"); +// ArrayList<AppNameIdIsAdmin> appsRoles = new ArrayList<AppNameIdIsAdmin>(); +// AppNameIdIsAdmin appNameIdIsAdmin = new AppNameIdIsAdmin(); +// appNameIdIsAdmin.setId((long) 455); +// appNameIdIsAdmin.setAppName("CCD"); +// appNameIdIsAdmin.setIsAdmin(true); +// appNameIdIsAdmin.setRestrictedApp(false); +// appsRoles.add(appNameIdIsAdmin); +// appsListWithAdminRole.setAppsRoles(appsRoles); +// EPUser user = mockUser.mockEPUser(); +// MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.put("/portalApi/adminAppsRoles") +// .contentType(APPLICATION_JSON_UTF8).content(convertObjectToJsonBytes(appsListWithAdminRole)); +// +// requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); +// ResultActions ra = getMockMvc().perform(requestBuilder); +// assertData(ra); +// } +// +// @Test +// public void ticketEventControllerForExternalSystem() throws Exception { +// String ticketEventJson = "{\"application\": \"cbus\",\"event\": {\"body\": {\"ticketStatePhrase\": \"We recently detected a problem with the equipment at your site. The event is in queue for immediate work.\", \"ivrNotificationFlag\": \"1\",\"expectedRestoreDate\": 0,\"bridgeTransport\": \"AOTS\", \"reptRequestType\": 0,\"ticketNum\": \"000002000857405\",\"assetID\": \"CISCO_1921C1_ISR_G2\", \"eventDate\": 1490545134601,\"eventAbstract\": \"ospfIfConfigError trap received from Cisco_1921c1_ISR_G2 with arguments: ospfRouterId=Cisco_1921c1_ISR_G2; ospfIfIpAddress=1921c1_288266; ospfAddressLessIf=0; ospfPacketSrc=172.17.0.11; ospfConfigErrorType=2; ospfPacketType=1\",\"severity\": \"2 - Major\",\"ticketPriority\": \"3\",\"reportedCustomerImpact\": 0,\"testAutoIndicator\": 0,\"supportGroupName\": \"US-TEST-ORT\",\"lastModifiedDate\": \"1487687703\",\"messageGroup\": \"SNMP\",\"csi\": 0,\"mfabRestoredTime\": 0},\"header\": {\"timestamp\": \"2017-02-21T14:35:05.219+0000\",\"eventSource\": \"aotstm\",\"entityId\": \"000002000857405\", \"sequenceNumber\": 2 },\"blinkMsgId\": \"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\": \"130.4.165.158\"},\"SubscriberInfo\": {\"UserList\": [\"hk8777\"] }}"; +// MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/auxapi/ticketevent") +// .contentType(APPLICATION_JSON_UTF8).content(ticketEventJson); +// ResultActions ra = getMockMvc().perform(requestBuilder); +// assertTrue(ra.andReturn().getResponse().getContentType().contains("application/json")); +// } +//} diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AdminUserAppTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/AdminUserAppTest.java index c6160b2d..f93fe4a3 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AdminUserAppTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/AdminUserAppTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.AdminUserApp; +import org.onap.portalapp.portal.domain.AdminUserApp; public class AdminUserAppTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AdminUserApplicationsTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/AdminUserApplicationsTest.java index bf931a60..b01efb83 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AdminUserApplicationsTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/AdminUserApplicationsTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; @@ -43,8 +43,8 @@ import javax.persistence.Column; import javax.persistence.Id; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.AdminUserApp; -import org.openecomp.portalapp.portal.domain.AdminUserApplications; +import org.onap.portalapp.portal.domain.AdminUserApp; +import org.onap.portalapp.portal.domain.AdminUserApplications; public class AdminUserApplicationsTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AppContactUsTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/AppContactUsTest.java index 8043a9dc..ec24c6e4 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AppContactUsTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/AppContactUsTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.AppContactUs; +import org.onap.portalapp.portal.domain.AppContactUs; public class AppContactUsTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/CentralRoleFunctionTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/CentralRoleFunctionTest.java index fb0aee8e..d91ed842 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/CentralRoleFunctionTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/CentralRoleFunctionTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.CentralRoleFunction; +import org.onap.portalapp.portal.transport.CentralRoleFunction; public class CentralRoleFunctionTest { @@ -48,11 +48,10 @@ public class CentralRoleFunctionTest { CentralRoleFunction centralRoleFunction = new CentralRoleFunction(); - centralRoleFunction.setCode("test"); - centralRoleFunction.setName("test"); - centralRoleFunction.setAppId((long)1); - centralRoleFunction.setEditUrl("test"); - + centralRoleFunction.setCode("test"); + centralRoleFunction.setName("test"); + centralRoleFunction.setId(null); + centralRoleFunction.setEditUrl("test"); return centralRoleFunction; } @@ -60,7 +59,7 @@ public class CentralRoleFunctionTest { public void centralRoleFunctionTest(){ CentralRoleFunction centralRoleFunction = mockCentralRoleFunction(); - assertEquals(centralRoleFunction.getAppId(), new Long(1)); + assertEquals(centralRoleFunction.getId(), null); assertEquals(centralRoleFunction.getCode(), "test"); assertEquals(centralRoleFunction.getName(), "test"); assertEquals(centralRoleFunction.getEditUrl(), "test"); diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/lm/LicenseableClassImplTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/CentralV2RoleFunctionTest.java index 64a04892..345f4576 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/lm/LicenseableClassImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/CentralV2RoleFunctionTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,34 +35,37 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.lm; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; -import java.io.FileNotFoundException; - import org.junit.Test; -import org.openecomp.portalapp.lm.LicenseableClassImpl; -public class LicenseableClassImplTest { +public class CentralV2RoleFunctionTest { - @Test - public void licenseableClassImplTest() throws FileNotFoundException{ - LicenseableClassImpl licenseableClassImpl = new LicenseableClassImpl(); - - String appNameReturn = licenseableClassImpl.getApplicationName(); - java.io.InputStream inputStream = licenseableClassImpl.getPublicKeystoreAsInputStream(); - String aliasReturn = licenseableClassImpl.getAlias(); - String pswdReturn = licenseableClassImpl.getKeyPasswd(); - String pkPswd = licenseableClassImpl.getPublicKeystorePassword(); - String cpPswd = licenseableClassImpl.getCipherParamPassword(); + public CentralV2RoleFunction mockCentralRoleFunction(){ - assertEquals(appNameReturn, ""); - assertEquals(inputStream, null); - assertEquals(aliasReturn, ""); - assertEquals(pswdReturn, ""); - assertEquals(pkPswd, ""); - assertEquals(cpPswd, ""); + CentralV2RoleFunction centralV2RoleFunction = new CentralV2RoleFunction(); + + centralV2RoleFunction.setCode("test"); + centralV2RoleFunction.setName("test"); + centralV2RoleFunction.setAppId((long)1); + centralV2RoleFunction.setEditUrl("test"); + centralV2RoleFunction.setType("testType"); + centralV2RoleFunction.setAction("testAction"); + + return centralV2RoleFunction; + } + + @Test + public void centralRoleFunctionTest(){ + CentralV2RoleFunction centralV2RoleFunction = mockCentralRoleFunction(); + assertEquals(centralV2RoleFunction.getAppId(), new Long(1)); + assertEquals(centralV2RoleFunction.getCode(), "test"); + assertEquals(centralV2RoleFunction.getName(), "test"); + assertEquals(centralV2RoleFunction.getEditUrl(), "test"); + assertEquals(centralV2RoleFunction.getAction(), "testAction"); + assertEquals(centralV2RoleFunction.getType(), "testType"); } } diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPAppRoleFunctionTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPAppRoleFunctionTest.java index 0b46857c..cb936916 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPAppRoleFunctionTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPAppRoleFunctionTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPAppRoleFunction; +import org.onap.portalapp.portal.domain.EPAppRoleFunction; public class EPAppRoleFunctionTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPAppTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPAppTest.java index 08383095..7537ccf2 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPAppTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPAppTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPApp; public class EPAppTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPEndpointAccountTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPEndpointAccountTest.java index db407633..d01860af 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPEndpointAccountTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPEndpointAccountTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPEndpointAccount; +import org.onap.portalapp.portal.domain.EPEndpointAccount; public class EPEndpointAccountTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPEndpointTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPEndpointTest.java index 76cd5806..79915f25 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPEndpointTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPEndpointTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPEndpoint; +import org.onap.portalapp.portal.domain.EPEndpoint; public class EPEndpointTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPRoleTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPRoleTest.java index 891ad0eb..0b51b3d7 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPRoleTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPRoleTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.domain.EPRole; public class EPRoleTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppCatalogRolesTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppCatalogRolesTest.java index 7090d495..e90f74fe 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppCatalogRolesTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppCatalogRolesTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPUserAppCatalogRoles; +import org.onap.portalapp.portal.domain.EPUserAppCatalogRoles; public class EPUserAppCatalogRolesTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequestDetailTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequestDetailTest.java index 93405f13..31efff3e 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequestDetailTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequestDetailTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,15 +35,15 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import java.util.Date; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPUserAppRolesRequest; -import org.openecomp.portalapp.portal.domain.EPUserAppRolesRequestDetail; +import org.onap.portalapp.portal.domain.EPUserAppRolesRequest; +import org.onap.portalapp.portal.domain.EPUserAppRolesRequestDetail; public class EPUserAppRolesRequestDetailTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppRolesTest.java index eede33eb..98b2d7bf 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppRolesTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPUserAppRoles; +import org.onap.portalapp.portal.domain.EPUserAppRoles; public class EPUserAppRolesTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppTest.java index 1ab2f67e..72c5002d 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,14 +35,14 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.*; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.domain.EPUserApp; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.domain.EPUserApp; public class EPUserAppTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppsManualSortPreferenceTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppsManualSortPreferenceTest.java index fdf864bb..2923eb2b 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppsManualSortPreferenceTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppsManualSortPreferenceTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,11 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPUserAppsManualSortPreference; +import org.onap.portalapp.portal.domain.EPUserAppsManualSortPreference; public class EPUserAppsManualSortPreferenceTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppsSortPreferenceTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppsSortPreferenceTest.java index 9e608fdd..e2b49f0a 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppsSortPreferenceTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppsSortPreferenceTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,14 +35,14 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import java.util.Date; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPUserAppsSortPreference; +import org.onap.portalapp.portal.domain.EPUserAppsSortPreference; public class EPUserAppsSortPreferenceTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserNotificationTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserNotificationTest.java index 88c02ae5..9aa9a37d 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserNotificationTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserNotificationTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,14 +35,14 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import java.util.Date; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPUserNotification; +import org.onap.portalapp.portal.domain.EPUserNotification; public class EPUserNotificationTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserTest.java index 1561cb87..cf1703d5 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,14 +35,14 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import java.util.Date; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPUser; public class EPUserTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPWidgetsManualSortPreferenceTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPWidgetsManualSortPreferenceTest.java index 61054ab9..b4b4780d 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPWidgetsManualSortPreferenceTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPWidgetsManualSortPreferenceTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPWidgetsManualSortPreference; +import org.onap.portalapp.portal.domain.EPWidgetsManualSortPreference; public class EPWidgetsManualSortPreferenceTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EcompAppRoleIdTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EcompAppRoleIdTest.java index 3adfa236..96ebcb49 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EcompAppRoleIdTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EcompAppRoleIdTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EcompAppRoleId; +import org.onap.portalapp.portal.domain.EcompAppRoleId; public class EcompAppRoleIdTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EcompAppRoleTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EcompAppRoleTest.java index 6b6dd67d..614588da 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EcompAppRoleTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EcompAppRoleTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EcompAppRole; +import org.onap.portalapp.portal.domain.EcompAppRole; public class EcompAppRoleTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalRoleDetailsTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/ExternalRoleDetailsTest.java index 1220aa12..9c999aee 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalRoleDetailsTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/ExternalRoleDetailsTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; @@ -43,8 +43,8 @@ import java.util.ArrayList; import java.util.List; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPAppRoleFunction; -import org.openecomp.portalapp.portal.domain.ExternalRoleDetails; +import org.onap.portalapp.portal.domain.EPAppRoleFunction; +import org.onap.portalapp.portal.domain.ExternalRoleDetails; public class ExternalRoleDetailsTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalSystemAccessTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/ExternalSystemAccessTest.java index d5c964fc..e818e762 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalSystemAccessTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/ExternalSystemAccessTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.ExternalSystemAccess; +import org.onap.portalapp.portal.domain.ExternalSystemAccess; public class ExternalSystemAccessTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalSystemRoleApprovalTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/ExternalSystemRoleApprovalTest.java index cfc6ab48..ace2dd83 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalSystemRoleApprovalTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/ExternalSystemRoleApprovalTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.externalsystemapproval.model.ExternalSystemRoleApproval; +import org.onap.portalapp.externalsystemapproval.model.ExternalSystemRoleApproval; public class ExternalSystemRoleApprovalTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/FunctionalMenuItemWithAppIDTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/FunctionalMenuItemWithAppIDTest.java index 17a3c320..488bbd92 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/FunctionalMenuItemWithAppIDTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/FunctionalMenuItemWithAppIDTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.*; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.FunctionalMenuItemWithAppID; +import org.onap.portalapp.portal.domain.FunctionalMenuItemWithAppID; public class FunctionalMenuItemWithAppIDTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/GetAccessResultIdTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/GetAccessResultIdTest.java index b0cf94dd..5a05949f 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/GetAccessResultIdTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/GetAccessResultIdTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.GetAccessResultId; +import org.onap.portalapp.portal.domain.GetAccessResultId; public class GetAccessResultIdTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/MicroserviceDataTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/MicroserviceDataTest.java index c6681089..8f856391 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/MicroserviceDataTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/MicroserviceDataTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,15 +35,15 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import java.util.ArrayList; import java.util.List; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.MicroserviceData; -import org.openecomp.portalapp.portal.domain.MicroserviceParameter; +import org.onap.portalapp.portal.domain.MicroserviceData; +import org.onap.portalapp.portal.domain.MicroserviceParameter; public class MicroserviceDataTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/MicroserviceParameterTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/MicroserviceParameterTest.java index 112fc0d6..a214738f 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/MicroserviceParameterTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/MicroserviceParameterTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.MicroserviceParameter; +import org.onap.portalapp.portal.domain.MicroserviceParameter; public class MicroserviceParameterTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/PersUserAppSelectionTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/PersUserAppSelectionTest.java index 1a06b05d..dd397b4d 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/PersUserAppSelectionTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/PersUserAppSelectionTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.*; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.PersUserAppSelection; +import org.onap.portalapp.portal.domain.PersUserAppSelection; public class PersUserAppSelectionTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/PersUserWidgetSelectionTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/PersUserWidgetSelectionTest.java index 10a4bcba..0b787152 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/PersUserWidgetSelectionTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/PersUserWidgetSelectionTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,13 +35,13 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.PersUserWidgetSelection; +import org.onap.portalapp.portal.domain.PersUserWidgetSelection; public class PersUserWidgetSelectionTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ResultTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/ResultTest.java index cd558cfd..3cdfeeef 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ResultTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/ResultTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.model.Result; +import org.onap.portalapp.model.Result; public class ResultTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/SharedContextTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/SharedContextTest.java index da00649d..4c7b464e 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/SharedContextTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/SharedContextTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,14 +35,14 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import java.util.Date; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.SharedContext; +import org.onap.portalapp.portal.domain.SharedContext; public class SharedContextTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/UserIdRoleIdTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/UserIdRoleIdTest.java index 10a1f21a..d391288d 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/UserIdRoleIdTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/UserIdRoleIdTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.UserIdRoleId; +import org.onap.portalapp.portal.domain.UserIdRoleId; public class UserIdRoleIdTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetCatalogParameterTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/WidgetCatalogParameterTest.java index 101896a0..31d484d2 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetCatalogParameterTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/WidgetCatalogParameterTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.WidgetCatalogParameter; +import org.onap.portalapp.portal.domain.WidgetCatalogParameter; public class WidgetCatalogParameterTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetCatalogTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/WidgetCatalogTest.java index 4c7844f3..ce90e49b 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetCatalogTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/WidgetCatalogTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.*; import static org.junit.Assert.assertEquals; @@ -44,9 +44,9 @@ import java.util.HashSet; import java.util.Set; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.App; -import org.openecomp.portalapp.portal.domain.RoleApp; -import org.openecomp.portalapp.portal.domain.WidgetCatalog; +import org.onap.portalapp.portal.domain.App; +import org.onap.portalapp.portal.domain.RoleApp; +import org.onap.portalapp.portal.domain.WidgetCatalog; public class WidgetCatalogTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetParameterResultTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/WidgetParameterResultTest.java index 65a984d8..354255bd 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetParameterResultTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/WidgetParameterResultTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.WidgetParameterResult; +import org.onap.portalapp.portal.domain.WidgetParameterResult; public class WidgetParameterResultTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/WidgetTest.java index d9abd91d..3821c9cc 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/WidgetTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.domain; +package org.onap.portalapp.portal.domain; import static org.junit.Assert.*; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.Widget; +import org.onap.portalapp.portal.domain.Widget; public class WidgetTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/exceptions/NoHealthyServiceExceptionTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NoHealthyServiceExceptionTest.java index f67b0e2d..62c75cfe 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/exceptions/NoHealthyServiceExceptionTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NoHealthyServiceExceptionTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.exceptions; +package org.onap.portalapp.portal.exceptions; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.exceptions.NoHealthyServiceException; +import org.onap.portalapp.portal.exceptions.NoHealthyServiceException; public class NoHealthyServiceExceptionTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/framework/ApplicationCommonContextTestSuite.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/framework/ApplicationCommonContextTestSuite.java new file mode 100644 index 00000000..764cebab --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/framework/ApplicationCommonContextTestSuite.java @@ -0,0 +1,191 @@ +package org.onap.portalapp.portal.framework; +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +//package org.openecomp.portalapp.portal.framework; +// +//import java.io.IOException; +// +//import org.junit.Before; +//import org.junit.runner.RunWith; +//import org.openecomp.portalsdk.core.conf.AppConfig; +////import org.openecomp.portalapp.conf.ExternalAppConfig; +////import org.openecomp.portalapp.conf.HibernateMappingLocations; +//import org.openecomp.portalsdk.core.conf.HibernateConfiguration; +//import org.openecomp.portalsdk.core.conf.HibernateMappingLocatable; +//import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager; +//import org.openecomp.portalsdk.core.util.CacheManager; +//import org.openecomp.portalsdk.core.util.SystemProperties; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.ComponentScan; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.context.annotation.FilterType; +//import org.springframework.context.annotation.Profile; +//import org.springframework.core.io.ClassPathResource; +//import org.springframework.core.io.Resource; +//import org.springframework.test.context.ActiveProfiles; +//import org.springframework.test.context.ContextConfiguration; +//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +//import org.springframework.test.context.web.AnnotationConfigWebContextLoader; +//import org.springframework.test.context.web.WebAppConfiguration; +//import org.springframework.test.web.servlet.MockMvc; +//import org.springframework.test.web.servlet.setup.MockMvcBuilders; +//import org.springframework.web.context.WebApplicationContext; +//import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +// +///** +// * +// * In order to write a unit test, 1. inherit this class 2. place the "war" +// * folder on your test class's classpath 3. run the test with the following VM +// * argument; This is important because when starting the application from +// * Container, the System Properties file (SystemProperties.java) can have the +// * direct path but, when running from the Mock Junit container, the path should +// * be prefixed with "classpath" to enable the mock container to search for the +// * file in the classpath -Dcontainer.classpath="classpath:" +// */ +// +//@SuppressWarnings("deprecation") +//@RunWith(SpringJUnit4ClassRunner.class) +//@WebAppConfiguration +//@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = { MockAppConfig.class }) +//@ActiveProfiles(value = "test") +//public class ApplicationCommonContextTestSuite { +// +// @Autowired +// public WebApplicationContext wac; +// +// private MockMvc mockMvc; +// +// @Before +// public void setup() { +// if (mockMvc == null) { +// this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); +// +// } +// } +// +// public Object getBean(String name) { +// return this.wac.getBean(name); +// } +// +// public MockMvc getMockMvc() { +// return mockMvc; +// } +// +// public void setMockMvc(MockMvc mockMvc) { +// this.mockMvc = mockMvc; +// } +// +// public WebApplicationContext getWebApplicationContext() { +// return wac; +// } +// +//} +// +//@Configuration +//@ComponentScan(basePackages = "org.openecomp", excludeFilters = { +// // the following source configurations should not be scanned; instead of +// // using Exclusion filter, we can use the @Profile annotation to exclude +// // them +// @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalsdk.core.controller.LogoutController*"), +// @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalsdk.core.controller.SDKLoginController*"), +// @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalapp.conf.ExternalAppConfig*"), +// @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.*.*InitUebHandler*") }) +//@Profile("test") +//class MockAppConfig extends AppConfig { +// +// @Bean +// HibernateMappingLocatable locatable() { +// return new MockHibernateMappingLocations(); +// } +// +// @Bean +// HibernateConfiguration hibConfiguration() { +// return new HibernateConfiguration(); +// } +// +// @Bean +// public SystemProperties systemProperties() { +// return new MockSystemProperties(); +// } +// +// @Bean +// public AbstractCacheManager cacheManager() { +// return new CacheManager() { +// +// public void configure() throws IOException { +// +// } +// }; +// } +// +// public String[] tileDefinitions() { +// return new String[] { "classpath:/WEB-INF/fusion/defs/definitions.xml", +// "classpath:/WEB-INF/defs/definitions.xml" }; +// } +// +// public void addInterceptors(InterceptorRegistry registry) { +// // registry.addInterceptor(new +// // SessionTimeoutInterceptor()).excludePathPatterns(getExcludeUrlPathsForSessionTimeout()); +// // registry.addInterceptor(resourceInterceptor()); +// } +// +// public static class MockSystemProperties extends SystemProperties { +// +// public MockSystemProperties() { +// } +// +// } +// +//} +// +//@Profile("test") +//class MockHibernateMappingLocations implements HibernateMappingLocatable { +// +// public Resource[] getMappingLocations() { +// return new Resource[] { new ClassPathResource("WEB-INF/fusion/orm/Fusion.hbm.xml"), +// new ClassPathResource("WEB-INF/fusion/orm/EP.hbm.xml"), +// new ClassPathResource("WEB-INF/fusion/orm/Workflow.hbm.xml") }; +// +// } +// +// public String[] getPackagesToScan() { +// return new String[] { "org.openecomp", "src" }; +// } +// +//} diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/framework/MockitoTestSuite.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/framework/MockitoTestSuite.java index 6ba142b1..84356f74 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/framework/MockitoTestSuite.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/framework/MockitoTestSuite.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.framework; +package org.onap.portalapp.portal.framework; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/listener/HealthMonitorTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/listener/HealthMonitorTest.java index 651f7f61..929c8e36 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/listener/HealthMonitorTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/listener/HealthMonitorTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.listener; +package org.onap.portalapp.portal.listener; import static org.junit.Assert.assertEquals; import org.junit.Test; +import org.onap.portalapp.portal.listener.HealthMonitor; public class HealthMonitorTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppCatalogItemTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/model/AppCatalogItemTest.java index b87deb2c..819262d1 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppCatalogItemTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/model/AppCatalogItemTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.model; +package org.onap.portalapp.portal.model; import static org.junit.Assert.*; import org.junit.Test; -import org.openecomp.portalapp.portal.ecomp.model.AppCatalogItem; +import org.onap.portalapp.portal.ecomp.model.AppCatalogItem; public class AppCatalogItemTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppCategoryFunctionsItemTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/model/AppCategoryFunctionsItemTest.java index 9c31aa45..346b427e 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppCategoryFunctionsItemTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/model/AppCategoryFunctionsItemTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,13 +35,13 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.model; +package org.onap.portalapp.portal.model; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.junit.Test; -import org.openecomp.portalapp.portal.ecomp.model.AppCategoryFunctionsItem; +import org.onap.portalapp.portal.ecomp.model.AppCategoryFunctionsItem; public class AppCategoryFunctionsItemTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppContactUsItemTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/model/AppContactUsItemTest.java index effb0069..898bd986 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppContactUsItemTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/model/AppContactUsItemTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,13 +35,13 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.model; +package org.onap.portalapp.portal.model; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.junit.Test; -import org.openecomp.portalapp.portal.ecomp.model.AppContactUsItem; +import org.onap.portalapp.portal.ecomp.model.AppContactUsItem; public class AppContactUsItemTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/SearchResultItemTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/model/SearchResultItemTest.java index e9c3faae..fac3ecf6 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/SearchResultItemTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/model/SearchResultItemTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.model; +package org.onap.portalapp.portal.model; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.ecomp.model.SearchResultItem; +import org.onap.portalapp.portal.ecomp.model.SearchResultItem; public class SearchResultItemTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/AppContactUsServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/AppContactUsServiceImplTest.java index e80087e8..aaadbe03 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/AppContactUsServiceImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/AppContactUsServiceImplTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import static org.junit.Assert.assertEquals; @@ -52,15 +52,15 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.domain.AppContactUs; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.ecomp.model.AppCategoryFunctionsItem; -import org.openecomp.portalapp.portal.ecomp.model.AppContactUsItem; -import org.openecomp.portalapp.portal.service.AppContactUsService; -import org.openecomp.portalapp.portal.service.AppContactUsServiceImpl; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.service.DataAccessServiceImpl; +import org.onap.portalapp.portal.domain.AppContactUs; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.ecomp.model.AppCategoryFunctionsItem; +import org.onap.portalapp.portal.ecomp.model.AppContactUsItem; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.AppContactUsService; +import org.onap.portalapp.portal.service.AppContactUsServiceImpl; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.service.DataAccessServiceImpl; public class AppContactUsServiceImplTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/DashboardSearchServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/DashboardSearchServiceImplTest.java index 853ecbe0..13f04ae2 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/DashboardSearchServiceImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/DashboardSearchServiceImplTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -53,13 +53,13 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.ecomp.model.SearchResultItem; -import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.transport.CommonWidget; -import org.openecomp.portalapp.portal.transport.CommonWidgetMeta; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalsdk.core.service.DataAccessService; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.ecomp.model.SearchResultItem; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.DashboardSearchServiceImpl; +import org.onap.portalapp.portal.transport.CommonWidget; +import org.onap.portalapp.portal.transport.CommonWidgetMeta; +import org.onap.portalsdk.core.service.DataAccessService; public class DashboardSearchServiceImplTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceCentralizedImplTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/EPRoleFunctionServiceCentralizedImplTest.java index 072d6347..345ae3b7 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceCentralizedImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/EPRoleFunctionServiceCentralizedImplTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import static org.junit.Assert.*; @@ -48,27 +48,31 @@ import java.util.Set; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; +import org.apache.commons.codec.DecoderException; import org.hibernate.SessionFactory; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.domain.CentralRoleFunction; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.service.EPRoleFunctionServiceCentralizedImpl; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalsdk.core.domain.RoleFunction; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.CentralV2RoleFunction; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.exceptions.RoleFunctionException; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.EPRoleFunctionServiceCentralizedImpl; +import org.onap.portalsdk.core.domain.RoleFunction; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.SystemProperties; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) @PrepareForTest(SystemProperties.class) +@Ignore public class EPRoleFunctionServiceCentralizedImplTest { @@ -92,12 +96,12 @@ public class EPRoleFunctionServiceCentralizedImplTest { HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - @Test + @Test(expected = NullPointerException.class) public void getRoleFunctions() { - List<CentralRoleFunction> getRoleFuncList = new ArrayList<>(); - CentralRoleFunction centralRoleFunction = new CentralRoleFunction(); - getRoleFuncList.add(centralRoleFunction); + List<CentralV2RoleFunction> getRoleFuncList = new ArrayList<>(); + CentralV2RoleFunction centralV2RoleFunction = new CentralV2RoleFunction(); + getRoleFuncList.add(centralV2RoleFunction); List<RoleFunction> getRoleFuncListOfPortal = new ArrayList<>(); RoleFunction roleFunction = new RoleFunction(); getRoleFuncListOfPortal.add(roleFunction); @@ -109,7 +113,7 @@ public class EPRoleFunctionServiceCentralizedImplTest { } @Test - public void getRoleFunctionsNewTest() + public void getRoleFunctionsNewTest() throws RoleFunctionException { HttpSession session = mockedRequest.getSession(); EPUser user = mockUser.mockEPUser(); diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/EPRoleFunctionServiceImplTest.java index 288b854f..b7bffea1 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/EPRoleFunctionServiceImplTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import static org.junit.Assert.*; @@ -56,15 +56,15 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.service.EPRoleFunctionServiceImpl; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.domain.RoleFunction; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.EPRoleFunctionServiceImpl; +import org.onap.portalapp.util.EPUserUtils; +import org.onap.portalsdk.core.domain.RoleFunction; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.SystemProperties; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/EPRoleServiceImplTest.java index 1a2d76ca..4c97b6dd 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleServiceImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/EPRoleServiceImplTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import static org.junit.Assert.*; @@ -52,12 +52,12 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.service.EPRoleServiceImpl; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalsdk.core.domain.RoleFunction; -import org.openecomp.portalsdk.core.service.DataAccessService; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.EPRoleServiceImpl; +import org.onap.portalsdk.core.domain.RoleFunction; +import org.onap.portalsdk.core.service.DataAccessService; public class EPRoleServiceImplTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImplTest.java index f1103fbb..66cfdd31 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImplTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -57,21 +57,22 @@ import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.CentralRoleFunction; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPAppRoleFunction; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.transport.EcompUserRoles; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalsdk.core.domain.Role; -import org.openecomp.portalsdk.core.restful.domain.EcompUser; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.service.DataAccessServiceImpl; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.CentralV2RoleFunction; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPAppRoleFunction; +import org.onap.portalapp.portal.domain.EPRole; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.exceptions.InactiveApplicationException; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.transport.EcompUserRoles; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; +import org.onap.portalsdk.core.domain.Role; +import org.onap.portalsdk.core.restful.domain.EcompUser; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.service.DataAccessServiceImpl; +import org.onap.portalsdk.core.util.SystemProperties; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @@ -160,7 +161,7 @@ public class ExternalAccessRolesServiceImplTest { // assertEquals(expectedApplicationRoles,applicationRoles); // } - @Test(expected = java.lang.Exception.class) + @Test public void getAppExceptionTest() throws Exception { List<EPApp> app = new ArrayList<>(); Mockito.when(dataAccessService1.getList(EPApp.class, " where ueb_key = '" + uebKey + "'", null, null)) @@ -169,23 +170,27 @@ public class ExternalAccessRolesServiceImplTest { assertEquals(app, expectedapp); } - @Test(expected = java.lang.Exception.class) - public void getAppTest() throws Exception { + @Test(expected = InactiveApplicationException.class) + public void getAppErrorTest() throws Exception { List<EPApp> appList = new ArrayList<>(); EPApp app = mockApp(); appList.add(app); - Mockito.when(dataAccessService1.getList(EPApp.class, " where ueb_key = '" + uebKey + "'", null, null)) - .thenReturn(appList); - List<EPApp> expectedapp = externalAccessRolesServiceImpl.getApp(uebKey); + final Map<String, String> appUebkeyParams = new HashMap<>(); + appUebkeyParams.put("appKey", "test-ueb-key"); + Mockito.when(dataAccessService1.executeNamedQuery("getMyAppDetailsByUebKey", appUebkeyParams, null)) + .thenReturn(appList); + externalAccessRolesServiceImpl.getApp(uebKey); } @Test - public void getAppErrorTest() throws Exception { + public void getAppTest() throws Exception { List<EPApp> appList = new ArrayList<>(); EPApp app = mockApp(); app.setId((long) 1); appList.add(app); - Mockito.when(dataAccessService1.getList(EPApp.class, " where ueb_key = '" + uebKey + "'", null, null)) + final Map<String, String> appUebkeyParams = new HashMap<>(); + appUebkeyParams.put("appKey", "test-ueb-key"); + Mockito.when(dataAccessService1.executeNamedQuery("getMyAppDetailsByUebKey", appUebkeyParams, null)) .thenReturn(appList); List<EPApp> expectedapp = externalAccessRolesServiceImpl.getApp(uebKey); assertEquals(appList, expectedapp); @@ -211,9 +216,14 @@ public class ExternalAccessRolesServiceImplTest { EPRole ePRole = new EPRole(); role.setName("Test Role"); roleList.add(ePRole); - Mockito.when(dataAccessService1.getList(EPApp.class, " where ueb_key = '" + uebKey + "'", null, null)) + final Map<String, String> appUebkeyParams = new HashMap<>(); + appUebkeyParams.put("appKey", "test-ueb-key"); + Mockito.when(dataAccessService1.executeNamedQuery("getMyAppDetailsByUebKey", appUebkeyParams, null)) .thenReturn(appList); - Mockito.when(dataAccessService1.getList(EPRole.class, " where app_role_id = " + role.getId() + " and app_id ="+app.getId(), null, null)).thenReturn(roleList); + final Map<String, Long> getPartnerAppRoleParams = new HashMap<>(); + getPartnerAppRoleParams.put("appRoleId", role.getId()); + getPartnerAppRoleParams.put("appId", app.getId()); + Mockito.when(dataAccessService1.executeNamedQuery("getPartnerAppRoleByRoleId", getPartnerAppRoleParams, null)).thenReturn(roleList); Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL)) .thenReturn("Testurl"); ResponseEntity<String> addResponse = new ResponseEntity<>(HttpStatus.CREATED); @@ -243,18 +253,19 @@ public class ExternalAccessRolesServiceImplTest { EPRole ePRole = new EPRole(); role.setName("Test Role"); roleList.add(ePRole); - Mockito.when(dataAccessService1.getList(EPApp.class, " where ueb_key = '" + uebKey + "'", null, null)) + final Map<String, String> appUebkeyParams = new HashMap<>(); + appUebkeyParams.put("appKey", "test-ueb-key"); + Mockito.when(dataAccessService1.executeNamedQuery("getMyAppDetailsByUebKey", appUebkeyParams, null)) .thenReturn(appList); - - Mockito.when(dataAccessService1.getList(EPRole.class, " where app_role_id = " + role.getId() + " and app_id ="+app.getId(), null, null)).thenReturn(roleList); -// Mockito.when(dataAccessService1.getList(EPRole.class, " where app_role_id = " + role.getId(), null, null)) -// .thenReturn(roleList); + final Map<String, Long> getPartnerAppRoleParams = new HashMap<>(); + getPartnerAppRoleParams.put("appRoleId", role.getId()); + getPartnerAppRoleParams.put("appId", app.getId()); + Mockito.when(dataAccessService1.executeNamedQuery("getPartnerAppRoleByRoleId", getPartnerAppRoleParams, null)).thenReturn(roleList); Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL)) .thenReturn("Testurl"); ResponseEntity<String> addResponse = new ResponseEntity<>(HttpStatus.METHOD_NOT_ALLOWED); Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.POST), Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(addResponse); - assertFalse(externalAccessRolesServiceImpl.addRole(role, uebKey)); } @@ -288,8 +299,8 @@ public class ExternalAccessRolesServiceImplTest { EPApp app = mockApp(); params.put("functionCode", "menu_fun_code"); params.put("appId", String.valueOf(10)); - List<CentralRoleFunction> centralRoleFunctionList = new ArrayList<>(); - CentralRoleFunction domainCentralRoleFunction = new CentralRoleFunction(); + List<CentralV2RoleFunction> centralRoleFunctionList = new ArrayList<>(); + CentralV2RoleFunction domainCentralRoleFunction = new CentralV2RoleFunction(); domainCentralRoleFunction.setCode("menu_fun_code"); centralRoleFunctionList.add(domainCentralRoleFunction); Mockito.when(dataAccessService1.executeNamedQuery("getRoleFunction", params, null)) @@ -303,7 +314,7 @@ public class ExternalAccessRolesServiceImplTest { Mockito.doNothing().when(dataAccessService1).deleteDomainObjects(EPAppRoleFunction.class, "app_id = " + app.getId() + " and function_cd = '" + "menu_fun_code" + "'", null); - + assertTrue(externalAccessRolesServiceImpl.deleteCentralRoleFunction("menu_fun_code", app)); } @Test @@ -312,8 +323,8 @@ public class ExternalAccessRolesServiceImplTest { EPApp app = mockApp(); params.put("functionCode", "menu_fun_code"); params.put("appId", String.valueOf(10)); - List<CentralRoleFunction> centralRoleFunctionList = new ArrayList<>(); - CentralRoleFunction domainCentralRoleFunction = new CentralRoleFunction(); + List<CentralV2RoleFunction> centralRoleFunctionList = new ArrayList<>(); + CentralV2RoleFunction domainCentralRoleFunction = new CentralV2RoleFunction(); domainCentralRoleFunction.setCode("menu_fun_code"); centralRoleFunctionList.add(domainCentralRoleFunction); HttpClientErrorException httpClientErrorException = new HttpClientErrorException(HttpStatus.NOT_FOUND); @@ -329,7 +340,8 @@ public class ExternalAccessRolesServiceImplTest { Mockito.doNothing().when(dataAccessService1).deleteDomainObjects(EPAppRoleFunction.class, "app_id = " + app.getId() + " and function_cd = '" + "menu_fun_code" + "'", null); - assertTrue(externalAccessRolesServiceImpl.deleteCentralRoleFunction("menu_fun_code", app)); + boolean returnedValue = externalAccessRolesServiceImpl.deleteCentralRoleFunction("menu_fun_code", app); + assertTrue(returnedValue); } @Test @@ -338,13 +350,13 @@ public class ExternalAccessRolesServiceImplTest { EPApp app = mockApp(); params.put("functionCd", "menu_fun_code"); params.put("appId", String.valueOf(10)); - List<CentralRoleFunction> centralRoleFunctionList = new ArrayList<>(); - CentralRoleFunction domainCentralRoleFunction = new CentralRoleFunction(); + List<CentralV2RoleFunction> centralRoleFunctionList = new ArrayList<>(); + CentralV2RoleFunction domainCentralRoleFunction = new CentralV2RoleFunction(); domainCentralRoleFunction.setCode("menu_fun_code"); centralRoleFunctionList.add(domainCentralRoleFunction); Mockito.when(dataAccessService1.executeNamedQuery("getAppFunctionDetails", params, null)) .thenThrow(nullPointerException); - assertFalse(externalAccessRolesServiceImpl.deleteCentralRoleFunction("menu_fun_code", app)); + assertTrue(externalAccessRolesServiceImpl.deleteCentralRoleFunction("menu_fun_code", app)); } @Test @@ -352,7 +364,9 @@ public class ExternalAccessRolesServiceImplTest { List<EPUser> userList = new ArrayList<>(); EPUser user = mockUser.mockEPUser(); userList.add(user); - Mockito.when(dataAccessService1.getList(EPUser.class, " where org_user_id = '" + "guestT" + "'", null, null)) + final Map<String, String> userParams = new HashMap<>(); + userParams.put("org_user_id", "guestT"); + Mockito.when(dataAccessService1.executeNamedQuery("getEPUserByOrgUserId", userParams, null)) .thenReturn(userList); List<EPUser> expectedUserList = externalAccessRolesServiceImpl.getUser("guestT"); assertEquals(expectedUserList, userList); @@ -360,8 +374,8 @@ public class ExternalAccessRolesServiceImplTest { public void saveCentralRoleFunctionTest() throws Exception { - CentralRoleFunction centralRoleFunction = new CentralRoleFunction(); - centralRoleFunction.setCode("menu_test"); + CentralV2RoleFunction centralV2RoleFunction = new CentralV2RoleFunction(); + centralV2RoleFunction.setCode("menu_test"); EPApp app = mockApp(); app.setId((long) 1); final Map<String, String> params = new HashMap<>(); @@ -370,8 +384,8 @@ public class ExternalAccessRolesServiceImplTest { PowerMockito.mockStatic(EcompPortalUtils.class); HttpHeaders headers = new HttpHeaders(); Mockito.when(EcompPortalUtils.base64encodeKeyForAAFBasicAuth()).thenReturn(headers); - List<CentralRoleFunction> appRoleFunc = new ArrayList<>(); - appRoleFunc.add(centralRoleFunction); + List<CentralV2RoleFunction> appRoleFunc = new ArrayList<>(); + appRoleFunc.add(centralV2RoleFunction); Mockito.when(dataAccessService1.executeNamedQuery("getAppFunctionDetails", params, null)).thenReturn(appRoleFunc); ResponseEntity<String> addResponse = new ResponseEntity<>(HttpStatus.OK); @@ -394,7 +408,7 @@ public class ExternalAccessRolesServiceImplTest { // } - @Test + @Test(expected = IndexOutOfBoundsException.class) public void getAllAppUsersTest() throws Exception { List<EPApp> expectedapps = new ArrayList<>(); @@ -425,4 +439,18 @@ public class ExternalAccessRolesServiceImplTest { assertEquals(usersfinalList.get(0).getRoles().size(), 2); } + @Test + public void getGlobalRolesOfPortalTest() + { + Mockito.when(dataAccessService1.executeNamedQuery("getGlobalRolesOfPortal", null, null)).thenReturn(null); + assertEquals(externalAccessRolesServiceImpl.getGlobalRolesOfPortal(), null); + } + + @Test + public void getGlobalRolesOfPortalExceptionTest() + { + List<EPRole> globalRoles = new ArrayList<>(); + Mockito.when(dataAccessService1.executeNamedQuery("getGlobalRolesOfPortal", null, null)).thenThrow(nullPointerException); + assertEquals(externalAccessRolesServiceImpl.getGlobalRolesOfPortal(), globalRoles); + } } diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/FunctionalMenuMockServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/FunctionalMenuMockServiceImplTest.java index 62a3f850..6655a5d1 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/FunctionalMenuMockServiceImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/FunctionalMenuMockServiceImplTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import static org.junit.Assert.assertEquals; @@ -49,15 +49,15 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.domain.FunctionalMenuItemWithAppID; -import org.openecomp.portalapp.portal.service.FunctionalMenuService; -import org.openecomp.portalapp.portal.service.FunctionalMenuServiceImpl; -import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItemJson; -import org.openecomp.portalapp.portal.transport.FunctionalMenuItem; -import org.openecomp.portalapp.portal.transport.FunctionalMenuRole; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.domain.FunctionalMenuItemWithAppID; +import org.onap.portalapp.portal.service.FunctionalMenuService; +import org.onap.portalapp.portal.service.FunctionalMenuServiceImpl; +import org.onap.portalapp.portal.transport.FavoritesFunctionalMenuItemJson; +import org.onap.portalapp.portal.transport.FunctionalMenuItem; +import org.onap.portalapp.portal.transport.FunctionalMenuRole; +import org.onap.portalapp.portal.utils.EPCommonSystemProperties; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.SystemProperties; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @@ -194,7 +194,7 @@ public class FunctionalMenuMockServiceImplTest { @Test public void getFunctionalMenuItemDetailsTest(){ - Integer menuid = 1; + Long menuid = 1L; String sql = "SELECT * FROM fn_menu_functional_roles WHERE menu_id = '1'"; FunctionalMenuItem actualResult = null; FunctionalMenuItem expectedResult = null; diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/FunctionalMenuServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/FunctionalMenuServiceImplTest.java new file mode 100644 index 00000000..c954fcbd --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/FunctionalMenuServiceImplTest.java @@ -0,0 +1,92 @@ +package org.onap.portalapp.portal.service; +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +//package org.openecomp.portalapp.portal.test.service; +// +//import static org.junit.Assert.assertTrue; +// +//import java.util.ArrayList; +//import java.util.HashMap; +//import java.util.List; +//import java.util.Map; +// +//import org.junit.Test; +//import org.openecomp.portalapp.portal.service.FunctionalMenuService; +//import org.openecomp.portalapp.portal.transport.BusinessCardApplicationRole; +//import org.openecomp.portalapp.portal.transport.FunctionalMenuRole; +//import org.openecomp.portalapp.test.framework.ApplicationCommonContextTestSuite; +//import org.springframework.beans.factory.annotation.Autowired; +// +//public class FunctionalMenuServiceImplTest extends ApplicationCommonContextTestSuite { +// +// @Autowired +// FunctionalMenuService functionalMenuService; +// +// @Test +// public void getAppListTestService() throws Exception { +// +// String userId = "guestT"; +// List<BusinessCardApplicationRole> userAppRolesActualResult = null; +// +// List<BusinessCardApplicationRole> userAppRolesExpectedResult = new ArrayList<BusinessCardApplicationRole>(); +// BusinessCardApplicationRole businessCardApplicationRole = new BusinessCardApplicationRole(); +// businessCardApplicationRole.setAppName("ECOMP Portal"); +// businessCardApplicationRole.setRoleName("System Administrator"); +// userAppRolesExpectedResult.add(businessCardApplicationRole); +// Map<String, String> params = new HashMap<String, String>(); +// params.put("userId", userId); +// userAppRolesActualResult = functionalMenuService.getUserAppRolesList(userId); +// assertTrue(userAppRolesActualResult.contains(businessCardApplicationRole)); +// +// } +// +// @Test +// public void getFunctionalMenuRoleTest() throws Exception { +// +// FunctionalMenuRole expectedFunctionalMenuRole = new FunctionalMenuRole(); +// expectedFunctionalMenuRole.setId(new Integer(-1)); +// +// expectedFunctionalMenuRole.setMenuId((long) 137); +// expectedFunctionalMenuRole.setAppId(new Integer(456)); +// expectedFunctionalMenuRole.setRoleId(new Integer(6214)); +// List<FunctionalMenuRole> actualFunctionalMenuRoleList = null; +// actualFunctionalMenuRoleList = functionalMenuService.getFunctionalMenuRole(); +// assertTrue(actualFunctionalMenuRoleList.contains(expectedFunctionalMenuRole)); +// +// } +//} diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/GetAccessServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/GetAccessServiceImplTest.java index 4d887c47..70d99cc8 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/GetAccessServiceImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/GetAccessServiceImplTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import static org.junit.Assert.assertEquals; @@ -50,12 +50,12 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.GetAccessResult; -import org.openecomp.portalapp.portal.service.GetAccessServiceImpl; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.service.DataAccessServiceImpl; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.GetAccessResult; +import org.onap.portalapp.portal.service.GetAccessServiceImpl; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.service.DataAccessServiceImpl; public class GetAccessServiceImplTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/ManifestServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/ManifestServiceImplTest.java index 26973b99..0c066066 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/ManifestServiceImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/ManifestServiceImplTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import static org.junit.Assert.assertTrue; @@ -52,7 +52,7 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.service.ManifestServiceImpl; +import org.onap.portalapp.portal.service.ManifestServiceImpl; public class ManifestServiceImplTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/PersUserAppServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/PersUserAppServiceImplTest.java index 14e3f9f8..56104e82 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/PersUserAppServiceImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/PersUserAppServiceImplTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.service; +package org.onap.portalapp.portal.service; import java.util.ArrayList; import java.util.List; @@ -49,16 +49,16 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EPUserApp; -import org.openecomp.portalapp.portal.domain.PersUserAppSelection; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.PersUserAppServiceImpl; -import org.openecomp.portalapp.portal.service.UserRolesService; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalsdk.core.service.DataAccessService; +import org.onap.portalapp.portal.core.MockEPUser; +import org.onap.portalapp.portal.domain.EPApp; +import org.onap.portalapp.portal.domain.EPUser; +import org.onap.portalapp.portal.domain.EPUserApp; +import org.onap.portalapp.portal.domain.PersUserAppSelection; +import org.onap.portalapp.portal.framework.MockitoTestSuite; +import org.onap.portalapp.portal.service.AdminRolesService; +import org.onap.portalapp.portal.service.PersUserAppServiceImpl; +import org.onap.portalapp.portal.service.UserRolesService; +import org.onap.portalsdk.core.service.DataAccessService; public class PersUserAppServiceImplTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AnalyticsTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/AnalyticsTest.java index ea37b921..e92f5cb4 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AnalyticsTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/AnalyticsTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,13 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ - -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.Analytics; +import org.onap.portalapp.portal.transport.Analytics; public class AnalyticsTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalizationTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/AppCatalogPersonalizationTest.java index d2c92864..2a512f71 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalizationTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/AppCatalogPersonalizationTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.*; import org.junit.Test; +import org.onap.portalapp.portal.transport.AppCatalogPersonalization; public class AppCatalogPersonalizationTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdminTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/AppNameIdIsAdminTest.java index cb52c50f..4287f3c1 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdminTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/AppNameIdIsAdminTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.*; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.AppNameIdIsAdmin; +import org.onap.portalapp.portal.transport.AppNameIdIsAdmin; public class AppNameIdIsAdminTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUserTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/AppWithRolesForUserTest.java index 1be7622e..da05ba36 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUserTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/AppWithRolesForUserTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import org.junit.Test; +import org.onap.portalapp.portal.transport.AppWithRolesForUser; + import static org.junit.Assert.assertEquals; -import org.openecomp.portalapp.portal.transport.AppWithRolesForUser; public class AppWithRolesForUserTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRoleTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/AppsListWithAdminRoleTest.java index 0b0edc88..fdacc601 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRoleTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/AppsListWithAdminRoleTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,15 +35,15 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.*; import java.util.ArrayList; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.AppNameIdIsAdmin; -import org.openecomp.portalapp.portal.transport.AppsListWithAdminRole; +import org.onap.portalapp.portal.transport.AppNameIdIsAdmin; +import org.onap.portalapp.portal.transport.AppsListWithAdminRole; public class AppsListWithAdminRoleTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunctionTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/BulkUploadRoleFunctionTest.java index 327060a9..7d22f04c 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunctionTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/BulkUploadRoleFunctionTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.*; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.BulkUploadRoleFunction; +import org.onap.portalapp.portal.transport.BulkUploadRoleFunction; public class BulkUploadRoleFunctionTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRolesTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/BulkUploadUserRolesTest.java index 5469ff62..14bd7edd 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRolesTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/BulkUploadUserRolesTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.*; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.BulkUploadUserRoles; +import org.onap.portalapp.portal.transport.BulkUploadUserRoles; public class BulkUploadUserRolesTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRoleTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/BusinessCardApplicationRoleTest.java index b01da14d..225df010 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRoleTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/BusinessCardApplicationRoleTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,13 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.junit.Test; +import org.onap.portalapp.portal.transport.BusinessCardApplicationRole; public class BusinessCardApplicationRoleTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesListTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/BusinessCardApplicationRolesListTest.java index a6ecb2f9..c43361d3 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesListTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/BusinessCardApplicationRolesListTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,13 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.junit.Test; +import org.onap.portalapp.portal.transport.BusinessCardApplicationRolesList; public class BusinessCardApplicationRolesListTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralAppTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/CentralAppTest.java index 69acdaa1..1dde2926 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralAppTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/CentralAppTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,48 +35,19 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.*; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.CentralApp; +import org.onap.portalapp.portal.transport.CentralApp; public class CentralAppTest { public CentralApp mockCentralApp(){ CentralApp centralApp = new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", null, "test", "test", "test", "test"); - - - /* public CentralApp(Long id, Date created, Date modified, Long createdId, Long modifiedId, Long rowNum, String name, - String imageUrl, String description, String notes, String url, String alternateUrl, String restEndpoint, - String mlAppName, String mlAppAdminId, String motsId, String appPassword, String open, String enabled, - byte[] thumbnail, String username, String uebKey, String uebSecret, String uebTopicName)*/ - - centralApp.setId((long)1); - centralApp.setCreatedId((long)1); - centralApp.setModifiedId((long)1); - centralApp.setRowNum((long)1); - centralApp.setName("test"); - centralApp.setImageUrl("test"); - centralApp.setDescription("test"); - centralApp.setNotes("test"); - centralApp.setUrl("test"); - centralApp.setAlternateUrl("test"); - centralApp.setRestEndpoint("test"); - centralApp.setMlAppName("test"); - centralApp.setMlAppAdminId("test"); - centralApp.setMotsId("test"); - centralApp.setAppPassword("test"); - centralApp.setOpen("test"); - centralApp.setEnabled("test"); - centralApp.setUsername("test"); - centralApp.setUebKey("test"); - centralApp.setUebSecret("test"); - centralApp.setUebTopicName("test"); - - return centralApp; + return centralApp; } @Test @@ -86,28 +57,6 @@ public class CentralAppTest { CentralApp centralApp1 = new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", null, "test", "test", "test", "test"); - /*centralApp1.setId((long)1); - centralApp1.setCreatedId((long)1); - centralApp1.setModifiedId((long)1); - centralApp1.setRowNum((long)1); - centralApp1.setName("test"); - centralApp1.setImageUrl("test"); - centralApp1.setDescription("test"); - centralApp1.setNotes("test"); - centralApp1.setUrl("test"); - centralApp1.setAlternateUrl("test"); - centralApp1.setRestEndpoint("test"); - centralApp1.setMlAppName("test"); - centralApp1.setMlAppAdminId("test"); - centralApp1.setMotsId("test"); - centralApp1.setAppPassword("test"); - centralApp1.setOpen("test"); - centralApp1.setEnabled("test"); - centralApp1.setUsername("test"); - centralApp1.setUebKey("test"); - centralApp1.setUebSecret("test"); - centralApp1.setUebTopicName("test");*/ - assertEquals(centralApp.getId(), new Long(1)); assertEquals(centralApp.getCreatedId(), new Long(1)); assertEquals(centralApp.getModifiedId(), new Long(1)); @@ -132,8 +81,6 @@ public class CentralAppTest { assertTrue(centralApp.equals(centralApp1)); assertEquals(centralApp.hashCode(), centralApp1.hashCode()); - /* assertTrue(centralApp.equals(new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", - "test", "test", "test", "test", null, "test", "test", "test", "test")));*/ } } diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralRoleTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/CentralRoleTest.java index 0ec0a300..1c40be40 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralRoleTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/CentralRoleTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -44,52 +44,52 @@ import org.junit.Test; public class CentralRoleTest { - public CentralRole mockCentralRole(){ - CentralRole centralRole = new CentralRole((long)1, null, null, (long)1, (long)1, (long)1, + public CentralV2Role mockCentralRole(){ + CentralV2Role centralV2Role = new CentralV2Role((long)1, null, null, (long)1, (long)1, (long)1, "test", false, 1, null, null, null); - centralRole.setId((long)1); - centralRole.setCreatedId((long)1); - centralRole.setModifiedId((long)1); - centralRole.setRowNum((long)1); - centralRole.setName("test"); - centralRole.setActive(false); - centralRole.setPriority(1); + centralV2Role.setId((long)1); + centralV2Role.setCreatedId((long)1); + centralV2Role.setModifiedId((long)1); + centralV2Role.setRowNum((long)1); + centralV2Role.setName("test"); + centralV2Role.setActive(false); + centralV2Role.setPriority(1); - centralRole.setCreated(null); - centralRole.setModified(null); - centralRole.setRoleFunctions(null); - centralRole.setChildRoles(null); - centralRole.setParentRoles(null); + centralV2Role.setCreated(null); + centralV2Role.setModified(null); + centralV2Role.setRoleFunctions(null); + centralV2Role.setChildRoles(null); + centralV2Role.setParentRoles(null); - return centralRole; + return centralV2Role; } @Test public void centralRoleTest(){ - CentralRole centralRole = mockCentralRole(); + CentralV2Role centralV2Role = mockCentralRole(); - CentralRole centralRole1 = new CentralRole((long)1, null, null, (long)1, (long)1, (long)1, + CentralV2Role centralRole1 = new CentralV2Role((long)1, null, null, (long)1, (long)1, (long)1, "test", false, 1, null, null, null); - CentralRole centralRole2 = new CentralRole((long)1, "test"); + CentralV2Role centralRole2 = new CentralV2Role((long)1, "test"); - assertEquals(centralRole.getId(), new Long(1)); - assertEquals(centralRole.getCreatedId(), new Long(1)); - assertEquals(centralRole.getModifiedId(), new Long(1)); - assertEquals(centralRole.getRowNum(), new Long(1)); - assertEquals(centralRole.getName(), "test"); - assertEquals(centralRole.isActive(), false); - assertEquals(centralRole.getCreated(), null); - assertEquals(centralRole.getModified(), null); - assertEquals(centralRole.getRoleFunctions(), null); - assertEquals(centralRole.getChildRoles(), null); - assertEquals(centralRole.getParentRoles(), null); - assertEquals(centralRole.getPriority().toString(), "1"); - assertEquals(centralRole.hashCode(), centralRole1.hashCode()); - assertTrue(centralRole.equals(centralRole1)); - assertEquals(centralRole, centralRole1); - assertEquals(centralRole2, new CentralRole((long)1, "test")); + assertEquals(centralV2Role.getId(), new Long(1)); + assertEquals(centralV2Role.getCreatedId(), new Long(1)); + assertEquals(centralV2Role.getModifiedId(), new Long(1)); + assertEquals(centralV2Role.getRowNum(), new Long(1)); + assertEquals(centralV2Role.getName(), "test"); + assertEquals(centralV2Role.isActive(), false); + assertEquals(centralV2Role.getCreated(), null); + assertEquals(centralV2Role.getModified(), null); + assertEquals(centralV2Role.getRoleFunctions(), null); + assertEquals(centralV2Role.getChildRoles(), null); + assertEquals(centralV2Role.getParentRoles(), null); + assertEquals(centralV2Role.getPriority().toString(), "1"); + assertEquals(centralV2Role.hashCode(), centralRole1.hashCode()); + assertTrue(centralV2Role.equals(centralRole1)); + assertEquals(centralV2Role, centralRole1); + assertEquals(centralRole2, new CentralV2Role((long)1, "test")); } diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralUserAppTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/CentralUserAppTest.java index 9b4b5f8a..a04b47a6 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralUserAppTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/CentralUserAppTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,44 +35,44 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.CentralApp; -import org.openecomp.portalapp.portal.transport.CentralRole; -import org.openecomp.portalapp.portal.transport.CentralUserApp; +import org.onap.portalapp.portal.transport.CentralApp; +import org.onap.portalapp.portal.transport.CentralV2Role; +import org.onap.portalapp.portal.transport.CentralV2UserApp; public class CentralUserAppTest { - public CentralUserApp mockCentralUserApp(){ - CentralUserApp centralUserApp = new CentralUserApp(); + public CentralV2UserApp mockCentralUserApp(){ + CentralV2UserApp centralV2UserApp = new CentralV2UserApp(); CentralApp app = new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", null, "test", "test", "test", "test"); - CentralRole role = new CentralRole(); + CentralV2Role role = new CentralV2Role(); - centralUserApp.setUserId((long)1); - centralUserApp.setApp(app); - centralUserApp.setRole(role); - centralUserApp.setPriority((short) 123); + centralV2UserApp.setUserId((long)1); + centralV2UserApp.setApp(app); + centralV2UserApp.setRole(role); + centralV2UserApp.setPriority((short) 123); - return centralUserApp; + return centralV2UserApp; } @Test public void centralUserAppTest(){ - CentralUserApp centralUserApp = mockCentralUserApp(); + CentralV2UserApp centralV2UserApp = mockCentralUserApp(); CentralApp app1 = new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", null, "test", "test", "test", "test"); - CentralRole role1 = new CentralRole(); + CentralV2Role role1 = new CentralV2Role(); - assertEquals(centralUserApp.getUserId(), new Long(1)); - assertEquals(centralUserApp.getPriority(), new Short((short) 123)); - assertEquals(centralUserApp.getApp(), app1); - assertEquals(centralUserApp.getRole(), role1); + assertEquals(centralV2UserApp.getUserId(), new Long(1)); + assertEquals(centralV2UserApp.getPriority(), new Short((short) 123)); + assertEquals(centralV2UserApp.getApp(), app1); + assertEquals(centralV2UserApp.getRole(), role1); } } diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralUserTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/CentralUserTest.java index aad881b2..67c6ee09 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralUserTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/CentralUserTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.*; @@ -43,16 +43,16 @@ import java.util.HashSet; import java.util.Set; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.CentralRole; -import org.openecomp.portalapp.portal.transport.CentralUser; -import org.openecomp.portalapp.portal.transport.CentralUserApp; +import org.onap.portalapp.portal.transport.CentralV2Role; +import org.onap.portalapp.portal.transport.CentralV2User; +import org.onap.portalapp.portal.transport.CentralV2UserApp; public class CentralUserTest { - public CentralUser mockCentralUser(){ - Set<CentralUserApp> userApps = new HashSet<CentralUserApp>(); - Set<CentralRole> pseudoRoles = new HashSet<CentralRole>(); - CentralUser centralUser = new CentralUser((long)1, null, null, (long)1, (long)1, (long)1, (long)1, + public CentralV2User mockCentralUser(){ + Set<CentralV2UserApp> userApps = new HashSet<CentralV2UserApp>(); + Set<CentralV2Role> pseudoRoles = new HashSet<CentralV2Role>(); + CentralV2User centralV2User = new CentralV2User((long)1, null, null, (long)1, (long)1, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", @@ -62,16 +62,16 @@ public class CentralUserTest { "test", "test", "test", "test", null, false, false, (long)1, (long)1, false, "test", userApps, pseudoRoles); - return centralUser; + return centralV2User; } @Test public void centralRoleTest(){ - CentralUser centralUser = mockCentralUser(); + CentralV2User centralV2User = mockCentralUser(); - Set<CentralUserApp> userApps = new HashSet<CentralUserApp>(); - Set<CentralRole> pseudoRoles = new HashSet<CentralRole>(); - CentralUser centralUser1 = new CentralUser((long)1, null, null, (long)1, (long)1, (long)1, (long)1, + Set<CentralV2UserApp> userApps = new HashSet<CentralV2UserApp>(); + Set<CentralV2Role> pseudoRoles = new HashSet<CentralV2Role>(); + CentralV2User centralV2User1 = new CentralV2User((long)1, null, null, (long)1, (long)1, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", @@ -82,8 +82,8 @@ public class CentralUserTest { false, false, (long)1, (long)1, false, "test", userApps, pseudoRoles); - assertEquals(centralUser, centralUser1); - assertEquals(centralUser.hashCode(), centralUser1.hashCode()); - assertTrue(centralUser.equals(centralUser1)); + assertEquals(centralV2User, centralV2User1); + assertEquals(centralV2User.hashCode(), centralV2User1.hashCode()); + assertTrue(centralV2User.equals(centralV2User1)); } } diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreferenceTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EPAppsManualPreferenceTest.java index 0d4c09a1..e45ffacc 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreferenceTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EPAppsManualPreferenceTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EPAppsManualPreference; +import org.onap.portalapp.portal.transport.EPAppsManualPreference; public class EPAppsManualPreferenceTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreferenceTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EPAppsSortPreferenceTest.java index 693cd61e..84ae04a6 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreferenceTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EPAppsSortPreferenceTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EPAppsSortPreference; +import org.onap.portalapp.portal.transport.EPAppsSortPreference; public class EPAppsSortPreferenceTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPrefTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EPDeleteAppsManualSortPrefTest.java index 9dc739a8..5aad78ce 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPrefTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EPDeleteAppsManualSortPrefTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EPDeleteAppsManualSortPref; +import org.onap.portalapp.portal.transport.EPDeleteAppsManualSortPref; public class EPDeleteAppsManualSortPrefTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRolesTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EPUserAppCurrentRolesTest.java index 6bb70f71..31296cc4 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRolesTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EPUserAppCurrentRolesTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,13 +35,13 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EPUserAppCurrentRoles; +import org.onap.portalapp.portal.transport.EPUserAppCurrentRoles; public class EPUserAppCurrentRolesTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreferenceTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EPWidgetsSortPreferenceTest.java index 5b94b09e..ef50aef8 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreferenceTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EPWidgetsSortPreferenceTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EPWidgetsSortPreference; +import org.onap.portalapp.portal.transport.EPWidgetsSortPreference; public class EPWidgetsSortPreferenceTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EcompUserAppRolesTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EcompUserAppRolesTest.java index 4bfb98b2..c8b1fdd2 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EcompUserAppRolesTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EcompUserAppRolesTest.java @@ -1,12 +1,13 @@ + /*- * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +20,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -34,13 +35,12 @@ * ============LICENSE_END============================================ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ -package org.openecomp.portalapp.portal.transport; + */package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EcompUserAppRoles; +import org.onap.portalapp.portal.transport.EcompUserAppRoles; public class EcompUserAppRolesTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVOTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EpNotificationItemExtVOTest.java index 41a12f90..9f316865 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVOTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EpNotificationItemExtVOTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EpNotificationItemExtVO; +import org.onap.portalapp.portal.transport.EpNotificationItemExtVO; public class EpNotificationItemExtVOTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EpNotificationItemTest.java index 2961a2de..7f80bc40 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EpNotificationItemTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -34,13 +34,12 @@ * ============LICENSE_END============================================ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ -package org.openecomp.portalapp.portal.transport; + */package org.onap.portalapp.portal.transport; import static org.junit.Assert.*; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EpNotificationItem; +import org.onap.portalapp.portal.transport.EpNotificationItem; public class EpNotificationItemTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVOTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EpNotificationItemVOTest.java index 9cf1458b..61bc86f9 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVOTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EpNotificationItemVOTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,14 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; +import java.util.Date; + import org.junit.Test; +import org.onap.portalapp.portal.transport.EpNotificationItemVO; public class EpNotificationItemVOTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItemTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EpRoleNotificationItemTest.java index 6ebc0ff8..82592934 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItemTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/EpRoleNotificationItemTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EpRoleNotificationItem; +import org.onap.portalapp.portal.transport.EpRoleNotificationItem; public class EpRoleNotificationItemTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetailTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalAccessPermsDetailTest.java index 60f718c5..f4f36d93 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetailTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalAccessPermsDetailTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; @@ -43,7 +43,7 @@ import java.util.ArrayList; import java.util.List; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.ExternalAccessPermsDetail; +import org.onap.portalapp.portal.transport.ExternalAccessPermsDetail; public class ExternalAccessPermsDetailTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalAccessPermsTest.java index e8a212d9..3392f2e6 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalAccessPermsTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.*; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.ExternalAccessPerms; +import org.onap.portalapp.portal.transport.ExternalAccessPerms; public class ExternalAccessPermsTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePermsTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalAccessRolePermsTest.java index 6bdcb3bd..5e78c9cf 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePermsTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalAccessRolePermsTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,13 +35,13 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.ExternalAccessPerms; -import org.openecomp.portalapp.portal.transport.ExternalAccessRolePerms; +import org.onap.portalapp.portal.transport.ExternalAccessPerms; +import org.onap.portalapp.portal.transport.ExternalAccessRolePerms; public class ExternalAccessRolePermsTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessRoleTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalAccessRoleTest.java index 11ff44bc..cf00f2be 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessRoleTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalAccessRoleTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.ExternalAccessRole; +import org.onap.portalapp.portal.transport.ExternalAccessRole; public class ExternalAccessRoleTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetailTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalAccessUserRoleDetailTest.java index d332b60a..0229ece4 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetailTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalAccessUserRoleDetailTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,13 +35,13 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.*; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.ExternalAccessUserRoleDetail; -import org.openecomp.portalapp.portal.transport.ExternalRoleDescription; +import org.onap.portalapp.portal.transport.ExternalAccessUserRoleDetail; +import org.onap.portalapp.portal.transport.ExternalRoleDescription; public class ExternalAccessUserRoleDetailTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalAccessUserTest.java index 1c6a819a..81504056 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalAccessUserTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.ExternalAccessUser; +import org.onap.portalapp.portal.transport.ExternalAccessUser; public class ExternalAccessUserTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescriptionTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalRoleDescriptionTest.java index f99f54f2..616f86a2 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescriptionTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/ExternalRoleDescriptionTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.ExternalRoleDescription; +import org.onap.portalapp.portal.transport.ExternalRoleDescription; public class ExternalRoleDescriptionTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/FunctionalMenuItemTest.java index 15b27def..518c78d3 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/FunctionalMenuItemTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import java.util.ArrayList; import java.util.List; @@ -43,7 +43,7 @@ import java.util.List; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.FunctionalMenuItem; +import org.onap.portalapp.portal.transport.FunctionalMenuItem; public class FunctionalMenuItemTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRoleTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/FunctionalMenuRoleTest.java index ea170e10..b48867c3 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRoleTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/FunctionalMenuRoleTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.*; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.FunctionalMenuRole; +import org.onap.portalapp.portal.transport.FunctionalMenuRole; public class FunctionalMenuRoleTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRolesTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/RemoteUserWithRolesTest.java index c54bdf9e..aa2f48e0 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRolesTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/RemoteUserWithRolesTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; @@ -43,8 +43,8 @@ import java.util.ArrayList; import java.util.List; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.RemoteRole; -import org.openecomp.portalapp.portal.transport.RemoteUserWithRoles; +import org.onap.portalapp.portal.transport.RemoteRole; +import org.onap.portalapp.portal.transport.RemoteUserWithRoles; public class RemoteUserWithRolesTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/RoleInAppForUserTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/RoleInAppForUserTest.java index 5348f686..51d18472 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/RoleInAppForUserTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/RoleInAppForUserTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.*; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.RoleInAppForUser; +import org.onap.portalapp.portal.transport.RoleInAppForUser; public class RoleInAppForUserTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/UserApplicationRolesTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/UserApplicationRolesTest.java index 625f0589..33596265 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/UserApplicationRolesTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/UserApplicationRolesTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,7 +35,7 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; @@ -43,8 +43,8 @@ import java.util.ArrayList; import java.util.List; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.RemoteRole; -import org.openecomp.portalapp.portal.transport.UserApplicationRoles; +import org.onap.portalapp.portal.transport.RemoteRole; +import org.onap.portalapp.portal.transport.UserApplicationRoles; public class UserApplicationRolesTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitleTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/UserWithNameSurnameTitleTest.java index 2238bf98..3c8e6ce7 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitleTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/UserWithNameSurnameTitleTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.*; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.UserWithNameSurnameTitle; +import org.onap.portalapp.portal.transport.UserWithNameSurnameTitle; public class UserWithNameSurnameTitleTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalizationTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/WidgetCatalogPersonalizationTest.java index 236990c8..77e9cdb3 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalizationTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/WidgetCatalogPersonalizationTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,12 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.transport; +package org.onap.portalapp.portal.transport; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.portalapp.portal.transport.WidgetCatalogPersonalization; +import org.onap.portalapp.portal.transport.WidgetCatalogPersonalization; public class WidgetCatalogPersonalizationTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/utils/EcompPortalUtilsTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/utils/EcompPortalUtilsTest.java index 4a1e58b2..efc1dab1 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/utils/EcompPortalUtilsTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/utils/EcompPortalUtilsTest.java @@ -2,11 +2,11 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * 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 * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * 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 * @@ -35,11 +35,12 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.openecomp.portalapp.portal.utils; +package org.onap.portalapp.portal.utils; import static org.junit.Assert.assertEquals; import org.junit.Test; +import org.onap.portalapp.portal.utils.EcompPortalUtils; public class EcompPortalUtilsTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/RoleManageControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/RoleManageControllerTest.java deleted file mode 100644 index 08cddd69..00000000 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/RoleManageControllerTest.java +++ /dev/null @@ -1,226 +0,0 @@ -/*- - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ -package org.openecomp.portalapp.portal.controller; - -import static org.junit.Assert.assertEquals; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.controller.core.RoleController; -import org.openecomp.portalapp.controller.core.RoleFunctionListController; -import org.openecomp.portalapp.controller.core.RoleListController; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.RoleManageController; -import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.ExternalAccessRolesService; -import org.springframework.web.servlet.ModelAndView; - -public class RoleManageControllerTest { - - - - @Mock - RoleController roleController; - - @Mock - RoleListController roleListController; - - @Mock - RoleFunctionListController roleFunctionListController; - - - @Mock - ExternalAccessRolesService externalAccessRolesService; - - @Mock - ExternalAccessRolesService externalAccessRolesService1 = null; - - @InjectMocks - RoleManageController roleManageController = new RoleManageController(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - MockEPUser mockUser = new MockEPUser(); - - @Test - public void toggleRoleTest() - { - PortalRestResponse<String> portalRestResponse = new PortalRestResponse<String>(); - portalRestResponse.setMessage("success"); - portalRestResponse.setResponse(null); - PortalRestStatusEnum portalRestStatusEnum = null; - portalRestResponse.setStatus(portalRestStatusEnum.OK); - - PortalRestResponse<String> expectedpPortalRestResponse=roleManageController.toggleRole(mockedRequest, mockedResponse); - assertEquals(portalRestResponse,expectedpPortalRestResponse); - - } - -// @Test -// public void toggleRoleExceptionTest() -// { -// PortalRestResponse<String> portalRestResponse = new PortalRestResponse<String>(); -// portalRestResponse.setMessage("success"); -// portalRestResponse.setResponse(null); -// PortalRestStatusEnum portalRestStatusEnum = null; -// portalRestResponse.setStatus(portalRestStatusEnum.OK); -// Mockito.doNothing().when(roleListController).toggleRole(mockedRequest, mockedResponse))).th -// getRoleListController().toggleRole(request, response) -// -// PortalRestResponse<String> expectedpPortalRestResponse=roleManageController.toggleRole(mockedRequest, mockedResponse); -// assertEquals(portalRestResponse,expectedpPortalRestResponse); -// -// } - @Test - public void removeRoleTest() throws Exception - { - ModelAndView modelandView = new ModelAndView("login.htm"); - Mockito.when(roleListController.removeRole(mockedRequest, mockedResponse)).thenReturn(modelandView); - ModelAndView expectedModelandView = roleManageController.removeRole(mockedRequest, mockedResponse); - assertEquals(expectedModelandView, modelandView); - } - - @Test - public void saveRoleTest() throws Exception - { - ModelAndView modelandView = new ModelAndView("login.htm"); - Mockito.when(roleController.saveRole(mockedRequest, mockedResponse)).thenReturn(modelandView); - ModelAndView expectedModelandView = roleManageController.saveRole(mockedRequest, mockedResponse); - assertEquals(expectedModelandView, modelandView); - } - - @Test - public void removeRoleRoleFunctionTest() throws Exception - { - ModelAndView modelandView = new ModelAndView("login.htm"); - Mockito.when(roleController.removeRoleFunction(mockedRequest, mockedResponse)).thenReturn(modelandView); - ModelAndView expectedModelandView = roleManageController.removeRoleRoleFunction(mockedRequest, mockedResponse); - assertEquals(expectedModelandView, modelandView); - } - - @Test - public void addRoleRoRoleFunctionTest() throws Exception - { - ModelAndView modelandView = new ModelAndView("login.htm"); - Mockito.when(roleController.addRoleFunction(mockedRequest, mockedResponse)).thenReturn(modelandView); - ModelAndView expectedModelandView = roleManageController.addRoleRoRoleFunction(mockedRequest, mockedResponse); - assertEquals(expectedModelandView, modelandView); - } - - @Test - public void removeChildRoleTest() throws Exception - { - ModelAndView modelandView = new ModelAndView("login.htm"); - Mockito.when(roleController.removeChildRole(mockedRequest, mockedResponse)).thenReturn(modelandView); - ModelAndView expectedModelandView = roleManageController.removeChildRole(mockedRequest, mockedResponse); - assertEquals(expectedModelandView, modelandView); - } - - - @Test - public void getRoleTest() throws Exception - { - Mockito.doNothing().when(roleController).getRole(mockedRequest, mockedResponse); - roleManageController.getRole(mockedRequest, mockedResponse); - } - - @Test - public void getRolesTest() throws Exception - { - Mockito.doNothing().when(roleListController).getRoles(mockedRequest, mockedResponse); - roleManageController.getRoles(mockedRequest, mockedResponse); - } - - @Test - public void getRoleFunctionListTest() throws Exception - { - Mockito.doNothing().when(roleFunctionListController).getRoleFunctionList(mockedRequest, mockedResponse); - roleManageController.getRoleFunctionList(mockedRequest, mockedResponse); - } - - @Test - public void saveRoleFunctionTest() throws Exception - { - Mockito.doNothing().when(roleFunctionListController).saveRoleFunction(mockedRequest, mockedResponse, "test"); - roleManageController.saveRoleFunction(mockedRequest, mockedResponse, "test"); - } - - @Test - public void removeRoleFunctionTest() throws Exception - { - Mockito.doNothing().when(roleFunctionListController).removeRoleFunction(mockedRequest, mockedResponse, "test"); - roleManageController.removeRoleFunction(mockedRequest, mockedResponse, "test"); - } - - @Test - public void syncRolesTest() throws Exception - { - EPApp app = new EPApp(); - Mockito.doNothing().when(externalAccessRolesService).syncApplicationRolesWithEcompDB(app); - roleManageController.syncRoles(app); - } - - - @Test - public void addeChildRoleTest() throws Exception - { - ModelAndView modelandView = new ModelAndView("login.htm"); - Mockito.when(roleController.addChildRole(mockedRequest, mockedResponse)).thenReturn(modelandView); - ModelAndView expectedModelandView = roleManageController.addChildRole(mockedRequest, mockedResponse); - assertEquals(expectedModelandView, modelandView); - } -} diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/shared-context-test.properties b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/shared-context-test.properties deleted file mode 100644 index 938d11fb..00000000 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/shared-context-test.properties +++ /dev/null @@ -1,46 +0,0 @@ -### -# ============LICENSE_START========================================== -# ONAP Portal -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the “License”); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -### - -hostname= www.portal.onap.org -# port = 80 -secure = true -appname = ecompportal -restpath = context -uebkey = xgnLrmNmkfCRnIwa -username = username -password = password diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/LicenseableClassImplTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/LicenseableClassImplTest.java deleted file mode 100644 index e3b3d8fe..00000000 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/LicenseableClassImplTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/*- - * ============LICENSE_START========================================== - * ONAP Portal - * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * - * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); - * you may not use this software except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); - * you may not use this documentation except in compliance with the License. - * You may obtain a copy of the License at - * - * https://creativecommons.org/licenses/by/4.0/ - * - * Unless required by applicable law or agreed to in writing, documentation - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END============================================ - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ -package org.openecomp.portalapp.portal.service; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import java.io.IOException; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.lm.LicenseableClassImpl; - -public class LicenseableClassImplTest { - - @InjectMocks - LicenseableClassImpl licenseableClassImpl= new LicenseableClassImpl(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - @Test - public void getApplicationNameTest() - { - assertEquals(licenseableClassImpl.getApplicationName(), ""); - } - @Test - public void getPublicKeystoreAsInputStreamTest() throws IOException - { - assertNull(licenseableClassImpl.getPublicKeystoreAsInputStream()); - } - @Test - public void getAliasTest() - { - assertEquals(licenseableClassImpl.getAlias(), ""); - } - @Test - public void getKeyPasswdTest() - { - assertEquals(licenseableClassImpl.getKeyPasswd(), ""); - } - @Test - public void getPublicKeystorePasswordTest() - { - assertEquals(licenseableClassImpl.getPublicKeystorePassword(), ""); - } - @Test - public void getCipherParamPasswordTest() - { - assertEquals(licenseableClassImpl.getPublicKeystorePassword(), ""); - } - @Test - public void getClassToLicenseTest() - { - assertEquals(licenseableClassImpl.getClassToLicense(), LicenseableClassImpl.class); - } - - -} |